aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c5
-rw-r--r--src/xmenu.c17
2 files changed, 19 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 9501cce20b3..76dd5711960 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3226,7 +3226,6 @@ buffer stay intact. */)
3226 /* Since we didn’t define EARLY_ABORT, we should never abort 3226 /* Since we didn’t define EARLY_ABORT, we should never abort
3227 early. */ 3227 early. */
3228 eassert (! early_abort); 3228 eassert (! early_abort);
3229 SAFE_FREE ();
3230 3229
3231 Fundo_boundary (); 3230 Fundo_boundary ();
3232 ptrdiff_t count = SPECPDL_INDEX (); 3231 ptrdiff_t count = SPECPDL_INDEX ();
@@ -3272,8 +3271,10 @@ buffer stay intact. */)
3272 --i; 3271 --i;
3273 --j; 3272 --j;
3274 } 3273 }
3274 unbind_to (count, Qnil);
3275 SAFE_FREE ();
3275 3276
3276 return unbind_to (count, Qnil); 3277 return Qnil;
3277} 3278}
3278 3279
3279static void 3280static void
diff --git a/src/xmenu.c b/src/xmenu.c
index 22995d8c7e8..6477d5b0aca 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1158,11 +1158,17 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer
1158 GtkRequisition req; 1158 GtkRequisition req;
1159 int max_x = -1; 1159 int max_x = -1;
1160 int max_y = -1; 1160 int max_y = -1;
1161#ifdef HAVE_GTK3
1162 int scale;
1163#endif
1161 1164
1162 Lisp_Object frame, workarea; 1165 Lisp_Object frame, workarea;
1163 1166
1164 XSETFRAME (frame, data->f); 1167 XSETFRAME (frame, data->f);
1165 1168
1169#ifdef HAVE_GTK3
1170 scale = xg_get_scale (data->f);
1171#endif
1166 /* TODO: Get the monitor workarea directly without calculating other 1172 /* TODO: Get the monitor workarea directly without calculating other
1167 items in x-display-monitor-attributes-list. */ 1173 items in x-display-monitor-attributes-list. */
1168 workarea = call3 (Qframe_monitor_workarea, 1174 workarea = call3 (Qframe_monitor_workarea,
@@ -1188,11 +1194,20 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer
1188 max_y = x_display_pixel_height (dpyinfo); 1194 max_y = x_display_pixel_height (dpyinfo);
1189 } 1195 }
1190 1196
1197 /* frame-monitor-workarea and {x,y}_display_pixel_width/height all
1198 return device pixels, but GTK wants scaled pixels. The positions
1199 passed in via data were already scaled for us. */
1200#ifdef HAVE_GTK3
1201 max_x /= scale;
1202 max_y /= scale;
1203#endif
1191 *x = data->x; 1204 *x = data->x;
1192 *y = data->y; 1205 *y = data->y;
1193 1206
1194 /* Check if there is room for the menu. If not, adjust x/y so that 1207 /* Check if there is room for the menu. If not, adjust x/y so that
1195 the menu is fully visible. */ 1208 the menu is fully visible. gtk_widget_get_preferred_size returns
1209 scaled pixels, so there is no need to apply the scaling
1210 factor. */
1196 gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req); 1211 gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req);
1197 if (data->x + req.width > max_x) 1212 if (data->x + req.width > max_x)
1198 *x -= data->x + req.width - max_x; 1213 *x -= data->x + req.width - max_x;