summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Maydell2020-12-11 17:55:52 +0100
committerPeter Maydell2020-12-11 17:55:52 +0100
commitf6029bb614cebb0d6c9800990af49d55338231fd (patch)
tree9e05320a3d3a50e275ea262f918189819c817082
parentMerge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20201210' into... (diff)
parentsdl2: Add extra mouse buttons (diff)
downloadqemu-f6029bb614cebb0d6c9800990af49d55338231fd.tar.gz
qemu-f6029bb614cebb0d6c9800990af49d55338231fd.tar.xz
qemu-f6029bb614cebb0d6c9800990af49d55338231fd.zip
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201211-pull-request' into staging
ui/console ui_info tweaks. ui/vnc: alpha cursor support. ui/vnc: locking fixes. ui/sdl: add extra mouse buttons. # gpg: Signature made Fri 11 Dec 2020 09:12:39 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20201211-pull-request: sdl2: Add extra mouse buttons ui/vnc: Add missing lock for send_color_map vnc: add alpha cursor support vnc: add pseudo encodings vnc: drop unused copyrect feature vnc: use enum for features console: allow con==NULL in dpy_{get, set}_ui_info and dpy_ui_info_supported console: drop qemu_console_get_ui_info Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/ui/console.h1
-rw-r--r--ui/console.c18
-rw-r--r--ui/sdl2.c2
-rw-r--r--ui/vnc.c26
-rw-r--r--ui/vnc.h30
5 files changed, 49 insertions, 28 deletions
diff --git a/include/ui/console.h b/include/ui/console.h
index e7303d8b98..5dd21976a3 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -390,7 +390,6 @@ bool qemu_console_is_gl_blocked(QemuConsole *con);
char *qemu_console_get_label(QemuConsole *con);
int qemu_console_get_index(QemuConsole *con);
uint32_t qemu_console_get_head(QemuConsole *con);
-QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con);
int qemu_console_get_width(QemuConsole *con, int fallback);
int qemu_console_get_height(QemuConsole *con, int fallback);
/* Return the low-level window id for the console */
diff --git a/ui/console.c b/ui/console.c
index 53dee8e26b..30e70be555 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1544,19 +1544,27 @@ static void dpy_set_ui_info_timer(void *opaque)
bool dpy_ui_info_supported(QemuConsole *con)
{
+ if (con == NULL) {
+ con = active_console;
+ }
+
return con->hw_ops->ui_info != NULL;
}
const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
{
- assert(con != NULL);
+ if (con == NULL) {
+ con = active_console;
+ }
return &con->ui_info;
}
int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)
{
- assert(con != NULL);
+ if (con == NULL) {
+ con = active_console;
+ }
if (!dpy_ui_info_supported(con)) {
return -1;
@@ -2122,12 +2130,6 @@ uint32_t qemu_console_get_head(QemuConsole *con)
return con ? con->head : -1;
}
-QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con)
-{
- assert(con != NULL);
- return &con->ui_info;
-}
-
int qemu_console_get_width(QemuConsole *con, int fallback)
{
if (con == NULL) {
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 189d26e2a9..a578017268 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -275,6 +275,8 @@ static void sdl_send_mouse_event(struct sdl2_console *scon, int dx, int dy,
[INPUT_BUTTON_LEFT] = SDL_BUTTON(SDL_BUTTON_LEFT),
[INPUT_BUTTON_MIDDLE] = SDL_BUTTON(SDL_BUTTON_MIDDLE),
[INPUT_BUTTON_RIGHT] = SDL_BUTTON(SDL_BUTTON_RIGHT),
+ [INPUT_BUTTON_SIDE] = SDL_BUTTON(SDL_BUTTON_X1),
+ [INPUT_BUTTON_EXTRA] = SDL_BUTTON(SDL_BUTTON_X2)
};
static uint32_t prev_state;
diff --git a/ui/vnc.c b/ui/vnc.c
index 49235056f7..34e6dc437c 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -937,6 +937,18 @@ static int vnc_cursor_define(VncState *vs)
QEMUCursor *c = vs->vd->cursor;
int isize;
+ if (vnc_has_feature(vs, VNC_FEATURE_ALPHA_CURSOR)) {
+ vnc_lock_output(vs);
+ vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
+ vnc_write_u8(vs, 0); /* padding */
+ vnc_write_u16(vs, 1); /* # of rects */
+ vnc_framebuffer_update(vs, c->hot_x, c->hot_y, c->width, c->height,
+ VNC_ENCODING_ALPHA_CURSOR);
+ vnc_write_s32(vs, VNC_ENCODING_RAW);
+ vnc_write(vs, c->data, c->width * c->height * 4);
+ vnc_unlock_output(vs);
+ return 0;
+ }
if (vnc_has_feature(vs, VNC_FEATURE_RICH_CURSOR)) {
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
@@ -2061,9 +2073,6 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
case VNC_ENCODING_RAW:
vs->vnc_encoding = enc;
break;
- case VNC_ENCODING_COPYRECT:
- vs->features |= VNC_FEATURE_COPYRECT_MASK;
- break;
case VNC_ENCODING_HEXTILE:
vs->features |= VNC_FEATURE_HEXTILE_MASK;
vs->vnc_encoding = enc;
@@ -2105,9 +2114,9 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
break;
case VNC_ENCODING_RICH_CURSOR:
vs->features |= VNC_FEATURE_RICH_CURSOR_MASK;
- if (vs->vd->cursor) {
- vnc_cursor_define(vs);
- }
+ break;
+ case VNC_ENCODING_ALPHA_CURSOR:
+ vs->features |= VNC_FEATURE_ALPHA_CURSOR_MASK;
break;
case VNC_ENCODING_EXT_KEY_EVENT:
send_ext_key_event_ack(vs);
@@ -2137,6 +2146,9 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
vnc_desktop_resize(vs);
check_pointer_type_change(&vs->mouse_mode_notifier, NULL);
vnc_led_state_change(vs);
+ if (vs->vd->cursor) {
+ vnc_cursor_define(vs);
+ }
}
static void set_pixel_conversion(VncState *vs)
@@ -2156,6 +2168,7 @@ static void send_color_map(VncState *vs)
{
int i;
+ vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_SET_COLOUR_MAP_ENTRIES);
vnc_write_u8(vs, 0); /* padding */
vnc_write_u16(vs, 0); /* first color */
@@ -2168,6 +2181,7 @@ static void send_color_map(VncState *vs)
vnc_write_u16(vs, (((i >> pf->gshift) & pf->gmax) << (16 - pf->gbits)));
vnc_write_u16(vs, (((i >> pf->bshift) & pf->bmax) << (16 - pf->bbits)));
}
+ vnc_unlock_output(vs);
}
static void set_pixel_format(VncState *vs, int bits_per_pixel,
diff --git a/ui/vnc.h b/ui/vnc.h
index 4e2637ce6c..c8d3ad9ec4 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -411,6 +411,8 @@ enum {
#define VNC_ENCODING_AUDIO 0XFFFFFEFD /* -259 */
#define VNC_ENCODING_TIGHT_PNG 0xFFFFFEFC /* -260 */
#define VNC_ENCODING_LED_STATE 0XFFFFFEFB /* -261 */
+#define VNC_ENCODING_DESKTOP_RESIZE_EXT 0XFFFFFECC /* -308 */
+#define VNC_ENCODING_ALPHA_CURSOR 0XFFFFFEC6 /* -314 */
#define VNC_ENCODING_WMVi 0x574D5669
/*****************************************************************************
@@ -438,18 +440,20 @@ enum {
*
*****************************************************************************/
-#define VNC_FEATURE_RESIZE 0
-#define VNC_FEATURE_HEXTILE 1
-#define VNC_FEATURE_POINTER_TYPE_CHANGE 2
-#define VNC_FEATURE_WMVI 3
-#define VNC_FEATURE_TIGHT 4
-#define VNC_FEATURE_ZLIB 5
-#define VNC_FEATURE_COPYRECT 6
-#define VNC_FEATURE_RICH_CURSOR 7
-#define VNC_FEATURE_TIGHT_PNG 8
-#define VNC_FEATURE_ZRLE 9
-#define VNC_FEATURE_ZYWRLE 10
-#define VNC_FEATURE_LED_STATE 11
+enum VncFeatures {
+ VNC_FEATURE_RESIZE,
+ VNC_FEATURE_HEXTILE,
+ VNC_FEATURE_POINTER_TYPE_CHANGE,
+ VNC_FEATURE_WMVI,
+ VNC_FEATURE_TIGHT,
+ VNC_FEATURE_ZLIB,
+ VNC_FEATURE_RICH_CURSOR,
+ VNC_FEATURE_ALPHA_CURSOR,
+ VNC_FEATURE_TIGHT_PNG,
+ VNC_FEATURE_ZRLE,
+ VNC_FEATURE_ZYWRLE,
+ VNC_FEATURE_LED_STATE,
+};
#define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE)
#define VNC_FEATURE_HEXTILE_MASK (1 << VNC_FEATURE_HEXTILE)
@@ -457,8 +461,8 @@ enum {
#define VNC_FEATURE_WMVI_MASK (1 << VNC_FEATURE_WMVI)
#define VNC_FEATURE_TIGHT_MASK (1 << VNC_FEATURE_TIGHT)
#define VNC_FEATURE_ZLIB_MASK (1 << VNC_FEATURE_ZLIB)
-#define VNC_FEATURE_COPYRECT_MASK (1 << VNC_FEATURE_COPYRECT)
#define VNC_FEATURE_RICH_CURSOR_MASK (1 << VNC_FEATURE_RICH_CURSOR)
+#define VNC_FEATURE_ALPHA_CURSOR_MASK (1 << VNC_FEATURE_ALPHA_CURSOR)
#define VNC_FEATURE_TIGHT_PNG_MASK (1 << VNC_FEATURE_TIGHT_PNG)
#define VNC_FEATURE_ZRLE_MASK (1 << VNC_FEATURE_ZRLE)
#define VNC_FEATURE_ZYWRLE_MASK (1 << VNC_FEATURE_ZYWRLE)