diff options
| author | Po Lu | 2022-01-25 08:21:55 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-25 08:22:30 +0800 |
| commit | eb4edfa0c86c27d0f978bc2551ba4ebee9dda63f (patch) | |
| tree | 19c2bb236718975b0d049b1eb19a5a4ff2cd58fb | |
| parent | 667e212048a1443b6f72647176aec701d18474c9 (diff) | |
| download | emacs-eb4edfa0c86c27d0f978bc2551ba4ebee9dda63f.tar.gz emacs-eb4edfa0c86c27d0f978bc2551ba4ebee9dda63f.zip | |
Fix GTK native input on scaled displays
* src/xfns.c (xic_set_preeditarea): Scale preedit spot rectangle
before giving it to GTK.
| -rw-r--r-- | src/xfns.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/xfns.c b/src/xfns.c index 33d8d98e70b..bb1e431ff87 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2844,14 +2844,16 @@ xic_set_preeditarea (struct window *w, int x, int y) | |||
| 2844 | } | 2844 | } |
| 2845 | #ifdef USE_GTK | 2845 | #ifdef USE_GTK |
| 2846 | GdkRectangle rect; | 2846 | GdkRectangle rect; |
| 2847 | int scale = xg_get_scale (f); | ||
| 2848 | |||
| 2847 | rect.x = (WINDOW_TO_FRAME_PIXEL_X (w, x) | 2849 | rect.x = (WINDOW_TO_FRAME_PIXEL_X (w, x) |
| 2848 | + WINDOW_LEFT_FRINGE_WIDTH (w) | 2850 | + WINDOW_LEFT_FRINGE_WIDTH (w) |
| 2849 | + WINDOW_LEFT_MARGIN_WIDTH (w)); | 2851 | + WINDOW_LEFT_MARGIN_WIDTH (w)) / scale; |
| 2850 | rect.y = (WINDOW_TO_FRAME_PIXEL_Y (w, y) | 2852 | rect.y = (WINDOW_TO_FRAME_PIXEL_Y (w, y) |
| 2851 | + FRAME_TOOLBAR_HEIGHT (f) | 2853 | + FRAME_TOOLBAR_HEIGHT (f) |
| 2852 | + FRAME_MENUBAR_HEIGHT (f)); | 2854 | + FRAME_MENUBAR_HEIGHT (f)) / scale; |
| 2853 | rect.width = w->phys_cursor_width; | 2855 | rect.width = w->phys_cursor_width / scale; |
| 2854 | rect.height = w->phys_cursor_height; | 2856 | rect.height = w->phys_cursor_height / scale; |
| 2855 | 2857 | ||
| 2856 | gtk_im_context_set_cursor_location (FRAME_X_OUTPUT (f)->im_context, | 2858 | gtk_im_context_set_cursor_location (FRAME_X_OUTPUT (f)->im_context, |
| 2857 | &rect); | 2859 | &rect); |