wayland: only recreate buffers on SetWH when Pending rolls around
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
7cdd2bcc79
commit
931cff0f6d
3 changed files with 28 additions and 14 deletions
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue