[client] wayland: handle output scale changes

If the scale factor of an wl_output changes while the client is running,
the maximum scale factor is not updated. This may result in incorrect
scaling.

Therefore, when the scale factor is changed, we should generate a
resize event.
This commit is contained in:
Quantum
2021-02-22 02:19:03 -05:00
committed by Geoffrey McRae
parent 0089c1252f
commit 389d8824e2
4 changed files with 6 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ static const struct xdg_wm_base_listener xdgWmBaseListener = {
// Surface-handling listeners.
static void surfaceUpdateScale(void)
void waylandWindowUpdateScale(void)
{
int32_t maxScale = 0;
struct SurfaceOutput * node;
@@ -65,7 +65,7 @@ static void wlSurfaceEnterHandler(void * data, struct wl_surface * surface, stru
struct SurfaceOutput * node = malloc(sizeof(struct SurfaceOutput));
node->output = output;
wl_list_insert(&wlWm.surfaceOutputs, &node->link);
surfaceUpdateScale();
waylandWindowUpdateScale();
}
static void wlSurfaceLeaveHandler(void * data, struct wl_surface * surface, struct wl_output * output)
@@ -77,7 +77,7 @@ static void wlSurfaceLeaveHandler(void * data, struct wl_surface * surface, stru
wl_list_remove(&node->link);
break;
}
surfaceUpdateScale();
waylandWindowUpdateScale();
}
static const struct wl_surface_listener wlSurfaceListener = {
@@ -158,7 +158,6 @@ bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool
return false;
}
wl_list_init(&wlWm.surfaceOutputs);
wl_surface_add_listener(wlWm.surface, &wlSurfaceListener, NULL);
wlWm.xdgSurface = xdg_wm_base_get_xdg_surface(wlWm.xdgWmBase, wlWm.surface);