summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--client.h24
-rw-r--r--dwl.12
-rw-r--r--dwl.c20
4 files changed, 36 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 0c2b78d..8635093 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -pedantic -DVERSION=\"$(VERSION)\"
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
-PKGS = wlroots wayland-server xcb xkbcommon libinput
+PKGS = wlroots wayland-server xcb xcb-icccm xkbcommon libinput
CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p)))
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
diff --git a/client.h b/client.h
index f27be2a..6648c59 100644
--- a/client.h
+++ b/client.h
@@ -30,16 +30,19 @@ client_surface(Client *c)
static inline void
client_activate_surface(struct wlr_surface *s, int activated)
{
+ struct wlr_xdg_surface *surface;
#ifdef XWAYLAND
- if (wlr_surface_is_xwayland_surface(s)) {
- wlr_xwayland_surface_activate(
- wlr_xwayland_surface_from_wlr_surface(s), activated);
+ struct wlr_xwayland_surface *xsurface;
+ if (wlr_surface_is_xwayland_surface(s)
+ && (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
+ wlr_xwayland_surface_activate(xsurface, activated);
return;
}
#endif
- if (wlr_surface_is_xdg_surface(s))
- wlr_xdg_toplevel_set_activated(
- wlr_xdg_surface_from_wlr_surface(s)->toplevel, activated);
+ if (wlr_surface_is_xdg_surface(s)
+ && (surface = wlr_xdg_surface_from_wlr_surface(s))
+ && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
+ wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
}
static inline void
@@ -211,8 +214,13 @@ client_min_size(Client *c, int *width, int *height)
#ifdef XWAYLAND
if (client_is_x11(c)) {
xcb_size_hints_t *size_hints = c->surface.xwayland->size_hints;
- *width = size_hints->min_width;
- *height = size_hints->min_height;
+ if (size_hints) {
+ *width = size_hints->min_width;
+ *height = size_hints->min_height;
+ } else {
+ *width = 0;
+ *height = 0;
+ }
return;
}
#endif
diff --git a/dwl.1 b/dwl.1
index f50602c..d958210 100644
--- a/dwl.1
+++ b/dwl.1
@@ -7,7 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl v
-.Op Fl s Ar command
+.Op Fl s Ar startup command
.Sh DESCRIPTION
.Nm
is a Wayland compositor based on wlroots.
diff --git a/dwl.c b/dwl.c
index 0acb22e..84e5f2e 100644
--- a/dwl.c
+++ b/dwl.c
@@ -50,8 +50,9 @@
#include <wlr/util/log.h>
#include <xkbcommon/xkbcommon.h>
#ifdef XWAYLAND
-#include <X11/Xlib.h>
#include <wlr/xwayland.h>
+#include <X11/Xlib.h>
+#include <xcb/xcb_icccm.h>
#endif
#include "util.h"
@@ -114,6 +115,7 @@ typedef struct {
#ifdef XWAYLAND
struct wl_listener activate;
struct wl_listener configure;
+ struct wl_listener set_hints;
#endif
int bw;
unsigned int tags;
@@ -348,6 +350,7 @@ static void activatex11(struct wl_listener *listener, void *data);
static void configurex11(struct wl_listener *listener, void *data);
static void createnotifyx11(struct wl_listener *listener, void *data);
static Atom getatom(xcb_connection_t *xc, const char *name);
+static void sethints(struct wl_listener *listener, void *data);
static void sigchld(int unused);
static void xwaylandready(struct wl_listener *listener, void *data);
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
@@ -925,6 +928,7 @@ destroynotify(struct wl_listener *listener, void *data)
#ifdef XWAYLAND
if (c->type != XDGShell) {
wl_list_remove(&c->configure.link);
+ wl_list_remove(&c->set_hints.link);
wl_list_remove(&c->activate.link);
} else
#endif
@@ -1000,7 +1004,7 @@ focusclient(Client *c, int lift)
} else {
Client *w;
struct wlr_scene_node *node = old->data;
- if ((w = node->data))
+ if (old->role_data && (w = node->data))
for (i = 0; i < 4; i++)
wlr_scene_rect_set_color(w->border[i], bordercolor);
@@ -1296,6 +1300,7 @@ monocle(Monitor *m)
continue;
resize(c, m->w.x, m->w.y, m->w.width, m->w.height, 0);
}
+ focusclient(focustop(m), 1);
}
void
@@ -2342,6 +2347,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
LISTEN(&xwayland_surface->events.request_activate, &c->activate, activatex11);
LISTEN(&xwayland_surface->events.request_configure, &c->configure,
configurex11);
+ LISTEN(&xwayland_surface->events.set_hints, &c->set_hints, sethints);
LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle);
LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify);
LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen,
@@ -2362,6 +2368,16 @@ getatom(xcb_connection_t *xc, const char *name)
}
void
+sethints(struct wl_listener *listener, void *data)
+{
+ Client *c = wl_container_of(listener, c, set_hints);
+ if (c != selclient()) {
+ c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
+ printstatus();
+ }
+}
+
+void
sigchld(int unused)
{
siginfo_t in;