sevz17 / dwl Goto Github PK
View Code? Open in Web Editor NEWThis project forked from djpohly/dwl
dwm for Wayland
License: Other
This project forked from djpohly/dwl
dwm for Wayland
License: Other
dwl version: 0.4
wlroots version: 0.16.2-2
So the problem with functions like glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
or SDL_SetRelativeMouseMode(SDL_TRUE);
. I see the same behavior with steam/wine games either.
Cursor keep being locked even if client is not focused. So the relative mode works properly inside sdl or glfw or some other window, but it seems that constraints are not being destroyed after focusing other client or going to another tag, and cursor remains constrained.
dwl -d log only shows this while toggling between tags
00:00:11.229 [DEBUG] [types/wlr_pointer_constraints_v1.c:242] new locked_pointer 0x5597235fdfa0 (res 0x559723526a80)
00:00:11.229 [DEBUG] [types/wlr_pointer_constraints_v1.c:343] constrained 0x5597235fdfa0
00:00:12.785 [DEBUG] [types/wlr_idle.c:183] Enabling idle timers for all seats
00:00:13.089 [DEBUG] [types/wlr_idle.c:183] Disabling idle timers for all seats
00:00:13.419 [DEBUG] [types/wlr_idle.c:183] Enabling idle timers for all seats
00:00:13.625 [DEBUG] [types/wlr_idle.c:183] Disabling idle timers for all seats
00:00:13.903 [DEBUG] [types/wlr_idle.c:183] Enabling idle timers for all seats
00:00:14.123 [DEBUG] [types/wlr_idle.c:183] Disabling idle timers for all seats
00:00:14.389 [DEBUG] [types/wlr_idle.c:183] Enabling idle timers for all seats
dwl's commit: b5776e5
wlroots version: 0.15.1
The pointer-constraints branch here and mainline now differ significantly in the arguments to motionnotify()
I am not immediately clear on how to resolve this or if this is a substantial, non-trivial matter to properly merge.
diff --git a/config.def.h b/config.def.h
index 43f35cd..89c4690 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,6 +5,7 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscree
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 smartborders = 1;
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/dwl.c b/dwl.c
index 0c80691..838e040 100644
--- a/dwl.c
+++ b/dwl.c
@@ -262,7 +262,7 @@ static void quit(const Arg *arg);
static void quitsignal(int signo);
static void rendermon(struct wl_listener *listener, void *data);
static void requeststartdrag(struct wl_listener *listener, void *data);
-static void resize(Client *c, struct wlr_box geo, int interact);
+static void resize(Client *c, struct wlr_box geo, int interact, int draw_borders);
static void run(char *startup_cmd);
static Client *selclient(void);
static void setcursor(struct wl_listener *listener, void *data);
@@ -750,7 +750,7 @@ closemon(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (c->isfloating && c->geom.x > m->m.width)
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
- .width = c->geom.width, .height = c->geom.height}, 0);
+ .width = c->geom.width, .height = c->geom.height}, 0, 1);
if (c->mon == m)
setmon(c, selmon, c->tags);
}
@@ -1440,7 +1440,7 @@ monocle(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue;
- resize(c, m->w, 0);
+ resize(c, m->w, 0, !smartborders);
}
focusclient(focustop(m), 1);
}
@@ -1483,11 +1483,11 @@ motionnotify(uint32_t time)
if (cursor_mode == CurMove) {
/* Move the grabbed client to the new position. */
resize(grabc, (struct wlr_box){.x = cursor->x - grabcx, .y = cursor->y - grabcy,
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
+ .width = grabc->geom.width, .height = grabc->geom.height}, 1, 1);
return;
} else if (cursor_mode == CurResize) {
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
- .width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1);
+ .width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1, 1);
return;
}
@@ -1731,10 +1731,11 @@ requeststartdrag(struct wl_listener *listener, void *data)
}
void
-resize(Client *c, struct wlr_box geo, int interact)
+resize(Client *c, struct wlr_box geo, int interact, int draw_borders)
{
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w;
c->geom = geo;
+ c->bw = draw_borders ? borderpx : 0;
applybounds(c, bbox);
/* Update scene-graph, including borders */
@@ -1840,6 +1841,8 @@ setfloating(Client *c, int floating)
{
c->isfloating = floating;
wlr_scene_node_reparent(c->scene, layers[c->isfloating ? LyrFloat : LyrTile]);
+ if (c->isfloating && !c->bw)
+ resize(c, c->mon->m, 0, 1);
arrange(c->mon);
printstatus();
}
@@ -1853,11 +1856,11 @@ setfullscreen(Client *c, int fullscreen)
if (fullscreen) {
c->prev = c->geom;
- resize(c, c->mon->m, 0);
+ resize(c, c->mon->m, 0, 0);
} else {
/* restore previous size instead of arrange for floating windows since
* client positions are set by the user and cannot be recalculated */
- resize(c, c->prev, 0);
+ resize(c, c->prev, 0, 1);
}
arrange(c->mon);
printstatus();
@@ -1870,6 +1873,12 @@ setlayout(const Arg *arg)
selmon->sellt ^= 1;
if (arg && arg->v)
selmon->lt[selmon->sellt] = (Layout *)arg->v;
+ if (!selmon->lt[selmon->sellt]->arrange) {
+ /* floating layout, draw borders around all clients */
+ Client *c;
+ wl_list_for_each(c, &clients, link)
+ resize(c, c->mon->m, 0, 1);
+ }
/* TODO change layout symbol? */
arrange(selmon);
printstatus();
@@ -1906,7 +1915,7 @@ setmon(Client *c, Monitor *m, unsigned int newtags)
}
if (m) {
/* Make sure window actually overlaps with the monitor */
- resize(c, c->geom, 0);
+ resize(c, c->geom, 0, 1);
wlr_surface_send_enter(client_surface(c), m->wlr_output);
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
arrange(m);
@@ -2172,7 +2181,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n = 0, mw, my, ty;
+ unsigned int i, n = 0, mw, my, ty, draw_borders = 1;
Client *c;
wl_list_for_each(c, &clients, link)
@@ -2181,6 +2190,9 @@ tile(Monitor *m)
if (n == 0)
return;
+ if (n == smartborders)
+ draw_borders = 0;
+
if (n > m->nmaster)
mw = m->nmaster ? m->w.width * m->mfact : 0;
else
@@ -2191,11 +2203,11 @@ tile(Monitor *m)
continue;
if (i < m->nmaster) {
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
- .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
+ .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0, draw_borders);
my += c->geom.height;
} else {
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
+ .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0, draw_borders);
ty += c->geom.height;
}
i++;
The current smartboarder patch didn't apply to the latest master branch, so I created an updated version. Is this the correct place to share?
I have merged both your idle-inhibitor branch and your input-inhibitor branch and find that this works nicely with swayidle/swaylock allowing automated timeout locking of an idle dwl session. (Thank you!)
However, if I set "IdleAction=suspend" in logind.conf (with a systemd machine), reboot the machine (or restart systemd-logind) and start a dwl session, dwl never suspends.
A login at TTY will suspend with the above set, but although swayidle is recognizing idle vs idle-inhibited state, logind does not when dwl is running.
I suspect this has something to do with "idle hinting," but don't know enough to dig further. Reading through the commits in the idle-inhibitor branch, I cannot tell whether this is an expected state of affairs or not.
If this is a trivial matter, point me in the right direction; I am happy to work on it.
If it is expected behaviour, let me know and I'll close the issue.
@sevz17 I have rebased the following branches on djpohly/main commit 0729f18. ALL of these were clean rebases with no manual intervention required. I have updated the wiki pages for each patch with today's date (2023-05-26):
If anything looks out of place, please let me know. Otherwise, feel free to close this "issue."
@sevz17 I have rebased the following patches since your updates today to upstream (djpohly):
pointer-constraints
smartborders
numlock/capslock
autostart
I have tested with all of the above rebased patches applied and found no problems. If you find anything incorrect in the rebasing, please let me know.
How to disable / turn off numlock when launch dwl?
@sevz17 : These are the first merges to your repository since you added write permissions.
Please take a look when you have the chance.
Let me know if there are any style changes you would like.
Let me know if there are any commit message changes you would like.
In general, these are your branches/patches and your repository; I want to be sure moving forward that maintenance I do is in keeping with your preferences.
Thank you for your recent work in the upstream repo!
Please consider merging upstream changes in the 'smartborders' branch so that we mortals have the option to merge your awesome 'smartborders' branch when building dwl.
dwl's commit: release 0.3
wlroots version: 0.15.1
I'm on gentoo using this ebuild.
The patch fails with
* Applying vanitygaps.patch ...
patching file config.def.h
Hunk #1 FAILED at 2.
Hunk #2 succeeded at 76 (offset -1 lines).
1 out of 2 hunks FAILED -- saving rejects to file config.def.h.rej
patching file config.def.h
Hunk #1 succeeded at 76 (offset -6 lines).
patching file dwl.c
Hunk #1 succeeded at 173 (offset -2 lines).
Hunk #2 FAILED at 230.
Hunk #3 succeeded at 237 with fuzz 2 (offset -4 lines).
Hunk #4 succeeded at 273 with fuzz 1 (offset -3 lines).
Hunk #5 succeeded at 285 (offset -6 lines).
Hunk #6 succeeded at 335 (offset -7 lines).
Hunk #7 succeeded at 825 (offset -67 lines).
Hunk #8 succeeded at 969 with fuzz 2 (offset -51 lines).
Hunk #9 succeeded at 1224 (offset -11 lines).
Hunk #10 succeeded at 1864 (offset -61 lines).
Hunk #11 succeeded at 2161 (offset -81 lines).
Hunk #12 succeeded at 2169 (offset -81 lines).
Hunk #13 succeeded at 2207 with fuzz 1 (offset -89 lines).
1 out of 13 hunks FAILED -- saving rejects to file dwl.c.rej
config.def.h.rej:
--- config.def.h
+++ config.def.h
@@ -2,6 +2,11 @@
static const int sloppyfocus = 1; /* focus follows mouse */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+static const unsigned int gappih = 10; /* horiz inner gap between windows */
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
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};
dwl.c.rej:
--- dwl.c
+++ dwl.c
@@ -230,6 +234,7 @@ static void createmon(struct wl_listener *listener, void *data);
static void createnotify(struct wl_listener *listener, void *data);
static void createpointer(struct wlr_input_device *device);
static void cursorframe(struct wl_listener *listener, void *data);
+static void defaultgaps(const Arg *arg);
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
static void destroynotify(struct wl_listener *listener, void *data);
I'm very sorry if this is something obvious.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.