diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-02-13 11:06:32 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-02-13 11:06:32 +0000 |
| commit | 7ce9ce89930ce260af839fb3e3e5f9101f5c69a0 (patch) | |
| tree | 216d31108b65618572964e8595c2c9d56b77ca97 /ui/gtk.c | |
| parent | e18e5501d8ac692d32657a3e1ef545b14e72b730 (diff) | |
| parent | 483644c25b932360018d15818d8bcd8c85ba70b8 (diff) | |
| download | focaccia-qemu-7ce9ce89930ce260af839fb3e3e5f9101f5c69a0.tar.gz focaccia-qemu-7ce9ce89930ce260af839fb3e3e5f9101f5c69a0.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20200212-pull-request' into staging
gtk: refresh rate fix. cocoa: drop pre-10.12 support. ui: rework show-cursor option. # gpg: Signature made Wed 12 Feb 2020 16:18:17 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-20200212-pull-request: ui/cocoa: Drop workarounds for pre-10.12 OSX ui: deprecate legacy -show-cursor option ui: drop curor_hide global variable. ui/gtk: implement show-cursor option ui/cocoa: switch to new show-cursor option ui/sdl: switch to new show-cursor option ui: wire up legacy -show-cursor option ui: add show-cursor option ui/gtk: Fix gd_refresh_rate_millihz() when widget window is not realized ui/gtk: Update gd_refresh_rate_millihz() to handle VirtualConsole Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/gtk.c')
| -rw-r--r-- | ui/gtk.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/ui/gtk.c b/ui/gtk.c index d18892d1de..f3f0af8921 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1965,17 +1965,19 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s) * If available, return the refresh rate of the display in milli-Hertz, * else return 0. */ -static int gd_refresh_rate_millihz(GtkDisplayState *s) +static int gd_refresh_rate_millihz(GtkWidget *window) { #ifdef GDK_VERSION_3_22 - GdkDisplay *dpy = gtk_widget_get_display(s->window); - GdkWindow *win = gtk_widget_get_window(s->window); - GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); + GdkWindow *win = gtk_widget_get_window(window); - return gdk_monitor_get_refresh_rate(monitor); -#else - return 0; + if (win) { + GdkDisplay *dpy = gtk_widget_get_display(window); + GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); + + return gdk_monitor_get_refresh_rate(monitor); + } #endif + return 0; } static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, @@ -2045,7 +2047,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, vc->gfx.kbd = qkbd_state_init(con); vc->gfx.dcl.con = con; - refresh_rate_millihz = gd_refresh_rate_millihz(s); + refresh_rate_millihz = gd_refresh_rate_millihz(vc->window ? + vc->window : s->window); if (refresh_rate_millihz) { vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / refresh_rate_millihz; } @@ -2243,8 +2246,12 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) textdomain("qemu"); window_display = gtk_widget_get_display(s->window); - s->null_cursor = gdk_cursor_new_for_display(window_display, - GDK_BLANK_CURSOR); + if (s->opts->has_show_cursor && s->opts->show_cursor) { + s->null_cursor = NULL; /* default pointer */ + } else { + s->null_cursor = gdk_cursor_new_for_display(window_display, + GDK_BLANK_CURSOR); + } s->mouse_mode_notifier.notify = gd_mouse_mode_change; qemu_add_mouse_mode_change_notifier(&s->mouse_mode_notifier); |