don't handle additional configure events, minor behavior changes

This commit is contained in:
sewn 2024-10-21 20:04:44 +03:00
parent e1a4a23a51
commit e06823dc40
No known key found for this signature in database

18
mew.c
View file

@ -58,7 +58,7 @@ static size_t cursor;
static struct item *items = NULL; static struct item *items = NULL;
static struct item *matches, *matchend; static struct item *matches, *matchend;
static struct item *prev, *curr, *next, *sel; static struct item *prev, *curr, *next, *sel;
static int running = 1; static int running = 0;
static struct wl_display *display; static struct wl_display *display;
static struct wl_compositor *compositor; static struct wl_compositor *compositor;
@ -176,7 +176,7 @@ loadfonts(void)
die("no fonts could be loaded"); die("no fonts could be loaded");
lrpad = drw->font->height; lrpad = drw->font->height;
bh = drw->font->height + (2 * scale); bh = drw->font->height + 2;
lines = MAX(lines, 0); lines = MAX(lines, 0);
mh = (lines + 1) * bh; mh = (lines + 1) * bh;
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
@ -764,6 +764,9 @@ static void
layer_surface_handle_configure(void *data, struct zwlr_layer_surface_v1 *layer_surface, layer_surface_handle_configure(void *data, struct zwlr_layer_surface_v1 *layer_surface,
uint32_t serial, uint32_t width, uint32_t height) uint32_t serial, uint32_t width, uint32_t height)
{ {
if (mw / scale == width && mh / scale == height)
return;
mw = width * scale; mw = width * scale;
mh = height * scale; mh = height * scale;
inputw = mw / 3; /* input width: ~33% of output width */ inputw = mw / 3; /* input width: ~33% of output width */
@ -788,6 +791,12 @@ surface_handle_preferred_scale(void *data,
{ {
scale = factor; scale = factor;
loadfonts(); loadfonts();
/* FIXME:
* Use a callback to ensure the 'configure' event
* is sent before the draw, which changes the dimensions
* properly for the update in scale.
*/
zwlr_layer_surface_v1_set_size(layer_surface, 0, mh / scale); zwlr_layer_surface_v1_set_size(layer_surface, 0, mh / scale);
redraw(); redraw();
} }
@ -987,11 +996,10 @@ setup(void)
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, -1); zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, -1);
zwlr_layer_surface_v1_set_keyboard_interactivity(layer_surface, true); zwlr_layer_surface_v1_set_keyboard_interactivity(layer_surface, true);
zwlr_layer_surface_v1_add_listener(layer_surface, zwlr_layer_surface_v1_add_listener(layer_surface, &layer_surface_listener, NULL);
&layer_surface_listener, NULL);
wl_surface_commit(surface); wl_surface_commit(surface);
wl_display_roundtrip(display); running = 1;
} }
static void static void