summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@proton.me>2023-12-07 22:43:13 -0600
committerLeonardo Hernández Hernández <leohdz172@proton.me>2023-12-07 22:43:13 -0600
commit0de7d1aa719befb6ba291b3e2cad12253d6fa6a3 (patch)
tree4e7bf40c4b2a0cd82228d7c0219a9b63d6d6d33d
parentbab5c0185a5f62fe30e1b02fa454fdddac73a752 (diff)
parent1884a076460797b42d4670cb62bacd3871740c59 (diff)
Merge branch 'main' into wlroots-next
-rw-r--r--README.md3
-rw-r--r--config.def.h1
-rw-r--r--dwl.c52
3 files changed, 29 insertions, 27 deletions
diff --git a/README.md b/README.md
index 820828f..1aa5195 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`,
but differs in that the display server will not shut down when this process
terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait
for it to terminate (if it hasn't already). This makes it ideal for execing into
-a user service manager like [s6], [anopa], [runit], or [`systemd --user`].
+a user service manager like [s6], [anopa], [runit], [dinit], or [`systemd --user`].
Note: The `-s` command is run as a *child process* of dwl, which means that it
does not have the ability to affect the environment of dwl or of any processes
@@ -167,6 +167,7 @@ inspiration, and to the various contributors to the project, including:
[s6]: https://skarnet.org/software/s6/
[anopa]: https://jjacky.com/anopa/
[runit]: http://smarden.org/runit/faq.html#userservices
+[dinit]: https://davmac.org/projects/dinit/
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
[wiki]: https://codeberg.org/dwl/dwl/wiki/Home#compatible-status-bars
[list of useful resources on our wiki]:
diff --git a/config.def.h b/config.def.h
index db0babc..5375eb5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -36,6 +36,7 @@ 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 */
/* example of a HiDPI laptop monitor:
diff --git a/dwl.c b/dwl.c
index 1143701..02a8735 100644
--- a/dwl.c
+++ b/dwl.c
@@ -21,7 +21,6 @@
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm.h>
-#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
@@ -30,6 +29,7 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_layer_shell_v1.h>
+#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output_management_v1.h>
@@ -188,7 +188,7 @@ struct Monitor {
struct wlr_session_lock_surface_v1 *lock_surface;
struct wlr_box m; /* monitor area, layout-relative */
struct wlr_box w; /* window area, layout-relative */
- struct wl_list layers[4]; /* LayerSurface::link */
+ struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2];
unsigned int seltags;
unsigned int sellt;
@@ -826,9 +826,9 @@ createlayersurface(struct wl_listener *listener, void *data)
l->mon = layer_surface->output->data;
l->scene_layer = wlr_scene_layer_surface_v1_create(scene_layer, layer_surface);
l->scene = l->scene_layer->tree;
- l->popups = surface->data = wlr_scene_tree_create(scene_layer);
- l->scene->node.data = l;
-
+ l->popups = surface->data = wlr_scene_tree_create(layer_surface->current.layer
+ < ZWLR_LAYER_SHELL_V1_LAYER_TOP ? layers[LyrTop] : scene_layer);
+ l->scene->node.data = l->popups->node.data = l;
wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link);
wlr_surface_send_enter(surface, layer_surface->output);
@@ -878,13 +878,14 @@ createmon(struct wl_listener *listener, void *data)
m->tagset[0] = m->tagset[1] = 1;
for (r = monrules; r < END(monrules); r++) {
if (!r->name || strstr(wlr_output->name, r->name)) {
+ m->m.x = r->x;
+ m->m.y = r->y;
m->mfact = r->mfact;
m->nmaster = r->nmaster;
- wlr_output_state_set_scale(&state, r->scale);
m->lt[0] = m->lt[1] = r->lt;
+ strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
+ wlr_output_state_set_scale(&state, r->scale);
wlr_output_state_set_transform(&state, r->rr);
- m->m.x = r->x;
- m->m.y = r->y;
break;
}
}
@@ -930,7 +931,6 @@ createmon(struct wl_listener *listener, void *data)
wlr_output_layout_add_auto(output_layout, wlr_output);
else
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
- strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
}
void
@@ -958,8 +958,7 @@ void
createpointer(struct wlr_pointer *pointer)
{
if (wlr_input_device_is_libinput(&pointer->base)) {
- struct libinput_device *libinput_device = (struct libinput_device*)
- wlr_libinput_get_device_handle(&pointer->base);
+ struct libinput_device *libinput_device = wlr_libinput_get_device_handle(&pointer->base);
if (libinput_device_config_tap_get_finger_count(libinput_device)) {
libinput_device_config_tap_set_enabled(libinput_device, tap_to_click);
@@ -1510,9 +1509,10 @@ mapnotify(struct wl_listener *listener, void *data)
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
c->scene->node.data = c->scene_surface->node.data = c;
+ client_get_geometry(c, &c->geom);
+
/* Handle unmanaged clients first so we can return prior create borders */
if (client_is_unmanaged(c)) {
- client_get_geometry(c, &c->geom);
/* Unmanaged clients always are floating */
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
wlr_scene_node_set_position(&c->scene->node, c->geom.x + borderpx,
@@ -1525,13 +1525,13 @@ mapnotify(struct wl_listener *listener, void *data)
}
for (i = 0; i < 4; i++) {
- c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor);
+ c->border[i] = wlr_scene_rect_create(c->scene, 0, 0,
+ c->isurgent ? urgentcolor : bordercolor);
c->border[i]->node.data = c;
}
/* Initialize client geometry with room for border */
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
- client_get_geometry(c, &c->geom);
c->geom.width += 2 * c->bw;
c->geom.height += 2 * c->bw;
@@ -2553,14 +2553,14 @@ updatemons(struct wl_listener *listener, void *data)
/* Remove this output from the layout to avoid cursor enter inside it */
wlr_output_layout_remove(output_layout, m->wlr_output);
closemon(m);
- memset(&m->m, 0, sizeof(m->m));
- memset(&m->w, 0, sizeof(m->w));
+ m->m = m->w = (struct wlr_box){0};
}
/* Insert outputs that need to */
wl_list_for_each(m, &mons, link)
if (m->wlr_output->enabled
&& !wlr_output_layout_get(output_layout, m->wlr_output))
wlr_output_layout_add_auto(output_layout, m->wlr_output);
+
/* Now that we update the output layout we can get its box */
wlr_output_layout_get_box(output_layout, NULL, &sgeom);
@@ -2584,8 +2584,7 @@ updatemons(struct wl_listener *listener, void *data)
if (m->lock_surface) {
struct wlr_scene_tree *scene_tree = m->lock_surface->surface->data;
wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y);
- wlr_session_lock_surface_v1_configure(m->lock_surface, m->m.width,
- m->m.height);
+ wlr_session_lock_surface_v1_configure(m->lock_surface, m->m.width, m->m.height);
}
/* Calculate the effective monitor geometry to use for clients */
@@ -2596,9 +2595,10 @@ updatemons(struct wl_listener *listener, void *data)
if ((c = focustop(m)) && c->isfullscreen)
resize(c, m->m, 0);
+ /* Try to re-set the gamma LUT when updating monitors,
+ * it's only really needed when enabling a disabled output, but meh. */
m->gamma_lut_changed = 1;
- config_head->state.enabled = 1;
- config_head->state.mode = m->wlr_output->current_mode;
+
config_head->state.x = m->m.x;
config_head->state.y = m->m.y;
}
@@ -2642,10 +2642,11 @@ urgent(struct wl_listener *listener, void *data)
if (!c || c == focustop(selmon))
return;
- if (client_surface(c)->mapped)
- client_set_border_color(c, urgentcolor);
c->isurgent = 1;
printstatus();
+
+ if (client_surface(c)->mapped)
+ client_set_border_color(c, urgentcolor);
}
void
@@ -2786,13 +2787,13 @@ createnotifyx11(struct wl_listener *listener, void *data)
/* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
+ 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_configure, &c->configure, configurex11);
+ LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints);
LISTEN(&xsurface->events.set_title, &c->set_title, updatetitle);
- LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
- LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
}
void
@@ -2825,11 +2826,10 @@ sethints(struct wl_listener *listener, void *data)
return;
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
+ printstatus();
if (c->isurgent && surface && surface->mapped)
client_set_border_color(c, urgentcolor);
-
- printstatus();
}
void