diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/extensions.c | 19 | ||||
-rw-r--r-- | sway/handlers.c | 8 |
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 | |||
89 | } | 89 | } |
90 | 90 | ||
91 | static void set_lock_surface(struct wl_client *client, struct wl_resource *resource, | 91 | static void set_lock_surface(struct wl_client *client, struct wl_resource *resource, |
92 | struct wl_resource *output, struct wl_resource *surface) { | 92 | struct wl_resource *_output, struct wl_resource *surface) { |
93 | sway_log(L_ERROR, "set_lock_surface is not currently supported"); | 93 | swayc_t *output = swayc_by_handle(wlc_handle_from_wl_output_resource(_output)); |
94 | swayc_t *view = swayc_by_handle(wlc_handle_from_wl_surface_resource(surface)); | ||
95 | if (view && output) { | ||
96 | swayc_t *workspace = output->focused; | ||
97 | if (!swayc_is_child_of(view, workspace)) { | ||
98 | move_container_to(view, workspace); | ||
99 | } | ||
100 | wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true); | ||
101 | workspace->fullscreen = view; | ||
102 | desktop_shell.is_locked = true; | ||
103 | set_focused_container(view); | ||
104 | arrange_windows(view, -1, -1); | ||
105 | } else { | ||
106 | sway_log(L_ERROR, "Attempted to set lock surface to non-view"); | ||
107 | } | ||
94 | } | 108 | } |
95 | 109 | ||
96 | static void unlock(struct wl_client *client, struct wl_resource *resource) { | 110 | static void unlock(struct wl_client *client, struct wl_resource *resource) { |
97 | sway_log(L_ERROR, "unlock is not currently supported"); | 111 | sway_log(L_ERROR, "unlock is not currently supported"); |
112 | // This isn't really necessary, we just unlock when the client exits. | ||
98 | } | 113 | } |
99 | 114 | ||
100 | static void set_grab_surface(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface) { | 115 | 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 | |||
331 | static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, | 331 | static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, |
332 | uint32_t key, enum wlc_key_state state) { | 332 | uint32_t key, enum wlc_key_state state) { |
333 | 333 | ||
334 | if (desktop_shell.is_locked) { | ||
335 | return EVENT_PASSTHROUGH; | ||
336 | } | ||
337 | |||
334 | if (locked_view_focus && state == WLC_KEY_STATE_PRESSED) { | 338 | if (locked_view_focus && state == WLC_KEY_STATE_PRESSED) { |
335 | return EVENT_PASSTHROUGH; | 339 | return EVENT_PASSTHROUGH; |
336 | } | 340 | } |
@@ -383,6 +387,10 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
383 | } | 387 | } |
384 | 388 | ||
385 | static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_point *origin) { | 389 | static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_point *origin) { |
390 | if (desktop_shell.is_locked) { | ||
391 | return EVENT_PASSTHROUGH; | ||
392 | } | ||
393 | |||
386 | struct wlc_point new_origin = *origin; | 394 | struct wlc_point new_origin = *origin; |
387 | // Switch to adjacent output if touching output edge. | 395 | // Switch to adjacent output if touching output edge. |
388 | // | 396 | // |