Render menu after surface enter event

This fixes an issue where the first visible frame is blurry on
fractional scale displays.
This commit is contained in:
adnano 2025-03-01 07:04:00 -05:00
parent eec775fad7
commit fc69aa6e2b
4 changed files with 38 additions and 23 deletions

View file

@ -3,7 +3,6 @@
#include <errno.h>
#include <poll.h>
#include <stdbool.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -18,6 +17,7 @@
#include "menu.h"
#include "pool-buffer.h"
#include "render.h"
#include "wayland.h"
#include "xdg-activation-v1-client-protocol.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
@ -208,6 +208,7 @@ static void noop() {
static void surface_enter(void *data, struct wl_surface *surface, struct wl_output *wl_output) {
struct wl_context *context = data;
context->output = wl_output_get_user_data(wl_output);
menu_invalidate(context->menu);
}
static const struct wl_surface_listener surface_listener = {
@ -492,6 +493,11 @@ int menu_run(struct menu *menu) {
if (fds[1].revents & POLLIN) {
keyboard_repeat(context->keyboard);
}
// Render the menu if necessary
if (!menu->rendered) {
render_menu(menu);
}
}
context_destroy(context);