Skip to content

Commit

Permalink
Correct resize popup position on HiDPI displays
Browse files Browse the repository at this point in the history
  • Loading branch information
vkareh authored and raveit65 committed Apr 29, 2018
1 parent 45d8f75 commit 8074c01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/window.c
Expand Up @@ -8060,8 +8060,11 @@ meta_window_refresh_resize_popup (MetaWindow *window)

if (window->display->grab_resize_popup == NULL)
{
if (window->size_hints.width_inc > 1 ||
window->size_hints.height_inc > 1)
gint scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
/* Display the resize popup only for windows that report an
* increment hint that's larger than the scale factor. */
if (window->size_hints.width_inc > scale ||
window->size_hints.height_inc > scale)
window->display->grab_resize_popup =
meta_ui_resize_popup_new (window->display->xdisplay,
window->screen->number);
Expand Down
8 changes: 8 additions & 0 deletions src/ui/resizepopup.c
Expand Up @@ -106,9 +106,11 @@ update_size_window (MetaResizePopup *popup)
char *str;
int x, y;
int width, height;
int scale;

g_return_if_fail (popup->size_window != NULL);

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

if (scale)
{
x = x / scale;
y = y / scale;
}

if (gtk_widget_get_realized (popup->size_window))
{
/* using move_resize to avoid jumpiness */
Expand Down

0 comments on commit 8074c01

Please sign in to comment.