Skip to content

Commit 31d6e60

Browse files
committed
wlroots: Adds 0.19 as submodule dependency and update code to build against it.
1 parent 1483f15 commit 31d6e60

File tree

8 files changed

+35
-72
lines changed

8 files changed

+35
-72
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.13)
2121
# * pixman at pixman-0.43.0
2222

2323
PKG_CHECK_MODULES(WAYLAND_SERVER REQUIRED IMPORTED_TARGET wayland-server>=1.22.0)
24-
# We build for wlroots 0.18.
25-
PKG_CHECK_MODULES(WLROOTS IMPORTED_TARGET wlroots-0.18>=0.18)
24+
# We build for wlroots 0.19 or 0.18.
25+
PKG_CHECK_MODULES(WLROOTS IMPORTED_TARGET wlroots-0.19>=0.19)
26+
IF(NOT WLROOTS_FOUND)
27+
PKG_CHECK_MODULES(WLROOTS REQUIRED IMPORTED_TARGET wlroots-0.18>=0.18)
28+
ENDIF(NOT WLROOTS_FOUND)
2629
PKG_CHECK_MODULES(XCB REQUIRED IMPORTED_TARGET xcb>=1.15)
2730
# XWayland considered optional.
2831
PKG_CHECK_MODULES(XWAYLAND xwayland>=22.1.9)

src/cursor.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ wlmaker_cursor_t *wlmaker_cursor_create(
150150
/* ------------------------------------------------------------------------- */
151151
void wlmaker_cursor_destroy(wlmaker_cursor_t *cursor_ptr)
152152
{
153+
wlmtk_util_disconnect_listener(
154+
&cursor_ptr->seat_request_set_cursor_listener);
155+
if (NULL != cursor_ptr->wlr_cursor_ptr) {
156+
wlmtk_util_disconnect_listener(&cursor_ptr->frame_listener);
157+
wlmtk_util_disconnect_listener(&cursor_ptr->axis_listener);
158+
wlmtk_util_disconnect_listener(&cursor_ptr->button_listener);
159+
wlmtk_util_disconnect_listener(&cursor_ptr->motion_absolute_listener);
160+
wlmtk_util_disconnect_listener(&cursor_ptr->motion_listener);
161+
}
162+
153163
if (NULL != cursor_ptr->pointer_ptr) {
154164
wlmtk_pointer_destroy(cursor_ptr->pointer_ptr);
155165
cursor_ptr->pointer_ptr = NULL;

src/toolkit/test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#define WLR_USE_UNSTABLE
2626
#include <wlr/types/wlr_output.h>
2727
#include <wlr/util/addon.h>
28+
#include <wlr/version.h>
2829
#undef WLR_USE_UNSTABLE
2930

3031
/* == Exported methods ===================================================== */
@@ -34,7 +35,11 @@ void wlmtk_test_wlr_output_init(struct wlr_output *wlr_output_ptr)
3435
{
3536
wlr_addon_set_init(&wlr_output_ptr->addons);
3637
wlr_addon_set_init(&wlr_output_ptr->addons);
38+
#if WLR_VERSION_NUM >= (19 << 8)
39+
wl_list_init(&wlr_output_ptr->WLR_PRIVATE.display_destroy.link);
40+
#else // WLR_VERSION_NUM >= (19 << 8)
3741
wl_list_init(&wlr_output_ptr->display_destroy.link);
42+
#endif // WLR_VERSION_NUM >= (19 << 8)
3843
wl_list_init(&wlr_output_ptr->modes);
3944
wl_list_init(&wlr_output_ptr->resources);
4045
wl_signal_init(&wlr_output_ptr->events.commit);

src/xdg_decoration.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,13 @@ void handle_decoration_request_mode(
308308
BS_ABORT();
309309
}
310310

311-
wlr_xdg_toplevel_decoration_v1_set_mode(
312-
decoration_ptr->wlr_xdg_toplevel_decoration_v1_ptr, mode);
311+
// TODO(kaeser@gubbe.ch): Setting the mode expects the surface to have been
312+
// committed already. Need to implement server-side state tracking and
313+
// applying these modes downstream after first commit.
314+
if (decoration_ptr->wlr_xdg_toplevel_decoration_v1_ptr->toplevel->base->initialized) {
315+
wlr_xdg_toplevel_decoration_v1_set_mode(
316+
decoration_ptr->wlr_xdg_toplevel_decoration_v1_ptr, mode);
317+
}
313318

314319
if (NULL != content_ptr) {
315320
bs_log(BS_INFO, "XDG decoration request_mode for XDG surface %p, "

src/xdg_popup.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ wlmaker_xdg_popup_t *wlmaker_xdg_popup_create(
103103
&wlmaker_xdg_popup_ptr->reposition_listener,
104104
handle_reposition);
105105
wlmtk_util_connect_listener_signal(
106-
#if WLR_VERSION_NUM >= (18 << 8)
107106
&wlr_xdg_popup_ptr->events.destroy,
108-
#else // WLR_VERSION_NUM >= (18 << 8)
109-
&wlr_xdg_popup_ptr->base->events.destroy,
110-
#endif // WLR_VERSION_NUM >= (18 << 8)
111107
&wlmaker_xdg_popup_ptr->destroy_listener,
112108
handle_destroy);
113109
wlmtk_util_connect_listener_signal(

src/xdg_shell.c

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,12 @@ static void handle_destroy(
3737
struct wl_listener *listener_ptr,
3838
void *data_ptr);
3939

40-
#if WLR_VERSION_NUM >= (18 << 8)
4140
static void handle_new_toplevel(
4241
struct wl_listener *listener_ptr,
4342
void *data_ptr);
4443
static void handle_new_popup(
4544
struct wl_listener *listener_ptr,
4645
void *data_ptr);
47-
#else // WLR_VERSION_NUM >= (18 << )8
48-
static void handle_new_surface(
49-
struct wl_listener *listener_ptr,
50-
void *data_ptr);
51-
#endif // WLR_VERSION_NUM >= (18 << 8)
5246

5347
/* == Exported methods ===================================================== */
5448

@@ -67,7 +61,6 @@ wlmaker_xdg_shell_t *wlmaker_xdg_shell_create(wlmaker_server_t *server_ptr)
6761
return NULL;
6862
}
6963

70-
#if WLR_VERSION_NUM >= (18 << 8)
7164
wlmtk_util_connect_listener_signal(
7265
&xdg_shell_ptr->wlr_xdg_shell_ptr->events.new_toplevel,
7366
&xdg_shell_ptr->new_toplevel_listener,
@@ -76,12 +69,6 @@ wlmaker_xdg_shell_t *wlmaker_xdg_shell_create(wlmaker_server_t *server_ptr)
7669
&xdg_shell_ptr->wlr_xdg_shell_ptr->events.new_popup,
7770
&xdg_shell_ptr->new_popup_listener,
7871
handle_new_popup);
79-
#else // WLR_VERSION_NUM >= (18 << 8)
80-
wlmtk_util_connect_listener_signal(
81-
&xdg_shell_ptr->wlr_xdg_shell_ptr->events.new_surface,
82-
&xdg_shell_ptr->new_surface_listener,
83-
handle_new_surface);
84-
#endif // WLR_VERSION_NUM >= (18 << 8)
8572
wlmtk_util_connect_listener_signal(
8673
&xdg_shell_ptr->wlr_xdg_shell_ptr->events.destroy,
8774
&xdg_shell_ptr->destroy_listener,
@@ -94,12 +81,8 @@ wlmaker_xdg_shell_t *wlmaker_xdg_shell_create(wlmaker_server_t *server_ptr)
9481
void wlmaker_xdg_shell_destroy(wlmaker_xdg_shell_t *xdg_shell_ptr)
9582
{
9683
wl_list_remove(&xdg_shell_ptr->destroy_listener.link);
97-
#if WLR_VERSION_NUM >= (18 << 8)
9884
wl_list_remove(&xdg_shell_ptr->new_popup_listener.link);
9985
wl_list_remove(&xdg_shell_ptr->new_toplevel_listener.link);
100-
#else // WLR_VERSION_NUM >= (18 << 8)
101-
wl_list_remove(&xdg_shell_ptr->new_surface_listener.link);
102-
#endif // WLR_VERSION_NUM >= (18 << 8)
10386
// Note: xdg_shell_ptr->wlr_xdg_shell_ptr is destroyed when the display
10487
// is destroyed.
10588
free(xdg_shell_ptr);
@@ -123,7 +106,6 @@ void handle_destroy(struct wl_listener *listener_ptr,
123106
wlmaker_xdg_shell_destroy(xdg_shell_ptr);
124107
}
125108

126-
#if WLR_VERSION_NUM >= (18 << 8)
127109
/* ------------------------------------------------------------------------- */
128110
/**
129111
* Event handler for the `new_toplevel` signal raised by `wlr_xdg_shell`.
@@ -167,43 +149,4 @@ void handle_new_popup(struct wl_listener *listener_ptr,
167149
}
168150
}
169151

170-
#else // WLR_VERSION_NUM >= (18 << 8)
171-
172-
/* ------------------------------------------------------------------------- */
173-
/**
174-
* Event handler for the `new_surface` signal raised by `wlr_xdg_shell`.
175-
*
176-
* @param listener_ptr
177-
* @param data_ptr
178-
*/
179-
void handle_new_surface(struct wl_listener *listener_ptr,
180-
void *data_ptr)
181-
{
182-
struct wlr_xdg_surface *wlr_xdg_surface_ptr;
183-
wlmaker_xdg_shell_t *xdg_shell_ptr = BS_CONTAINER_OF(
184-
listener_ptr, wlmaker_xdg_shell_t, new_surface_listener);
185-
wlr_xdg_surface_ptr = data_ptr;
186-
187-
switch (wlr_xdg_surface_ptr->role) {
188-
case WLR_XDG_SURFACE_ROLE_POPUP:
189-
// We're dealing with popups separately -- via the `new_popup` signal
190-
// from the `wlr_xdg_surface` for popups as children of XDG shell
191-
// surfaces, respectively the `new_popup` signal of the
192-
// `wlr_scene_layer_surface` for popups of the WLR layer surface.
193-
break;
194-
195-
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:;
196-
wlmtk_window_t *window_ptr = wlmtk_window_create_from_xdg_toplevel(
197-
wlr_xdg_surface_ptr->toplevel, xdg_shell_ptr->server_ptr);
198-
bs_log(BS_INFO, "XDG shell: Toolkit window %p for surface %p",
199-
window_ptr, wlr_xdg_surface_ptr);
200-
break;
201-
202-
default:
203-
bs_log(BS_ERROR, "Unhandled role: %d", wlr_xdg_surface_ptr->role);
204-
}
205-
}
206-
207-
#endif // WLR_VERSION_NUM >= (18 << 8)
208-
209152
/* == End of xdg_shell.c =================================================== */

src/xdg_toplevel.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,7 @@ xdg_toplevel_surface_t *xdg_toplevel_surface_create(
248248
&xdg_tl_surface_ptr->super_content.client.gid);
249249

250250
wlmtk_util_connect_listener_signal(
251-
#if WLR_VERSION_NUM >= (18 << 8)
252251
&wlr_xdg_toplevel_ptr->events.destroy,
253-
#else // WLR_VERSION_NUM >= (18 << 8)
254-
&wlr_xdg_toplevel_ptr->base->events.destroy,
255-
#endif // WLR_VERSION_NUM >= (18 << 8)
256252
&xdg_tl_surface_ptr->destroy_listener,
257253
handle_destroy);
258254
wlmtk_util_connect_listener_signal(
@@ -598,8 +594,13 @@ void handle_toplevel_request_maximize(
598594
// Protocol expects an `ack_configure`. Depending on current state, that
599595
// may not have been sent throught @ref wlmtk_window_request_maximized,
600596
// hence adding an explicit `ack_configure` here.
601-
wlr_xdg_surface_schedule_configure(
602-
xdg_tl_surface_ptr->wlr_xdg_toplevel_ptr->base);
597+
// TODO(kaeser@gubbe.ch): Setting the mode expects the surface to have been
598+
// committed already. Need to implement server-side state tracking and
599+
// applying these modes downstream after first commit.
600+
if (xdg_tl_surface_ptr->wlr_xdg_toplevel_ptr->base->initialized) {
601+
wlr_xdg_surface_schedule_configure(
602+
xdg_tl_surface_ptr->wlr_xdg_toplevel_ptr->base);
603+
}
603604
}
604605

605606
/* ------------------------------------------------------------------------- */

0 commit comments

Comments
 (0)