Merge remote-tracking branch 'djpohly/main' into wlroots-next

This commit is contained in:
Leonardo Hernández Hernández 2022-05-10 20:08:41 -05:00
commit dca68f9aa1
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
6 changed files with 64 additions and 12 deletions

View File

@ -1,6 +1,6 @@
include config.mk include config.mk
CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -pedantic CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -pedantic -DVERSION=\"$(VERSION)\"
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols) WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner) WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
@ -14,6 +14,15 @@ all: dwl
clean: clean:
rm -f dwl *.o *-protocol.h *-protocol.c rm -f dwl *.o *-protocol.h *-protocol.c
dist: clean
mkdir -p dwl-$(VERSION)
cp -R LICENSE* Makefile README.md generate-version.sh client.h\
config.def.h config.mk protocols dwl.1 dwl.c util.c util.h\
dwl-$(VERSION)
echo "echo $(VERSION)" > dwl-$(VERSION)/generate-version.sh
tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
rm -rf dwl-$(VERSION)
install: dwl install: dwl
install -Dm755 dwl $(DESTDIR)$(PREFIX)/bin/dwl install -Dm755 dwl $(DESTDIR)$(PREFIX)/bin/dwl
install -Dm644 dwl.1 $(DESTDIR)$(MANDIR)/man1/dwl.1 install -Dm644 dwl.1 $(DESTDIR)$(MANDIR)/man1/dwl.1
@ -21,7 +30,7 @@ install: dwl
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1
.PHONY: all clean install uninstall .PHONY: all clean dist install uninstall
# wayland-scanner is a tool which generates C headers and rigging for Wayland # wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up # protocols, which are specified in XML. wlroots requires you to rig these up

View File

@ -113,6 +113,8 @@ client_is_float_type(Client *c)
&& (size_hints->max_width == size_hints->min_width || && (size_hints->max_width == size_hints->min_width ||
size_hints->max_height == size_hints->min_height)) size_hints->max_height == size_hints->min_height))
return 1; return 1;
return 0;
} }
#endif #endif

View File

@ -1,3 +1,6 @@
_VERSION = 0.3.1
VERSION = $(shell ./generate-version.sh $(_VERSION))
# paths # paths
PREFIX = /usr/local PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man

7
dwl.1
View File

@ -6,6 +6,7 @@
.Nd dwm for Wayland .Nd dwm for Wayland
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl v
.Op Fl s Ar command .Op Fl s Ar command
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -15,6 +16,12 @@ It is intended to fill the same space in the Wayland world that
does for X11. does for X11.
.Pp .Pp
When given the When given the
.Fl v
option,
.Nm
writes its name and version to standard error and exits unsuccessfully.
.Pp
When given the
.Fl s .Fl s
option, option,
.Nm .Nm

30
dwl.c
View File

@ -475,8 +475,11 @@ arrangelayers(Monitor *m)
layersurface->layer_surface->mapped) { layersurface->layer_surface->mapped) {
/* Deactivate the focused client. */ /* Deactivate the focused client. */
focusclient(NULL, 0); focusclient(NULL, 0);
if (kb)
wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface,
kb->keycodes, kb->num_keycodes, &kb->modifiers); kb->keycodes, kb->num_keycodes, &kb->modifiers);
else
wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, NULL, 0, NULL);
return; return;
} }
} }
@ -516,7 +519,7 @@ buttonpress(struct wl_listener *listener, void *data)
focusclient(c, 1); focusclient(c, 1);
keyboard = wlr_seat_get_keyboard(seat); keyboard = wlr_seat_get_keyboard(seat);
mods = wlr_keyboard_get_modifiers(keyboard); mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
for (b = buttons; b < END(buttons); b++) { for (b = buttons; b < END(buttons); b++) {
if (CLEANMASK(mods) == CLEANMASK(b->mod) && if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
event->button == b->button && b->func) { event->button == b->button && b->func) {
@ -615,6 +618,7 @@ closemon(Monitor *m)
if (c->mon == m) if (c->mon == m)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }
printstatus();
} }
void void
@ -1013,10 +1017,22 @@ focusclient(Client *c, int lift)
return; return;
} }
#ifdef XWAYLAND
/* This resolves an issue where the last spawned xwayland client
* receives all pointer activity.
*/
if (c->type == X11Managed)
wlr_xwayland_surface_restack(c->surface.xwayland, NULL,
XCB_STACK_MODE_ABOVE);
#endif
/* Have a client, so focus its top-level wlr_surface */ /* Have a client, so focus its top-level wlr_surface */
kb = wlr_seat_get_keyboard(seat); kb = wlr_seat_get_keyboard(seat);
if (kb)
wlr_seat_keyboard_notify_enter(seat, client_surface(c), wlr_seat_keyboard_notify_enter(seat, client_surface(c),
kb->keycodes, kb->num_keycodes, &kb->modifiers); kb->keycodes, kb->num_keycodes, &kb->modifiers);
else
wlr_seat_keyboard_notify_enter(seat, client_surface(c), NULL, 0, NULL);
/* Activate the new client */ /* Activate the new client */
client_activate_surface(client_surface(c), 1); client_activate_surface(client_surface(c), 1);
@ -2227,11 +2243,11 @@ xytonode(double x, double y, struct wlr_surface **psurface,
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
Client *c = NULL; Client *c = NULL;
LayerSurface *l = NULL; LayerSurface *l = NULL;
int i; const int *layer;
int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg }; int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg };
for (i = 0; i < LENGTH(focus_order); i++) { for (layer = focus_order; layer < END(focus_order); layer++) {
if ((node = wlr_scene_node_at(layers[focus_order[i]], x, y, nx, ny))) { if ((node = wlr_scene_node_at(layers[*layer], x, y, nx, ny))) {
if (node->type == WLR_SCENE_NODE_SURFACE) if (node->type == WLR_SCENE_NODE_SURFACE)
surface = wlr_scene_surface_from_node(node)->surface; surface = wlr_scene_surface_from_node(node)->surface;
/* Walk the tree to find a node that knows the client */ /* Walk the tree to find a node that knows the client */
@ -2402,9 +2418,11 @@ main(int argc, char *argv[])
char *startup_cmd = NULL; char *startup_cmd = NULL;
int c; int c;
while ((c = getopt(argc, argv, "s:h")) != -1) { while ((c = getopt(argc, argv, "s:hv")) != -1) {
if (c == 's') if (c == 's')
startup_cmd = optarg; startup_cmd = optarg;
else if (c == 'v')
die("dwl " VERSION);
else else
goto usage; goto usage;
} }
@ -2420,5 +2438,5 @@ main(int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
usage: usage:
die("Usage: %s [-s startup command]", argv[0]); die("Usage: %s [-v] [-s startup command]", argv[0]);
} }

13
generate-version.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if git tag --contains HEAD | grep -q $1; then
echo $1
else
branch="$(git rev-parse --abbrev-ref HEAD)"
commit="$(git rev-parse --short HEAD)"
if [ "${branch}" != "main" ]; then
echo $1-$branch-$commit
else
echo $1-$commit
fi
fi