Ui 20180112 patches
The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/ui-20180112-pull-request
for you to fetch changes up to 849bbe60356caf3d320202d45f1ddffeefae06c7:
sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held (2018-01-12 15:51:18 +0100)
----------------------------------------------------------------
sdl2: bugfixes.
spice: cleanups.
input: mem leak fix.
gtk: deprecate 2.x support.
----------------------------------------------------------------
Daniel P. Berrange (1):
ui: deprecate use of GTK 2.x in favour of 3.x series
Frediano Ziglio (4):
spice: remove QXLWorker interface field
spice: remove unused watch list
spice: remove only written event_mask field
spice: remove unused timer list
Jindrich Makovicka (3):
sdl2: Do not hide the cursor on auxilliary windows
sdl2 uses surface relative coordinates
sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held
linzhecheng (1):
input: fix memory leak
configure | 6 ++++ include/ui/sdl2.h | 1 + include/ui/spice-display.h | 1 - hw/display/qxl.c | 1 - ui/gtk.c | 5 +++ ui/input.c | 2 ++ ui/sdl2.c | 79 ++++++++++++++++++++++++++-------------------- ui/spice-core.c | 14 ++------ ui/spice-display.c | 2 -- qemu-doc.texi | 9 ++++++ 10 files changed, 70 insertions(+), 50 deletions(-)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 3/9] spice: remove QXLWorker interface field
From: Frediano Ziglio <[email protected]>
This fields points to an old interface that is no more used in the current code.
Message-id: [email protected]
--- include/ui/spice-display.h | 1 - hw/display/qxl.c | 1 - ui/spice-display.c | 2 -- 3 files changed, 4 deletions(-)
include/ui/spice-display.h +0 -1
@@ -86,7 +86,6 @@ struct SimpleSpiceDisplay {DisplayChangeListener dcl;void *buf;int bufsize; -QXLWorker *worker;QXLInstance qxl;uint32_t unique;pixman_image_t *surface;
hw/display/qxl.c +0 -1
@@ -518,7 +518,6 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)PCIQXLDevice *qxl =container_of (sin, PCIQXLDevice, ssd.qxl);trace_qxl_interface_attach_worker (qxl->id); - qxl->ssd.worker = qxl_worker; }static void interface_set_compression_level (QXLInstance *sin,int level)
ui/spice-display.c +0 -2
@@ -519,7 +519,6 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id); - ssd->worker = qxl_worker; }static void interface_set_compression_level (QXLInstance *sin,int level)
@@ -1028,7 +1027,6 @@ static void qemu_spice_display_init_one(QemuConsole *con) ssd->qxl.base.sif = &dpy_interface.base;qemu_spice_add_display_interface (&ssd->qxl, con); -assert (ssd->worker);qemu_spice_create_host_memslot (ssd);register_displaychangelistener (&ssd->dcl);
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 4/9] spice: remove unused watch list
In reply to Gerd HoffmannFrom: Frediano Ziglio <[email protected]>
Message-id: [email protected]
--- ui/spice-core.c | 4 ---- 1 file changed, 4 deletions(-)
ui/spice-core.c +0 -4
@@ -92,9 +92,7 @@ struct SpiceWatch {int event_mask;SpiceWatchFunc func;void *opaque; -QTAILQ_ENTRY (SpiceWatch) next; }; -static QTAILQ_HEAD(, SpiceWatch) watches = QTAILQ_HEAD_INITIALIZER(watches);static void watch_read (void *opaque) {
@@ -131,7 +129,6 @@ static SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void * watch->fd = fd; watch->func = func; watch->opaque = opaque; -QTAILQ_INSERT_TAIL (&watches, watch, next);watch_update_mask (watch, event_mask);return watch;
@@ -140,7 +137,6 @@ static SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *static void watch_remove (SpiceWatch *watch) {qemu_set_fd_handler (watch->fd,NULL ,NULL ,NULL ); -QTAILQ_REMOVE (&watches, watch, next);g_free (watch); }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 6/9] spice: remove unused timer list
In reply to Gerd HoffmannFrom: Frediano Ziglio <[email protected]>
Message-id: [email protected]
--- ui/spice-core.c | 4 ---- 1 file changed, 4 deletions(-)
ui/spice-core.c +0 -4
@@ -55,9 +55,7 @@ static QemuThread me;struct SpiceTimer {QEMUTimer *timer; -QTAILQ_ENTRY (SpiceTimer) next; }; -static QTAILQ_HEAD(, SpiceTimer) timers = QTAILQ_HEAD_INITIALIZER(timers);static SpiceTimer *timer_add (SpiceTimerFunc func,void *opaque) {
@@ -65,7 +63,6 @@ static SpiceTimer *timer_add(SpiceTimerFunc func, void *opaque) timer =g_malloc0 (sizeof (*timer)); timer->timer =timer_new_ms (QEMU_CLOCK_REALTIME , func, opaque); -QTAILQ_INSERT_TAIL (&timers, timer, next);return timer; }
@@ -83,7 +80,6 @@ static void timer_remove(SpiceTimer *timer) {timer_del (timer->timer);timer_free (timer->timer); -QTAILQ_REMOVE (&timers, timer, next);g_free (timer); }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 1/9] input: fix memory leak
In reply to Gerd HoffmannFrom: linzhecheng <[email protected]>
If kbd_queue is not empty and queue_count >= queue_limit, we should free evt.
Message-id: [email protected]
--- ui/input.c | 2 ++ 1 file changed, 2 insertions(+)
ui/input.c +2 -0
@@ -421,6 +421,8 @@ void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down) }else if (queue_count < queue_limit) {qemu_input_queue_event (&kbd_queue, src, evt);qemu_input_queue_sync (&kbd_queue); + }else { +qapi_free_InputEvent (evt); } }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 2/9] ui: deprecate use of GTK 2.x in favour of 3.x series
In reply to Gerd HoffmannFrom: "Daniel P. Berrange" <[email protected]>
The GTK 3.0 release was made in Feb, 2011:
https://blog.gtk.org/2011/02/10/gtk-3-0-released/
That will soon be 7 years ago, which is enough time to consider the 3.x series widely supported.
Thus we deprecate the GTK 2.x support, which will allow us to delete it in the last release of 2018. By this time, GTK 3.x will be almost 8 years old.
Message-id: [email protected]
--- configure | 6 ++++++ ui/gtk.c | 5 +++++ qemu-doc.texi | 9 +++++++++ 3 files changed, 20 insertions(+)
configure +6 -0
@@ -5629,6 +5629,12 @@ if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" fi +if test "$gtkabi" = "2.0"; then + echo + echo "WARNING: Use of GTK 2.0 is deprecated and will be removed in" + echo "WARNING: future releases. Please switch to using GTK 3.0" +fi + if test "$supported_cpu" = "no"; then echo echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
ui/gtk.c +5 -0
@@ -2248,6 +2248,11 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)exit (1 ); } +#if !GTK_CHECK_VERSION (3 ,0 ,0 ) +g_printerr ("Running QEMU with GTK 2.x is deprecated, and will be removed\n" +"in a future release. Please switch to GTK 3.x instead\n" ); +#endif + s->window =gtk_window_new (GTK_WINDOW_TOPLEVEL );#if GTK_CHECK_VERSION (3 ,2 ,0 ) s->vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 );
qemu-doc.texi +9 -0
@@ -2587,6 +2587,15 @@ they were first deprecated in the 2.10.0 release. What follows is a list of all features currently marked as deprecated. +@section Build options + +@subsection GTK 2.x + +Previously QEMU has supported building against both GTK 2.x +and 3.x series APIs. Support for the GTK 2.x builds will be +discontinued, so maintainers should switch to using GTK 3.x, +which is the default. + @section System emulator command line arguments @subsection -tdf (since 1.3.0)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 5/9] spice: remove only written event_mask field
In reply to Gerd HoffmannFrom: Frediano Ziglio <[email protected]>
Message-id: [email protected]
--- ui/spice-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
ui/spice-core.c +2 -4
@@ -89,7 +89,6 @@ static void timer_remove(SpiceTimer *timer)struct SpiceWatch {int fd; -int event_mask;SpiceWatchFunc func;void *opaque; };
@@ -111,11 +110,10 @@ static void watch_update_mask(SpiceWatch *watch, int event_mask)IOHandler *on_read =NULL ;IOHandler *on_write =NULL ; - watch->event_mask = event_mask; -if (watch->event_mask &SPICE_WATCH_EVENT_READ ) { +if (event_mask &SPICE_WATCH_EVENT_READ ) { on_read = watch_read; } -if (watch->event_mask &SPICE_WATCH_EVENT_WRITE ) { +if (event_mask &SPICE_WATCH_EVENT_WRITE ) { on_write = watch_write; }qemu_set_fd_handler (watch->fd, on_read, on_write, watch);
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 9/9] sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held
In reply to Gerd HoffmannFrom: Jindrich Makovicka <[email protected]>
When SDL2 windows change focus while a key is held, the window that receives the focus also receives a new KeyDown event, without an autorepeat flag. This means that if a WM places the qemu console over the main window after Ctrl-Alt-2, the console closes immediately after opening. Then, the main window receives the KeyDown event again and the whole process repeats.
This patch makes the SDL2 UI ignore the KeyDown events on a window that just received the focus, if the GUI modifier was held. The ignore flag is reset on a first KeyUp event. This effectively works around the issue above.
Message-Id: <[email protected]>
--- include/ui/sdl2.h | 1 + ui/sdl2.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-)
include/ui/sdl2.h +1 -0
@@ -24,6 +24,7 @@ struct sdl2_console {int opengl;int updates;int idle_counter; +int ignore_hotkeys;SDL_GLContext winctx;#ifdef CONFIG_OPENGL QemuGLShader *gls;
ui/sdl2.c +24 -8
@@ -312,22 +312,28 @@ static void toggle_full_screen(struct sdl2_console *scon)sdl2_redraw (scon); } -static void handle_keydown (SDL_Event *ev) +static int get_mod_state (void ) { -int mod_state, win; -struct sdl2_console *scon =get_scon_from_window (ev->key.windowID); +SDL_Keymod mod =SDL_GetModState ();if (alt_grab) { - mod_state = (SDL_GetModState () & (gui_grab_code |KMOD_LSHIFT )) == +return (mod & (gui_grab_code |KMOD_LSHIFT )) == (gui_grab_code |KMOD_LSHIFT ); }else if (ctrl_grab) { - mod_state = (SDL_GetModState () &KMOD_RCTRL ) ==KMOD_RCTRL ; +return (mod &KMOD_RCTRL ) ==KMOD_RCTRL ; }else { - mod_state = (SDL_GetModState () & gui_grab_code) == gui_grab_code; +return (mod & gui_grab_code) == gui_grab_code; } - gui_key_modifier_pressed = mod_state; +} -if (gui_key_modifier_pressed) { +static void handle_keydown (SDL_Event *ev) +{ +int win; +struct sdl2_console *scon =get_scon_from_window (ev->key.windowID); + + gui_key_modifier_pressed =get_mod_state (); + +if (!scon->ignore_hotkeys && gui_key_modifier_pressed && !ev->key.repeat) {switch (ev->key.keysym.scancode) {case SDL_SCANCODE_2 :case SDL_SCANCODE_3 :
@@ -401,6 +407,8 @@ static void handle_keyup(SDL_Event *ev)int mod_state;struct sdl2_console *scon =get_scon_from_window (ev->key.windowID); + scon->ignore_hotkeys = false; +if (!alt_grab) { mod_state = (ev->key.keysym.mod & gui_grab_code); }else {
@@ -547,6 +555,14 @@ static void handle_windowevent(SDL_Event *ev)if (!gui_grab && (qemu_input_is_absolute () || absolute_enabled)) {absolute_mouse_grab (scon); } +/* If a new console window opened using a hotkey receives the +* focus, SDL sends another KEYDOWN event to the new window, +* closing the console window immediately after. +* +* Work around this by ignoring further hotkey events until a +* key is released. +*/ + scon->ignore_hotkeys =get_mod_state ();break ;case SDL_WINDOWEVENT_FOCUS_LOST :if (gui_grab && !gui_fullscreen) {
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 8/9] sdl2 uses surface relative coordinates
In reply to Gerd HoffmannFrom: Jindrich Makovicka <[email protected]>
This patch fixes mouse positioning with -device usb-tablet and fullscreen or resized window.
Message-Id: <[email protected]>
--- ui/sdl2.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-)
ui/sdl2.c +4 -26
@@ -276,32 +276,10 @@ static void sdl_send_mouse_event(struct sdl2_console *scon, int dx, int dy, }if (qemu_input_is_absolute ()) { -int scr_w, scr_h; -int max_w =0 , max_h =0 ; -int off_x =0 , off_y =0 ; -int cur_off_x =0 , cur_off_y =0 ; -int i; - -for (i =0 ; i < sdl2_num_outputs; i++) { -struct sdl2_console *thiscon = &sdl2_console[i]; -if (thiscon->real_window && thiscon->surface) { -SDL_GetWindowSize (thiscon->real_window, &scr_w, &scr_h); - cur_off_x = thiscon->x; - cur_off_y = thiscon->y; -if (scr_w + cur_off_x > max_w) { - max_w = scr_w + cur_off_x; - } -if (scr_h + cur_off_y > max_h) { - max_h = scr_h + cur_off_y; - } -if (i == scon->idx) { - off_x = cur_off_x; - off_y = cur_off_y; - } - } - } -qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_X , off_x + x,0 , max_w); -qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_Y , off_y + y,0 , max_h); +qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_X , + x,0 ,surface_width (scon->surface)); +qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_Y , + y,0 ,surface_height (scon->surface)); }else {if (guest_cursor) { x -= guest_x;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 7/9] sdl2: Do not hide the cursor on auxilliary windows
In reply to Gerd HoffmannFrom: Jindrich Makovicka <[email protected]>
Message-Id: <[email protected]>
--- ui/sdl2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
ui/sdl2.c +17 -0
@@ -466,6 +466,10 @@ static void handle_mousemotion(SDL_Event *ev)int max_x, max_y;struct sdl2_console *scon =get_scon_from_window (ev->key.windowID); +if (!qemu_console_is_graphic (scon->dcl.con)) { +return ; + } +if (qemu_input_is_absolute () || absolute_enabled) {int scr_w, scr_h;SDL_GetWindowSize (scon->real_window, &scr_w, &scr_h);
@@ -494,6 +498,10 @@ static void handle_mousebutton(SDL_Event *ev)SDL_MouseButtonEvent *bev;struct sdl2_console *scon =get_scon_from_window (ev->key.windowID); +if (!qemu_console_is_graphic (scon->dcl.con)) { +return ; + } + bev = &ev->button;if (!gui_grab && !qemu_input_is_absolute ()) {if (ev->type ==SDL_MOUSEBUTTONUP && bev->button ==SDL_BUTTON_LEFT ) {
@@ -516,6 +524,10 @@ static void handle_mousewheel(SDL_Event *ev)SDL_MouseWheelEvent *wev = &ev->wheel;InputButton btn; +if (!qemu_console_is_graphic (scon->dcl.con)) { +return ; + } +if (wev->y >0 ) { btn =INPUT_BUTTON_WHEEL_UP ; }else if (wev->y <0 ) {
@@ -657,6 +669,11 @@ static void sdl_mouse_warp(DisplayChangeListener *dcl, int x, int y, int on) { struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); + +if (!qemu_console_is_graphic (scon->dcl.con)) { +return ; + } +if (on) {if (!guest_cursor) {sdl_show_cursor ();
Signature · 1 line
2.9.3
Peter Maydell
AppliedQuoted 10 lines · Gerd Hoffmann
The following changes since commit
997eba28a3ed5400a80f754bf3a1c8044b75b9ff:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://git.kraxel.org/qemutags/ui-20180112-pull-requestfor you to fetch changes up to
849bbe60356caf3d320202d45f1ddffeefae06c7:
Quoted 8 lines
sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held (2018-01-12 15:51:18 +0100)
----------------------------------------------------------------
sdl2: bugfixes.
spice: cleanups.
input: mem leak fix.
gtk: deprecate 2.x support.
Applied, thanks.
Please can you add some text to the "Build Dependencies" section of the changelog for the GTK2 deprecation?
https://wiki.qemu.org/index.php?title=ChangeLog/2.12
-- PMM