Skip to content

Commit

Permalink
Implement xdg-actionvation-unstable-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Mar 23, 2021
1 parent 03daa53 commit c8a2375
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/sway/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ struct sway_server {
struct wlr_text_input_manager_v3 *text_input;
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;

struct wlr_xdg_activation_v1 *xdg_activation_v1;
struct wl_listener xdg_activation_v1_request_activate;

// The timeout for transactions, after which a transaction is applied
// regardless of readiness.
size_t txn_timeout_ms;
Expand Down Expand Up @@ -141,5 +144,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data);
void handle_server_decoration(struct wl_listener *listener, void *data);
void handle_xdg_decoration(struct wl_listener *listener, void *data);
void handle_pointer_constraint(struct wl_listener *listener, void *data);
#if WLR_HAS_XDG_ACTIVATION
void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
void *data);
#endif

#endif
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ wlroots_features = {
'systemd': false,
'elogind': false,
'libseat': false,
'xdg-activation': false,
}
foreach name, _ : wlroots_features
var_name = 'have_' + name.underscorify()
Expand Down
4 changes: 4 additions & 0 deletions sway/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ if have_xwayland
sway_deps += xcb
endif

if wlroots_features['xdg-activation']
sway_sources += 'xdg_activation_v1.c'
endif

executable(
'sway',
sway_sources,
Expand Down
11 changes: 11 additions & 0 deletions sway/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_xcursor_manager.h>
#if WLR_HAS_XDG_ACTIVATION
#include <wlr/types/wlr_xdg_activation_v1.h>
#endif
#include <wlr/types/wlr_xdg_decoration_v1.h>
#if WLR_HAS_XDG_FOREIGN
#include <wlr/types/wlr_xdg_foreign_registry.h>
Expand Down Expand Up @@ -156,6 +159,14 @@ bool server_init(struct sway_server *server) {
wlr_primary_selection_v1_device_manager_create(server->wl_display);
wlr_viewporter_create(server->wl_display);

#if WLR_HAS_XDG_ACTIVATION
server->xdg_activation_v1 = wlr_xdg_activation_v1_create(server->wl_display);
server->xdg_activation_v1_request_activate.notify =
xdg_activation_v1_handle_request_activate;
wl_signal_add(&server->xdg_activation_v1->events.request_activate,
&server->xdg_activation_v1_request_activate);
#endif

#if WLR_HAS_XDG_FOREIGN
struct wlr_xdg_foreign_registry *foreign_registry =
wlr_xdg_foreign_registry_create(server->wl_display);
Expand Down

0 comments on commit c8a2375

Please sign in to comment.