~bl4ckb0ne/kaiju-dev

wlroots: build from subproject first before finding as dependency v1 NEEDS REVISION

Pedro Lucas Porcellis: 1
 wlroots: build from subproject first before finding as dependency

 3 files changed, 30 insertions(+), 24 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~bl4ckb0ne/kaiju-dev/patches/29475/mbox | git am -3
Learn more about email & git

[PATCH] wlroots: build from subproject first before finding as dependency Export this patch

This allows us to set kaiju to track wlroots upstream and always be
up-to-date with the latest work on it. This patch also updates kaiju to
deal with wlroots version 252b2348.
---

I've also removed the -pedantic flag, because meson was complaining on
wlroots's wlr_log method and I couldn't really find a way to fix it.
Also, noticed that -Dwarning_level=3 is already set per subproject, so I
think we actually don't need it?
 layer.c     |  8 ++++----
 meson.build | 14 ++++++++++----
 view.c      | 32 ++++++++++++++++----------------
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/layer.c b/layer.c
index 31e9dc3..1ac7853 100644
--- a/layer.c
+++ b/layer.c
@@ -223,7 +223,7 @@ layer_map_handler(struct wl_listener *listener, void *data)
	struct kaiju_layer *layer = wl_container_of(listener, layer,
			events.map);

	wlr_log(WLR_DEBUG, "map layer %p", layer);
	wlr_log(WLR_DEBUG, "map layer %p", (void *)layer);

	layer->mapped = true;

@@ -236,7 +236,7 @@ layer_unmap_handler(struct wl_listener *listener, void *data)
	struct kaiju_layer *layer = wl_container_of(listener, layer,
			events.unmap);

	wlr_log(WLR_DEBUG, "unmap layer %p", layer);
	wlr_log(WLR_DEBUG, "unmap layer %p", (void *)layer);

	layer->mapped = false;

@@ -248,7 +248,7 @@ layer_destroy_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_layer *layer = wl_container_of(listener, layer,
			events.destroy);
	wlr_log(WLR_ERROR, "destroying layer %p", layer);
	wlr_log(WLR_ERROR, "destroying layer %p", (void *)layer);

	wl_list_remove(&layer->events.map.link);
	wl_list_remove(&layer->events.unmap.link);
@@ -277,7 +277,7 @@ new_kaiju_layer_handler(struct wl_listener *listener, void *data)
	}

	struct kaiju_layer *layer = calloc(1, sizeof(struct kaiju_layer));
	wlr_log(WLR_DEBUG, "new layer %p", layer);
	wlr_log(WLR_DEBUG, "new layer %p", (void *)layer);

	layer->wlr_layer_surface = layer_surface;
	layer->mapped = false;
diff --git a/meson.build b/meson.build
index 97593de..749537e 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
	'c',
	version: '0.1',
	license: 'MIT',
	meson_version: '>=0.54.0',
	meson_version: '>=0.60.0',
	default_options: [
		'c_std=c11',
		'warning_level=3',
@@ -22,7 +22,6 @@ add_project_arguments(
cc = meson.get_compiler('c')

add_project_arguments(cc.get_supported_arguments([
	'-pedantic',
	'-Wundef',
	'-Wlogical-op',
	'-Wmissing-include-dirs',
@@ -47,12 +46,19 @@ add_project_arguments(cc.get_supported_arguments([
	'-Wno-unused-parameter',
]), language: 'c')

wlroots_version = ['>=0.16.0', '<0.17.0']
subproject(
	'wlroots',
	default_options: ['examples=false'],
	required: false,
	version: wlroots_version,
)

wayland_server = dependency('wayland-server')
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
wlroots = dependency('wlroots')
xkbcommon = dependency('xkbcommon')

wlroots = dependency('wlroots', version: wlroots_version)
subdir('protocol')

kaiju_src = files(
diff --git a/view.c b/view.c
index e12fc1f..63be0d9 100644
--- a/view.c
+++ b/view.c
@@ -26,7 +26,7 @@ kaiju_view_focus(struct kaiju_view *view)
		/* Deactivate the previous surface */
		struct wlr_xdg_surface *xdg_previous =
			wlr_xdg_surface_from_wlr_surface(previous);
		wlr_xdg_toplevel_set_activated(xdg_previous, false);
		wlr_xdg_toplevel_set_activated(xdg_previous->toplevel, false);
	}

	struct kaiju_server *server = view->server;
@@ -37,7 +37,7 @@ kaiju_view_focus(struct kaiju_view *view)
	wl_list_insert(&server->views, &view->link);

	/* Activate the current surface */
	wlr_xdg_toplevel_set_activated(view->wlr_xdg_surface, true);
	wlr_xdg_toplevel_set_activated(view->wlr_xdg_surface->toplevel, true);

	/* Tell the seat to give keyboard input to the surface */
	wlr_seat_keyboard_notify_enter(seat, surface, keyboard->keycodes,
@@ -59,25 +59,25 @@ kaiju_view_position(struct kaiju_view *view)
{
	assert(view);

	struct wlr_box *layout = wlr_output_layout_get_box(
			view->server->wlr_output_layout, NULL);
	struct wlr_box layout;
	wlr_output_layout_get_box(view->server->wlr_output_layout, NULL, &layout);

	//if (view->wlr_xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
	if (!view->wlr_xdg_surface->toplevel->parent) {
		/* The parent view should occupy all the screen space */
		view->x = layout->x;
		view->y = layout->y;
		view->x = layout.x;
		view->y = layout.y;

		wlr_xdg_toplevel_set_size(view->wlr_xdg_surface,
				(uint32_t)layout->width,
				(uint32_t)layout->height);
		wlr_xdg_toplevel_set_maximized(view->wlr_xdg_surface, true);
		wlr_xdg_toplevel_set_size(view->wlr_xdg_surface->toplevel,
				(uint32_t)layout.width,
				(uint32_t)layout.height);
		wlr_xdg_toplevel_set_maximized(view->wlr_xdg_surface->toplevel, true);
	} else {
		/* The child view should be centered */
		int width, height;
		kaiju_view_get_geometry(view, &width, &height);
		view->x = (layout->width - width) / 2;
		view->y = (layout->height - height) / 2;
		view->x = (layout.width - width) / 2;
		view->y = (layout.height - height) / 2;
	}
}

@@ -86,7 +86,7 @@ view_map_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_view *view = wl_container_of(listener, view, events.map);
	assert(view);
	wlr_log(WLR_DEBUG, "map view %p", view);
	wlr_log(WLR_DEBUG, "map view %p", (void *)view);

	view->mapped = true;

@@ -100,7 +100,7 @@ view_unmap_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_view *view = wl_container_of(listener, view, events.unmap);
	assert(view);
	wlr_log(WLR_DEBUG, "unmap view %p", view);
	wlr_log(WLR_DEBUG, "unmap view %p", (void *)view);

	view->mapped = false;
}
@@ -111,7 +111,7 @@ view_destroy_handler(struct wl_listener *listener, void *data)
	struct kaiju_view *view = wl_container_of(listener, view,
			events.destroy);
	assert(view);
	wlr_log(WLR_DEBUG, "destroying view %p", view);
	wlr_log(WLR_DEBUG, "destroying view %p", (void *)view);

	wl_list_remove(&view->link);
	free(view);
@@ -124,7 +124,7 @@ struct kaiju_view *kaiju_view_create(struct kaiju_server *server,
	assert(surface);

	struct kaiju_view *view = calloc(1, sizeof(struct kaiju_view));
	wlr_log(WLR_DEBUG, "creating view %p", view);
	wlr_log(WLR_DEBUG, "creating view %p", (void *)view);

	view->server = server;
	view->wlr_xdg_surface = surface;
-- 
2.34.1
Thanks for the patch, the subproject is a very nice to have, but I don't think
we should make the move to an upstream wlroots, there is not interesting
stuff in 0.16.0 [1] yet, we can stick with 0.15.0 for the time being.