diff options
Diffstat (limited to 'src/platform/x11/window.c')
| -rw-r--r-- | src/platform/x11/window.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/platform/x11/window.c b/src/platform/x11/window.c index 347b4c2..3bab6e2 100644 --- a/src/platform/x11/window.c +++ b/src/platform/x11/window.c @@ -58,7 +58,6 @@ struct x11_surface { struct yasl_frame frame; struct yasl_damage_list damage; struct yasl_frame_clock clock; - uint32_t state; bool want_draw, drawing, presented, destroyed; struct x11_surface *parent; bool is_popup; @@ -700,7 +699,7 @@ static struct yasl_surface *create_toplevel(struct yasl_display *base, if (spec->fullscreen) { XChangeProperty(d->native, s->window, d->net_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&d->fullscreen, 1); - s->state |= YASL_STATE_FULLSCREEN; + s->base.state |= YASL_STATE_FULLSCREEN; } XMapWindow(d->native, s->window); XFlush(d->native); @@ -893,7 +892,7 @@ static void update_state(struct x11_surface *s) int format; unsigned long count, left; unsigned char *data = NULL; - uint32_t state = s->state & YASL_STATE_ACTIVATED; + uint32_t state = s->base.state & ~(YASL_STATE_FULLSCREEN | YASL_STATE_MAXIMIZED); if (XGetWindowProperty(d->native, s->window, d->net_state, 0, 64, False, XA_ATOM, &actual, &format, &count, &left, &data) == Success && format == 32) { Atom *atoms = (Atom *)data; @@ -906,8 +905,8 @@ static void update_state(struct x11_surface *s) if (h && v) state |= YASL_STATE_MAXIMIZED; } if (data) XFree(data); - if (state == s->state) return; - s->state = state; + if (state == s->base.state) return; + s->base.state = state; if (s->cbs && s->cbs->state) s->cbs->state(&s->base, state, s->ud); } @@ -1335,11 +1334,11 @@ static void dispatch(struct yasl_display *base) case FocusIn: case FocusOut: { bool focused = event.type == FocusIn; if (s->ic) { if (focused) XSetICFocus(s->ic); else XUnsetICFocus(s->ic); } - if (focused) s->state |= YASL_STATE_ACTIVATED; - else s->state &= ~YASL_STATE_ACTIVATED; + if (focused) s->base.state |= YASL_STATE_ACTIVATED; + else s->base.state &= ~YASL_STATE_ACTIVATED; push(s, (struct yasl_input_event){ .kind = YASL_INPUT_FOCUS, .focus.focused = focused}, NULL, 0); - if (s->cbs && s->cbs->state) s->cbs->state(&s->base, s->state, s->ud); + if (s->cbs && s->cbs->state) s->cbs->state(&s->base, s->base.state, s->ud); break; } case PropertyNotify: @@ -1746,7 +1745,6 @@ static struct yasl_geometry geometry(const struct yasl_surface *s) { return (struct yasl_geometry){((const struct x11_surface *)s)->size, YASL_SCALE_UNIT}; } -static uint32_t state(const struct yasl_surface *s) { return ((const struct x11_surface *)s)->state; } static int mods(const struct yasl_display *d) { return (int)((const struct x11_display *)d)->mods; } static void *native_display(struct yasl_display *d) { return ((struct x11_display *)d)->native; } static void *native_surface(struct yasl_surface *s) { return (void *)(uintptr_t)((struct x11_surface *)s)->window; } @@ -2042,7 +2040,6 @@ const struct yasl_backend_ops yasl_x11_backend = { .surface_present = present, .surface_input_poll = input_poll, .surface_geometry = geometry, - .surface_state = state, .surface_timing = timing, .surface_frame_time_ns = frame_time, .surface_set_cursor = cursor, |
