summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-11-15 23:52:21 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-11-15 23:52:21 -0600
commit21ef004886be1092becba61abb71e9fd86b85c85 (patch)
tree5c7cef468e79af768aa920cd6465a62fce90878c
parentdae00caaddee6d14cb566ee750c976543788d5fe (diff)
listen to the output request_state event;
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2693
-rw-r--r--dwl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 386763a..d630d06 100644
--- a/dwl.c
+++ b/dwl.c
@@ -173,6 +173,7 @@ struct Monitor {
struct wlr_scene_output *scene_output;
struct wl_listener frame;
struct wl_listener destroy;
+ struct wl_listener request_state;
struct wlr_box m; /* monitor area, layout-relative */
struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface::link */
@@ -260,6 +261,7 @@ static void quit(const Arg *arg);
static void quitsignal(int signo);
static void rendermon(struct wl_listener *listener, void *data);
static void requeststartdrag(struct wl_listener *listener, void *data);
+static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact);
static void run(char *startup_cmd);
static Client *selclient(void);
@@ -865,6 +867,7 @@ createmon(struct wl_listener *listener, void *data)
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
+ LISTEN(&wlr_output->events.request_state, &m->request_state, requestmonstate);
wlr_output_enable(wlr_output, 1);
if (!wlr_output_commit(wlr_output))
@@ -1709,6 +1712,13 @@ requeststartdrag(struct wl_listener *listener, void *data)
}
void
+requestmonstate(struct wl_listener *listener, void *data)
+{
+ struct wlr_output_event_request_state *event = data;
+ wlr_output_commit_state(event->output, event->state);
+}
+
+void
resize(Client *c, struct wlr_box geo, int interact)
{
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w;