diff options
author | Stivvo <stivvo01@gmail.com> | 2020-09-04 19:20:07 +0200 |
---|---|---|
committer | Guido Cella <guido@guidocella.xyz> | 2020-12-19 18:05:51 +0100 |
commit | 64113a682f64065d6cc5df186cbecdc28565152d (patch) | |
tree | 9dc32ca8febba071b8e3653f3cee2c75df1df6ca | |
parent | 573535c89c5bd470d2e820851a0b5ef54395b4dc (diff) |
Fullscreen xwayland
-rw-r--r-- | dwl.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -116,6 +116,7 @@ typedef struct { int prevy; int prevwidth; int prevheight; + bool isfullscreen; } Client; typedef struct { @@ -344,6 +345,7 @@ static struct wl_listener request_set_sel = {.notify = setsel}; static void activatex11(struct wl_listener *listener, void *data); static void configurex11(struct wl_listener *listener, void *data); static void createnotifyx11(struct wl_listener *listener, void *data); +static void fullscreenotifyx11(struct wl_listener *listener, void *data); static Atom getatom(xcb_connection_t *xc, const char *name); static void renderindependents(struct wlr_output *output, struct timespec *now); static void updatewindowtype(Client *c); @@ -916,8 +918,8 @@ createnotify(struct wl_listener *listener, void *data) c->destroy.notify = destroynotify; wl_signal_add(&xdg_surface->events.destroy, &c->destroy); - wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen); c->fullscreen.notify = fullscreenotify; + wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen); } void @@ -2455,6 +2457,34 @@ createnotifyx11(struct wl_listener *listener, void *data) wl_signal_add(&xwayland_surface->events.request_configure, &c->configure); c->destroy.notify = destroynotify; wl_signal_add(&xwayland_surface->events.destroy, &c->destroy); + + c->fullscreen.notify = fullscreenotifyx11; + wl_signal_add(&xwayland_surface->events.request_fullscreen, &c->fullscreen); + c->isfullscreen = false; +} + +void +fullscreenotifyx11(struct wl_listener *listener, void *data) { + FILE *xway = fopen("/tmp/dwl/xway", "a"); + Client *c; + c = wl_container_of(listener, c, fullscreen); + c->isfullscreen = !c->isfullscreen; + wlr_xwayland_surface_set_fullscreen( + c->surface.xwayland, c->isfullscreen); + c->bw = ((int)(!c->isfullscreen)) * borderpx; + + fprintf(xway, "fullscreen: %d\n", c->surface.xwayland->fullscreen); + fclose(xway); + + if (c->isfullscreen) { /* fullscreen off */ + c->prevx = c->geom.x; + c->prevy = c->geom.y; + c->prevheight = c->geom.height; + c->prevwidth = c->geom.width; + resize(c, c->mon->w.x, c->mon->w.y, c->mon->w.width, c->mon->w.height, 0); + } else { /* fullscreen on */ + resize(c, c->prevx, c->prevy, c->prevwidth, c->prevheight, 1); + } } Atom |