Compare commits

..

8 commits

7 changed files with 46 additions and 47 deletions

View file

@ -33,14 +33,6 @@ body:
validations:
required: false
- type: textarea
attributes:
label: Description
value: |
The steps you took to reproduce the problem.
validations:
required: false
- type: textarea
id: debug_log
attributes:
@ -60,3 +52,11 @@ body:
- If the lines mentioning dwl or wlroots have `??`. Please compile both dwl and wlroots from source (enabling debug symbols) and try to reproduce.
validations:
required: false
- type: textarea
attributes:
label: Description
value: |
The steps you took to reproduce the problem.
validations:
required: false

View file

@ -5,8 +5,8 @@ include config.mk
# flags for compiling
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND)
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
# CFLAGS / LDFLAGS
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)

View file

@ -34,10 +34,8 @@ given the base on which it is built. Implemented default features are:
- Damage tracking provided by scenegraph API
Given the Wayland architecture, dwl has to implement features from dwm **and**
the xorg-server. Because of this, it is impossible to maintain the original
project goal of 2000 SLOC and have a reasonably complete compositor with
features comparable to dwm. However, this does not mean that the code will grow
indiscriminately. We will try to keep the code as small as possible.
the xorg-server. Because of this, it is impossible to maintain the original project goal of 2000
SLOC and have a reasonably complete compositor with features comparable to dwm.
Features under consideration (possibly as patches) are:
@ -157,8 +155,8 @@ possible.
Many thanks to suckless.org and the dwm developers and community for the
inspiration, and to the various contributors to the project, including:
- **Devin J. Pohly for creating and nurturing the fledgling project**
- Alexander Courtis for the XWayland implementation
- Devin J. Pohly for creating and nurturing the fledgling project
- Guido Cella for the layer-shell protocol implementation, patch maintenance,
and for helping to keep the project running
- Stivvo for output management and fullscreen support, and patch maintenance

View file

@ -339,10 +339,10 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
return 0;
}
#endif
if ((int32_t)width == c->surface.xdg->toplevel->current.width
&& (int32_t)height == c->surface.xdg->toplevel->current.height)
if (width == c->surface.xdg->toplevel->current.width
&& height ==c->surface.xdg->toplevel->current.height)
return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
}
static inline void

View file

@ -12,7 +12,7 @@ static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff);
/* To conform 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.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
/* Autostart */
static const char *const autostart[] = {
@ -49,13 +49,13 @@ static const Layout layouts[] = {
/* monitors */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */
/* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor:
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
*/
{ "DP-3", 0.5, 1, 1.5, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
/* defaults */
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
};
/* keyboard */
@ -130,13 +130,13 @@ static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, SHCMD("dmenu_path | wmenu | xargs -I_-_ /bin/sh -c \"exec _-_\"") },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_S, spawn, SHCMD("slurp | grim -g - - | wl-copy -t image/png") },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = (char*[]){ "foot", NULL } } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = { "foot", NULL } } },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },

39
dwl.c
View file

@ -65,7 +65,6 @@
/* macros */
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define ROUND(X) ((int)((X < 0) ? (X - 0.5) : (X + 0.5)))
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
@ -197,7 +196,7 @@ struct Monitor {
unsigned int seltags;
unsigned int sellt;
uint32_t tagset[2];
float mfact;
double mfact;
int gamma_lut_changed;
int nmaster;
char ltsymbol[16];
@ -420,9 +419,9 @@ applybounds(Client *c, struct wlr_box *bbox)
c->geom.x = bbox->x + bbox->width - c->geom.width;
if (c->geom.y >= bbox->y + bbox->height)
c->geom.y = bbox->y + bbox->height - c->geom.height;
if (c->geom.x + c->geom.width + 2 * (int)c->bw <= bbox->x)
if (c->geom.x + c->geom.width + 2 * c->bw <= bbox->x)
c->geom.x = bbox->x;
if (c->geom.y + c->geom.height + 2 * (int)c->bw <= bbox->y)
if (c->geom.y + c->geom.height + 2 * c->bw <= bbox->y)
c->geom.y = bbox->y;
}
@ -452,8 +451,7 @@ applyrules(Client *c)
{
/* rule matching */
const char *appid, *title;
uint32_t newtags = 0;
int i;
uint32_t i, newtags = 0;
const Rule *r;
Monitor *mon = selmon, *m;
@ -547,7 +545,7 @@ arrangelayers(Monitor *m)
arrangelayer(m, &m->layers[i], &usable_area, 0);
/* Find topmost keyboard interactive layer, if such a layer exists */
for (i = 0; i < (int)LENGTH(layers_above_shell); i++) {
for (i = 0; i < LENGTH(layers_above_shell); i++) {
wl_list_for_each_reverse(l, &m->layers[layers_above_shell[i]], link) {
if (locked || !l->layer_surface->current.keyboard_interactive || !l->mapped)
continue;
@ -694,7 +692,7 @@ cleanupmon(struct wl_listener *listener, void *data)
{
Monitor *m = wl_container_of(listener, m, destroy);
LayerSurface *l, *tmp;
size_t i;
int i;
/* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) {
@ -1531,6 +1529,7 @@ locksession(struct wl_listener *listener, void *data)
void
maplayersurfacenotify(struct wl_listener *listener, void *data)
{
LayerSurface *l = wl_container_of(listener, l, map);
motionnotify(0);
}
@ -1669,17 +1668,17 @@ motionnotify(uint32_t time)
}
/* Update drag icon's position */
wlr_scene_node_set_position(&drag_icon->node, ROUND(cursor->x), ROUND(cursor->y));
wlr_scene_node_set_position(&drag_icon->node, cursor->x, cursor->y);
/* If we are currently grabbing the mouse, handle and return */
if (cursor_mode == CurMove) {
/* Move the grabbed client to the new position. */
resize(grabc, (struct wlr_box){.x = ROUND(cursor->x) - grabcx, .y = ROUND(cursor->y) - grabcy,
resize(grabc, (struct wlr_box){.x = cursor->x - grabcx, .y = cursor->y - grabcy,
.width = grabc->geom.width, .height = grabc->geom.height}, 1);
return;
} else if (cursor_mode == CurResize) {
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
.width = ROUND(cursor->x) - grabc->geom.x, .height = ROUND(cursor->y) - grabc->geom.y}, 1);
.width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1);
return;
}
@ -1731,8 +1730,8 @@ moveresize(const Arg *arg)
setfloating(grabc, 1);
switch (cursor_mode = arg->ui) {
case CurMove:
grabcx = ROUND(cursor->x) - grabc->geom.x;
grabcy = ROUND(cursor->y) - grabc->geom.y;
grabcx = cursor->x - grabc->geom.x;
grabcy = cursor->y - grabc->geom.y;
wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
break;
case CurResize:
@ -1805,6 +1804,9 @@ apply_or_test:
else
wlr_output_configuration_v1_send_failed(config);
wlr_output_configuration_v1_destroy(config);
/* TODO: use a wrapper function? */
updatemons(NULL, NULL);
}
void
@ -2151,7 +2153,7 @@ setmfact(const Arg *arg)
if (!arg || !selmon || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.1 || f > 0.9)
return;
selmon->mfact = f;
@ -2213,7 +2215,7 @@ setup(void)
struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig};
sigemptyset(&sa.sa_mask);
for (i = 0; i < (int)LENGTH(sig); i++)
for (i = 0; i < LENGTH(sig); i++)
sigaction(sig[i], &sa, NULL);
wlr_log_init(log_level, NULL);
@ -2323,7 +2325,7 @@ setup(void)
wl_signal_add(&session_lock_mgr->events.new_lock, &lock_listener);
LISTEN_STATIC(&session_lock_mgr->events.destroy, destroysessionmgr);
locked_bg = wlr_scene_rect_create(layers[LyrBlock], sgeom.width, sgeom.height,
(float [4]){0.1f, 0.1f, 0.1f, 1.0f});
(float [4]){0.1, 0.1, 0.1, 1.0});
wlr_scene_node_set_enabled(&locked_bg->node, 0);
/* Use decoration protocols to negotiate server-side decorations */
@ -2501,8 +2503,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
unsigned int mw, my, ty;
int i, n = 0;
unsigned int i, n = 0, mw, my, ty;
Client *c;
wl_list_for_each(c, &clients, link)
@ -2512,7 +2513,7 @@ tile(Monitor *m)
return;
if (n > m->nmaster)
mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
mw = m->nmaster ? m->w.width * m->mfact : 0;
else
mw = m->w.width;
i = my = ty = 0;

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1705856552,
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
"lastModified": 1704722960,
"narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
"rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
"type": "github"
},
"original": {