~bl4ckb0ne/kaiju-dev

kaiju: all: upgrade to wlroots 0.16.1 v1 APPLIED

Pedro Lucas Porcellis: 1
 all: upgrade to wlroots 0.16.1

 4 files changed, 31 insertions(+), 27 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/38267/mbox | git am -3
Learn more about email & git

[PATCH kaiju] all: upgrade to wlroots 0.16.1 Export this patch

---

This is, as discussed on IRC, a single patch upgrading to wlroots
0.16.1, will send a scene upgrade later on.

 meson.build |  2 +-
 seat.c      | 22 ++++++++++++----------
 server.c    |  6 +++---
 view.c      | 28 +++++++++++++++-------------
 4 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/meson.build b/meson.build
index 8858520..c7a48f8 100644
--- a/meson.build
+++ b/meson.build
@@ -45,7 +45,7 @@ add_project_arguments(cc.get_supported_arguments([
	'-Wno-unused-parameter',
]), language: 'c')

wlroots_version = ['>=0.15.0', '<0.16.0']
wlroots_version = ['>=0.16.1', '<0.17.0']
subproject(
	'wlroots',
	default_options: ['warning_level=2', 'examples=false'],
diff --git a/seat.c b/seat.c
index 369ea44..0b72fba 100644
--- a/seat.c
+++ b/seat.c
@@ -55,11 +55,13 @@ new_pointer(struct kaiju_seat *seat, struct kaiju_input_device *device)
static void
new_keyboard(struct kaiju_seat *seat, struct kaiju_input_device *device)
{
	struct wlr_keyboard *keyboard = device->wlr_input_device->keyboard;
	struct wlr_keyboard *keyboard =
		wlr_keyboard_from_input_device(device->wlr_input_device);

	wlr_keyboard_set_keymap(keyboard,
			seat->wlr_keyboard_group->keyboard.keymap);
	wlr_keyboard_group_add_keyboard(seat->wlr_keyboard_group, keyboard);
	wlr_seat_set_keyboard(seat->wlr_seat, device->wlr_input_device);
	wlr_seat_set_keyboard(seat->wlr_seat, keyboard);
}

void
@@ -108,7 +110,7 @@ keyboard_key_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_seat *seat = wl_container_of(listener, seat,
			keyboard_events.key);
	struct wlr_event_keyboard_key *event = data;
	struct wlr_keyboard_key_event *event = data;

	wlr_seat_keyboard_notify_key(seat->wlr_seat, event->time_msec,
			event->keycode, event->state);
@@ -148,9 +150,9 @@ cursor_motion_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_seat *seat = wl_container_of(listener, seat,
			cursor_events.motion);
	struct wlr_event_pointer_motion *event = data;
	struct wlr_pointer_motion_event *event = data;

	wlr_cursor_move(seat->wlr_cursor, event->device, event->delta_x,
	wlr_cursor_move(seat->wlr_cursor, &event->pointer->base, event->delta_x,
			event->delta_y);

	cursor_motion(seat, event->time_msec);
@@ -161,10 +163,10 @@ cursor_absolute_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_seat *seat = wl_container_of(listener, seat,
			cursor_events.motion_absolute);
	struct wlr_event_pointer_motion_absolute *event = data;
	struct wlr_pointer_motion_absolute_event *event = data;

	wlr_cursor_warp_absolute(seat->wlr_cursor, event->device, event->x,
			event->y);
	wlr_cursor_warp_absolute(seat->wlr_cursor, &event->pointer->base,
			event->x, event->y);

	cursor_motion(seat, event->time_msec);
}
@@ -174,7 +176,7 @@ cursor_button_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_seat *seat = wl_container_of(listener, seat,
			cursor_events.button);
	struct wlr_event_pointer_button *event = data;
	struct wlr_pointer_button_event *event = data;

	wlr_seat_pointer_notify_button(seat->wlr_seat, event->time_msec,
			event->button, event->state);
@@ -196,7 +198,7 @@ cursor_axis_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_seat *seat = wl_container_of(listener, seat,
			cursor_events.axis);
	struct wlr_event_pointer_axis *event = data;
	struct wlr_pointer_axis_event *event = data;

	wlr_seat_pointer_notify_axis(seat->wlr_seat, event->time_msec,
			event->orientation, event->delta, event->delta_discrete,
diff --git a/server.c b/server.c
index acaea16..a0c09c8 100644
--- a/server.c
+++ b/server.c
@@ -121,11 +121,11 @@ new_virtual_keyboard_handler(struct wl_listener *listener, void *data)
{
	struct kaiju_server *server = wl_container_of(listener, server,
			events.new_virtual_keyboard);
	struct wlr_virtual_keyboard_v1 *keyboard = data;
	struct wlr_virtual_keyboard_v1 *vkeyboard = data;

	wlr_log(WLR_DEBUG, "handling new virtual keyboard");

	kaiju_seat_new_device(server->seat, &keyboard->input_device);
	kaiju_seat_new_device(server->seat, &vkeyboard->keyboard.base);
}

bool
@@ -169,7 +169,7 @@ kaiju_server_init(struct kaiju_server *server)

	server->seat = kaiju_seat_create(server);

	server->shells.xdg = wlr_xdg_shell_create(server->wl_display);
	server->shells.xdg = wlr_xdg_shell_create(server->wl_display, 3);
	server->shells.layer = wlr_layer_shell_v1_create(server->wl_display);

	server->events.new_input.notify = new_input_handler;
diff --git a/view.c b/view.c
index e12fc1f..5e81d33 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,27 @@ 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;

		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);
		view->x = layout.x;
		view->y = layout.y;

		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;
	}
}

-- 
2.39.0
Thanks!

Applied in 221ce6d