comparison src/gui_beval.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 4cb334816bb1
children 067aeec2d1e7
comparison
equal deleted inserted replaced
14574:4ba20935ebe7 14575:f8cd07a1cbb5
942 if (beval->msg != NULL) 942 if (beval->msg != NULL)
943 { 943 {
944 GtkRequisition requisition; 944 GtkRequisition requisition;
945 int screen_w; 945 int screen_w;
946 int screen_h; 946 int screen_h;
947 int screen_x;
948 int screen_y;
947 int x; 949 int x;
948 int y; 950 int y;
949 int x_offset = EVAL_OFFSET_X; 951 int x_offset = EVAL_OFFSET_X;
950 int y_offset = EVAL_OFFSET_Y; 952 int y_offset = EVAL_OFFSET_Y;
951 PangoLayout *layout; 953 PangoLayout *layout;
954 GdkScreen *screen; 956 GdkScreen *screen;
955 957
956 screen = gtk_widget_get_screen(beval->target); 958 screen = gtk_widget_get_screen(beval->target);
957 gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); 959 gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
958 # endif 960 # endif
959 gui_gtk_get_screen_size_of_win(beval->balloonShell, 961 gui_gtk_get_screen_geom_of_win(beval->balloonShell,
960 &screen_w, &screen_h); 962 &screen_x, &screen_y, &screen_w, &screen_h);
961 # if !GTK_CHECK_VERSION(3,0,0) 963 # if !GTK_CHECK_VERSION(3,0,0)
962 gtk_widget_ensure_style(beval->balloonShell); 964 gtk_widget_ensure_style(beval->balloonShell);
963 gtk_widget_ensure_style(beval->balloonLabel); 965 gtk_widget_ensure_style(beval->balloonLabel);
964 # endif 966 # endif
965 967
996 # endif 998 # endif
997 x += beval->x; 999 x += beval->x;
998 y += beval->y; 1000 y += beval->y;
999 1001
1000 /* Get out of the way of the mouse pointer */ 1002 /* Get out of the way of the mouse pointer */
1001 if (x + x_offset + requisition.width > screen_w) 1003 if (x + x_offset + requisition.width > screen_x + screen_w)
1002 y_offset += 15; 1004 y_offset += 15;
1003 if (y + y_offset + requisition.height > screen_h) 1005 if (y + y_offset + requisition.height > screen_y + screen_h)
1004 y_offset = -requisition.height - EVAL_OFFSET_Y; 1006 y_offset = -requisition.height - EVAL_OFFSET_Y;
1005 1007
1006 /* Sanitize values */ 1008 /* Sanitize values */
1007 x = CLAMP(x + x_offset, 0, MAX(0, screen_w - requisition.width)); 1009 x = CLAMP(x + x_offset, 0,
1008 y = CLAMP(y + y_offset, 0, MAX(0, screen_h - requisition.height)); 1010 MAX(0, screen_x + screen_w - requisition.width));
1011 y = CLAMP(y + y_offset, 0,
1012 MAX(0, screen_y + screen_h - requisition.height));
1009 1013
1010 /* Show the balloon */ 1014 /* Show the balloon */
1011 # if GTK_CHECK_VERSION(3,0,0) 1015 # if GTK_CHECK_VERSION(3,0,0)
1012 gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); 1016 gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y);
1013 # else 1017 # else