Mercurial > vim
comparison src/gui_gtk_x11.c @ 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 | cb8b9bf76082 |
children | 7334bf933510 |
comparison
equal
deleted
inserted
replaced
24169:e4b64b309fbf | 24170:74f869d4bd54 |
---|---|
4166 int *height) | 4166 int *height) |
4167 { | 4167 { |
4168 GdkRectangle geometry; | 4168 GdkRectangle geometry; |
4169 GdkWindow *win = gtk_widget_get_window(wid); | 4169 GdkWindow *win = gtk_widget_get_window(wid); |
4170 #if GTK_CHECK_VERSION(3,22,0) | 4170 #if GTK_CHECK_VERSION(3,22,0) |
4171 GdkDisplay *dpy = gtk_widget_get_display(wid); | 4171 GdkDisplay *dpy; |
4172 GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); | 4172 GdkMonitor *monitor; |
4173 | 4173 |
4174 if (wid != NULL && gtk_widget_get_realized(wid)) | |
4175 dpy = gtk_widget_get_display(wid); | |
4176 else | |
4177 dpy = gdk_display_get_default(); | |
4178 if (win != NULL) | |
4179 monitor = gdk_display_get_monitor_at_window(dpy, win); | |
4180 else | |
4181 monitor = gdk_display_get_monitor_at_point(dpy, point_x, point_y); | |
4174 gdk_monitor_get_geometry(monitor, &geometry); | 4182 gdk_monitor_get_geometry(monitor, &geometry); |
4175 #else | 4183 #else |
4176 GdkScreen* screen; | 4184 GdkScreen* screen; |
4177 int monitor; | 4185 int monitor; |
4178 | 4186 |
4179 if (wid != NULL && gtk_widget_has_screen(wid)) | 4187 if (wid != NULL && gtk_widget_has_screen(wid)) |
4180 screen = gtk_widget_get_screen(wid); | 4188 screen = gtk_widget_get_screen(wid); |
4181 else | 4189 else |
4182 screen = gdk_screen_get_default(); | 4190 screen = gdk_screen_get_default(); |
4183 if (win == NULL) | 4191 if (win != NULL) |
4192 monitor = gdk_screen_get_monitor_at_window(screen, win); | |
4193 else | |
4184 monitor = gdk_screen_get_monitor_at_point(screen, point_x, point_y); | 4194 monitor = gdk_screen_get_monitor_at_point(screen, point_x, point_y); |
4185 else | |
4186 monitor = gdk_screen_get_monitor_at_window(screen, win); | |
4187 gdk_screen_get_monitor_geometry(screen, monitor, &geometry); | 4195 gdk_screen_get_monitor_geometry(screen, monitor, &geometry); |
4188 #endif | 4196 #endif |
4189 *screen_x = geometry.x; | 4197 *screen_x = geometry.x; |
4190 *screen_y = geometry.y; | 4198 *screen_y = geometry.y; |
4191 *width = geometry.width; | 4199 *width = geometry.width; |