summaryrefslogtreecommitdiff
path: root/update.diff
blob: d38a5296105caa6498f697016d184da47012c1af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
diff --git a/README.md b/README.md
index 887bf29..6b12ab0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # dwl - dwm for Wayland
 
-Join us on our [Discord server](https://discord.gg/jJxZnrGPWN)!
+Join us on our [Discord server](https://discord.gg/jJxZnrGPWN) and at [#dwl](https://web.libera.chat/?channels=#dwl) on irc.libera.chat.
 
 dwl is a compact, hackable compositor for Wayland based on [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots/). It is intended to fill the same space in the Wayland world that dwm does in X11, primarily in terms of philosophy, and secondarily in terms of functionality. Like dwm, dwl is:
 
@@ -85,10 +85,6 @@ Existing dwl-specific status bars and dwl-specific scripts for other status bars
 
 You can find a [list of Wayland applications on the sway wiki](https://github.com/swaywm/sway/wiki/i3-Migration-Guide).
 
-## IRC channel
-
-dwl's IRC channel is #dwl on irc.libera.chat.
-
 ## Acknowledgements
 
 dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots developers. This was made possible in many cases by looking at how sway accomplished something, then trying to do the same in as suckless a way as possible.
diff --git a/config.h b/config.h
index bc08e2e..7745e7d 100644
--- a/config.h
+++ b/config.h
@@ -49,8 +49,7 @@ static const MonitorRule monrules[] = {
 	{ "eDP-1",    0.5,  1,      2,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
 	*/
 	/* defaults */
-	{ "HDMI-A-1", 0.55, 1,      1,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
-	{ "HDMI-A-2", 0.55, 1,      1,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
+	{ NULL,       0.55, 1,      1,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
 };
 
 /* keyboard */
diff --git a/dwl.c b/dwl.c
index 227e1c4..2533ef7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -315,7 +315,7 @@ static void swallow(Client *c, Client *w);
 /* variables */
 static const char broken[] = "broken";
 static pid_t child_pid = -1;
-static struct wlr_surface *exclusive_focus;
+static void *exclusive_focus;
 static struct wl_display *dpy;
 static struct wlr_backend *backend;
 static struct wlr_scene *scene;
@@ -574,7 +574,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int
 		const uint32_t both_vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
 			| ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
 
-		if (exclusive != (state->exclusive_zone > 0))
+		if (wlr_layer_surface->mapped && exclusive != (state->exclusive_zone > 0))
 			continue;
 
 		bounds = state->exclusive_zone == -1 ? full_area : *usable_area;
@@ -643,6 +643,8 @@ arrangelayers(Monitor *m)
 		ZWLR_LAYER_SHELL_V1_LAYER_TOP,
 	};
 	LayerSurface *layersurface;
+	if (!m || !m->wlr_output->enabled)
+		return;
 
 	/* Arrange exclusive surfaces from top->bottom */
 	for (i = 3; i >= 0; i--)
@@ -665,8 +667,8 @@ arrangelayers(Monitor *m)
 					layersurface->layer_surface->mapped) {
 				/* Deactivate the focused client. */
 				focusclient(NULL, 0);
-				exclusive_focus = layersurface->layer_surface->surface;
-				client_notify_enter(exclusive_focus, wlr_seat_get_keyboard(seat));
+				exclusive_focus = layersurface;
+				client_notify_enter(layersurface->layer_surface->surface, wlr_seat_get_keyboard(seat));
 				return;
 			}
 		}
@@ -801,6 +803,7 @@ cleanupmon(struct wl_listener *listener, void *data)
 	wl_list_remove(&m->destroy.link);
 	wl_list_remove(&m->frame.link);
 	wl_list_remove(&m->link);
+	wlr_output->data = NULL;
 	wlr_output_layout_remove(output_layout, m->wlr_output);
 	wlr_scene_output_destroy(m->scene_output);
 
@@ -835,8 +838,9 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
 {
 	LayerSurface *layersurface = wl_container_of(listener, layersurface, surface_commit);
 	struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface;
+	struct wlr_output *wlr_output = wlr_layer_surface->output;
 
-	if (!layersurface->mon)
+	if (!wlr_output || !(layersurface->mon = wlr_output->data))
 		return;
 
 	if (layers[wlr_layer_surface->current.layer] != layersurface->scene) {
@@ -1127,8 +1131,6 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data)
 	wl_list_remove(&layersurface->unmap.link);
 	wl_list_remove(&layersurface->surface_commit.link);
 	wlr_scene_node_destroy(layersurface->scene);
-	if (layersurface->mon)
-		arrangelayers(layersurface->mon);
 	free(layersurface);
 }
 
@@ -1551,9 +1553,6 @@ mapnotify(struct wl_listener *listener, void *data)
 	}
 	printstatus();
 
-	if (c->isfullscreen)
-		setfullscreen(c, 1);
-
 	c->mon->un_map = 1;
 	if (!c->noswallow) {
 			Client *p = termforwin(c);
@@ -2029,6 +2028,8 @@ void
 setfullscreen(Client *c, int fullscreen)
 {
 	c->isfullscreen = fullscreen;
+	if (!c->mon)
+		return;
 	c->bw = fullscreen ? 0 : borderpx;
 	client_set_fullscreen(c, fullscreen);
 
@@ -2114,7 +2115,7 @@ setmon(Client *c, Monitor *m, unsigned int newtags)
 		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);
+		setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
 	}
 	focusclient(focustop(selmon), 1);
 }
@@ -2512,7 +2513,10 @@ unmaplayersurfacenotify(struct wl_listener *listener, void *data)
 
 	layersurface->layer_surface->mapped = (layersurface->mapped = 0);
 	wlr_scene_node_set_enabled(layersurface->scene, 0);
-	if (layersurface->layer_surface->surface == exclusive_focus)
+	if (layersurface->layer_surface->output
+			&& (layersurface->mon = layersurface->layer_surface->output->data))
+		arrangelayers(layersurface->mon);
+	if (layersurface == exclusive_focus)
 		exclusive_focus = NULL;
 	if (layersurface->layer_surface->surface ==
 			seat->keyboard_state.focused_surface)