From d4e08c07629b4534e45b292614899a6b9bb876bd Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Mon, 23 Aug 2021 18:59:31 -0500 Subject: [PATCH 1/9] update deprecated xkb function name --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index b898537..2c1634b 100644 --- a/dwl.c +++ b/dwl.c @@ -793,7 +793,7 @@ createkeyboard(struct wlr_input_device *device) /* Prepare an XKB keymap and assign it to the keyboard. */ context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - keymap = xkb_map_new_from_names(context, &xkb_rules, + keymap = xkb_keymap_new_from_names(context, &xkb_rules, XKB_KEYMAP_COMPILE_NO_FLAGS); wlr_keyboard_set_keymap(device->keyboard, keymap); From 1e89aa72a354c0ef2240cac1a8b28b0b5c4b701a Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Tue, 14 Sep 2021 18:59:51 -0400 Subject: [PATCH 2/9] damage after destroy layersurface --- dwl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 8a31136..1e19648 100644 --- a/dwl.c +++ b/dwl.c @@ -1024,8 +1024,10 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data) wl_list_remove(&layersurface->surface_commit.link); if (layersurface->layer_surface->output) { Monitor *m = layersurface->layer_surface->output->data; - if (m) + if (m) { arrangelayers(m); + wlr_output_damage_add_whole(m->damage); + } layersurface->layer_surface->output = NULL; } free(layersurface); From 4a88a7025e9d68a1c997659f0208053464ac0510 Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Tue, 14 Sep 2021 19:44:15 -0400 Subject: [PATCH 3/9] handle unmanaged xwayland mapping --- dwl.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 1e19648..4c9cba5 100644 --- a/dwl.c +++ b/dwl.c @@ -383,7 +383,9 @@ 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); void commitnotifyx11(struct wl_listener *listener, void *data); +static void damageallmons(); static Atom getatom(xcb_connection_t *xc, const char *name); +static void mapnotify_unmanaged(struct wl_listener *listener, void *data); static void renderindependents(struct wlr_output *output, struct timespec *now); static void xwaylandready(struct wl_listener *listener, void *data); static Client *xytoindependent(double x, double y); @@ -2584,6 +2586,7 @@ createnotifyx11(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xwayland_surface = data; Client *c; + wlr_xwayland_surface_ping(xwayland_surface); wl_list_for_each(c, &clients, link) if (c->isfullscreen && VISIBLEON(c, c->mon)) setfullscreen(c, 0); @@ -2596,7 +2599,10 @@ createnotifyx11(struct wl_listener *listener, void *data) c->isfullscreen = 0; /* Listen to the various events it can emit */ - LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); + if (c->type == X11Managed) + LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); + else + LISTEN(&xwayland_surface->events.map, &c->map, mapnotify_unmanaged); LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify); LISTEN(&xwayland_surface->events.request_activate, &c->activate, activatex11); @@ -2614,7 +2620,20 @@ commitnotifyx11(struct wl_listener *listener, void *data) Client *c = wl_container_of(listener, c, commit); // Damage the whole screen - wlr_output_damage_add_whole(c->mon->damage); + if (c->type == X11Managed) + wlr_output_damage_add_whole(c->mon->damage); + else + damageallmons(); +} + +void +damageallmons() +{ + Monitor *m; + + wl_list_for_each(m, &mons, link) + if (m && m->wlr_output && m->damage) + wlr_output_damage_add_whole(m->damage); } Atom @@ -2630,6 +2649,19 @@ getatom(xcb_connection_t *xc, const char *name) return atom; } +void +mapnotify_unmanaged(struct wl_listener *listener, void *data) +{ + Client *c = wl_container_of(listener, c, map); + struct wlr_xwayland_surface *xwayland_surface = c->surface.xwayland; + + wl_list_insert(&independents, &c->link); + LISTEN(&xwayland_surface->surface->events.commit, &c->commit, commitnotifyx11); + client_get_geometry(c, &c->geom); + damageallmons(); +} + + void renderindependents(struct wlr_output *output, struct timespec *now) { From c0e646d20bb549d9bc750b77b523a2e33d6d88b0 Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Wed, 15 Sep 2021 16:42:34 -0400 Subject: [PATCH 4/9] removed unnecessary statements --- dwl.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/dwl.c b/dwl.c index 4c9cba5..3fe8832 100644 --- a/dwl.c +++ b/dwl.c @@ -1357,12 +1357,6 @@ mapnotify(struct wl_listener *listener, void *data) /* Called when the surface is mapped, or ready to display on-screen. */ Client *c = wl_container_of(listener, c, map); - if (client_is_unmanaged(c)) { - /* Insert this independent into independents lists. */ - wl_list_insert(&independents, &c->link); - return; - } - /* Insert this client into client lists. */ wl_list_insert(&clients, &c->link); wl_list_insert(&fstack, &c->flink); @@ -2586,7 +2580,6 @@ createnotifyx11(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xwayland_surface = data; Client *c; - wlr_xwayland_surface_ping(xwayland_surface); wl_list_for_each(c, &clients, link) if (c->isfullscreen && VISIBLEON(c, c->mon)) setfullscreen(c, 0); @@ -2653,11 +2646,8 @@ void mapnotify_unmanaged(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, map); - struct wlr_xwayland_surface *xwayland_surface = c->surface.xwayland; - wl_list_insert(&independents, &c->link); - LISTEN(&xwayland_surface->surface->events.commit, &c->commit, commitnotifyx11); - client_get_geometry(c, &c->geom); + LISTEN(&c->surface.xwayland->surface->events.commit, &c->commit, commitnotifyx11); damageallmons(); } From 90ed84be14eac109ec5952ee88cc16a7b9fec824 Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Wed, 15 Sep 2021 18:09:49 -0400 Subject: [PATCH 5/9] remove listeners --- dwl.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/dwl.c b/dwl.c index 3fe8832..d005906 100644 --- a/dwl.c +++ b/dwl.c @@ -1048,14 +1048,22 @@ destroynotify(struct wl_listener *listener, void *data) wl_list_remove(&c->map.link); wl_list_remove(&c->unmap.link); wl_list_remove(&c->destroy.link); + if (c->type && c->type != XDGShell) { +#ifdef XWAYLAND + if (c->type == X11Managed) { + wl_list_remove(&c->activate.link); + wl_list_remove(&c->configure.link); + } else { + wl_list_remove(&c->configure.link); + free(c); + return; + } +#endif + } else { + wl_list_remove(&c->commit.link); + } wl_list_remove(&c->set_title.link); wl_list_remove(&c->fullscreen.link); -#ifdef XWAYLAND - if (c->type == X11Managed) - wl_list_remove(&c->activate.link); - else if (c->type == XDGShell) -#endif - wl_list_remove(&c->commit.link); free(c); } @@ -2592,19 +2600,21 @@ createnotifyx11(struct wl_listener *listener, void *data) c->isfullscreen = 0; /* Listen to the various events it can emit */ - if (c->type == X11Managed) + if (c->type == X11Managed) { LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); - else + LISTEN(&xwayland_surface->events.request_activate, &c->activate, + activatex11); + LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle); + LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen, + fullscreennotify); + } + else { LISTEN(&xwayland_surface->events.map, &c->map, mapnotify_unmanaged); + } LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify); - LISTEN(&xwayland_surface->events.request_activate, &c->activate, - activatex11); LISTEN(&xwayland_surface->events.request_configure, &c->configure, configurex11); - LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle); LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify); - LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen, - fullscreennotify); } void From a4ce5e08abf9fd0452965c36832b6f070a38f355 Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Wed, 15 Sep 2021 18:34:26 -0400 Subject: [PATCH 6/9] fix no xwayland --- dwl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dwl.c b/dwl.c index d005906..128be93 100644 --- a/dwl.c +++ b/dwl.c @@ -1048,16 +1048,14 @@ destroynotify(struct wl_listener *listener, void *data) wl_list_remove(&c->map.link); wl_list_remove(&c->unmap.link); wl_list_remove(&c->destroy.link); - if (c->type && c->type != XDGShell) { + if (client_is_unmanaged(c)) { #ifdef XWAYLAND - if (c->type == X11Managed) { - wl_list_remove(&c->activate.link); - wl_list_remove(&c->configure.link); - } else { - wl_list_remove(&c->configure.link); - free(c); - return; - } + wl_list_remove(&c->configure.link); + free(c); + return; + } else if (c->type == X11Managed) { + wl_list_remove(&c->activate.link); + wl_list_remove(&c->configure.link); #endif } else { wl_list_remove(&c->commit.link); From dd3f34253076c6765a626d747c52164a95dd52bb Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Sat, 18 Sep 2021 13:12:17 -0400 Subject: [PATCH 7/9] fix foot scroll crash --- dwl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 128be93..05c647f 100644 --- a/dwl.c +++ b/dwl.c @@ -818,7 +818,8 @@ void commitnotify_sub(struct wl_listener *listener, void *data) { Subsurface *s = wl_container_of(listener, s, commit); - wlr_output_damage_add_whole(s->c->mon->damage); + if (s->c->mon) + wlr_output_damage_add_whole(s->c->mon->damage); } void From 99fbebcae35aae1d9b673bddb6ebd6eb05feeecf Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Sun, 26 Sep 2021 20:19:36 -0400 Subject: [PATCH 8/9] Remove redundant xcursor manager --- dwl.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/dwl.c b/dwl.c index 2c1634b..6303c25 100644 --- a/dwl.c +++ b/dwl.c @@ -323,10 +323,6 @@ static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr; static struct wlr_cursor *cursor; static struct wlr_xcursor_manager *cursor_mgr; -#ifdef XWAYLAND -static struct wlr_xcursor *xcursor; -static struct wlr_xcursor_manager *xcursor_mgr; -#endif static struct wlr_seat *seat; static struct wl_list keyboards; @@ -2133,18 +2129,6 @@ setup(void) wl_signal_add(&xwayland->events.ready, &xwayland_ready); wl_signal_add(&xwayland->events.new_surface, &new_xwayland_surface); - /* - * Create the XWayland cursor manager at scale 1, setting its default - * pointer to match the rest of dwl. - */ - xcursor_mgr = wlr_xcursor_manager_create(NULL, 24); - wlr_xcursor_manager_load(xcursor_mgr, 1); - if ((xcursor = wlr_xcursor_manager_get_xcursor(xcursor_mgr, "left_ptr", 1))) - wlr_xwayland_set_cursor(xwayland, - xcursor->images[0]->buffer, xcursor->images[0]->width * 4, - xcursor->images[0]->width, xcursor->images[0]->height, - xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y); - setenv("DISPLAY", xwayland->display_name, 1); } else { fprintf(stderr, "failed to setup XWayland X server, continuing without it\n"); From 6144aa39cc1d43c09a6e127a3d21e78d49e6116b Mon Sep 17 00:00:00 2001 From: ARDiDo <90479315+ARDiDo@users.noreply.github.com> Date: Tue, 28 Sep 2021 18:30:56 -0400 Subject: [PATCH 9/9] Set unmanaged monitor and remove damageallmons --- dwl.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dwl.c b/dwl.c index 05c647f..6a2d220 100644 --- a/dwl.c +++ b/dwl.c @@ -383,7 +383,6 @@ 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); void commitnotifyx11(struct wl_listener *listener, void *data); -static void damageallmons(); static Atom getatom(xcb_connection_t *xc, const char *name); static void mapnotify_unmanaged(struct wl_listener *listener, void *data); static void renderindependents(struct wlr_output *output, struct timespec *now); @@ -2622,20 +2621,7 @@ commitnotifyx11(struct wl_listener *listener, void *data) Client *c = wl_container_of(listener, c, commit); // Damage the whole screen - if (c->type == X11Managed) - wlr_output_damage_add_whole(c->mon->damage); - else - damageallmons(); -} - -void -damageallmons() -{ - Monitor *m; - - wl_list_for_each(m, &mons, link) - if (m && m->wlr_output && m->damage) - wlr_output_damage_add_whole(m->damage); + wlr_output_damage_add_whole(c->mon->damage); } Atom @@ -2656,8 +2642,10 @@ mapnotify_unmanaged(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, map); wl_list_insert(&independents, &c->link); + client_get_geometry(c, &c->geom); + c->mon = xytomon(c->geom.x, c->geom.y); LISTEN(&c->surface.xwayland->surface->events.commit, &c->commit, commitnotifyx11); - damageallmons(); + wlr_output_damage_add_whole(c->mon->damage); }