wayland: track configures through a bit field
This will let us add more stuff later. Also, it's a better spot
to put the bit field outside of the {current, pending} struct as
the bit field doesn't make any sense if it's part of the `current`
values.
This commit is contained in:
parent
d4b048735d
commit
322a80e76e
5
glfw/wl_platform.h
vendored
5
glfw/wl_platform.h
vendored
@ -127,6 +127,9 @@ typedef enum WaylandWindowState {
|
||||
|
||||
static const WaylandWindowState TOPLEVEL_STATE_DOCKED = TOPLEVEL_STATE_MAXIMIZED | TOPLEVEL_STATE_FULLSCREEN | TOPLEVEL_STATE_TILED_TOP | TOPLEVEL_STATE_TILED_LEFT | TOPLEVEL_STATE_TILED_RIGHT | TOPLEVEL_STATE_TILED_BOTTOM;
|
||||
|
||||
enum WaylandWindowPendingState {
|
||||
PENDING_STATE_TOPLEVEL = 1,
|
||||
};
|
||||
|
||||
// Wayland-specific per-window data
|
||||
//
|
||||
@ -217,10 +220,10 @@ typedef struct _GLFWwindowWayland
|
||||
unsigned int x, y;
|
||||
} axis_discrete_count;
|
||||
|
||||
uint32_t pending_state;
|
||||
struct {
|
||||
int width, height;
|
||||
uint32_t toplevel_states;
|
||||
bool set;
|
||||
} current, pending;
|
||||
} _GLFWwindowWayland;
|
||||
|
||||
|
||||
6
glfw/wl_window.c
vendored
6
glfw/wl_window.c
vendored
@ -479,7 +479,7 @@ xdgToplevelHandleConfigure(void* data,
|
||||
window->wl.pending.toplevel_states = new_states;
|
||||
window->wl.pending.width = width;
|
||||
window->wl.pending.height = height;
|
||||
window->wl.pending.set = true;
|
||||
window->wl.pending_state |= PENDING_STATE_TOPLEVEL;
|
||||
}
|
||||
|
||||
static void xdgToplevelHandleClose(void* data,
|
||||
@ -500,11 +500,10 @@ static void xdgSurfaceHandleConfigure(void* data,
|
||||
{
|
||||
_GLFWwindow* window = data;
|
||||
xdg_surface_ack_configure(surface, serial);
|
||||
if (window->wl.pending.set) {
|
||||
if (window->wl.pending_state & PENDING_STATE_TOPLEVEL) {
|
||||
uint32_t new_states = window->wl.pending.toplevel_states;
|
||||
int width = window->wl.pending.width;
|
||||
int height = window->wl.pending.height;
|
||||
window->wl.pending.set = false;
|
||||
|
||||
if (new_states != window->wl.current.toplevel_states ||
|
||||
width != window->wl.current.width ||
|
||||
@ -524,6 +523,7 @@ static void xdgSurfaceHandleConfigure(void* data,
|
||||
}
|
||||
}
|
||||
wl_surface_commit(window->wl.surface);
|
||||
window->wl.pending_state = 0;
|
||||
}
|
||||
|
||||
static const struct xdg_surface_listener xdgSurfaceListener = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user