]> granicus.if.org Git - vim/commitdiff
patch 8.2.2626: GTK3: error when starting up and -geometry is given v8.2.2626
authorBram Moolenaar <Bram@vim.org>
Sat, 20 Mar 2021 11:36:46 +0000 (12:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 20 Mar 2021 11:36:46 +0000 (12:36 +0100)
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)

src/gui_gtk_x11.c
src/version.c

index 3fdff4d3f32ed5970d880dbb3179253cf3ccfe65..249b20877ac0999b137395957ddf6850de3fb34a 100644 (file)
@@ -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)
-       monitor = gdk_screen_get_monitor_at_point(screen, point_x, point_y);
-    else
+    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);
     gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
 #endif
     *screen_x = geometry.x;
index 36547d0e8f08bfbaa95e6574eff4f4b1f92c6f75..bd72953aa620c5824e2878fcc094290a61eda247 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2626,
 /**/
     2625,
 /**/