mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
wayland: Also emit size-changed when appropriate
We need to be a bit more careful when updating the screen size - the code that was there would not do the right thing if e.g. the width of one monitor was reduced.
This commit is contained in:
parent
0489fcffbe
commit
27e517a445
@ -852,6 +852,30 @@ _gdk_wayland_screen_init (GdkWaylandScreen *screen_wayland)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_screen_size (GdkWaylandScreen *screen_wayland)
|
||||||
|
{
|
||||||
|
gint width, height;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
width = height = 0;
|
||||||
|
for (i = 0; i < screen_wayland->monitors->len; i++)
|
||||||
|
{
|
||||||
|
GdkWaylandMonitor *monitor = screen_wayland->monitors->pdata[i];
|
||||||
|
|
||||||
|
width = MAX (width, monitor->geometry.x + monitor->geometry.width);
|
||||||
|
height = MAX (height, monitor->geometry.y + monitor->geometry.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen_wayland->width != width ||
|
||||||
|
screen_wayland->height != height)
|
||||||
|
{
|
||||||
|
screen_wayland->width = width;
|
||||||
|
screen_wayland->height = width;
|
||||||
|
g_signal_emit_by_name (screen_wayland, "size-changed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_handle_geometry(void *data,
|
output_handle_geometry(void *data,
|
||||||
struct wl_output *wl_output,
|
struct wl_output *wl_output,
|
||||||
@ -878,7 +902,10 @@ output_handle_geometry(void *data,
|
|||||||
display->init_ref_count--;
|
display->init_ref_count--;
|
||||||
|
|
||||||
if (monitor->geometry.width != 0)
|
if (monitor->geometry.width != 0)
|
||||||
|
{
|
||||||
g_signal_emit_by_name (monitor->screen, "monitors-changed");
|
g_signal_emit_by_name (monitor->screen, "monitors-changed");
|
||||||
|
update_screen_size (monitor->screen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -898,11 +925,7 @@ output_handle_mode(void *data,
|
|||||||
monitor->geometry.height = height;
|
monitor->geometry.height = height;
|
||||||
|
|
||||||
g_signal_emit_by_name (monitor->screen, "monitors-changed");
|
g_signal_emit_by_name (monitor->screen, "monitors-changed");
|
||||||
|
update_screen_size (monitor->screen);
|
||||||
monitor->screen->width =
|
|
||||||
MAX (monitor->screen->width, monitor->geometry.x + width);
|
|
||||||
monitor->screen->height =
|
|
||||||
MAX (monitor->screen->height, monitor->geometry.y + height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener =
|
static const struct wl_output_listener output_listener =
|
||||||
|
Loading…
Reference in New Issue
Block a user