From d2995d1eb2f541db845c60c11420bf81ee0143ab Mon Sep 17 00:00:00 2001 From: taiyu Date: Mon, 17 Aug 2015 11:24:45 -0700 Subject: [PATCH 1/2] fixed handling of views with override_redirect (dmenu) --- sway/handlers.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index b166b7a6..78ca7438 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -13,6 +13,8 @@ #include "container.h" static struct wlc_origin mouse_origin; +//Keyboard input is being overrided by window (dmenu) +static bool override_redirect = false; static bool pointer_test(swayc_t *view, void *_origin) { const struct wlc_origin *origin = _origin; @@ -98,6 +100,7 @@ static bool handle_view_created(wlc_handle handle) { } // For things like Dmenu if (type & WLC_BIT_OVERRIDE_REDIRECT) { + override_redirect = true; wlc_view_focus(handle); } @@ -134,14 +137,14 @@ static void handle_view_destroyed(wlc_handle handle) { wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); sway_log(L_DEBUG,"Unmanaged window of type %x was destroyed", type); if (type & WLC_BIT_UNMANAGED) { - focus_view(focus_pointer()); + focus_pointer(); arrange_windows(active_workspace, -1, -1); return; } if (type & WLC_BIT_OVERRIDE_REDIRECT) { - focus_view(focus_pointer()); - arrange_windows(active_workspace, -1, -1); + override_redirect = false; + focus_pointer(); return; } if (type & WLC_BIT_POPUP) { @@ -221,6 +224,9 @@ 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, uint32_t sym, enum wlc_key_state state) { enum { QSIZE = 32 }; + if (override_redirect) { + return false; + } static uint8_t head = 0; static uint32_t array[QSIZE]; bool cmd_success = false; From 199ba05ef16fab4d1027e8db909251a3fb31e49a Mon Sep 17 00:00:00 2001 From: taiyu Date: Mon, 17 Aug 2015 11:44:05 -0700 Subject: [PATCH 2/2] put back --- sway/handlers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index 78ca7438..5c673697 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -38,7 +38,7 @@ swayc_t *focus_pointer(void) { if (pointer && focused != pointer) { unfocus_all(&root_container); focus_view(pointer); - } else if (!focused){ + } else if (!focused) { focus_view(active_workspace); } focused = pointer; @@ -137,14 +137,14 @@ static void handle_view_destroyed(wlc_handle handle) { wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); sway_log(L_DEBUG,"Unmanaged window of type %x was destroyed", type); if (type & WLC_BIT_UNMANAGED) { - focus_pointer(); + focus_view(focus_pointer()); arrange_windows(active_workspace, -1, -1); return; } if (type & WLC_BIT_OVERRIDE_REDIRECT) { override_redirect = false; - focus_pointer(); + focus_view(focus_pointer()); return; } if (type & WLC_BIT_POPUP) {