mirror of
https://github.com/tiyn/dwl.git
synced 2026-01-11 17:39:45 +01:00
Compare commits
1 Commits
hide-behin
...
xwayland-h
| Author | SHA1 | Date | |
|---|---|---|---|
| 97d0cef703 |
9
client.h
9
client.h
@@ -94,9 +94,12 @@ client_activate_surface(struct wlr_surface *s, int activated)
|
|||||||
{
|
{
|
||||||
struct wlr_xdg_toplevel *toplevel;
|
struct wlr_xdg_toplevel *toplevel;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
struct wlr_xwayland_surface *xsurface;
|
struct wlr_xwayland_surface *surface;
|
||||||
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
if ((surface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
||||||
wlr_xwayland_surface_activate(xsurface, activated);
|
if (activated && surface->minimized)
|
||||||
|
wlr_xwayland_surface_set_minimized(surface, false);
|
||||||
|
|
||||||
|
wlr_xwayland_surface_activate(surface, activated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ static const float bordercolor[] = COLOR(0x444444ff);
|
|||||||
static const float focuscolor[] = COLOR(0x005577ff);
|
static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 0.0f}; /* You can also use glsl colors */
|
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
#define TAGCOUNT (9)
|
#define TAGCOUNT (9)
|
||||||
|
|||||||
43
dwl.c
43
dwl.c
@@ -131,6 +131,7 @@ typedef struct {
|
|||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
struct wl_listener activate;
|
struct wl_listener activate;
|
||||||
struct wl_listener associate;
|
struct wl_listener associate;
|
||||||
|
struct wl_listener minimize;
|
||||||
struct wl_listener dissociate;
|
struct wl_listener dissociate;
|
||||||
struct wl_listener configure;
|
struct wl_listener configure;
|
||||||
struct wl_listener set_hints;
|
struct wl_listener set_hints;
|
||||||
@@ -442,6 +443,7 @@ static void associatex11(struct wl_listener *listener, void *data);
|
|||||||
static void configurex11(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 createnotifyx11(struct wl_listener *listener, void *data);
|
||||||
static void dissociatex11(struct wl_listener *listener, void *data);
|
static void dissociatex11(struct wl_listener *listener, void *data);
|
||||||
|
static void minimizenotify(struct wl_listener *listener, void *data);
|
||||||
static void sethints(struct wl_listener *listener, void *data);
|
static void sethints(struct wl_listener *listener, void *data);
|
||||||
static void xwaylandready(struct wl_listener *listener, void *data);
|
static void xwaylandready(struct wl_listener *listener, void *data);
|
||||||
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
|
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
|
||||||
@@ -505,9 +507,7 @@ applyrules(Client *c)
|
|||||||
void
|
void
|
||||||
arrange(Monitor *m)
|
arrange(Monitor *m)
|
||||||
{
|
{
|
||||||
LayerSurface *l;
|
Client *c;
|
||||||
Client *c, *sel = focustop(m);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!m->wlr_output->enabled)
|
if (!m->wlr_output->enabled)
|
||||||
return;
|
return;
|
||||||
@@ -538,26 +538,6 @@ arrange(Monitor *m)
|
|||||||
: c->scene->node.parent);
|
: c->scene->node.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel && sel->isfullscreen && VISIBLEON(sel, m)) {
|
|
||||||
for (i = 2; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--) {
|
|
||||||
wl_list_for_each(l, &sel->mon->layers[i], link)
|
|
||||||
wlr_scene_node_set_enabled(&l->scene->node, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (c->mon != m)
|
|
||||||
continue;
|
|
||||||
wlr_scene_node_set_enabled(&c->scene->node, (sel->isfullscreen && c == sel)
|
|
||||||
|| !sel->isfullscreen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!sel || (!sel->isfullscreen && VISIBLEON(sel, m))) {
|
|
||||||
for (i = 2; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--) {
|
|
||||||
wl_list_for_each(l, &m->layers[i], link)
|
|
||||||
wlr_scene_node_set_enabled(&l->scene->node, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m->lt[m->sellt]->arrange)
|
if (m->lt[m->sellt]->arrange)
|
||||||
m->lt[m->sellt]->arrange(m);
|
m->lt[m->sellt]->arrange(m);
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
@@ -1356,6 +1336,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
|||||||
wl_list_remove(&c->activate.link);
|
wl_list_remove(&c->activate.link);
|
||||||
wl_list_remove(&c->associate.link);
|
wl_list_remove(&c->associate.link);
|
||||||
wl_list_remove(&c->configure.link);
|
wl_list_remove(&c->configure.link);
|
||||||
|
wl_list_remove(&c->minimize.link);
|
||||||
wl_list_remove(&c->dissociate.link);
|
wl_list_remove(&c->dissociate.link);
|
||||||
wl_list_remove(&c->set_hints.link);
|
wl_list_remove(&c->set_hints.link);
|
||||||
} else
|
} else
|
||||||
@@ -3154,6 +3135,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
|
|||||||
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
|
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
|
||||||
LISTEN(&xsurface->events.dissociate, &c->dissociate, dissociatex11);
|
LISTEN(&xsurface->events.dissociate, &c->dissociate, dissociatex11);
|
||||||
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
|
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
|
||||||
|
LISTEN(&xsurface->events.request_minimize, &c->minimize, minimizenotify);
|
||||||
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
|
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
|
||||||
LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
|
LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
|
||||||
LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints);
|
LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints);
|
||||||
@@ -3168,6 +3150,21 @@ dissociatex11(struct wl_listener *listener, void *data)
|
|||||||
wl_list_remove(&c->unmap.link);
|
wl_list_remove(&c->unmap.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
minimizenotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
Client *c = wl_container_of(listener, c, minimize);
|
||||||
|
struct wlr_xwayland_surface *xsurface = c->surface.xwayland;
|
||||||
|
struct wlr_xwayland_minimize_event *e = data;
|
||||||
|
int focused;
|
||||||
|
|
||||||
|
if (xsurface->surface == NULL || !xsurface->surface->mapped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
focused = seat->keyboard_state.focused_surface == xsurface->surface;
|
||||||
|
wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sethints(struct wl_listener *listener, void *data)
|
sethints(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
From ac1537f068ea626f1984803ed8db08faf7943b18 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
|
||||||
<leohdz172@proton.me>
|
|
||||||
Date: Sun, 10 Apr 2022 22:38:53 -0500
|
|
||||||
Subject: [PATCH] hide-behind-fullscreen
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
|
||||||
---
|
|
||||||
config.def.h | 2 +-
|
|
||||||
dwl.c | 24 +++++++++++++++++++++++-
|
|
||||||
2 files changed, 24 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 22d2171d..1d5a4c84 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -12,7 +12,7 @@ static const float bordercolor[] = COLOR(0x444444ff);
|
|
||||||
static const float focuscolor[] = COLOR(0x005577ff);
|
|
||||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
|
||||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
|
||||||
-static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
|
||||||
+static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 0.0f}; /* You can also use glsl colors */
|
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
|
||||||
#define TAGCOUNT (9)
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index ad21e1ba..f5395fe6 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -505,7 +505,9 @@ applyrules(Client *c)
|
|
||||||
void
|
|
||||||
arrange(Monitor *m)
|
|
||||||
{
|
|
||||||
- Client *c;
|
|
||||||
+ LayerSurface *l;
|
|
||||||
+ Client *c, *sel = focustop(m);
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
if (!m->wlr_output->enabled)
|
|
||||||
return;
|
|
||||||
@@ -536,6 +538,26 @@ arrange(Monitor *m)
|
|
||||||
: c->scene->node.parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (sel && sel->isfullscreen && VISIBLEON(sel, m)) {
|
|
||||||
+ for (i = 2; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--) {
|
|
||||||
+ wl_list_for_each(l, &sel->mon->layers[i], link)
|
|
||||||
+ wlr_scene_node_set_enabled(&l->scene->node, 0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ wl_list_for_each(c, &clients, link) {
|
|
||||||
+ if (c->mon != m)
|
|
||||||
+ continue;
|
|
||||||
+ wlr_scene_node_set_enabled(&c->scene->node, (sel->isfullscreen && c == sel)
|
|
||||||
+ || !sel->isfullscreen);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (!sel || (!sel->isfullscreen && VISIBLEON(sel, m))) {
|
|
||||||
+ for (i = 2; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--) {
|
|
||||||
+ wl_list_for_each(l, &m->layers[i], link)
|
|
||||||
+ wlr_scene_node_set_enabled(&l->scene->node, 1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (m->lt[m->sellt]->arrange)
|
|
||||||
m->lt[m->sellt]->arrange(m);
|
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
|
||||||
--
|
|
||||||
2.48.0
|
|
||||||
|
|
||||||
91
xwayland-handle-minimize.patch
Normal file
91
xwayland-handle-minimize.patch
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
From 7277f668f19f5a7fcfbbc96e80cb2829487848ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: korei999 <ju7t1xe@gmail.com>
|
||||||
|
Date: Mon, 1 Apr 2024 15:13:11 +0300
|
||||||
|
Subject: [PATCH] handle minimize request for xwayland clients
|
||||||
|
|
||||||
|
---
|
||||||
|
client.h | 9 ++++++---
|
||||||
|
dwl.c | 19 +++++++++++++++++++
|
||||||
|
2 files changed, 25 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/client.h b/client.h
|
||||||
|
index 800b867..c46cfb2 100644
|
||||||
|
--- a/client.h
|
||||||
|
+++ b/client.h
|
||||||
|
@@ -94,9 +94,12 @@ client_activate_surface(struct wlr_surface *s, int activated)
|
||||||
|
{
|
||||||
|
struct wlr_xdg_toplevel *toplevel;
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
- struct wlr_xwayland_surface *xsurface;
|
||||||
|
- if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
||||||
|
- wlr_xwayland_surface_activate(xsurface, activated);
|
||||||
|
+ struct wlr_xwayland_surface *surface;
|
||||||
|
+ if ((surface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
||||||
|
+ if (activated && surface->minimized)
|
||||||
|
+ wlr_xwayland_surface_set_minimized(surface, false);
|
||||||
|
+
|
||||||
|
+ wlr_xwayland_surface_activate(surface, activated);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 39ce68c..b49f57b 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -131,6 +131,7 @@ typedef struct {
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
struct wl_listener activate;
|
||||||
|
struct wl_listener associate;
|
||||||
|
+ struct wl_listener minimize;
|
||||||
|
struct wl_listener dissociate;
|
||||||
|
struct wl_listener configure;
|
||||||
|
struct wl_listener set_hints;
|
||||||
|
@@ -412,6 +413,7 @@ static void configurex11(struct wl_listener *listener, void *data);
|
||||||
|
static void createnotifyx11(struct wl_listener *listener, void *data);
|
||||||
|
static void dissociatex11(struct wl_listener *listener, void *data);
|
||||||
|
static xcb_atom_t getatom(xcb_connection_t *xc, const char *name);
|
||||||
|
+static void minimizenotify(struct wl_listener *listener, void *data);
|
||||||
|
static void sethints(struct wl_listener *listener, void *data);
|
||||||
|
static void xwaylandready(struct wl_listener *listener, void *data);
|
||||||
|
static struct wlr_xwayland *xwayland;
|
||||||
|
@@ -1177,6 +1179,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
|
wl_list_remove(&c->activate.link);
|
||||||
|
wl_list_remove(&c->associate.link);
|
||||||
|
wl_list_remove(&c->configure.link);
|
||||||
|
+ wl_list_remove(&c->minimize.link);
|
||||||
|
wl_list_remove(&c->dissociate.link);
|
||||||
|
wl_list_remove(&c->set_hints.link);
|
||||||
|
} else
|
||||||
|
@@ -2984,6 +2987,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
|
||||||
|
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
|
||||||
|
LISTEN(&xsurface->events.dissociate, &c->dissociate, dissociatex11);
|
||||||
|
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
|
||||||
|
+ LISTEN(&xsurface->events.request_minimize, &c->minimize, minimizenotify);
|
||||||
|
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
|
||||||
|
LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
|
||||||
|
LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints);
|
||||||
|
@@ -3011,6 +3015,21 @@ getatom(xcb_connection_t *xc, const char *name)
|
||||||
|
return atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+minimizenotify(struct wl_listener *listener, void *data)
|
||||||
|
+{
|
||||||
|
+ Client *c = wl_container_of(listener, c, minimize);
|
||||||
|
+ struct wlr_xwayland_surface *xsurface = c->surface.xwayland;
|
||||||
|
+ struct wlr_xwayland_minimize_event *e = data;
|
||||||
|
+ int focused;
|
||||||
|
+
|
||||||
|
+ if (xsurface->surface == NULL || !xsurface->surface->mapped)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ focused = seat->keyboard_state.focused_surface == xsurface->surface;
|
||||||
|
+ wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
sethints(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
||||||
Reference in New Issue
Block a user