summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-01-11 01:32:43 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2022-01-11 01:32:43 -0500
commit8b9745931430e3564229cdbbbb0e9bc40523c4d3 (patch)
tree391852b7b364a3013ec20fe57d22fecc74650072
parent0d04794b1580c3fae5da215fcac8af6d9cf5fc2d (diff)
parentf85d8e79d09bb167f133fbaa40dd01bc3d3d26a3 (diff)
Merge branch 'main' into personalpersonal
-rw-r--r--client.h30
-rw-r--r--dwl.c27
2 files changed, 31 insertions, 26 deletions
diff --git a/client.h b/client.h
index 56e3089..4fd1863 100644
--- a/client.h
+++ b/client.h
@@ -5,7 +5,7 @@
* that they will simply compile out if the chosen #defines leave them unused.
*/
-/* Leave this function first; it's used in the others */
+/* Leave these functions first; they're used in the others */
static inline int
client_is_x11(Client *c)
{
@@ -16,6 +16,16 @@ client_is_x11(Client *c)
#endif
}
+static inline struct wlr_surface *
+client_surface(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->surface;
+#endif
+ return c->surface.xdg->surface;
+}
+
/* The others */
static inline void
client_activate_surface(struct wlr_surface *s, int activated)
@@ -35,14 +45,12 @@ client_activate_surface(struct wlr_surface *s, int activated)
static inline void
client_for_each_surface(Client *c, wlr_surface_iterator_func_t fn, void *data)
{
+ wlr_surface_for_each_surface(client_surface(c), fn, data);
#ifdef XWAYLAND
- if (client_is_x11(c)) {
- wlr_surface_for_each_surface(c->surface.xwayland->surface,
- fn, data);
+ if (client_is_x11(c))
return;
- }
#endif
- wlr_xdg_surface_for_each_surface(c->surface.xdg, fn, data);
+ wlr_xdg_surface_for_each_popup_surface(c->surface.xdg, fn, data);
}
static inline const char *
@@ -153,16 +161,6 @@ client_set_tiled(Client *c, uint32_t edges)
}
static inline struct wlr_surface *
-client_surface(Client *c)
-{
-#ifdef XWAYLAND
- if (client_is_x11(c))
- return c->surface.xwayland->surface;
-#endif
- return c->surface.xdg->surface;
-}
-
-static inline struct wlr_surface *
client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
{
#ifdef XWAYLAND
diff --git a/dwl.c b/dwl.c
index 4a125e8..79791c7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -13,6 +13,7 @@
#include <libinput.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
+#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
@@ -311,6 +312,7 @@ static const char broken[] = "broken";
static struct wl_display *dpy;
static struct wlr_backend *backend;
static struct wlr_renderer *drw;
+static struct wlr_allocator *alloc;
static struct wlr_compositor *compositor;
static struct wlr_xdg_shell *xdg_shell;
@@ -562,7 +564,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int
box.y -= state->margin.bottom;
}
if (box.width < 0 || box.height < 0) {
- wlr_layer_surface_v1_close(wlr_layer_surface);
+ wlr_layer_surface_v1_destroy(wlr_layer_surface);
continue;
}
layersurface->geo = box;
@@ -788,7 +790,7 @@ commitnotify(struct wl_listener *listener, void *data)
Client *c = wl_container_of(listener, c, commit);
/* mark a pending resize as completed */
- if (c->resize && c->resize <= c->surface.xdg->configure_serial)
+ if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
c->resize = 0;
}
@@ -830,6 +832,8 @@ createmon(struct wl_listener *listener, void *data)
Monitor *m = wlr_output->data = calloc(1, sizeof(*m));
m->wlr_output = wlr_output;
+ wlr_output_init_render(wlr_output, alloc, drw);
+
/* Initialize monitor state using configured rules */
for (size_t i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -938,13 +942,13 @@ createlayersurface(struct wl_listener *listener, void *data)
wlr_layer_surface->data = layersurface;
m = wlr_layer_surface->output->data;
- wl_list_insert(&m->layers[wlr_layer_surface->client_pending.layer],
+ wl_list_insert(&m->layers[wlr_layer_surface->pending.layer],
&layersurface->link);
- // Temporarily set the layer's current state to client_pending
+ // Temporarily set the layer's current state to pending
// so that we can easily arrange it
old_state = wlr_layer_surface->current;
- wlr_layer_surface->current = wlr_layer_surface->client_pending;
+ wlr_layer_surface->current = wlr_layer_surface->pending;
arrangelayers(m);
wlr_layer_surface->current = old_state;
}
@@ -1033,7 +1037,7 @@ void
setfullscreen(Client *c, int fullscreen)
{
c->isfullscreen = fullscreen;
- c->bw = (1 - fullscreen) * borderpx;
+ c->bw = fullscreen ? 0 : borderpx;
client_set_fullscreen(c, fullscreen);
if (fullscreen) {
@@ -2040,12 +2044,15 @@ setup(void)
if (!(backend = wlr_backend_autocreate(dpy)))
BARF("couldn't create backend");
- /* If we don't provide a renderer, autocreate makes a GLES2 renderer for us.
- * The renderer is responsible for defining the various pixel formats it
- * supports for shared memory, this configures that for clients. */
- drw = wlr_backend_get_renderer(backend);
+ /* Create a renderer with the default implementation */
+ if (!(drw = wlr_renderer_autocreate(backend)))
+ BARF("couldn't create renderer");
wlr_renderer_init_wl_display(drw, dpy);
+ /* Create a default allocator */
+ if (!(alloc = wlr_allocator_autocreate(backend, drw)))
+ BARF("couldn't create allocator");
+
/* This creates some hands-off wlroots interfaces. The compositor is
* necessary for clients to allocate surfaces and the data device manager
* handles the clipboard. Each of these wlroots interfaces has room for you