wayland: quick fix for changing height

We use the surface size of a fullscreen layer to calculate screen size.
But when height is recomputed and given as a percentage, this definition
becomes self-referencing.

Do a quick fix by caching the monitor resolution.
This commit is contained in:
lbonn 2022-02-05 13:13:17 +01:00
parent 9efa6504c3
commit 396b13f5a8

View file

@ -80,16 +80,31 @@ static struct {
guint repaint_source;
/** Window fullscreen */
gboolean fullscreen;
int monitor_width;
int monitor_height;
} WlState = {
.flags = MENU_NORMAL,
.idle_timeout = 0,
.count = 0L,
.repaint_source = 0,
.fullscreen = FALSE,
.monitor_width = 0,
.monitor_height = 0,
};
static void wayland_rofi_view_get_current_monitor(int *width, int *height) {
display_get_surface_dimensions(width, height);
// TODO: handle changing monitor resolution
if (WlState.monitor_width == 0 && WlState.monitor_height == 0) {
display_get_surface_dimensions(&WlState.monitor_width, &WlState.monitor_height);
}
if (width) {
*width = WlState.monitor_width;
}
if (height) {
*height = WlState.monitor_height;
}
}
/**