]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix GTK native input on scaled displays
authorPo Lu <luangruo@yahoo.com>
Tue, 25 Jan 2022 00:21:55 +0000 (08:21 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 25 Jan 2022 00:22:30 +0000 (08:22 +0800)
* src/xfns.c (xic_set_preeditarea): Scale preedit spot rectangle
before giving it to GTK.

src/xfns.c

index 33d8d98e70b9972c4b4c603a3ec5abe535a3fb60..bb1e431ff87c53ec31fb915baed4be753c855c21 100644 (file)
@@ -2844,14 +2844,16 @@ xic_set_preeditarea (struct window *w, int x, int y)
     }
 #ifdef USE_GTK
   GdkRectangle rect;
+  int scale = xg_get_scale (f);
+
   rect.x = (WINDOW_TO_FRAME_PIXEL_X (w, x)
            + WINDOW_LEFT_FRINGE_WIDTH (w)
-           + WINDOW_LEFT_MARGIN_WIDTH (w));
+           + WINDOW_LEFT_MARGIN_WIDTH (w)) / scale;
   rect.y = (WINDOW_TO_FRAME_PIXEL_Y (w, y)
            + FRAME_TOOLBAR_HEIGHT (f)
-           + FRAME_MENUBAR_HEIGHT (f));
-  rect.width = w->phys_cursor_width;
-  rect.height = w->phys_cursor_height;
+           + FRAME_MENUBAR_HEIGHT (f)) / scale;
+  rect.width = w->phys_cursor_width / scale;
+  rect.height = w->phys_cursor_height / scale;
 
   gtk_im_context_set_cursor_location (FRAME_X_OUTPUT (f)->im_context,
                                      &rect);