Mercurial > vim
diff src/mbyte.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 | e4c553e9132b |
children | 82e7ce311065 |
line wrap: on
line diff
--- a/src/mbyte.c +++ b/src/mbyte.c @@ -4951,24 +4951,26 @@ im_add_to_input(char_u *str, int len) static void im_preedit_window_set_position(void) { - int x, y, w, h, sw, sh; + int x, y, width, height; + int screen_x, screen_y, screen_width, screen_height; if (preedit_window == NULL) return; - gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh); + gui_gtk_get_screen_geom_of_win(gui.drawarea, + &screen_x, &screen_y, &screen_width, &screen_height); #if GTK_CHECK_VERSION(3,0,0) gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y); #else gdk_window_get_origin(gui.drawarea->window, &x, &y); #endif - gtk_window_get_size(GTK_WINDOW(preedit_window), &w, &h); + gtk_window_get_size(GTK_WINDOW(preedit_window), &width, &height); x = x + FILL_X(gui.col); y = y + FILL_Y(gui.row); - if (x + w > sw) - x = sw - w; - if (y + h > sh) - y = sh - h; + if (x + width > screen_x + screen_width) + x = screen_x + screen_width - width; + if (y + height > screen_y + screen_height) + y = screen_y + screen_height - height; gtk_window_move(GTK_WINDOW(preedit_window), x, y); }