diff options
| author | Alexander Gramiak | 2019-04-07 19:02:03 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-04-14 19:15:45 -0600 |
| commit | fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (patch) | |
| tree | a872db9e55d150d03c7378b599d860214cab28b5 | |
| parent | 5c2f94a182a1154766154040eb5b4b39275fd3b6 (diff) | |
| download | emacs-fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e.tar.gz emacs-fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e.zip | |
Bump minimum GTK versions to 2.24 and 3.10
* configure.ac: Bump required GTK 2 and GTK 3 versions and the
associated GLib versions. Remove obsolete AC_CHECK_FUNCS calls. These
check for functions available in later GTK 2 versions. These checks
and can safely be removed with the exception of
gtk_window_set_has_resize_grip, which according to a comment in
gtkutil.c causes an issue in Ubuntu's GTK 2.
* src/gtkutil.c:
* src/xfns.c:
* src/xterm.c:
* src/xterm.h: Remove now unused conditional blocks. Use HAVE_GTK3
instead of GTK_CHECK_VERSION where now applicable. Remove checks of
now always true USE_GTK_TOOLTIP.
| -rw-r--r-- | configure.ac | 34 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | src/gtkutil.c | 154 | ||||
| -rw-r--r-- | src/xfns.c | 36 | ||||
| -rw-r--r-- | src/xterm.c | 2 | ||||
| -rw-r--r-- | src/xterm.h | 33 |
6 files changed, 61 insertions, 202 deletions
diff --git a/configure.ac b/configure.ac index cff9a274226..3cebf3d78c4 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -2688,8 +2688,8 @@ check_gtk2=no | |||
| 2688 | gtk3_pkg_errors= | 2688 | gtk3_pkg_errors= |
| 2689 | if test "${opsys}" != "mingw32"; then | 2689 | if test "${opsys}" != "mingw32"; then |
| 2690 | if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then | 2690 | if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then |
| 2691 | GLIB_REQUIRED=2.28 | 2691 | GLIB_REQUIRED=2.37.5 |
| 2692 | GTK_REQUIRED=3.0 | 2692 | GTK_REQUIRED=3.10 |
| 2693 | GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" | 2693 | GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" |
| 2694 | 2694 | ||
| 2695 | dnl Checks for libraries. | 2695 | dnl Checks for libraries. |
| @@ -2716,8 +2716,8 @@ if test "${opsys}" != "mingw32"; then | |||
| 2716 | fi | 2716 | fi |
| 2717 | 2717 | ||
| 2718 | if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then | 2718 | if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then |
| 2719 | GLIB_REQUIRED=2.10 | 2719 | GLIB_REQUIRED=2.28 |
| 2720 | GTK_REQUIRED=2.10 | 2720 | GTK_REQUIRED=2.24 |
| 2721 | GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" | 2721 | GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" |
| 2722 | 2722 | ||
| 2723 | dnl Checks for libraries. | 2723 | dnl Checks for libraries. |
| @@ -2804,30 +2804,8 @@ if test "${HAVE_GTK}" = "yes"; then | |||
| 2804 | AC_CHECK_FUNCS(gtk_file_selection_new) | 2804 | AC_CHECK_FUNCS(gtk_file_selection_new) |
| 2805 | fi | 2805 | fi |
| 2806 | 2806 | ||
| 2807 | dnl Same as above for gtk_handle_box. | 2807 | dnl This procedure causes a bug on certain Ubuntu GTK+2 builds |
| 2808 | HAVE_GTK_HANDLE_BOX=no | 2808 | AC_CHECK_FUNCS(gtk_window_set_has_resize_grip) |
| 2809 | AC_CHECK_DECL(GTK_TYPE_HANDLE_BOX, HAVE_GTK_HANDLE_BOX=yes, | ||
| 2810 | HAVE_GTK_HANDLE_BOX=no, [AC_INCLUDES_DEFAULT | ||
| 2811 | #include <gtk/gtk.h>]) | ||
| 2812 | if test "$HAVE_GTK_HANDLE_BOX" = yes; then | ||
| 2813 | AC_CHECK_FUNCS(gtk_handle_box_new) | ||
| 2814 | fi | ||
| 2815 | |||
| 2816 | dnl Same as above for gtk_tearoff_menu_item. | ||
| 2817 | HAVE_GTK_TEAROFF_MENU_ITEM=no | ||
| 2818 | AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes, | ||
| 2819 | HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT | ||
| 2820 | #include <gtk/gtk.h>]) | ||
| 2821 | if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then | ||
| 2822 | AC_CHECK_FUNCS(gtk_tearoff_menu_item_new) | ||
| 2823 | fi | ||
| 2824 | |||
| 2825 | dnl Check for functions introduced in 2.14 and later. | ||
| 2826 | AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \ | ||
| 2827 | gtk_dialog_get_action_area gtk_widget_get_sensitive \ | ||
| 2828 | gtk_widget_get_mapped gtk_adjustment_get_page_size \ | ||
| 2829 | gtk_orientable_set_orientation \ | ||
| 2830 | gtk_window_set_has_resize_grip) | ||
| 2831 | 2809 | ||
| 2832 | term_header=gtkutil.h | 2810 | term_header=gtkutil.h |
| 2833 | fi | 2811 | fi |
| @@ -89,6 +89,10 @@ Options" in the Emacs manual for more information. | |||
| 89 | check that the portable dumper code has been updated to match the last | 89 | check that the portable dumper code has been updated to match the last |
| 90 | change to one of the data structures that it relies on. | 90 | change to one of the data structures that it relies on. |
| 91 | 91 | ||
| 92 | --- | ||
| 93 | ** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3 | ||
| 94 | builds respectively. | ||
| 95 | |||
| 92 | 96 | ||
| 93 | * Startup Changes in Emacs 27.1 | 97 | * Startup Changes in Emacs 27.1 |
| 94 | 98 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index b130692c87a..2612683bcb2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 52 | #include <X11/extensions/Xdbe.h> | 52 | #include <X11/extensions/Xdbe.h> |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW | 55 | #ifdef HAVE_GTK3 |
| 56 | #define gtk_widget_set_has_window(w, b) \ | 56 | #define XG_TEXT_CANCEL "Cancel" |
| 57 | (gtk_fixed_set_has_window (GTK_FIXED (w), b)) | 57 | #define XG_TEXT_OK "OK" |
| 58 | #endif | 58 | #define XG_TEXT_OPEN "Open" |
| 59 | #ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA | ||
| 60 | #define gtk_dialog_get_action_area(w) ((w)->action_area) | ||
| 61 | #define gtk_dialog_get_content_area(w) ((w)->vbox) | ||
| 62 | #endif | ||
| 63 | #ifndef HAVE_GTK_WIDGET_GET_SENSITIVE | ||
| 64 | #define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w)) | ||
| 65 | #endif | ||
| 66 | #ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE | ||
| 67 | #define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s)) | ||
| 68 | #define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s)) | ||
| 69 | #define gtk_adjustment_get_step_increment(w) ((w)->step_increment) | ||
| 70 | #define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s)) | ||
| 71 | #endif | ||
| 72 | #if GTK_CHECK_VERSION (2, 12, 0) | ||
| 73 | #define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL) | ||
| 74 | #else | 59 | #else |
| 75 | #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) | 60 | #define XG_TEXT_CANCEL GTK_STOCK_CANCEL |
| 61 | #define XG_TEXT_OK GTK_STOCK_OK | ||
| 62 | #define XG_TEXT_OPEN GTK_STOCK_OPEN | ||
| 76 | #endif | 63 | #endif |
| 77 | 64 | ||
| 78 | #if ! GTK_CHECK_VERSION (2, 14, 0) | 65 | #ifndef HAVE_GTK3 |
| 79 | #define gtk_adjustment_configure(adj, xvalue, xlower, \ | ||
| 80 | xupper, xstep_increment, \ | ||
| 81 | xpage_increment, xpagesize) \ | ||
| 82 | do { \ | ||
| 83 | adj->lower = xlower; \ | ||
| 84 | adj->upper = xupper; \ | ||
| 85 | adj->page_size = xpagesize; \ | ||
| 86 | gtk_adjustment_set_value (adj, xvalue); \ | ||
| 87 | adj->page_increment = xpage_increment; \ | ||
| 88 | adj->step_increment = xstep_increment; \ | ||
| 89 | } while (0) | ||
| 90 | #endif /* < Gtk+ 2.14 */ | ||
| 91 | 66 | ||
| 92 | #ifdef HAVE_FREETYPE | 67 | #ifdef HAVE_FREETYPE |
| 93 | #if GTK_CHECK_VERSION (3, 2, 0) | ||
| 94 | #define USE_NEW_GTK_FONT_CHOOSER 1 | ||
| 95 | #else | ||
| 96 | #define USE_NEW_GTK_FONT_CHOOSER 0 | ||
| 97 | #define gtk_font_chooser_dialog_new(x, y) \ | 68 | #define gtk_font_chooser_dialog_new(x, y) \ |
| 98 | gtk_font_selection_dialog_new (x) | 69 | gtk_font_selection_dialog_new (x) |
| 99 | #undef GTK_FONT_CHOOSER | 70 | #undef GTK_FONT_CHOOSER |
| @@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 101 | #define gtk_font_chooser_set_font(x, y) \ | 72 | #define gtk_font_chooser_set_font(x, y) \ |
| 102 | gtk_font_selection_dialog_set_font_name (x, y) | 73 | gtk_font_selection_dialog_set_font_name (x, y) |
| 103 | #endif | 74 | #endif |
| 104 | #endif /* HAVE_FREETYPE */ | ||
| 105 | |||
| 106 | #if GTK_CHECK_VERSION (3, 10, 0) | ||
| 107 | #define XG_TEXT_CANCEL "Cancel" | ||
| 108 | #define XG_TEXT_OK "OK" | ||
| 109 | #define XG_TEXT_OPEN "Open" | ||
| 110 | #else | ||
| 111 | #define XG_TEXT_CANCEL GTK_STOCK_CANCEL | ||
| 112 | #define XG_TEXT_OK GTK_STOCK_OK | ||
| 113 | #define XG_TEXT_OPEN GTK_STOCK_OPEN | ||
| 114 | #endif | ||
| 115 | 75 | ||
| 116 | #ifndef HAVE_GTK3 | ||
| 117 | #ifdef USE_GTK_TOOLTIP | ||
| 118 | #define gdk_window_get_screen(w) gdk_drawable_get_screen (w) | ||
| 119 | #endif | ||
| 120 | #define gdk_window_get_geometry(w, a, b, c, d) \ | 76 | #define gdk_window_get_geometry(w, a, b, c, d) \ |
| 121 | gdk_window_get_geometry (w, a, b, c, d, 0) | 77 | gdk_window_get_geometry (w, a, b, c, d, 0) |
| 122 | #define gdk_x11_window_lookup_for_display(d, w) \ | ||
| 123 | gdk_xid_table_lookup_for_display (d, w) | ||
| 124 | #define gtk_box_new(ori, spacing) \ | 78 | #define gtk_box_new(ori, spacing) \ |
| 125 | ((ori) == GTK_ORIENTATION_HORIZONTAL \ | 79 | ((ori) == GTK_ORIENTATION_HORIZONTAL \ |
| 126 | ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing))) | 80 | ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing))) |
| 127 | #define gtk_scrollbar_new(ori, spacing) \ | 81 | #define gtk_scrollbar_new(ori, spacing) \ |
| 128 | ((ori) == GTK_ORIENTATION_HORIZONTAL \ | 82 | ((ori) == GTK_ORIENTATION_HORIZONTAL \ |
| 129 | ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing))) | 83 | ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing))) |
| 130 | #ifndef GDK_KEY_g | ||
| 131 | #define GDK_KEY_g GDK_g | ||
| 132 | #endif | ||
| 133 | #endif /* HAVE_GTK3 */ | 84 | #endif /* HAVE_GTK3 */ |
| 134 | 85 | ||
| 135 | #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) | 86 | #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) |
| @@ -227,7 +178,7 @@ xg_get_gdk_scale (void) | |||
| 227 | int | 178 | int |
| 228 | xg_get_scale (struct frame *f) | 179 | xg_get_scale (struct frame *f) |
| 229 | { | 180 | { |
| 230 | #if GTK_CHECK_VERSION (3, 10, 0) | 181 | #ifdef HAVE_GTK3 |
| 231 | if (FRAME_GTK_WIDGET (f)) | 182 | if (FRAME_GTK_WIDGET (f)) |
| 232 | return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); | 183 | return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); |
| 233 | #endif | 184 | #endif |
| @@ -261,15 +212,7 @@ xg_display_close (Display *dpy) | |||
| 261 | gdpy_def = gdpy_new; | 212 | gdpy_def = gdpy_new; |
| 262 | } | 213 | } |
| 263 | 214 | ||
| 264 | #if GTK_CHECK_VERSION (2, 0, 0) && ! GTK_CHECK_VERSION (2, 10, 0) | ||
| 265 | /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash | ||
| 266 | <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we | ||
| 267 | can continue running, but there will be memory leaks. */ | ||
| 268 | g_object_run_dispose (G_OBJECT (gdpy)); | ||
| 269 | #else | ||
| 270 | /* This seems to be fixed in GTK 2.10. */ | ||
| 271 | gdk_display_close (gdpy); | 215 | gdk_display_close (gdpy); |
| 272 | #endif | ||
| 273 | } | 216 | } |
| 274 | 217 | ||
| 275 | 218 | ||
| @@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f, | |||
| 368 | GtkWidget *widget, | 311 | GtkWidget *widget, |
| 369 | GtkImage *old_widget) | 312 | GtkImage *old_widget) |
| 370 | { | 313 | { |
| 371 | #if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) | 314 | #if defined USE_CAIRO && defined HAVE_GTK3 |
| 372 | cairo_surface_t *surface; | 315 | cairo_surface_t *surface; |
| 373 | #else | 316 | #else |
| 374 | GdkPixbuf *icon_buf; | 317 | GdkPixbuf *icon_buf; |
| @@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f, | |||
| 400 | on a monochrome display, and sometimes bad on all displays with | 343 | on a monochrome display, and sometimes bad on all displays with |
| 401 | certain themes. */ | 344 | certain themes. */ |
| 402 | 345 | ||
| 403 | #if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) | 346 | #if defined USE_CAIRO && defined HAVE_GTK3 |
| 404 | surface = img->cr_data; | 347 | surface = img->cr_data; |
| 405 | 348 | ||
| 406 | if (surface) | 349 | if (surface) |
| @@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f, | |||
| 643 | We use that to pop down the tooltip. This happens if Gtk+ for some | 586 | We use that to pop down the tooltip. This happens if Gtk+ for some |
| 644 | reason wants to change or hide the tooltip. */ | 587 | reason wants to change or hide the tooltip. */ |
| 645 | 588 | ||
| 646 | #ifdef USE_GTK_TOOLTIP | ||
| 647 | |||
| 648 | static void | 589 | static void |
| 649 | hierarchy_ch_cb (GtkWidget *widget, | 590 | hierarchy_ch_cb (GtkWidget *widget, |
| 650 | GtkWidget *previous_toplevel, | 591 | GtkWidget *previous_toplevel, |
| @@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget, | |||
| 711 | return FALSE; | 652 | return FALSE; |
| 712 | } | 653 | } |
| 713 | 654 | ||
| 714 | #endif /* USE_GTK_TOOLTIP */ | ||
| 715 | |||
| 716 | /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. | 655 | /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. |
| 717 | Return true if a system tooltip is available. */ | 656 | Return true if a system tooltip is available. */ |
| 718 | 657 | ||
| @@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f, | |||
| 722 | int *width, | 661 | int *width, |
| 723 | int *height) | 662 | int *height) |
| 724 | { | 663 | { |
| 725 | #ifndef USE_GTK_TOOLTIP | ||
| 726 | return 0; | ||
| 727 | #else | ||
| 728 | struct x_output *x = f->output_data.x; | 664 | struct x_output *x = f->output_data.x; |
| 729 | GtkWidget *widget; | 665 | GtkWidget *widget; |
| 730 | GdkWindow *gwin; | 666 | GdkWindow *gwin; |
| @@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f, | |||
| 768 | unblock_input (); | 704 | unblock_input (); |
| 769 | 705 | ||
| 770 | return TRUE; | 706 | return TRUE; |
| 771 | #endif /* USE_GTK_TOOLTIP */ | ||
| 772 | } | 707 | } |
| 773 | 708 | ||
| 774 | /* Show the tooltip at ROOT_X and ROOT_Y. | 709 | /* Show the tooltip at ROOT_X and ROOT_Y. |
| @@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f, | |||
| 777 | void | 712 | void |
| 778 | xg_show_tooltip (struct frame *f, int root_x, int root_y) | 713 | xg_show_tooltip (struct frame *f, int root_x, int root_y) |
| 779 | { | 714 | { |
| 780 | #ifdef USE_GTK_TOOLTIP | ||
| 781 | struct x_output *x = f->output_data.x; | 715 | struct x_output *x = f->output_data.x; |
| 782 | if (x->ttip_window) | 716 | if (x->ttip_window) |
| 783 | { | 717 | { |
| @@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y) | |||
| 787 | gtk_widget_show (GTK_WIDGET (x->ttip_window)); | 721 | gtk_widget_show (GTK_WIDGET (x->ttip_window)); |
| 788 | unblock_input (); | 722 | unblock_input (); |
| 789 | } | 723 | } |
| 790 | #endif | ||
| 791 | } | 724 | } |
| 792 | 725 | ||
| 793 | 726 | ||
| @@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y) | |||
| 797 | bool | 730 | bool |
| 798 | xg_hide_tooltip (struct frame *f) | 731 | xg_hide_tooltip (struct frame *f) |
| 799 | { | 732 | { |
| 800 | #ifdef USE_GTK_TOOLTIP | ||
| 801 | if (f->output_data.x->ttip_window) | 733 | if (f->output_data.x->ttip_window) |
| 802 | { | 734 | { |
| 803 | GtkWindow *win = f->output_data.x->ttip_window; | 735 | GtkWindow *win = f->output_data.x->ttip_window; |
| @@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f) | |||
| 816 | 748 | ||
| 817 | return TRUE; | 749 | return TRUE; |
| 818 | } | 750 | } |
| 819 | #endif | ||
| 820 | return FALSE; | 751 | return FALSE; |
| 821 | } | 752 | } |
| 822 | 753 | ||
| @@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *f) | |||
| 1193 | has backported it to Gtk+ 2.0 and they add the resize grip for | 1124 | has backported it to Gtk+ 2.0 and they add the resize grip for |
| 1194 | Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop | 1125 | Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop |
| 1195 | forever, so disable the grip. */ | 1126 | forever, so disable the grip. */ |
| 1196 | #if (! GTK_CHECK_VERSION (3, 0, 0) \ | 1127 | #if (! defined HAVE_GTK3 \ |
| 1197 | && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP) | 1128 | && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP) |
| 1198 | gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE); | 1129 | gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE); |
| 1199 | #endif | 1130 | #endif |
| @@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f) | |||
| 1328 | gdk_window_set_override_redirect (gwin, TRUE); | 1259 | gdk_window_set_override_redirect (gwin, TRUE); |
| 1329 | } | 1260 | } |
| 1330 | 1261 | ||
| 1331 | #ifdef USE_GTK_TOOLTIP | ||
| 1332 | /* Steal a tool tip window we can move ourselves. */ | 1262 | /* Steal a tool tip window we can move ourselves. */ |
| 1333 | f->output_data.x->ttip_widget = 0; | 1263 | f->output_data.x->ttip_widget = 0; |
| 1334 | f->output_data.x->ttip_lbl = 0; | 1264 | f->output_data.x->ttip_lbl = 0; |
| 1335 | f->output_data.x->ttip_window = 0; | 1265 | f->output_data.x->ttip_window = 0; |
| 1336 | gtk_widget_set_tooltip_text (wtop, "Dummy text"); | 1266 | gtk_widget_set_tooltip_text (wtop, "Dummy text"); |
| 1337 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); | 1267 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); |
| 1338 | #endif | ||
| 1339 | 1268 | ||
| 1340 | { | 1269 | { |
| 1341 | GdkScreen *screen = gtk_widget_get_screen (wtop); | 1270 | GdkScreen *screen = gtk_widget_get_screen (wtop); |
| @@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f) | |||
| 1363 | { | 1292 | { |
| 1364 | if (FRAME_GTK_OUTER_WIDGET (f)) | 1293 | if (FRAME_GTK_OUTER_WIDGET (f)) |
| 1365 | { | 1294 | { |
| 1366 | #ifdef USE_GTK_TOOLTIP | ||
| 1367 | struct x_output *x = f->output_data.x; | 1295 | struct x_output *x = f->output_data.x; |
| 1368 | #endif | ||
| 1369 | struct xg_frame_tb_info *tbinfo | 1296 | struct xg_frame_tb_info *tbinfo |
| 1370 | = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), | 1297 | = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), |
| 1371 | TB_INFO_KEY); | 1298 | TB_INFO_KEY); |
| @@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f) | |||
| 1378 | FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ | 1305 | FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ |
| 1379 | FRAME_X_RAW_DRAWABLE (f) = 0; | 1306 | FRAME_X_RAW_DRAWABLE (f) = 0; |
| 1380 | FRAME_GTK_OUTER_WIDGET (f) = 0; | 1307 | FRAME_GTK_OUTER_WIDGET (f) = 0; |
| 1381 | #ifdef USE_GTK_TOOLTIP | ||
| 1382 | if (x->ttip_lbl) | 1308 | if (x->ttip_lbl) |
| 1383 | gtk_widget_destroy (x->ttip_lbl); | 1309 | gtk_widget_destroy (x->ttip_lbl); |
| 1384 | if (x->ttip_widget) | 1310 | if (x->ttip_widget) |
| 1385 | g_object_unref (G_OBJECT (x->ttip_widget)); | 1311 | g_object_unref (G_OBJECT (x->ttip_widget)); |
| 1386 | #endif | ||
| 1387 | } | 1312 | } |
| 1388 | } | 1313 | } |
| 1389 | 1314 | ||
| @@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated) | |||
| 1561 | void | 1486 | void |
| 1562 | xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) | 1487 | xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) |
| 1563 | { | 1488 | { |
| 1564 | #if GTK_CHECK_VERSION (2, 18, 0) | ||
| 1565 | block_input (); | 1489 | block_input (); |
| 1566 | if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2)) | 1490 | if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2)) |
| 1567 | { | 1491 | { |
| @@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) | |||
| 1576 | x_sync (f1); | 1500 | x_sync (f1); |
| 1577 | } | 1501 | } |
| 1578 | unblock_input (); | 1502 | unblock_input (); |
| 1579 | #endif | ||
| 1580 | } | 1503 | } |
| 1581 | 1504 | ||
| 1582 | 1505 | ||
| @@ -2216,7 +2139,7 @@ xg_get_file_name (struct frame *f, | |||
| 2216 | 2139 | ||
| 2217 | #ifdef HAVE_FREETYPE | 2140 | #ifdef HAVE_FREETYPE |
| 2218 | 2141 | ||
| 2219 | #if USE_NEW_GTK_FONT_CHOOSER | 2142 | #ifdef HAVE_GTK3 |
| 2220 | 2143 | ||
| 2221 | #define XG_WEIGHT_TO_SYMBOL(w) \ | 2144 | #define XG_WEIGHT_TO_SYMBOL(w) \ |
| 2222 | (w <= PANGO_WEIGHT_THIN ? Qextra_light \ | 2145 | (w <= PANGO_WEIGHT_THIN ? Qextra_light \ |
| @@ -2233,7 +2156,7 @@ xg_get_file_name (struct frame *f, | |||
| 2233 | : s == PANGO_STYLE_ITALIC ? Qitalic \ | 2156 | : s == PANGO_STYLE_ITALIC ? Qitalic \ |
| 2234 | : Qnormal) | 2157 | : Qnormal) |
| 2235 | 2158 | ||
| 2236 | #endif /* USE_NEW_GTK_FONT_CHOOSER */ | 2159 | #endif /* HAVE_GTK3 */ |
| 2237 | 2160 | ||
| 2238 | 2161 | ||
| 2239 | static char *x_last_font_name; | 2162 | static char *x_last_font_name; |
| @@ -2280,7 +2203,7 @@ xg_get_font (struct frame *f, const char *default_name) | |||
| 2280 | done = xg_dialog_run (f, w); | 2203 | done = xg_dialog_run (f, w); |
| 2281 | if (done == GTK_RESPONSE_OK) | 2204 | if (done == GTK_RESPONSE_OK) |
| 2282 | { | 2205 | { |
| 2283 | #if USE_NEW_GTK_FONT_CHOOSER | 2206 | #ifdef HAVE_GTK3 |
| 2284 | /* Use the GTK3 font chooser. */ | 2207 | /* Use the GTK3 font chooser. */ |
| 2285 | PangoFontDescription *desc | 2208 | PangoFontDescription *desc |
| 2286 | = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w)); | 2209 | = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w)); |
| @@ -2320,7 +2243,7 @@ xg_get_font (struct frame *f, const char *default_name) | |||
| 2320 | g_free (x_last_font_name); | 2243 | g_free (x_last_font_name); |
| 2321 | x_last_font_name = font_name; | 2244 | x_last_font_name = font_name; |
| 2322 | } | 2245 | } |
| 2323 | #endif /* USE_NEW_GTK_FONT_CHOOSER */ | 2246 | #endif /* HAVE_GTK3 */ |
| 2324 | } | 2247 | } |
| 2325 | 2248 | ||
| 2326 | gtk_widget_destroy (w); | 2249 | gtk_widget_destroy (w); |
| @@ -3041,9 +2964,7 @@ xg_update_menubar (GtkWidget *menubar, | |||
| 3041 | bridge that might be loaded) that the item's label has | 2964 | bridge that might be loaded) that the item's label has |
| 3042 | changed. */ | 2965 | changed. */ |
| 3043 | gtk_label_set_text (wlabel, utf8_label); | 2966 | gtk_label_set_text (wlabel, utf8_label); |
| 3044 | #if GTK_CHECK_VERSION (2, 16, 0) | ||
| 3045 | g_object_notify (G_OBJECT (witem), "label"); | 2967 | g_object_notify (G_OBJECT (witem), "label"); |
| 3046 | #endif | ||
| 3047 | if (utf8_label) g_free (utf8_label); | 2968 | if (utf8_label) g_free (utf8_label); |
| 3048 | iter = g_list_next (iter); | 2969 | iter = g_list_next (iter); |
| 3049 | val = val->next; | 2970 | val = val->next; |
| @@ -3222,10 +3143,8 @@ xg_update_menu_item (widget_value *val, | |||
| 3222 | } | 3143 | } |
| 3223 | } | 3144 | } |
| 3224 | 3145 | ||
| 3225 | #if GTK_CHECK_VERSION (2, 16, 0) | ||
| 3226 | if (label_changed) /* See comment in xg_update_menubar. */ | 3146 | if (label_changed) /* See comment in xg_update_menubar. */ |
| 3227 | g_object_notify (G_OBJECT (w), "label"); | 3147 | g_object_notify (G_OBJECT (w), "label"); |
| 3228 | #endif | ||
| 3229 | } | 3148 | } |
| 3230 | 3149 | ||
| 3231 | /* Update the toggle menu item W so it corresponds to VAL. */ | 3150 | /* Update the toggle menu item W so it corresponds to VAL. */ |
| @@ -3324,7 +3243,7 @@ xg_update_submenu (GtkWidget *submenu, | |||
| 3324 | { | 3243 | { |
| 3325 | /* Not a submenu anymore. */ | 3244 | /* Not a submenu anymore. */ |
| 3326 | g_object_ref (G_OBJECT (sub)); | 3245 | g_object_ref (G_OBJECT (sub)); |
| 3327 | remove_submenu (witem); | 3246 | gtk_menu_item_set_submenu (witem, NULL); |
| 3328 | gtk_widget_destroy (sub); | 3247 | gtk_widget_destroy (sub); |
| 3329 | } | 3248 | } |
| 3330 | else if (cur->contents) | 3249 | else if (cur->contents) |
| @@ -4492,14 +4411,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, | |||
| 4492 | } | 4411 | } |
| 4493 | #endif | 4412 | #endif |
| 4494 | 4413 | ||
| 4495 | #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION | ||
| 4496 | #define toolbar_set_orientation(w, o) \ | ||
| 4497 | gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o) | ||
| 4498 | #else | ||
| 4499 | #define toolbar_set_orientation(w, o) \ | ||
| 4500 | gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) | ||
| 4501 | #endif | ||
| 4502 | |||
| 4503 | /* Attach a tool bar to frame F. */ | 4414 | /* Attach a tool bar to frame F. */ |
| 4504 | 4415 | ||
| 4505 | static void | 4416 | static void |
| @@ -4509,10 +4420,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos) | |||
| 4509 | bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); | 4420 | bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); |
| 4510 | GtkWidget *top_widget = x->toolbar_widget; | 4421 | GtkWidget *top_widget = x->toolbar_widget; |
| 4511 | 4422 | ||
| 4512 | toolbar_set_orientation (x->toolbar_widget, | 4423 | gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget), |
| 4513 | into_hbox | 4424 | into_hbox |
| 4514 | ? GTK_ORIENTATION_VERTICAL | 4425 | ? GTK_ORIENTATION_VERTICAL |
| 4515 | : GTK_ORIENTATION_HORIZONTAL); | 4426 | : GTK_ORIENTATION_HORIZONTAL); |
| 4516 | 4427 | ||
| 4517 | if (into_hbox) | 4428 | if (into_hbox) |
| 4518 | { | 4429 | { |
| @@ -4565,7 +4476,7 @@ static void | |||
| 4565 | xg_create_tool_bar (struct frame *f) | 4476 | xg_create_tool_bar (struct frame *f) |
| 4566 | { | 4477 | { |
| 4567 | struct x_output *x = f->output_data.x; | 4478 | struct x_output *x = f->output_data.x; |
| 4568 | #if GTK_CHECK_VERSION (3, 3, 6) | 4479 | #ifdef HAVE_GTK3 |
| 4569 | GtkStyleContext *gsty; | 4480 | GtkStyleContext *gsty; |
| 4570 | #endif | 4481 | #endif |
| 4571 | struct xg_frame_tb_info *tbinfo | 4482 | struct xg_frame_tb_info *tbinfo |
| @@ -4589,10 +4500,11 @@ xg_create_tool_bar (struct frame *f) | |||
| 4589 | gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); | 4500 | gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); |
| 4590 | 4501 | ||
| 4591 | gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); | 4502 | gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); |
| 4592 | toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL); | 4503 | gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget), |
| 4504 | GTK_ORIENTATION_HORIZONTAL); | ||
| 4593 | g_signal_connect (x->toolbar_widget, "size-allocate", | 4505 | g_signal_connect (x->toolbar_widget, "size-allocate", |
| 4594 | G_CALLBACK (tb_size_cb), f); | 4506 | G_CALLBACK (tb_size_cb), f); |
| 4595 | #if GTK_CHECK_VERSION (3, 3, 6) | 4507 | #ifdef HAVE_GTK3 |
| 4596 | gsty = gtk_widget_get_style_context (x->toolbar_widget); | 4508 | gsty = gtk_widget_get_style_context (x->toolbar_widget); |
| 4597 | gtk_style_context_add_class (gsty, "primary-toolbar"); | 4509 | gtk_style_context_add_class (gsty, "primary-toolbar"); |
| 4598 | #endif | 4510 | #endif |
| @@ -4645,7 +4557,7 @@ xg_make_tool_item (struct frame *f, | |||
| 4645 | GtkWidget *wb = gtk_button_new (); | 4557 | GtkWidget *wb = gtk_button_new (); |
| 4646 | /* The eventbox is here so we can have tooltips on disabled items. */ | 4558 | /* The eventbox is here so we can have tooltips on disabled items. */ |
| 4647 | GtkWidget *weventbox = gtk_event_box_new (); | 4559 | GtkWidget *weventbox = gtk_event_box_new (); |
| 4648 | #if GTK_CHECK_VERSION (3, 3, 6) | 4560 | #ifdef HAVE_GTK3 |
| 4649 | GtkCssProvider *css_prov = gtk_css_provider_new (); | 4561 | GtkCssProvider *css_prov = gtk_css_provider_new (); |
| 4650 | GtkStyleContext *gsty; | 4562 | GtkStyleContext *gsty; |
| 4651 | 4563 | ||
| @@ -4777,7 +4689,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, | |||
| 4777 | { | 4689 | { |
| 4778 | gpointer gold_img = g_object_get_data (G_OBJECT (wimage), | 4690 | gpointer gold_img = g_object_get_data (G_OBJECT (wimage), |
| 4779 | XG_TOOL_BAR_IMAGE_DATA); | 4691 | XG_TOOL_BAR_IMAGE_DATA); |
| 4780 | #if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) | 4692 | #if defined USE_CAIRO && defined HAVE_GTK3 |
| 4781 | void *old_img = (void *) gold_img; | 4693 | void *old_img = (void *) gold_img; |
| 4782 | if (old_img != img->cr_data) | 4694 | if (old_img != img->cr_data) |
| 4783 | return 1; | 4695 | return 1; |
| @@ -4850,7 +4762,7 @@ find_icon_from_name (char *name, | |||
| 4850 | GtkIconTheme *icon_theme, | 4762 | GtkIconTheme *icon_theme, |
| 4851 | char **icon_name) | 4763 | char **icon_name) |
| 4852 | { | 4764 | { |
| 4853 | #if ! GTK_CHECK_VERSION (3, 10, 0) | 4765 | #ifndef HAVE_GTK3 |
| 4854 | GtkStockItem stock_item; | 4766 | GtkStockItem stock_item; |
| 4855 | #endif | 4767 | #endif |
| 4856 | 4768 | ||
| @@ -4863,7 +4775,7 @@ find_icon_from_name (char *name, | |||
| 4863 | *icon_name = NULL; | 4775 | *icon_name = NULL; |
| 4864 | } | 4776 | } |
| 4865 | 4777 | ||
| 4866 | #if ! GTK_CHECK_VERSION (3, 10, 0) | 4778 | #ifndef HAVE_GTK3 |
| 4867 | else if (gtk_stock_lookup (name, &stock_item)) | 4779 | else if (gtk_stock_lookup (name, &stock_item)) |
| 4868 | *icon_name = NULL; | 4780 | *icon_name = NULL; |
| 4869 | #endif | 4781 | #endif |
| @@ -5078,7 +4990,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 5078 | prepare_image_for_display (f, img); | 4990 | prepare_image_for_display (f, img); |
| 5079 | 4991 | ||
| 5080 | if (img->load_failed_p | 4992 | if (img->load_failed_p |
| 5081 | #if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) | 4993 | #if defined USE_CAIRO && defined HAVE_GTK3 |
| 5082 | || img->cr_data == NULL | 4994 | || img->cr_data == NULL |
| 5083 | #else | 4995 | #else |
| 5084 | || img->pixmap == None | 4996 | || img->pixmap == None |
| @@ -5113,7 +5025,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 5113 | else if (stock_name) | 5025 | else if (stock_name) |
| 5114 | { | 5026 | { |
| 5115 | 5027 | ||
| 5116 | #if GTK_CHECK_VERSION (3, 10, 0) | 5028 | #ifdef HAVE_GTK3 |
| 5117 | w = gtk_image_new_from_icon_name (stock_name, icon_size); | 5029 | w = gtk_image_new_from_icon_name (stock_name, icon_size); |
| 5118 | #else | 5030 | #else |
| 5119 | w = gtk_image_new_from_stock (stock_name, icon_size); | 5031 | w = gtk_image_new_from_stock (stock_name, icon_size); |
| @@ -5133,7 +5045,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 5133 | { | 5045 | { |
| 5134 | w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 5046 | w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
| 5135 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | 5047 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
| 5136 | #if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) | 5048 | #if defined USE_CAIRO && defined HAVE_GTK3 |
| 5137 | (gpointer)img->cr_data | 5049 | (gpointer)img->cr_data |
| 5138 | #else | 5050 | #else |
| 5139 | (gpointer)img->pixmap | 5051 | (gpointer)img->pixmap |
| @@ -5309,7 +5221,7 @@ xg_initialize (void) | |||
| 5309 | 5221 | ||
| 5310 | settings = gtk_settings_get_for_screen (gdk_display_get_default_screen | 5222 | settings = gtk_settings_get_for_screen (gdk_display_get_default_screen |
| 5311 | (gdk_display_get_default ())); | 5223 | (gdk_display_get_default ())); |
| 5312 | #if ! GTK_CHECK_VERSION (3, 10, 0) | 5224 | #ifndef HAVE_GTK3 |
| 5313 | /* Remove F10 as a menu accelerator, it does not mix well with Emacs key | 5225 | /* Remove F10 as a menu accelerator, it does not mix well with Emacs key |
| 5314 | bindings. It doesn't seem to be any way to remove properties, | 5226 | bindings. It doesn't seem to be any way to remove properties, |
| 5315 | so we set it to "" which in means "no key". */ | 5227 | so we set it to "" which in means "no key". */ |
diff --git a/src/xfns.c b/src/xfns.c index e521ed12e40..dbc5e10c415 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */) | |||
| 4496 | Return false if and only if the workarea information cannot be | 4496 | Return false if and only if the workarea information cannot be |
| 4497 | obtained via the _NET_WORKAREA root window property. */ | 4497 | obtained via the _NET_WORKAREA root window property. */ |
| 4498 | 4498 | ||
| 4499 | #if ! GTK_CHECK_VERSION (3, 4, 0) | 4499 | #ifndef HAVE_GTK3 |
| 4500 | static bool | 4500 | static bool |
| 4501 | x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) | 4501 | x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) |
| 4502 | { | 4502 | { |
| @@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4906 | Lisp_Object attributes_list = Qnil; | 4906 | Lisp_Object attributes_list = Qnil; |
| 4907 | 4907 | ||
| 4908 | #ifdef USE_GTK | 4908 | #ifdef USE_GTK |
| 4909 | double mm_width_per_pixel, mm_height_per_pixel; | ||
| 4910 | GdkDisplay *gdpy; | 4909 | GdkDisplay *gdpy; |
| 4911 | #if ! GTK_CHECK_VERSION (3, 22, 0) | 4910 | #if ! GTK_CHECK_VERSION (3, 22, 0) |
| 4911 | double mm_width_per_pixel, mm_height_per_pixel; | ||
| 4912 | GdkScreen *gscreen; | 4912 | GdkScreen *gscreen; |
| 4913 | #endif | 4913 | #endif |
| 4914 | gint primary_monitor = 0, n_monitors, i; | 4914 | gint primary_monitor = 0, n_monitors, i; |
| @@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4917 | struct MonitorInfo *monitors; | 4917 | struct MonitorInfo *monitors; |
| 4918 | 4918 | ||
| 4919 | block_input (); | 4919 | block_input (); |
| 4920 | mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen) | ||
| 4921 | / x_display_pixel_width (dpyinfo)); | ||
| 4922 | mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen) | ||
| 4923 | / x_display_pixel_height (dpyinfo)); | ||
| 4924 | gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); | 4920 | gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); |
| 4925 | #if GTK_CHECK_VERSION (3, 22, 0) | 4921 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 4926 | n_monitors = gdk_display_get_n_monitors (gdpy); | 4922 | n_monitors = gdk_display_get_n_monitors (gdpy); |
| 4927 | #else | 4923 | #else |
| 4928 | gscreen = gdk_display_get_default_screen (gdpy); | 4924 | gscreen = gdk_display_get_default_screen (gdpy); |
| 4929 | #if GTK_CHECK_VERSION (2, 20, 0) | ||
| 4930 | primary_monitor = gdk_screen_get_primary_monitor (gscreen); | ||
| 4931 | #endif | ||
| 4932 | n_monitors = gdk_screen_get_n_monitors (gscreen); | 4925 | n_monitors = gdk_screen_get_n_monitors (gscreen); |
| 4926 | primary_monitor = gdk_screen_get_primary_monitor (gscreen); | ||
| 4927 | /* Fallback if gdk_screen_get_monitor_{width,height}_mm fail */ | ||
| 4928 | mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen) | ||
| 4929 | / x_display_pixel_width (dpyinfo)); | ||
| 4930 | mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen) | ||
| 4931 | / x_display_pixel_height (dpyinfo)); | ||
| 4933 | #endif | 4932 | #endif |
| 4934 | monitor_frames = make_nil_vector (n_monitors); | 4933 | monitor_frames = make_nil_vector (n_monitors); |
| 4935 | monitors = xzalloc (n_monitors * sizeof *monitors); | 4934 | monitors = xzalloc (n_monitors * sizeof *monitors); |
| @@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4958 | 4957 | ||
| 4959 | for (i = 0; i < n_monitors; ++i) | 4958 | for (i = 0; i < n_monitors; ++i) |
| 4960 | { | 4959 | { |
| 4961 | gint width_mm = -1, height_mm = -1; | 4960 | gint width_mm, height_mm; |
| 4962 | GdkRectangle rec, work; | 4961 | GdkRectangle rec, work; |
| 4963 | struct MonitorInfo *mi = &monitors[i]; | 4962 | struct MonitorInfo *mi = &monitors[i]; |
| 4964 | int scale = 1; | 4963 | int scale = 1; |
| @@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4975 | #if GTK_CHECK_VERSION (3, 22, 0) | 4974 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 4976 | width_mm = gdk_monitor_get_width_mm (monitor); | 4975 | width_mm = gdk_monitor_get_width_mm (monitor); |
| 4977 | height_mm = gdk_monitor_get_height_mm (monitor); | 4976 | height_mm = gdk_monitor_get_height_mm (monitor); |
| 4978 | #elif GTK_CHECK_VERSION (2, 14, 0) | 4977 | #else |
| 4979 | width_mm = gdk_screen_get_monitor_width_mm (gscreen, i); | 4978 | width_mm = gdk_screen_get_monitor_width_mm (gscreen, i); |
| 4980 | height_mm = gdk_screen_get_monitor_height_mm (gscreen, i); | 4979 | height_mm = gdk_screen_get_monitor_height_mm (gscreen, i); |
| 4981 | #endif | ||
| 4982 | if (width_mm < 0) | 4980 | if (width_mm < 0) |
| 4983 | width_mm = rec.width * mm_width_per_pixel + 0.5; | 4981 | width_mm = rec.width * mm_width_per_pixel + 0.5; |
| 4984 | if (height_mm < 0) | 4982 | if (height_mm < 0) |
| 4985 | height_mm = rec.height * mm_height_per_pixel + 0.5; | 4983 | height_mm = rec.height * mm_height_per_pixel + 0.5; |
| 4986 | 4984 | #endif | |
| 4987 | #if GTK_CHECK_VERSION (3, 22, 0) | 4985 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 4988 | gdk_monitor_get_workarea (monitor, &work); | 4986 | gdk_monitor_get_workarea (monitor, &work); |
| 4989 | #elif GTK_CHECK_VERSION (3, 4, 0) | 4987 | #elif defined HAVE_GTK3 |
| 4990 | gdk_screen_get_monitor_workarea (gscreen, i, &work); | 4988 | gdk_screen_get_monitor_workarea (gscreen, i, &work); |
| 4991 | #else | 4989 | #else |
| 4992 | /* Emulate the behavior of GTK+ 3.4. */ | 4990 | /* Emulate the behavior of GTK+ 3.4. */ |
| @@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 5010 | /* GTK returns scaled sizes for the workareas. */ | 5008 | /* GTK returns scaled sizes for the workareas. */ |
| 5011 | #if GTK_CHECK_VERSION (3, 22, 0) | 5009 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 5012 | scale = gdk_monitor_get_scale_factor (monitor); | 5010 | scale = gdk_monitor_get_scale_factor (monitor); |
| 5013 | #elif GTK_CHECK_VERSION (3, 10, 0) | 5011 | #elif defined HAVE_GTK3 |
| 5014 | scale = gdk_screen_get_monitor_scale_factor (gscreen, i); | 5012 | scale = gdk_screen_get_monitor_scale_factor (gscreen, i); |
| 5015 | #endif | 5013 | #endif |
| 5016 | rec.width *= scale; | 5014 | rec.width *= scale; |
| @@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 5031 | 5029 | ||
| 5032 | #if GTK_CHECK_VERSION (3, 22, 0) | 5030 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 5033 | dupstring (&mi->name, (gdk_monitor_get_model (monitor))); | 5031 | dupstring (&mi->name, (gdk_monitor_get_model (monitor))); |
| 5034 | #elif GTK_CHECK_VERSION (2, 14, 0) | 5032 | #else |
| 5035 | mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); | 5033 | mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); |
| 5036 | #endif | 5034 | #endif |
| 5037 | } | 5035 | } |
| @@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 5041 | primary_monitor, | 5039 | primary_monitor, |
| 5042 | monitor_frames, | 5040 | monitor_frames, |
| 5043 | source); | 5041 | source); |
| 5044 | #if GTK_CHECK_VERSION (2, 14, 0) | ||
| 5045 | free_monitors (monitors, n_monitors); | 5042 | free_monitors (monitors, n_monitors); |
| 5046 | #else | ||
| 5047 | xfree (monitors); | ||
| 5048 | #endif | ||
| 5049 | unblock_input (); | 5043 | unblock_input (); |
| 5050 | #else /* not USE_GTK */ | 5044 | #else /* not USE_GTK */ |
| 5051 | 5045 | ||
| @@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */) | |||
| 5380 | static void | 5374 | static void |
| 5381 | x_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) | 5375 | x_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) |
| 5382 | { | 5376 | { |
| 5383 | #if defined (USE_GTK) && GTK_CHECK_VERSION (2, 18, 0) | 5377 | #ifdef USE_GTK |
| 5384 | block_input (); | 5378 | block_input (); |
| 5385 | xg_frame_restack (f1, f2, above_flag); | 5379 | xg_frame_restack (f1, f2, above_flag); |
| 5386 | unblock_input (); | 5380 | unblock_input (); |
diff --git a/src/xterm.c b/src/xterm.c index def6915d62e..b9f4a1fc303 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -12514,7 +12514,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 12514 | 12514 | ||
| 12515 | dpy = DEFAULT_GDK_DISPLAY (); | 12515 | dpy = DEFAULT_GDK_DISPLAY (); |
| 12516 | 12516 | ||
| 12517 | #if ! GTK_CHECK_VERSION (2, 90, 0) | 12517 | #ifndef HAVE_GTK3 |
| 12518 | /* Load our own gtkrc if it exists. */ | 12518 | /* Load our own gtkrc if it exists. */ |
| 12519 | { | 12519 | { |
| 12520 | const char *file = "~/.emacs.d/gtkrc"; | 12520 | const char *file = "~/.emacs.d/gtkrc"; |
diff --git a/src/xterm.h b/src/xterm.h index c5ad38650c2..bb7631a3f44 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget; | |||
| 50 | #include <gdk/gdkx.h> | 50 | #include <gdk/gdkx.h> |
| 51 | #endif /* USE_GTK */ | 51 | #endif /* USE_GTK */ |
| 52 | 52 | ||
| 53 | /* True iff GTK's version is at least I.J.K. */ | 53 | #ifndef USE_GTK |
| 54 | #ifndef GTK_CHECK_VERSION | 54 | #define GTK_CHECK_VERSION(i, j, k) false |
| 55 | # ifdef USE_GTK | ||
| 56 | # define GTK_CHECK_VERSION(i, j, k) \ | ||
| 57 | ((i) \ | ||
| 58 | < GTK_MAJOR_VERSION + ((j) \ | ||
| 59 | < GTK_MINOR_VERSION + ((k) \ | ||
| 60 | <= GTK_MICRO_VERSION))) | ||
| 61 | # else | ||
| 62 | # define GTK_CHECK_VERSION(i, j, k) false | ||
| 63 | # endif | ||
| 64 | #endif | 55 | #endif |
| 65 | 56 | ||
| 66 | #ifdef USE_GTK | 57 | #ifdef USE_GTK |
| @@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget; | |||
| 76 | #endif | 67 | #endif |
| 77 | #endif /* USE_GTK */ | 68 | #endif /* USE_GTK */ |
| 78 | 69 | ||
| 79 | /* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */ | ||
| 80 | #if GTK_CHECK_VERSION (2, 14, 0) | ||
| 81 | #define USE_GTK_TOOLTIP | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifdef USE_CAIRO | 70 | #ifdef USE_CAIRO |
| 85 | #include <cairo-xlib.h> | 71 | #include <cairo-xlib.h> |
| 86 | #ifdef CAIRO_HAS_PDF_SURFACE | 72 | #ifdef CAIRO_HAS_PDF_SURFACE |
| @@ -594,12 +580,9 @@ struct x_output | |||
| 594 | GdkGeometry size_hints; | 580 | GdkGeometry size_hints; |
| 595 | long hint_flags; | 581 | long hint_flags; |
| 596 | 582 | ||
| 597 | #ifdef USE_GTK_TOOLTIP | ||
| 598 | GtkTooltip *ttip_widget; | 583 | GtkTooltip *ttip_widget; |
| 599 | GtkWidget *ttip_lbl; | 584 | GtkWidget *ttip_lbl; |
| 600 | GtkWindow *ttip_window; | 585 | GtkWindow *ttip_window; |
| 601 | #endif /* USE_GTK_TOOLTIP */ | ||
| 602 | |||
| 603 | #endif /* USE_GTK */ | 586 | #endif /* USE_GTK */ |
| 604 | 587 | ||
| 605 | /* If >=0, a bitmap index. The indicated bitmap is used for the | 588 | /* If >=0, a bitmap index. The indicated bitmap is used for the |
| @@ -793,18 +776,6 @@ extern void x_mark_frame_dirty (struct frame *f); | |||
| 793 | FRAME_X_WINDOW (f)) | 776 | FRAME_X_WINDOW (f)) |
| 794 | #else | 777 | #else |
| 795 | #ifdef USE_GTK | 778 | #ifdef USE_GTK |
| 796 | /* Functions not present in older Gtk+ */ | ||
| 797 | |||
| 798 | #ifndef HAVE_GTK_WIDGET_GET_WINDOW | ||
| 799 | #define gtk_widget_get_window(w) ((w)->window) | ||
| 800 | #endif | ||
| 801 | #ifndef HAVE_GTK_WIDGET_GET_MAPPED | ||
| 802 | #define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w)) | ||
| 803 | #endif | ||
| 804 | #ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE | ||
| 805 | #define gtk_adjustment_get_page_size(w) ((w)->page_size) | ||
| 806 | #define gtk_adjustment_get_upper(w) ((w)->upper) | ||
| 807 | #endif | ||
| 808 | 779 | ||
| 809 | #ifdef HAVE_GTK3 | 780 | #ifdef HAVE_GTK3 |
| 810 | #define DEFAULT_GDK_DISPLAY() \ | 781 | #define DEFAULT_GDK_DISPLAY() \ |