~ruther/dwl

35778025419b3b2cd7cc6d0ebc17a6d1fe79f3ef — Leonardo Hernández Hernández 3 years ago 4465dcb + 230d343
Merge branch 'wlroots-next' into scenegraph-wlroots-next
4 files changed, 21 insertions(+), 16 deletions(-)

M README.md
M client.h
M config.def.h
M dwl.c
M README.md => README.md +1 -1
@@ 2,7 2,7 @@

Join us on our [Discord server](https://discord.gg/jJxZnrGPWN)!

dwl is a compact, hackable compositor for Wayland based on [wlroots](https://github.com/swaywm/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:
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:

- Easy to understand, hack on, and extend with patches
- One C source file (or a very small number) configurable via `config.h`

M client.h => client.h +5 -6
@@ 39,7 39,7 @@ client_activate_surface(struct wlr_surface *s, int activated)
#endif
	if (wlr_surface_is_xdg_surface(s))
		wlr_xdg_toplevel_set_activated(
				wlr_xdg_surface_from_wlr_surface(s), activated);
				wlr_xdg_surface_from_wlr_surface(s)->toplevel, activated);
}

static inline void


@@ 121,7 121,7 @@ client_send_close(Client *c)
		return;
	}
#endif
	wlr_xdg_toplevel_send_close(c->surface.xdg);
	wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
}

static inline void


@@ 133,7 133,7 @@ client_set_fullscreen(Client *c, int fullscreen)
		return;
	}
#endif
	wlr_xdg_toplevel_set_fullscreen(c->surface.xdg, fullscreen);
	wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
}

static inline uint32_t


@@ 146,7 146,7 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
		return 0;
	}
#endif
	return wlr_xdg_toplevel_set_size(c->surface.xdg, width, height);
	return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
}

static inline void


@@ 156,8 156,7 @@ client_set_tiled(Client *c, uint32_t edges)
	if (client_is_x11(c))
		return;
#endif
	wlr_xdg_toplevel_set_tiled(c->surface.xdg, WLR_EDGE_TOP |
			WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
	wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
}

static inline struct wlr_surface *

M config.def.h => config.def.h +1 -1
@@ 96,7 96,7 @@ static const Key keys[] = {
	TAGKEYS(          XKB_KEY_3, XKB_KEY_numbersign,                 2),
	TAGKEYS(          XKB_KEY_4, XKB_KEY_dollar,                     3),
	TAGKEYS(          XKB_KEY_5, XKB_KEY_percent,                    4),
	TAGKEYS(          XKB_KEY_6, XKB_KEY_caret,                      5),
	TAGKEYS(          XKB_KEY_6, XKB_KEY_asciicircum,                5),
	TAGKEYS(          XKB_KEY_7, XKB_KEY_ampersand,                  6),
	TAGKEYS(          XKB_KEY_8, XKB_KEY_asterisk,                   7),
	TAGKEYS(          XKB_KEY_9, XKB_KEY_parenleft,                  8),

M dwl.c => dwl.c +14 -8
@@ 37,6 37,7 @@
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_subcompositor.h>
#include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_xcursor_manager.h>


@@ 124,11 125,6 @@ typedef struct {
} Client;

typedef struct {
	struct wl_listener request_mode;
	struct wl_listener destroy;
} Decoration;

typedef struct {
	uint32_t mod;
	xkb_keysym_t keysym;
	void (*func)(const Arg *);


@@ 1342,6 1338,7 @@ mapnotify(struct wl_listener *listener, void *data)
	/* Set initial monitor, tags, floating status, and focus */
	applyrules(c);
	resize(c, c->geom.x, c->geom.y, c->geom.width, c->geom.height, 0);
	printstatus();
}

void


@@ 1669,11 1666,13 @@ run(char *startup_cmd)
			EBARF("startup: fork");
		if (startup_pid == 0) {
			dup2(piperw[0], STDIN_FILENO);
			close(piperw[0]);
			close(piperw[1]);
			execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL);
			EBARF("startup: execl");
		}
		dup2(piperw[1], STDOUT_FILENO);
		close(piperw[1]);
		close(piperw[0]);
	}
	/* If nobody is reading the status output, don't terminate */


@@ 1872,6 1871,7 @@ setup(void)
	wlr_gamma_control_manager_v1_create(dpy);
	wlr_primary_selection_v1_device_manager_create(dpy);
	wlr_viewporter_create(dpy);
	wlr_subcompositor_create(dpy);

	/* Initializes the interface used to implement urgency hints */
	activation = wlr_xdg_activation_v1_create(dpy);


@@ 2125,6 2125,10 @@ unmapnotify(struct wl_listener *listener, void *data)
{
	/* Called when the surface is unmapped, and should no longer be shown. */
	Client *c = wl_container_of(listener, c, unmap);
	if (c == grabc) {
		cursor_mode = CurNormal;
		grabc = NULL;
	}
	wl_list_remove(&c->link);
	if (client_is_unmanaged(c))
		return;


@@ 2132,6 2136,7 @@ unmapnotify(struct wl_listener *listener, void *data)
	setmon(c, NULL, 0);
	wl_list_remove(&c->flink);
	wlr_scene_node_destroy(c->scene);
	printstatus();
}

void


@@ 2147,7 2152,7 @@ updatemons(struct wl_listener *listener, void *data)
	struct wlr_output_configuration_v1 *config =
		wlr_output_configuration_v1_create();
	Monitor *m;
	sgeom = *wlr_output_layout_get_box(output_layout, NULL);
	wlr_output_layout_get_box(output_layout, NULL, &sgeom);
	wl_list_for_each(m, &mons, link) {
		struct wlr_output_configuration_head_v1 *config_head =
			wlr_output_configuration_head_v1_create(config, m->wlr_output);


@@ 2156,7 2161,8 @@ updatemons(struct wl_listener *listener, void *data)
		/* TODO: move focus if selmon is disabled */

		/* Get the effective monitor geometry to use for surfaces */
		m->m = m->w = *wlr_output_layout_get_box(output_layout, m->wlr_output);
		wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->m));
		wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->w));
		wlr_scene_output_set_position(m->scene_output, m->m.x, m->m.y);
		/* Calculate the effective monitor geometry to use for clients */
		arrangelayers(m);


@@ 2212,7 2218,7 @@ void
virtualkeyboard(struct wl_listener *listener, void *data)
{
	struct wlr_virtual_keyboard_v1 *keyboard = data;
	struct wlr_input_device *device = &keyboard->input_device;
	struct wlr_input_device *device = &keyboard->keyboard.base;
	createkeyboard(device);
}


Do not follow this link