mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-27 03:36:31 +00:00
Merge remote-tracking branch 'djpohly/main' into wlroots-next
chase wlroots X11 hints update
This commit is contained in:
commit
88a8b784d0
4 changed files with 36 additions and 12 deletions
2
Makefile
2
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_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)
|
||||||
|
|
||||||
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)))
|
CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p)))
|
||||||
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
|
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
|
||||||
|
|
||||||
|
|
24
client.h
24
client.h
|
@ -30,16 +30,19 @@ client_surface(Client *c)
|
||||||
static inline void
|
static inline void
|
||||||
client_activate_surface(struct wlr_surface *s, int activated)
|
client_activate_surface(struct wlr_surface *s, int activated)
|
||||||
{
|
{
|
||||||
|
struct wlr_xdg_surface *surface;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (wlr_surface_is_xwayland_surface(s)) {
|
struct wlr_xwayland_surface *xsurface;
|
||||||
wlr_xwayland_surface_activate(
|
if (wlr_surface_is_xwayland_surface(s)
|
||||||
wlr_xwayland_surface_from_wlr_surface(s), activated);
|
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
|
||||||
|
wlr_xwayland_surface_activate(xsurface, activated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wlr_surface_is_xdg_surface(s))
|
if (wlr_surface_is_xdg_surface(s)
|
||||||
wlr_xdg_toplevel_set_activated(
|
&& (surface = wlr_xdg_surface_from_wlr_surface(s))
|
||||||
wlr_xdg_surface_from_wlr_surface(s)->toplevel, activated);
|
&& surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
|
||||||
|
wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -211,8 +214,13 @@ client_min_size(Client *c, int *width, int *height)
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
xcb_size_hints_t *size_hints = c->surface.xwayland->size_hints;
|
xcb_size_hints_t *size_hints = c->surface.xwayland->size_hints;
|
||||||
*width = size_hints->min_width;
|
if (size_hints) {
|
||||||
*height = size_hints->min_height;
|
*width = size_hints->min_width;
|
||||||
|
*height = size_hints->min_height;
|
||||||
|
} else {
|
||||||
|
*width = 0;
|
||||||
|
*height = 0;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
2
dwl.1
2
dwl.1
|
@ -7,7 +7,7 @@
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl v
|
.Op Fl v
|
||||||
.Op Fl s Ar command
|
.Op Fl s Ar startup command
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
is a Wayland compositor based on wlroots.
|
is a Wayland compositor based on wlroots.
|
||||||
|
|
20
dwl.c
20
dwl.c
|
@ -50,8 +50,9 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <xcb/xcb_icccm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -114,6 +115,7 @@ typedef struct {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
struct wl_listener activate;
|
struct wl_listener activate;
|
||||||
struct wl_listener configure;
|
struct wl_listener configure;
|
||||||
|
struct wl_listener set_hints;
|
||||||
#endif
|
#endif
|
||||||
int bw;
|
int bw;
|
||||||
unsigned int tags;
|
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 configurex11(struct wl_listener *listener, void *data);
|
||||||
static void createnotifyx11(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 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 sigchld(int unused);
|
||||||
static void xwaylandready(struct wl_listener *listener, void *data);
|
static void xwaylandready(struct wl_listener *listener, void *data);
|
||||||
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
|
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
|
||||||
|
@ -925,6 +928,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (c->type != XDGShell) {
|
if (c->type != XDGShell) {
|
||||||
wl_list_remove(&c->configure.link);
|
wl_list_remove(&c->configure.link);
|
||||||
|
wl_list_remove(&c->set_hints.link);
|
||||||
wl_list_remove(&c->activate.link);
|
wl_list_remove(&c->activate.link);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
@ -1000,7 +1004,7 @@ focusclient(Client *c, int lift)
|
||||||
} else {
|
} else {
|
||||||
Client *w;
|
Client *w;
|
||||||
struct wlr_scene_node *node = old->data;
|
struct wlr_scene_node *node = old->data;
|
||||||
if ((w = node->data))
|
if (old->role_data && (w = node->data))
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
wlr_scene_rect_set_color(w->border[i], bordercolor);
|
wlr_scene_rect_set_color(w->border[i], bordercolor);
|
||||||
|
|
||||||
|
@ -1296,6 +1300,7 @@ monocle(Monitor *m)
|
||||||
continue;
|
continue;
|
||||||
resize(c, m->w.x, m->w.y, m->w.width, m->w.height, 0);
|
resize(c, m->w.x, m->w.y, m->w.width, m->w.height, 0);
|
||||||
}
|
}
|
||||||
|
focusclient(focustop(m), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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_activate, &c->activate, activatex11);
|
||||||
LISTEN(&xwayland_surface->events.request_configure, &c->configure,
|
LISTEN(&xwayland_surface->events.request_configure, &c->configure,
|
||||||
configurex11);
|
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.set_title, &c->set_title, updatetitle);
|
||||||
LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify);
|
LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify);
|
||||||
LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen,
|
LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen,
|
||||||
|
@ -2361,6 +2367,16 @@ getatom(xcb_connection_t *xc, const char *name)
|
||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
sigchld(int unused)
|
sigchld(int unused)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue