listen to the output request_state event;

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2693
This commit is contained in:
Leonardo Hernández Hernández 2022-11-15 23:52:21 -06:00
parent dae00caadd
commit 21ef004886
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

10
dwl.c
View File

@ -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))
@ -1708,6 +1711,13 @@ requeststartdrag(struct wl_listener *listener, void *data)
wlr_data_source_destroy(event->drag->source);
}
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)
{