Commit 35b31e0b authored by Oblomov's avatar Oblomov

X11 mixed dpi: use computed window scale factor in gdkdisplay-x11

... instead of of using impl->window_scale directly.
parent 03ea666c
Pipeline #13073 passed with stage
in 10 minutes and 58 seconds
......@@ -628,6 +628,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkX11Screen *x11_screen = NULL;
GdkToplevelX11 *toplevel = NULL;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
gint window_scale = 1;
gboolean return_val;
/* Find the GdkWindow that this event relates to. If that's
......@@ -656,6 +657,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
x11_screen = GDK_X11_SCREEN (screen);
toplevel = _gdk_x11_window_get_toplevel (window);
window_impl = GDK_WINDOW_IMPL_X11 (window->impl);
window_scale = gdk_window_get_scale_factor (window);
g_object_ref (window);
}
......@@ -729,13 +731,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkRectangle expose_rect;
int x2, y2;
expose_rect.x = xevent->xexpose.x / window_impl->window_scale;
expose_rect.y = xevent->xexpose.y / window_impl->window_scale;
expose_rect.x = xevent->xexpose.x / window_scale;
expose_rect.y = xevent->xexpose.y / window_scale;
x2 = (xevent->xexpose.x + xevent->xexpose.width + window_impl->window_scale -1) / window_impl->window_scale;
x2 = (xevent->xexpose.x + xevent->xexpose.width + window_scale -1) / window_scale;
expose_rect.width = x2 - expose_rect.x;
y2 = (xevent->xexpose.y + xevent->xexpose.height + window_impl->window_scale -1) / window_impl->window_scale;
y2 = (xevent->xexpose.y + xevent->xexpose.height + window_scale -1) / window_scale;
expose_rect.height = y2 - expose_rect.y;
_gdk_x11_window_process_expose (window, xevent->xexpose.serial, &expose_rect);
......@@ -759,13 +761,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
break;
}
expose_rect.x = xevent->xgraphicsexpose.x / window_impl->window_scale;
expose_rect.y = xevent->xgraphicsexpose.y / window_impl->window_scale;
expose_rect.x = xevent->xgraphicsexpose.x / window_scale;
expose_rect.y = xevent->xgraphicsexpose.y / window_scale;
x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + window_impl->window_scale -1) / window_impl->window_scale;
x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + window_scale -1) / window_scale;
expose_rect.width = x2 - expose_rect.x;
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + window_impl->window_scale -1) / window_impl->window_scale;
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + window_scale -1) / window_scale;
expose_rect.height = y2 - expose_rect.y;
_gdk_x11_window_process_expose (window, xevent->xgraphicsexpose.serial, &expose_rect);
......@@ -954,8 +956,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
{
window_impl->unscaled_width = xevent->xconfigure.width;
window_impl->unscaled_height = xevent->xconfigure.height;
window->width = (xevent->xconfigure.width + window_impl->window_scale - 1) / window_impl->window_scale;
window->height = (xevent->xconfigure.height + window_impl->window_scale - 1) / window_impl->window_scale;
window->width = (xevent->xconfigure.width + window_scale - 1) / window_scale;
window->height = (xevent->xconfigure.height + window_scale - 1) / window_scale;
_gdk_window_update_size (window);
_gdk_x11_window_update_size (window_impl);
......@@ -980,8 +982,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
{
event->configure.type = GDK_CONFIGURE;
event->configure.window = window;
event->configure.width = (xevent->xconfigure.width + window_impl->window_scale - 1) / window_impl->window_scale;
event->configure.height = (xevent->xconfigure.height + window_impl->window_scale - 1) / window_impl->window_scale;
event->configure.width = (xevent->xconfigure.width + window_scale - 1) / window_scale;
event->configure.height = (xevent->xconfigure.height + window_scale - 1) / window_scale;
if (!xevent->xconfigure.send_event &&
!xevent->xconfigure.override_redirect &&
......@@ -999,15 +1001,15 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
&tx, &ty,
&child_window))
{
event->configure.x = tx / window_impl->window_scale;
event->configure.y = ty / window_impl->window_scale;
event->configure.x = tx / window_scale;
event->configure.y = ty / window_scale;
}
gdk_x11_display_error_trap_pop_ignored (display);
}
else
{
event->configure.x = xevent->xconfigure.x / window_impl->window_scale;
event->configure.y = xevent->xconfigure.y / window_impl->window_scale;
event->configure.x = xevent->xconfigure.x / window_scale;
event->configure.y = xevent->xconfigure.y / window_scale;
}
if (!is_substructure)
{
......@@ -1211,11 +1213,11 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkRectangle rect;
int x2, y2;
rect.x = window->x + damage_event->area.x / window_impl->window_scale;
rect.y = window->y + damage_event->area.y / window_impl->window_scale;
rect.x = window->x + damage_event->area.x / window_scale;
rect.y = window->y + damage_event->area.y / window_scale;
x2 = (rect.x * window_impl->window_scale + damage_event->area.width + window_impl->window_scale -1) / window_impl->window_scale;
y2 = (rect.y * window_impl->window_scale + damage_event->area.height + window_impl->window_scale -1) / window_impl->window_scale;
x2 = (rect.x * window_scale + damage_event->area.width + window_scale -1) / window_scale;
y2 = (rect.y * window_scale + damage_event->area.height + window_scale -1) / window_scale;
rect.width = x2 - rect.x;
rect.height = y2 - rect.y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment