# HG changeset patch # User Bram Moolenaar # Date 1616240703 -3600 # Node ID 74f869d4bd5443ff61c9b7aa6f9fa0dded62ffda # Parent e4b64b309fbfa6b8559867a508b8a3f57f2db22a patch 8.2.2626: GTK3: error when starting up and -geometry is given Commit: https://github.com/vim/vim/commit/240014321b0aa5d6eb00a70865fa9935fd888d60 Author: Bram Moolenaar 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) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- 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; diff --git a/src/version.c b/src/version.c --- 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,