summaryrefslogtreecommitdiffstats
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-12-01 22:11:48 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-01 22:11:48 -0500
commit0d395681feb13e41a1ba7f70a4e100e9094547f4 (patch)
treef2ad9862fffab357de9ae684e4fafdc0b2f9ba3b /sway/handlers.c
parentEnforce keyboard permissions (diff)
downloadsway-0d395681feb13e41a1ba7f70a4e100e9094547f4.tar.gz
sway-0d395681feb13e41a1ba7f70a4e100e9094547f4.tar.zst
sway-0d395681feb13e41a1ba7f70a4e100e9094547f4.zip
Enforce mouse permissions
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c23
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
730 if (focused->type == C_VIEW) { 730 if (focused->type == C_VIEW) {
731 pid_t pid = wlc_view_get_pid(focused->handle); 731 pid_t pid = wlc_view_get_pid(focused->handle);
732 if (!(get_feature_policy(pid) & FEATURE_KEYBOARD)) { 732 if (!(get_feature_policy(pid) & FEATURE_KEYBOARD)) {
733 sway_log(L_INFO, "Denying keypress to %d (%s)", pid, focused->name);
734 return EVENT_HANDLED; 733 return EVENT_HANDLED;
735 } 734 }
736 } 735 }
@@ -790,6 +789,15 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
790 } 789 }
791 790
792 pointer_position_set(&new_origin, false); 791 pointer_position_set(&new_origin, false);
792
793 swayc_t *focused = get_focused_container(&root_container);
794 if (focused->type == C_VIEW) {
795 pid_t pid = wlc_view_get_pid(focused->handle);
796 if (!(get_feature_policy(pid) & FEATURE_MOUSE)) {
797 return EVENT_HANDLED;
798 }
799 }
800
793 return EVENT_PASSTHROUGH; 801 return EVENT_PASSTHROUGH;
794} 802}
795 803
@@ -857,6 +865,12 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
857 865
858 // don't change focus or mode if fullscreen 866 // don't change focus or mode if fullscreen
859 if (swayc_is_fullscreen(focused)) { 867 if (swayc_is_fullscreen(focused)) {
868 if (focused->type == C_VIEW) {
869 pid_t pid = wlc_view_get_pid(focused->handle);
870 if (!(get_feature_policy(pid) & FEATURE_MOUSE)) {
871 return EVENT_HANDLED;
872 }
873 }
860 return EVENT_PASSTHROUGH; 874 return EVENT_PASSTHROUGH;
861 } 875 }
862 876
@@ -899,6 +913,13 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
899 return EVENT_HANDLED; 913 return EVENT_HANDLED;
900 } 914 }
901 915
916 if (focused->type == C_VIEW) {
917 pid_t pid = wlc_view_get_pid(focused->handle);
918 if (!(get_feature_policy(pid) & FEATURE_MOUSE)) {
919 return EVENT_HANDLED;
920 }
921 }
922
902 // Always send mouse release 923 // Always send mouse release
903 if (state == WLC_BUTTON_STATE_RELEASED) { 924 if (state == WLC_BUTTON_STATE_RELEASED) {
904 return EVENT_PASSTHROUGH; 925 return EVENT_PASSTHROUGH;