diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-20 12:36:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-20 12:36:46 +0100 |
commit | 240014321b0aa5d6eb00a70865fa9935fd888d60 (patch) | |
tree | bc2691e2125fa50dbc1bfdb17dd060063ed4f39d | |
parent | af125866db46405fdaf99ac4e43b630d196a4aa4 (diff) |
patch 8.2.2626: GTK3: error when starting up and -geometry is givenv8.2.2626
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)
-rw-r--r-- | src/gui_gtk_x11.c | 18 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 3fdff4d3f3..249b20877a 100644 --- 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) - 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; diff --git a/src/version.c b/src/version.c index 36547d0e8f..bd72953aa6 100644 --- 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, |