changeset 24170:74f869d4bd54 v8.2.2626

patch 8.2.2626: GTK3: error when starting up and -geometry is given Commit: https://github.com/vim/vim/commit/240014321b0aa5d6eb00a70865fa9935fd888d60 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 20 12:36:46 2021 +0100 patch 8.2.2626: GTK3: error when starting up and -geometry is given Problem: GTK3: error when starting up and -geometry is given. (Dominique Pell?) Solution: Use another function to get the monitor if the window has not been created yet. (closes #7978)
author Bram Moolenaar <Bram@vim.org>
date Sat, 20 Mar 2021 12:45:03 +0100
parents e4b64b309fbf
children 66480abe9e5a
files src/gui_gtk_x11.c src/version.c
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -4168,9 +4168,17 @@ gui_gtk_get_screen_geom_of_win(
     GdkRectangle geometry;
     GdkWindow *win = gtk_widget_get_window(wid);
 #if GTK_CHECK_VERSION(3,22,0)
-    GdkDisplay *dpy = gtk_widget_get_display(wid);
-    GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
-
+    GdkDisplay *dpy;
+    GdkMonitor *monitor;
+
+    if (wid != NULL && gtk_widget_get_realized(wid))
+	dpy = gtk_widget_get_display(wid);
+    else
+	dpy = gdk_display_get_default();
+    if (win != NULL)
+	monitor = gdk_display_get_monitor_at_window(dpy, win);
+    else
+	monitor = gdk_display_get_monitor_at_point(dpy, point_x, point_y);
     gdk_monitor_get_geometry(monitor, &geometry);
 #else
     GdkScreen* screen;
@@ -4180,10 +4188,10 @@ gui_gtk_get_screen_geom_of_win(
 	screen = gtk_widget_get_screen(wid);
     else
 	screen = gdk_screen_get_default();
-    if (win == NULL)
+    if (win != NULL)
+	monitor = gdk_screen_get_monitor_at_window(screen, win);
+    else
 	monitor = gdk_screen_get_monitor_at_point(screen, point_x, point_y);
-    else
-	monitor = gdk_screen_get_monitor_at_window(screen, win);
     gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
 #endif
     *screen_x = geometry.x;
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2626,
+/**/
     2625,
 /**/
     2624,