mirror of
https://github.com/tiyn/dwl.git
synced 2026-01-11 17:39:45 +01:00
Compare commits
1 Commits
warpcursor
...
attachtop
| Author | SHA1 | Date | |
|---|---|---|---|
| 7faae9dfcf |
36
attachtop.patch
Normal file
36
attachtop.patch
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
From 42a66d6e06c38e913766ce625f049fdbc3dd0d12 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
|
Date: Sun, 7 Apr 2024 21:10:17 +0200
|
||||||
|
Subject: [PATCH] New client are attached on top of the stack
|
||||||
|
|
||||||
|
---
|
||||||
|
dwl.c | 13 ++++++++++++-
|
||||||
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index bf763df..c0a3d74 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
c->geom.height += 2 * c->bw;
|
||||||
|
|
||||||
|
/* Insert this client into client lists. */
|
||||||
|
- wl_list_insert(&clients, &c->link);
|
||||||
|
+ i = 0;
|
||||||
|
+ wl_list_for_each(w, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(w, selmon) || c->isfloating)
|
||||||
|
+ continue;
|
||||||
|
+ p = w;
|
||||||
|
+ if (++i >= selmon->nmaster)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ if (i > 0)
|
||||||
|
+ wl_list_insert(&p->link, &c->link);
|
||||||
|
+ else
|
||||||
|
+ wl_list_insert(&clients, &c->link);
|
||||||
|
wl_list_insert(&fstack, &c->flink);
|
||||||
|
|
||||||
|
/* Set initial monitor, tags, floating status, and focus:
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
||||||
40
dwl.c
40
dwl.c
@@ -347,7 +347,6 @@ 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);
|
||||||
@@ -541,7 +540,6 @@ arrange(Monitor *m)
|
|||||||
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
|
||||||
@@ -1409,10 +1407,6 @@ 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);
|
||||||
@@ -1781,7 +1775,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||||||
c->geom.height += 2 * c->bw;
|
c->geom.height += 2 * c->bw;
|
||||||
|
|
||||||
/* Insert this client into client lists. */
|
/* Insert this client into client lists. */
|
||||||
wl_list_insert(&clients, &c->link);
|
i = 0;
|
||||||
|
wl_list_for_each(w, &clients, link) {
|
||||||
|
if (!VISIBLEON(w, selmon) || c->isfloating)
|
||||||
|
continue;
|
||||||
|
p = w;
|
||||||
|
if (++i >= selmon->nmaster)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i > 0)
|
||||||
|
wl_list_insert(&p->link, &c->link);
|
||||||
|
else
|
||||||
|
wl_list_insert(&clients, &c->link);
|
||||||
wl_list_insert(&fstack, &c->flink);
|
wl_list_insert(&fstack, &c->flink);
|
||||||
|
|
||||||
/* Set initial monitor, tags, floating status, and focus:
|
/* Set initial monitor, tags, floating status, and focus:
|
||||||
@@ -3005,27 +3010,6 @@ 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,71 +0,0 @@
|
|||||||
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