aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-12-18 19:29:44 -0500
committerDrew DeVault <sir@cmpwn.com>2015-12-18 19:30:19 -0500
commit3282163f64291cfd63611110ab63e37051e80501 (patch)
tree7e89557c10e4bcc8415e482ad37106cc2e334236 /sway
parenteefc93db43ab6d5d308970afa43919a68bde2b79 (diff)
downloadsway-3282163f64291cfd63611110ab63e37051e80501.tar.xz
Implement compositor support for swaylock
This makes swaylock more or less work.
Diffstat (limited to 'sway')
-rw-r--r--sway/extensions.c19
-rw-r--r--sway/handlers.c8
2 files changed, 25 insertions, 2 deletions
diff --git a/sway/extensions.c b/sway/extensions.c
index 1ca66468..5e09bdbb 100644
--- a/sway/extensions.c
+++ b/sway/extensions.c
@@ -89,12 +89,27 @@ static void desktop_unlock(struct wl_client *client, struct wl_resource *resourc
}
static void set_lock_surface(struct wl_client *client, struct wl_resource *resource,
- struct wl_resource *output, struct wl_resource *surface) {
- sway_log(L_ERROR, "set_lock_surface is not currently supported");
+ struct wl_resource *_output, struct wl_resource *surface) {
+ swayc_t *output = swayc_by_handle(wlc_handle_from_wl_output_resource(_output));
+ swayc_t *view = swayc_by_handle(wlc_handle_from_wl_surface_resource(surface));
+ if (view && output) {
+ swayc_t *workspace = output->focused;
+ if (!swayc_is_child_of(view, workspace)) {
+ move_container_to(view, workspace);
+ }
+ wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true);
+ workspace->fullscreen = view;
+ desktop_shell.is_locked = true;
+ set_focused_container(view);
+ arrange_windows(view, -1, -1);
+ } else {
+ sway_log(L_ERROR, "Attempted to set lock surface to non-view");
+ }
}
static void unlock(struct wl_client *client, struct wl_resource *resource) {
sway_log(L_ERROR, "unlock is not currently supported");
+ // This isn't really necessary, we just unlock when the client exits.
}
static void set_grab_surface(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface) {
diff --git a/sway/handlers.c b/sway/handlers.c
index 136ef577..3161c677 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -331,6 +331,10 @@ static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit s
static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,
uint32_t key, enum wlc_key_state state) {
+ if (desktop_shell.is_locked) {
+ return EVENT_PASSTHROUGH;
+ }
+
if (locked_view_focus && state == WLC_KEY_STATE_PRESSED) {
return EVENT_PASSTHROUGH;
}
@@ -383,6 +387,10 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
}
static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_point *origin) {
+ if (desktop_shell.is_locked) {
+ return EVENT_PASSTHROUGH;
+ }
+
struct wlc_point new_origin = *origin;
// Switch to adjacent output if touching output edge.
//