Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
xdg-activation-v1: new protocol implementation
Browse files Browse the repository at this point in the history
This implements the new xdg-activation-v1 protocol [1].

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/50
  • Loading branch information
emersion committed May 17, 2021
1 parent 6369f70 commit 820db44
Show file tree
Hide file tree
Showing 5 changed files with 394 additions and 3 deletions.
59 changes: 59 additions & 0 deletions include/wlr/types/wlr_xdg_activation_v1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif

#ifndef WLR_TYPES_WLR_XDG_ACTIVATION_V1
#define WLR_TYPES_WLR_XDG_ACTIVATION_V1

#include <wayland-server-core.h>

struct wlr_xdg_activation_token_v1 {
struct wlr_xdg_activation_v1 *activation;
struct wl_list link; // wlr_xdg_activation_v1.tokens

// The source surface that created the token.
struct wlr_surface *surface; // can be NULL
// The seat on which activation is being requested.
struct wlr_seat *seat; // can be NULL
// The serial for the input event that created the token.
uint32_t serial; // invalid if seat is NULL
// The application ID to be activated. This is just a hint.
char *app_id; // can be NULL

// private state

char *token;
struct wl_resource *resource; // can be NULL

struct wl_listener seat_destroy;
struct wl_listener surface_destroy;
};

struct wlr_xdg_activation_v1 {
struct wl_global *global;

struct wl_list tokens; // wlr_xdg_activation_token_v1.link

struct {
struct wl_signal destroy;
struct wl_signal request_activate; // wlr_xdg_activation_v1_request_activate_event
} events;

struct wl_listener display_destroy;
};

struct wlr_xdg_activation_v1_request_activate_event {
// The token used to request activation.
struct wlr_xdg_activation_token_v1 *token;
// The surface requesting for activation.
struct wlr_surface *surface;
};

struct wlr_xdg_activation_v1 *wlr_xdg_activation_v1_create(
struct wl_display *display);

#endif
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ pixman = dependency('pixman-1')
math = cc.find_library('m')
rt = cc.find_library('rt')


wlr_files = []
wlr_deps = [
wayland_server,
Expand Down
3 changes: 2 additions & 1 deletion protocol/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
wayland_protos = dependency('wayland-protocols', version: '>=1.21')
wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir')

wayland_scanner_dep = dependency('wayland-scanner', native: true)
Expand All @@ -23,6 +23,7 @@ protocols = {
'relative-pointer-unstable-v1': wl_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
'tablet-unstable-v2': wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml',
'text-input-unstable-v3': wl_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml',
'xdg-activation-v1': wl_protocol_dir / 'staging/xdg-activation/xdg-activation-v1.xml',
'xdg-decoration-unstable-v1': wl_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
'xdg-foreign-unstable-v1': wl_protocol_dir / 'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml',
'xdg-foreign-unstable-v2': wl_protocol_dir / 'unstable/xdg-foreign/xdg-foreign-unstable-v2.xml',
Expand Down
2 changes: 1 addition & 1 deletion types/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ wlr_files += files(
'wlr_virtual_keyboard_v1.c',
'wlr_virtual_pointer_v1.c',
'wlr_xcursor_manager.c',
'wlr_xdg_activation_v1.c',
'wlr_xdg_decoration_v1.c',
'wlr_xdg_foreign_v1.c',
'wlr_xdg_foreign_v2.c',
'wlr_xdg_foreign_registry.c',
'wlr_xdg_output_v1.c',
)

Loading

0 comments on commit 820db44

Please sign in to comment.