diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-12-01 22:11:48 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-12-01 22:11:48 -0500 |
commit | 0d395681feb13e41a1ba7f70a4e100e9094547f4 (patch) | |
tree | f2ad9862fffab357de9ae684e4fafdc0b2f9ba3b /sway | |
parent | 8aeeacf178b234cefd046aa4ea8ec9c076d3f7b1 (diff) |
Enforce mouse permissions
Diffstat (limited to 'sway')
-rw-r--r-- | sway/handlers.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 3b85679d..a329329d 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -730,7 +730,6 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier if (focused->type == C_VIEW) { pid_t pid = wlc_view_get_pid(focused->handle); if (!(get_feature_policy(pid) & FEATURE_KEYBOARD)) { - sway_log(L_INFO, "Denying keypress to %d (%s)", pid, focused->name); return EVENT_HANDLED; } } @@ -790,6 +789,15 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct } pointer_position_set(&new_origin, false); + + swayc_t *focused = get_focused_container(&root_container); + if (focused->type == C_VIEW) { + pid_t pid = wlc_view_get_pid(focused->handle); + if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { + return EVENT_HANDLED; + } + } + return EVENT_PASSTHROUGH; } @@ -857,6 +865,12 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w // don't change focus or mode if fullscreen if (swayc_is_fullscreen(focused)) { + if (focused->type == C_VIEW) { + pid_t pid = wlc_view_get_pid(focused->handle); + if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { + return EVENT_HANDLED; + } + } return EVENT_PASSTHROUGH; } @@ -899,6 +913,13 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w return EVENT_HANDLED; } + if (focused->type == C_VIEW) { + pid_t pid = wlc_view_get_pid(focused->handle); + if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { + return EVENT_HANDLED; + } + } + // Always send mouse release if (state == WLC_BUTTON_STATE_RELEASED) { return EVENT_PASSTHROUGH; |