comparison src/gui_gtk_x11.c @ 14575:f8cd07a1cbb5 v8.1.0301

patch 8.1.0301: GTK: input method popup displayed on wrong screen. commit https://github.com/vim/vim/commit/3f6a16f022c437eccaeb683640b25a972cb1b376 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 19 22:58:45 2018 +0200 patch 8.1.0301: GTK: input method popup displayed on wrong screen. Problem: GTK: Input method popup displayed on wrong screen. Solution: Add the screen position offset. (Ken Takata, closes https://github.com/vim/vim/issues/3268)
author Christian Brabandt <cb@256bit.org>
date Sun, 19 Aug 2018 23:00:06 +0200
parents 2f6f886d9a87
children 82e7ce311065
comparison
equal deleted inserted replaced
14574:4ba20935ebe7 14575:f8cd07a1cbb5
5006 */ 5006 */
5007 gui_mch_update(); 5007 gui_mch_update();
5008 } 5008 }
5009 5009
5010 void 5010 void
5011 gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height) 5011 gui_gtk_get_screen_geom_of_win(
5012 { 5012 GtkWidget *wid,
5013 int *screen_x,
5014 int *screen_y,
5015 int *width,
5016 int *height)
5017 {
5018 GdkRectangle geometry;
5019 GdkWindow *win = gtk_widget_get_window(wid);
5013 #if GTK_CHECK_VERSION(3,22,0) 5020 #if GTK_CHECK_VERSION(3,22,0)
5014 GdkDisplay *dpy = gtk_widget_get_display(wid); 5021 GdkDisplay *dpy = gtk_widget_get_display(wid);
5015 GdkWindow *win = gtk_widget_get_window(wid);
5016 GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); 5022 GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
5017 GdkRectangle geometry;
5018 5023
5019 gdk_monitor_get_geometry(monitor, &geometry); 5024 gdk_monitor_get_geometry(monitor, &geometry);
5020 *width = geometry.width;
5021 *height = geometry.height;
5022 #else 5025 #else
5023 GdkScreen* screen; 5026 GdkScreen* screen;
5027 int monitor;
5024 5028
5025 if (wid != NULL && gtk_widget_has_screen(wid)) 5029 if (wid != NULL && gtk_widget_has_screen(wid))
5026 screen = gtk_widget_get_screen(wid); 5030 screen = gtk_widget_get_screen(wid);
5027 else 5031 else
5028 screen = gdk_screen_get_default(); 5032 screen = gdk_screen_get_default();
5029 *width = gdk_screen_get_width(screen); 5033 monitor = gdk_screen_get_monitor_at_window(screen, win);
5030 *height = gdk_screen_get_height(screen); 5034 gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
5031 #endif 5035 #endif
5036 *screen_x = geometry.x;
5037 *screen_y = geometry.y;
5038 *width = geometry.width;
5039 *height = geometry.height;
5032 } 5040 }
5033 5041
5034 /* 5042 /*
5035 * The screen size is used to make sure the initial window doesn't get bigger 5043 * The screen size is used to make sure the initial window doesn't get bigger
5036 * than the screen. This subtracts some room for menubar, toolbar and window 5044 * than the screen. This subtracts some room for menubar, toolbar and window
5037 * decorations. 5045 * decorations.
5038 */ 5046 */
5039 void 5047 void
5040 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) 5048 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
5041 { 5049 {
5042 gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h); 5050 int x, y;
5051
5052 gui_gtk_get_screen_geom_of_win(gui.mainwin, &x, &y, screen_w, screen_h);
5043 5053
5044 /* Subtract 'guiheadroom' from the height to allow some room for the 5054 /* Subtract 'guiheadroom' from the height to allow some room for the
5045 * window manager (task list and window title bar). */ 5055 * window manager (task list and window title bar). */
5046 *screen_h -= p_ghr; 5056 *screen_h -= p_ghr;
5047 5057