Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -944,6 +944,8 @@ drawBalloon(BalloonEval *beval) GtkRequisition requisition; int screen_w; int screen_h; + int screen_x; + int screen_y; int x; int y; int x_offset = EVAL_OFFSET_X; @@ -956,8 +958,8 @@ drawBalloon(BalloonEval *beval) screen = gtk_widget_get_screen(beval->target); gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); # endif - gui_gtk_get_screen_size_of_win(beval->balloonShell, - &screen_w, &screen_h); + gui_gtk_get_screen_geom_of_win(beval->balloonShell, + &screen_x, &screen_y, &screen_w, &screen_h); # if !GTK_CHECK_VERSION(3,0,0) gtk_widget_ensure_style(beval->balloonShell); gtk_widget_ensure_style(beval->balloonLabel); @@ -998,14 +1000,16 @@ drawBalloon(BalloonEval *beval) y += beval->y; /* Get out of the way of the mouse pointer */ - if (x + x_offset + requisition.width > screen_w) + if (x + x_offset + requisition.width > screen_x + screen_w) y_offset += 15; - if (y + y_offset + requisition.height > screen_h) + if (y + y_offset + requisition.height > screen_y + screen_h) y_offset = -requisition.height - EVAL_OFFSET_Y; /* Sanitize values */ - x = CLAMP(x + x_offset, 0, MAX(0, screen_w - requisition.width)); - y = CLAMP(y + y_offset, 0, MAX(0, screen_h - requisition.height)); + x = CLAMP(x + x_offset, 0, + MAX(0, screen_x + screen_w - requisition.width)); + y = CLAMP(y + y_offset, 0, + MAX(0, screen_y + screen_h - requisition.height)); /* Show the balloon */ # if GTK_CHECK_VERSION(3,0,0)