aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfns.c
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-07 19:02:03 -0600
committerAlexander Gramiak2019-04-14 19:15:45 -0600
commitfc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (patch)
treea872db9e55d150d03c7378b599d860214cab28b5 /src/xfns.c
parent5c2f94a182a1154766154040eb5b4b39275fd3b6 (diff)
downloademacs-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.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c36
1 files changed, 15 insertions, 21 deletions
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
4500static bool 4500static bool
4501x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) 4501x_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). */)
5380static void 5374static void
5381x_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) 5375x_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 ();