* src/gtkutil.c (xg_get_scale): New function.
(xg_show_tooltip): Use it.
* src/xmenu.c (create_and_show_popup_menu): Put menus in the
right place.
*dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL;
}
+/* Scaling/HiDPI functions. */
+int
+xg_get_scale (struct frame *f)
+{
+ if (FRAME_VISIBLE_P (f) && FRAME_GTK_WIDGET (f))
+ return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
+ return 1;
+}
/* Close display DPY. */
if (x->ttip_window)
{
block_input ();
- gtk_window_move (x->ttip_window, root_x, root_y);
+ gtk_window_move (x->ttip_window, root_x / xg_get_scale (f),
+ root_y / xg_get_scale (f));
gtk_widget_show_all (GTK_WIDGET (x->ttip_window));
unblock_input ();
}
extern void xg_frame_set_char_size (struct frame *f, int width, int height);
extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
+extern int xg_get_scale (struct frame *f);
extern void xg_display_open (char *display_name, Display **dpy);
extern void xg_display_close (Display *dpy);
extern GdkCursor * xg_create_default_cursor (Display *dpy);
/* Child of win. */
&dummy_window);
+#ifdef HAVE_GTK3
+ /* Use window scaling factor to adjust position for hidpi screens. */
+ x /= xg_get_scale (f);
+ y /= xg_get_scale (f);
+#endif
unblock_input ();
popup_x_y.x = x;
popup_x_y.y = y;