mirror of
https://github.com/tiyn/dwl.git
synced 2026-01-11 17:39:45 +01:00
Compare commits
2 Commits
hide-behin
...
warpcursor
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e9c5a374f | |||
| 9c78e36a36 |
@@ -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)
|
||||||
|
|||||||
51
dwl.c
51
dwl.c
@@ -347,6 +347,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
|||||||
static void view(const Arg *arg);
|
static void view(const Arg *arg);
|
||||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||||
static void virtualpointer(struct wl_listener *listener, void *data);
|
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||||
|
static void warpcursor(const Client *c);
|
||||||
static Monitor *xytomon(double x, double y);
|
static Monitor *xytomon(double x, double y);
|
||||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||||
@@ -505,9 +506,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,30 +537,11 @@ 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);
|
||||||
checkidleinhibitor(NULL);
|
checkidleinhibitor(NULL);
|
||||||
|
warpcursor(focustop(selmon));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1429,6 +1409,10 @@ focusclient(Client *c, int lift)
|
|||||||
if (locked)
|
if (locked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Warp cursor to center of client if it is outside */
|
||||||
|
if (lift)
|
||||||
|
warpcursor(c);
|
||||||
|
|
||||||
/* Raise client in stacking order if requested */
|
/* Raise client in stacking order if requested */
|
||||||
if (c && lift)
|
if (c && lift)
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
@@ -3021,6 +3005,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
|||||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
warpcursor(const Client *c) {
|
||||||
|
if (cursor_mode != CurNormal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!c && selmon) {
|
||||||
|
wlr_cursor_warp_closest(cursor,
|
||||||
|
NULL,
|
||||||
|
selmon->w.x + selmon->w.width / 2.0 ,
|
||||||
|
selmon->w.y + selmon->w.height / 2.0);
|
||||||
|
}
|
||||||
|
else if ( c && (cursor->x < c->geom.x ||
|
||||||
|
cursor->x > c->geom.x + c->geom.width ||
|
||||||
|
cursor->y < c->geom.y ||
|
||||||
|
cursor->y > c->geom.y + c->geom.height))
|
||||||
|
wlr_cursor_warp_closest(cursor,
|
||||||
|
NULL,
|
||||||
|
c->geom.x + c->geom.width / 2.0,
|
||||||
|
c->geom.y + c->geom.height / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
xytomon(double x, double y)
|
xytomon(double x, double y)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|
||||||
71
warpcursor.patch
Normal file
71
warpcursor.patch
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
From 4951ccc89dac2b557994b2f6c3aacb2398e2d1b1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ben Collerson <benc@benc.cc>
|
||||||
|
Date: Thu, 4 Jan 2024 20:30:01 +1000
|
||||||
|
Subject: [PATCH] warpcursor
|
||||||
|
|
||||||
|
---
|
||||||
|
dwl.c | 27 +++++++++++++++++++++++++++
|
||||||
|
1 file changed, 27 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 145fd018..f7ad6c13 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -347,6 +347,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
||||||
|
static void view(const Arg *arg);
|
||||||
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||||
|
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||||
|
+static void warpcursor(const Client *c);
|
||||||
|
static Monitor *xytomon(double x, double y);
|
||||||
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
|
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||||
|
@@ -514,6 +515,7 @@ arrange(Monitor *m)
|
||||||
|
m->lt[m->sellt]->arrange(m);
|
||||||
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
|
checkidleinhibitor(NULL);
|
||||||
|
+ warpcursor(focustop(selmon));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -1323,6 +1325,10 @@ focusclient(Client *c, int lift)
|
||||||
|
if (locked)
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ /* Warp cursor to center of client if it is outside */
|
||||||
|
+ if (lift)
|
||||||
|
+ warpcursor(c);
|
||||||
|
+
|
||||||
|
/* Raise client in stacking order if requested */
|
||||||
|
if (c && lift)
|
||||||
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
|
@@ -2927,6 +2933,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||||
|
wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+warpcursor(const Client *c) {
|
||||||
|
+ if (cursor_mode != CurNormal) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ if (!c && selmon) {
|
||||||
|
+ wlr_cursor_warp_closest(cursor,
|
||||||
|
+ NULL,
|
||||||
|
+ selmon->w.x + selmon->w.width / 2.0 ,
|
||||||
|
+ selmon->w.y + selmon->w.height / 2.0);
|
||||||
|
+ }
|
||||||
|
+ else if ( c && (cursor->x < c->geom.x ||
|
||||||
|
+ cursor->x > c->geom.x + c->geom.width ||
|
||||||
|
+ cursor->y < c->geom.y ||
|
||||||
|
+ cursor->y > c->geom.y + c->geom.height))
|
||||||
|
+ wlr_cursor_warp_closest(cursor,
|
||||||
|
+ NULL,
|
||||||
|
+ c->geom.x + c->geom.width / 2.0,
|
||||||
|
+ c->geom.y + c->geom.height / 2.0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Monitor *
|
||||||
|
xytomon(double x, double y)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
Reference in New Issue
Block a user