GtkRequisition req;
int max_x = -1;
int max_y = -1;
+#ifdef HAVE_GTK3
+ int scale;
+#endif
Lisp_Object frame, workarea;
XSETFRAME (frame, data->f);
+#ifdef HAVE_GTK3
+ scale = xg_get_scale (data->f);
+#endif
/* TODO: Get the monitor workarea directly without calculating other
items in x-display-monitor-attributes-list. */
workarea = call3 (Qframe_monitor_workarea,
max_y = x_display_pixel_height (dpyinfo);
}
+ /* frame-monitor-workarea and {x,y}_display_pixel_width/height all
+ return device pixels, but GTK wants scaled pixels. The positions
+ passed in via data were already scaled for us. */
+#ifdef HAVE_GTK3
+ max_x /= scale;
+ max_y /= scale;
+#endif
*x = data->x;
*y = data->y;
/* Check if there is room for the menu. If not, adjust x/y so that
- the menu is fully visible. */
+ the menu is fully visible. gtk_widget_get_preferred_size returns
+ scaled pixels, so there is no need to apply the scaling
+ factor. */
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req);
if (data->x + req.width > max_x)
*x -= data->x + req.width - max_x;