wayland: only recreate buffers on SetWH when Pending rolls around
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-04-23 14:39:38 -07:00
commit 931cff0f6d
3 changed files with 28 additions and 14 deletions

View file

@ -507,6 +507,7 @@ struct _MwLLWayland {
MwPoint cur_mouse_pos; /* Currently known mouse position */
int resizing;
int setting_wh;
MwU32 mw, mh; /* Monitor width and height as advertised by wl_output.mode */

View file

@ -2075,19 +2075,9 @@ static void MwLLSetXYImpl(MwLL handle, int x, int y) {
MwLLDispatch(handle, draw, NULL);
}
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
WIDGET_CHECK(handle);
static void actually_set_wh(MwLL handle) {
region_invalidate(handle);
/* Prevent an integer underflow when the w/h is too low */
if((w < 2 || h < 2)) {
handle->wayland.ww = 2;
handle->wayland.wh = 2;
} else {
handle->wayland.ww = w;
handle->wayland.wh = h;
}
if(handle->wayland.type == MwLL_WAYLAND_TOPLEVEL && handle->wayland.configured) {
xdg_surface_set_window_geometry(handle->wayland.toplevel->xdg_surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
}
@ -2112,6 +2102,24 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) {
backbuffer_destroy(&handle->wayland);
backbuffer_setup(&handle->wayland);
MwLLDispatch(handle, draw, NULL);
}
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
WIDGET_CHECK(handle);
/* Prevent an integer underflow when the w/h is too low */
if((w < 2 || h < 2)) {
handle->wayland.ww = 2;
handle->wayland.wh = 2;
} else {
handle->wayland.ww = w;
handle->wayland.wh = h;
}
if(!handle->wayland.setting_wh) {
handle->wayland.setting_wh = 1;
}
handle->wayland.events_pending = 1;
}
@ -2309,6 +2317,11 @@ static int MwLLPendingImpl(MwLL handle) {
handle->wayland.resizing = 0;
if(handle->wayland.setting_wh) {
actually_set_wh(handle);
handle->wayland.setting_wh = 0;
}
#ifdef USE_DBUS
if(wl_call_tbl.has_dbus) {
if(handle->wayland.dark_theme_detection) {

View file

@ -410,8 +410,8 @@ static void redrawIfNeeded(MwWidget handle, int row) {
static int mwListBoxSetImpl(MwWidget handle, int row, int col, const char* text) {
MwListBox lb = handle->internal;
MwListBoxEntry entry;
char* t = text == NULL ? NULL : MwStringDuplicate(text);
int new = 0;
char* t = text == NULL ? NULL : MwStringDuplicate(text);
int new = 0;
if(row == -1) row = arrlen(lb->list);
entry.name = NULL;
@ -439,7 +439,7 @@ static int mwListBoxSetImpl(MwWidget handle, int row, int col, const char* text)
static void mwListBoxSetIconImpl(MwWidget handle, int index, MwLLPixmap icon) {
MwListBox lb = handle->internal;
MwListBoxEntry entry;
int new = 0;
int new = 0;
if(index == -1) index = arrlen(lb->list);
entry.name = NULL;