Skip to content

Commit 8ff4358

Browse files
committed
xdg-activation-v1: new protocol implementation
This implements the new xdg-activation-v1 protocol [1]. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/50
1 parent b86a0c8 commit 8ff4358

File tree

5 files changed

+391
-3
lines changed

5 files changed

+391
-3
lines changed
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* This an unstable interface of wlroots. No guarantees are made regarding the
3+
* future consistency of this API.
4+
*/
5+
#ifndef WLR_USE_UNSTABLE
6+
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
7+
#endif
8+
9+
#ifndef WLR_TYPES_WLR_XDG_ACTIVATION_V1
10+
#define WLR_TYPES_WLR_XDG_ACTIVATION_V1
11+
12+
#include <wayland-server-core.h>
13+
14+
struct wlr_xdg_activation_token_v1 {
15+
struct wlr_xdg_activation_v1 *activation;
16+
// The source surface that created the token.
17+
struct wlr_surface *surface; // can be NULL
18+
struct wlr_seat *seat; // can be NULL
19+
// The serial for the input event that created the token.
20+
uint32_t serial; // invalid if seat is NULL
21+
// The application ID to be activated. This is just a hint.
22+
char *app_id; // can be NULL
23+
struct wl_list link; // wlr_xdg_activation_v1.tokens
24+
25+
// private state
26+
27+
char *token;
28+
struct wl_resource *resource; // can be NULL
29+
30+
struct wl_listener seat_destroy;
31+
struct wl_listener surface_destroy;
32+
};
33+
34+
struct wlr_xdg_activation_v1 {
35+
36+
struct wl_list tokens; // wlr_xdg_activation_token_v1.link
37+
38+
struct {
39+
struct wl_signal destroy;
40+
struct wl_signal request_activate; // wlr_xdg_activation_v1_request_activate_event
41+
} events;
42+
43+
// private state
44+
45+
struct wl_global *global;
46+
47+
struct wl_listener display_destroy;
48+
};
49+
50+
struct wlr_xdg_activation_v1_request_activate_event {
51+
struct wlr_xdg_activation_v1 *activation;
52+
// The token used to request activation.
53+
struct wlr_xdg_activation_token_v1 *token;
54+
// The surface requesting for activation.
55+
struct wlr_surface *surface;
56+
};
57+
58+
struct wlr_xdg_activation_v1 *wlr_xdg_activation_v1_create(
59+
struct wl_display *display);
60+
61+
#endif

meson.build

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ pixman = dependency('pixman-1')
105105
math = cc.find_library('m')
106106
rt = cc.find_library('rt')
107107

108-
109108
wlr_files = []
110109
wlr_deps = [
111110
wayland_server,

protocol/meson.build

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
1+
wayland_protos = dependency('wayland-protocols', version: '>=1.21')
22
wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir')
33

44
wayland_scanner_dep = dependency('wayland-scanner', native: true)
@@ -23,6 +23,7 @@ protocols = {
2323
'relative-pointer-unstable-v1': wl_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
2424
'tablet-unstable-v2': wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml',
2525
'text-input-unstable-v3': wl_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml',
26+
'xdg-activation-v1': wl_protocol_dir / 'staging/xdg-activation/xdg-activation-v1.xml',
2627
'xdg-decoration-unstable-v1': wl_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
2728
'xdg-foreign-unstable-v1': wl_protocol_dir / 'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml',
2829
'xdg-foreign-unstable-v2': wl_protocol_dir / 'unstable/xdg-foreign/xdg-foreign-unstable-v2.xml',

types/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ wlr_files += files(
6262
'wlr_virtual_keyboard_v1.c',
6363
'wlr_virtual_pointer_v1.c',
6464
'wlr_xcursor_manager.c',
65+
'wlr_xdg_activation_v1.c',
6566
'wlr_xdg_decoration_v1.c',
6667
'wlr_xdg_foreign_v1.c',
6768
'wlr_xdg_foreign_v2.c',
6869
'wlr_xdg_foreign_registry.c',
6970
'wlr_xdg_output_v1.c',
7071
)
71-

0 commit comments

Comments
 (0)