Skip to content

Commit 04e564c

Browse files
vkarehraveit65
authored andcommitted
Correct resize popup position on HiDPI displays
1 parent 079c458 commit 04e564c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/core/window.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8073,8 +8073,11 @@ meta_window_refresh_resize_popup (MetaWindow *window)
80738073

80748074
if (window->display->grab_resize_popup == NULL)
80758075
{
8076-
if (window->size_hints.width_inc > 1 ||
8077-
window->size_hints.height_inc > 1)
8076+
gint scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
8077+
/* Display the resize popup only for windows that report an
8078+
* increment hint that's larger than the scale factor. */
8079+
if (window->size_hints.width_inc > scale ||
8080+
window->size_hints.height_inc > scale)
80788081
window->display->grab_resize_popup =
80798082
meta_ui_resize_popup_new (window->display->xdisplay,
80808083
window->screen->number);

src/ui/resizepopup.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ update_size_window (MetaResizePopup *popup)
106106
char *str;
107107
int x, y;
108108
int width, height;
109+
int scale;
109110

110111
g_return_if_fail (popup->size_window != NULL);
111112

113+
scale = gtk_widget_get_scale_factor (GTK_WIDGET (popup->size_window));
112114
/* Translators: This represents the size of a window. The first number is
113115
* the width of the window and the second is the height.
114116
*/
@@ -125,6 +127,12 @@ update_size_window (MetaResizePopup *popup)
125127
x = popup->rect.x + (popup->rect.width - width) / 2;
126128
y = popup->rect.y + (popup->rect.height - height) / 2;
127129

130+
if (scale)
131+
{
132+
x = x / scale;
133+
y = y / scale;
134+
}
135+
128136
if (gtk_widget_get_realized (popup->size_window))
129137
{
130138
/* using move_resize to avoid jumpiness */

0 commit comments

Comments
 (0)