diff options
-rwxr-xr-x | configure | 51 | ||||
-rw-r--r-- | include/ui/gtk.h | 9 | ||||
-rw-r--r-- | qemu-deprecated.texi | 7 | ||||
-rw-r--r-- | ui/gtk-egl.c | 10 | ||||
-rw-r--r-- | ui/gtk.c | 192 |
5 files changed, 26 insertions, 243 deletions
@@ -454,7 +454,6 @@ glusterfs_discard="no" glusterfs_fallocate="no" glusterfs_zerofill="no" gtk="" -gtkabi="" gtk_gl="no" tls_priority="NORMAL" gnutls="" @@ -1370,8 +1369,6 @@ for opt do ;; --disable-pvrdma) pvrdma="no" ;; - --with-gtkabi=*) gtkabi="$optarg" - ;; --disable-vte) vte="no" ;; --enable-vte) vte="yes" @@ -1659,7 +1656,6 @@ disabled with --disable-FEATURE, default is enabled if available: sdl SDL UI --with-sdlabi select preferred SDL ABI 1.2 or 2.0 gtk gtk UI - --with-gtkabi select preferred GTK ABI 2.0 or 3.0 vte vte support for the gtk UI curses curses UI vnc VNC UI support @@ -2646,24 +2642,9 @@ fi # GTK probe if test "$gtk" != "no"; then - if test "$gtkabi" = ""; then - # The GTK ABI was not specified explicitly, so try whether 3.0 is available. - # Use 2.0 as a fallback if that is available. - if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then - gtkabi=3.0 - elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then - gtkabi=2.0 - else - gtkabi=3.0 - fi - fi - gtkpackage="gtk+-$gtkabi" - gtkx11package="gtk+-x11-$gtkabi" - if test "$gtkabi" = "3.0" ; then - gtkversion="3.0.0" - else - gtkversion="2.18.0" - fi + gtkpackage="gtk+-3.0" + gtkx11package="gtk+-x11-3.0" + gtkversion="3.0.0" if $pkg_config --exists "$gtkpackage >= $gtkversion"; then gtk_cflags=$($pkg_config --cflags $gtkpackage) gtk_libs=$($pkg_config --libs $gtkpackage) @@ -2907,16 +2888,11 @@ fi # VTE probe if test "$vte" != "no"; then - if test "$gtkabi" = "3.0"; then - vteminversion="0.32.0" - if $pkg_config --exists "vte-2.91"; then - vtepackage="vte-2.91" - else - vtepackage="vte-2.90" - fi + vteminversion="0.32.0" + if $pkg_config --exists "vte-2.91"; then + vtepackage="vte-2.91" else - vtepackage="vte" - vteminversion="0.24.0" + vtepackage="vte-2.90" fi if $pkg_config --exists "$vtepackage >= $vteminversion"; then vte_cflags=$($pkg_config --cflags $vtepackage) @@ -2924,11 +2900,7 @@ if test "$vte" != "no"; then vteversion=$($pkg_config --modversion $vtepackage) vte="yes" elif test "$vte" = "yes"; then - if test "$gtkabi" = "3.0"; then - feature_not_found "vte" "Install libvte-2.90/2.91 devel" - else - feature_not_found "vte" "Install libvte devel" - fi + feature_not_found "vte" "Install libvte-2.90/2.91 devel" else vte="no" fi @@ -6109,12 +6081,6 @@ 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 "$sdlabi" = "1.2"; then echo echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in" @@ -6431,7 +6397,6 @@ if test "$bluez" = "yes" ; then fi if test "$gtk" = "yes" ; then echo "CONFIG_GTK=m" >> $config_host_mak - echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak echo "GTK_LIBS=$gtk_libs" >> $config_host_mak if test "$gtk_gl" = "yes" ; then diff --git a/include/ui/gtk.h b/include/ui/gtk.h index a79780a..99edd3c 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -27,15 +27,6 @@ #include "ui/egl-context.h" #endif -/* Compatibility define to let us build on both Gtk2 and Gtk3 */ -#if GTK_CHECK_VERSION(3, 0, 0) -static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh) -{ - *ww = gdk_window_get_width(w); - *wh = gdk_window_get_height(w); -} -#endif - typedef struct GtkDisplayState GtkDisplayState; typedef struct VirtualGfxConsole { diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 16ff946..11b870c 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -19,13 +19,6 @@ 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. - @subsection SDL 1.2 Previously QEMU has supported building against both SDL 1.2 diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index fb00ad1..a77c25b 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -48,11 +48,7 @@ void gd_egl_init(VirtualConsole *vc) return; } -#if GTK_CHECK_VERSION(3, 0, 0) Window x11_window = gdk_x11_window_get_xid(gdk_window); -#else - Window x11_window = gdk_x11_drawable_get_xid(gdk_window); -#endif if (!x11_window) { return; } @@ -82,7 +78,8 @@ void gd_egl_draw(VirtualConsole *vc) vc->gfx.esurface, vc->gfx.ectx); window = gtk_widget_get_window(vc->gfx.drawing_area); - gdk_drawable_get_size(window, &ww, &wh); + ww = gdk_window_get_width(window); + wh = gdk_window_get_height(window); surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); @@ -265,7 +262,8 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl, vc->gfx.esurface, vc->gfx.ectx); window = gtk_widget_get_window(vc->gfx.drawing_area); - gdk_drawable_get_size(window, &ww, &wh); + ww = gdk_window_get_width(window); + wh = gdk_window_get_height(window); egl_fb_setup_default(&vc->gfx.win_fb, ww, wh); if (vc->gfx.cursor_fb.texture) { egl_texture_blit(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb, @@ -111,49 +111,6 @@ # define VTE_CHECK_VERSION(a, b, c) 0 #endif -#if defined(CONFIG_VTE) && !GTK_CHECK_VERSION(3, 0, 0) -/* - * The gtk2 vte terminal widget seriously messes up the window resize - * for some reason. You basically can't make the qemu window smaller - * any more because the toplevel window geoemtry hints are overridden. - * - * Workaround that by hiding all vte widgets, except the one in the - * current tab. - * - * Luckily everything works smooth in gtk3. - */ -# define VTE_RESIZE_HACK 1 -#endif - -#if !GTK_CHECK_VERSION(2, 20, 0) -#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget) -#endif - -#ifndef GDK_IS_X11_DISPLAY -#define GDK_IS_X11_DISPLAY(dpy) (dpy == dpy) -#endif -#ifndef GDK_IS_WAYLAND_DISPLAY -#define GDK_IS_WAYLAND_DISPLAY(dpy) (dpy == dpy) -#endif -#ifndef GDK_IS_WIN32_DISPLAY -#define GDK_IS_WIN32_DISPLAY(dpy) (dpy == dpy) -#endif - -#if !GTK_CHECK_VERSION(2, 22, 0) -#define GDK_KEY_0 GDK_0 -#define GDK_KEY_1 GDK_1 -#define GDK_KEY_2 GDK_2 -#define GDK_KEY_f GDK_f -#define GDK_KEY_g GDK_g -#define GDK_KEY_m GDK_m -#define GDK_KEY_q GDK_q -#define GDK_KEY_plus GDK_plus -#define GDK_KEY_equal GDK_equal -#define GDK_KEY_minus GDK_minus -#define GDK_KEY_Pause GDK_Pause -#define GDK_KEY_Delete GDK_Delete -#endif - /* Some older mingw versions lack this constant or have * it conditionally defined */ #ifdef _WIN32 @@ -455,7 +412,8 @@ static void gd_update_full_redraw(VirtualConsole *vc) { GtkWidget *area = vc->gfx.drawing_area; int ww, wh; - gdk_drawable_get_size(gtk_widget_get_window(area), &ww, &wh); + ww = gdk_window_get_width(gtk_widget_get_window(area)); + wh = gdk_window_get_height(gtk_widget_get_window(area)); #if defined(CONFIG_GTK_GL) if (vc->gfx.gls && gtk_use_gl_area) { gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); @@ -530,7 +488,8 @@ static void gd_update(DisplayChangeListener *dcl, if (!win) { return; } - gdk_drawable_get_size(win, &ww, &wh); + ww = gdk_window_get_width(win); + wh = gdk_window_get_height(win); mx = my = 0; if (ww > fbw) { @@ -549,7 +508,6 @@ static void gd_refresh(DisplayChangeListener *dcl) graphic_hw_update(dcl->con); } -#if GTK_CHECK_VERSION(3, 0, 0) static GdkDevice *gd_get_pointer(GdkDisplay *dpy) { #if GTK_CHECK_VERSION(3, 20, 0) @@ -580,24 +538,6 @@ static void gd_mouse_set(DisplayChangeListener *dcl, vc->s->last_x = x; vc->s->last_y = y; } -#else -static void gd_mouse_set(DisplayChangeListener *dcl, - int x, int y, int visible) -{ - VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); - gint x_root, y_root; - - if (qemu_input_is_absolute()) { - return; - } - - gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area), - x, y, &x_root, &y_root); - gdk_display_warp_pointer(gtk_widget_get_display(vc->gfx.drawing_area), - gtk_widget_get_screen(vc->gfx.drawing_area), - x_root, y_root); -} -#endif static void gd_cursor_define(DisplayChangeListener *dcl, QEMUCursor *c) @@ -619,11 +559,7 @@ static void gd_cursor_define(DisplayChangeListener *dcl, pixbuf, c->hot_x, c->hot_y); gdk_window_set_cursor(gtk_widget_get_window(vc->gfx.drawing_area), cursor); g_object_unref(pixbuf); -#if !GTK_CHECK_VERSION(3, 0, 0) - gdk_cursor_unref(cursor); -#else g_object_unref(cursor); -#endif } static void gd_switch(DisplayChangeListener *dcl, @@ -863,7 +799,8 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque) fbw = surface_width(vc->gfx.ds); fbh = surface_height(vc->gfx.ds); - gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh); + ww = gdk_window_get_width(gtk_widget_get_window(widget)); + wh = gdk_window_get_height(gtk_widget_get_window(widget)); if (s->full_screen) { vc->gfx.scale_x = (double)ww / fbw; @@ -907,29 +844,6 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque) return TRUE; } -#if !GTK_CHECK_VERSION(3, 0, 0) -static gboolean gd_expose_event(GtkWidget *widget, GdkEventExpose *expose, - void *opaque) -{ - cairo_t *cr; - gboolean ret; - - cr = gdk_cairo_create(gtk_widget_get_window(widget)); - cairo_rectangle(cr, - expose->area.x, - expose->area.y, - expose->area.width, - expose->area.height); - cairo_clip(cr); - - ret = gd_draw_event(widget, cr, opaque); - - cairo_destroy(cr); - - return ret; -} -#endif - static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, void *opaque) { @@ -947,8 +861,8 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x; fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y; - gdk_drawable_get_size(gtk_widget_get_window(vc->gfx.drawing_area), - &ww, &wh); + ww = gdk_window_get_width(gtk_widget_get_window(vc->gfx.drawing_area)); + wh = gdk_window_get_height(gtk_widget_get_window(vc->gfx.drawing_area)); mx = my = 0; if (ww > fbw) { @@ -1026,13 +940,8 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, } if (x != (int)motion->x_root || y != (int)motion->y_root) { -#if GTK_CHECK_VERSION(3, 0, 0) GdkDevice *dev = gdk_event_get_device((GdkEvent *)motion); gdk_device_warp(dev, screen, x, y); -#else - GdkDisplay *display = gtk_widget_get_display(widget); - gdk_display_warp_pointer(display, screen, x, y); -#endif s->last_set = FALSE; return FALSE; } @@ -1309,10 +1218,6 @@ static void gd_accel_switch_vc(void *opaque) VirtualConsole *vc = opaque; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE); -#if !GTK_CHECK_VERSION(3, 0, 0) - /* GTK2 sends the accel key to the target console - ignore this until */ - vc->s->ignore_keys = true; -#endif } static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque) @@ -1539,7 +1444,7 @@ static void gd_grab_update(VirtualConsole *vc, bool kbd, bool ptr) gdk_seat_ungrab(seat); } } -#elif GTK_CHECK_VERSION(3, 0, 0) +#else static void gd_grab_devices(VirtualConsole *vc, bool grab, GdkInputSource source, GdkEventMask mask, GdkCursor *cursor) @@ -1578,14 +1483,10 @@ static void gd_grab_keyboard(VirtualConsole *vc, const char *reason) #if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, true, vc->s->ptr_owner == vc); -#elif GTK_CHECK_VERSION(3, 0, 0) +#else gd_grab_devices(vc, true, GDK_SOURCE_KEYBOARD, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK, NULL); -#else - gdk_keyboard_grab(gtk_widget_get_window(vc->gfx.drawing_area), - FALSE, - GDK_CURRENT_TIME); #endif vc->s->kbd_owner = vc; gd_update_caption(vc->s); @@ -1603,10 +1504,8 @@ static void gd_ungrab_keyboard(GtkDisplayState *s) #if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, false, vc->s->ptr_owner == vc); -#elif GTK_CHECK_VERSION(3, 0, 0) - gd_grab_devices(vc, false, GDK_SOURCE_KEYBOARD, 0, NULL); #else - gdk_keyboard_ungrab(GDK_CURRENT_TIME); + gd_grab_devices(vc, false, GDK_SOURCE_KEYBOARD, 0, NULL); #endif gd_update_caption(s); trace_gd_ungrab(vc->label, "kbd"); @@ -1628,7 +1527,7 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason) gd_grab_update(vc, vc->s->kbd_owner == vc, true); gdk_device_get_position(gd_get_pointer(display), NULL, &vc->s->grab_x_root, &vc->s->grab_y_root); -#elif GTK_CHECK_VERSION(3, 0, 0) +#else gd_grab_devices(vc, true, GDK_SOURCE_MOUSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | @@ -1638,19 +1537,6 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason) vc->s->null_cursor); gdk_device_get_position(gd_get_pointer(display), NULL, &vc->s->grab_x_root, &vc->s->grab_y_root); -#else - gdk_pointer_grab(gtk_widget_get_window(vc->gfx.drawing_area), - FALSE, /* All events to come to our window directly */ - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_BUTTON_MOTION_MASK | - GDK_SCROLL_MASK, - NULL, /* Allow cursor to move over entire desktop */ - vc->s->null_cursor, - GDK_CURRENT_TIME); - gdk_display_get_pointer(display, NULL, - &vc->s->grab_x_root, &vc->s->grab_y_root, NULL); #endif vc->s->ptr_owner = vc; gd_update_caption(vc->s); @@ -1673,16 +1559,11 @@ static void gd_ungrab_pointer(GtkDisplayState *s) gdk_device_warp(gd_get_pointer(display), gtk_widget_get_screen(vc->gfx.drawing_area), vc->s->grab_x_root, vc->s->grab_y_root); -#elif GTK_CHECK_VERSION(3, 0, 0) +#else gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL); gdk_device_warp(gd_get_pointer(display), gtk_widget_get_screen(vc->gfx.drawing_area), vc->s->grab_x_root, vc->s->grab_y_root); -#else - gdk_pointer_ungrab(GDK_CURRENT_TIME); - gdk_display_warp_pointer(display, - gtk_widget_get_screen(vc->gfx.drawing_area), - vc->s->grab_x_root, vc->s->grab_y_root); #endif gd_update_caption(s); trace_gd_ungrab(vc->label, "ptr"); @@ -1715,21 +1596,10 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, return; } -#ifdef VTE_RESIZE_HACK - vc = gd_vc_find_current(s); - if (vc && vc->type == GD_VC_VTE) { - gtk_widget_hide(vc->vte.terminal); - } -#endif vc = gd_vc_find_by_page(s, arg2); if (!vc) { return; } -#ifdef VTE_RESIZE_HACK - if (vc->type == GD_VC_VTE) { - gtk_widget_show(vc->vte.terminal); - } -#endif gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE); on_vga = (vc->type == GD_VC_GFX && @@ -1963,20 +1833,15 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc, vte_terminal_set_size(VTE_TERMINAL(vc->vte.terminal), VC_TERM_X_MIN, VC_TERM_Y_MIN); -#if VTE_CHECK_VERSION(0, 28, 0) && GTK_CHECK_VERSION(3, 0, 0) +#if VTE_CHECK_VERSION(0, 28, 0) vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(vc->vte.terminal)); #else vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->vte.terminal)); #endif -#if GTK_CHECK_VERSION(3, 0, 0) box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); scrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, vadjustment); -#else - box = gtk_hbox_new(false, 2); - scrollbar = gtk_vscrollbar_new(vadjustment); -#endif gtk_box_pack_end(GTK_BOX(box), scrollbar, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(box), vc->vte.terminal, TRUE, TRUE, 0); @@ -2015,7 +1880,6 @@ static void gd_vcs_init(GtkDisplayState *s, GSList *group, static void gd_connect_vc_gfx_signals(VirtualConsole *vc) { -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(vc->gfx.drawing_area, "draw", G_CALLBACK(gd_draw_event), vc); #if defined(CONFIG_GTK_GL) @@ -2027,10 +1891,6 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc) G_CALLBACK(gd_resize_event), vc); } #endif -#else - g_signal_connect(vc->gfx.drawing_area, "expose-event", - G_CALLBACK(gd_expose_event), vc); -#endif if (qemu_console_is_graphic(vc->gfx.dcl.con)) { g_signal_connect(vc->gfx.drawing_area, "event", G_CALLBACK(gd_event), vc); @@ -2234,11 +2094,9 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s) gtk_accel_group_connect(s->accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0, g_cclosure_new_swap(G_CALLBACK(gd_accel_full_screen), s, NULL)); -#if GTK_CHECK_VERSION(3, 8, 0) gtk_accel_label_set_accel( GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))), GDK_KEY_f, HOTKEY_MODIFIERS); -#endif gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item); separator = gtk_separator_menu_item_new(); @@ -2370,11 +2228,6 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) assert(opts->type == DISPLAY_TYPE_GTK); s->opts = opts; -#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); @@ -2431,23 +2284,6 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) gtk_widget_show_all(s->window); -#ifdef VTE_RESIZE_HACK - { - VirtualConsole *cur = gd_vc_find_current(s); - if (cur) { - int i; - - for (i = 0; i < s->nb_vcs; i++) { - VirtualConsole *vc = &s->vc[i]; - if (vc && vc->type == GD_VC_VTE && vc != cur) { - gtk_widget_hide(vc->vte.terminal); - } - } - gd_update_windowsize(cur); - } - } -#endif - vc = gd_vc_find_current(s); gtk_widget_set_sensitive(s->view_menu, vc != NULL); #ifdef CONFIG_VTE |