From 87d87cc4041a997d00ebf234ca5118b9248a3b95 Mon Sep 17 00:00:00 2001 From: krypek <115574014+krypciak@users.noreply.github.com> Date: Wed, 23 Nov 2022 22:56:52 +0100 Subject: [PATCH 1/9] Fix comparison between signed and unsigned int When c->bw is 0, the right side of the MAX functions gets turned into an unsigned integer and that results in -1 being the outcome. This causes big issues in xwayland clients. --- dwl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index b884d06..fc6c4da 100644 --- a/dwl.c +++ b/dwl.c @@ -389,8 +389,8 @@ applybounds(Client *c, struct wlr_box *bbox) struct wlr_box min = {0}, max = {0}; client_get_size_hints(c, &max, &min); /* try to set size hints */ - c->geom.width = MAX(min.width + (2 * c->bw), c->geom.width); - c->geom.height = MAX(min.height + (2 * c->bw), c->geom.height); + c->geom.width = MAX(min.width + (2 * (int)c->bw), c->geom.width); + c->geom.height = MAX(min.height + (2 * (int)c->bw), c->geom.height); /* Some clients set them max size to INT_MAX, which does not violates * the protocol but its innecesary, they can set them max size to zero. */ if (max.width > 0 && !(2 * c->bw > INT_MAX - max.width)) /* Checks for overflow */ From 3213088aa23e1f6cad1a5ba506dfb7318e1011c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Wed, 30 Nov 2022 17:42:58 -0600 Subject: [PATCH 2/9] do not try to set the parent's same tags and monitor for xwayland clients References: https://github.com/djpohly/dwl/pull/334#issuecomment-1330166324 --- dwl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index c1ff934..fd22c8f 100644 --- a/dwl.c +++ b/dwl.c @@ -1381,7 +1381,8 @@ mapnotify(struct wl_listener *listener, void *data) * we always consider floating, clients that have parent and thus * we set the same tags and monitor than its parent, if not * try to apply rules for them */ - if ((p = client_get_parent(c))) { + /* TODO: https://github.com/djpohly/dwl/pull/334#issuecomment-1330166324 */ + if (c->type == XDGShell && (p = client_get_parent(c))) { c->isfloating = 1; wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]); setmon(c, p->mon, p->tags); From c91d21b68f436bc61dfce8b3f47beb5855bdd1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 25 Nov 2022 12:15:55 -0600 Subject: [PATCH 3/9] do not move/resize if grabbed client is fullscreen --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index fd22c8f..4648890 100644 --- a/dwl.c +++ b/dwl.c @@ -1510,7 +1510,7 @@ moveresize(const Arg *arg) if (cursor_mode != CurNormal && cursor_mode != CurPressed) return; xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL); - if (!grabc || client_is_unmanaged(grabc)) + if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen) return; /* Float the window and tell motionnotify to grab it */ From 10c56d63489506ee852f3ec18f078e60ba1885f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Wed, 30 Nov 2022 18:51:35 -0600 Subject: [PATCH 4/9] add option to allow invisible surfaces to disable idle tracking --- config.def.h | 13 +++++++------ dwl.c | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config.def.h b/config.def.h index 0473b40..8f01192 100644 --- a/config.def.h +++ b/config.def.h @@ -1,11 +1,12 @@ /* appearance */ -static const int sloppyfocus = 1; /* focus follows mouse */ -static const unsigned int borderpx = 1; /* border pixel of windows */ -static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0}; -static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0}; -static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; +static const int sloppyfocus = 1; /* focus follows mouse */ +static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0}; +static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0}; +static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ -static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; +static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; diff --git a/dwl.c b/dwl.c index 4648890..f07a867 100644 --- a/dwl.c +++ b/dwl.c @@ -597,8 +597,9 @@ checkidleinhibitor(struct wlr_surface *exclude) struct wlr_scene_tree *tree; struct wlr_idle_inhibitor_v1 *inhibitor; wl_list_for_each(inhibitor, &idle_inhibit_mgr->inhibitors, link) { - if (exclude != inhibitor->surface && (tree = inhibitor->surface->data) - && tree->node.enabled) { + if (bypass_surface_visibility || (exclude != inhibitor->surface + && (tree = inhibitor->surface->data) + && tree->node.enabled)) { inhibited = 1; break; } From 6df6781b437937e835d8caca14024829747bd2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Wed, 30 Nov 2022 18:54:54 -0600 Subject: [PATCH 5/9] simplify check for surface's node state all `struct wlr_surface` should have a `wlr_scene_tree *` as data --- dwl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index f07a867..3f6db50 100644 --- a/dwl.c +++ b/dwl.c @@ -594,11 +594,10 @@ void checkidleinhibitor(struct wlr_surface *exclude) { int inhibited = 0; - struct wlr_scene_tree *tree; struct wlr_idle_inhibitor_v1 *inhibitor; wl_list_for_each(inhibitor, &idle_inhibit_mgr->inhibitors, link) { + struct wlr_scene_tree *tree = inhibitor->surface->data; if (bypass_surface_visibility || (exclude != inhibitor->surface - && (tree = inhibitor->surface->data) && tree->node.enabled)) { inhibited = 1; break; From b4fb1f77c768fb7bd568d3cc67c59dcfdb7cae28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 1 Dec 2022 20:49:49 -0600 Subject: [PATCH 6/9] fix xwayland clients being floating by default Fix 3213088aa23e1f6cad1a5ba506dfb7318e1011c9 References: https://github.com/djpohly/dwl/pull/334#issuecomment-1333147730 --- client.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client.h b/client.h index 3c81135..c18d01a 100644 --- a/client.h +++ b/client.h @@ -184,8 +184,7 @@ client_is_float_type(Client *c) } #endif return ((min.width > 0 || min.height > 0 || max.width > 0 || max.height > 0) - && (min.width == max.width || min.height == max.height)) - || client_get_parent(c); + && (min.width == max.width || min.height == max.height)); } static inline int From f929eaef1e15c2624de20cdcb0e348e6cab21152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 2 Dec 2022 10:07:24 -0600 Subject: [PATCH 7/9] ask for version instead of commit in bug reports --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 64e2054..6b60803 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,7 +8,7 @@ assignees: '' --- ## Info -dwl's commit: +dwl version: wlroots version: ## Description