diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 0bb4f613..27f6d294 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -90,6 +90,10 @@ swayc_t *container_under_pointer(void) { | |||
90 | static bool handle_output_created(wlc_handle output) { | 90 | static bool handle_output_created(wlc_handle output) { |
91 | swayc_t *op = new_output(output); | 91 | swayc_t *op = new_output(output); |
92 | 92 | ||
93 | if (!op) { | ||
94 | return false; | ||
95 | } | ||
96 | |||
93 | // Switch to workspace if we need to | 97 | // Switch to workspace if we need to |
94 | if (swayc_active_workspace() == NULL) { | 98 | if (swayc_active_workspace() == NULL) { |
95 | swayc_t *ws = op->children->items[0]; | 99 | swayc_t *ws = op->children->items[0]; |
@@ -108,6 +112,8 @@ static void handle_output_destroyed(wlc_handle output) { | |||
108 | } | 112 | } |
109 | if (i < list->length) { | 113 | if (i < list->length) { |
110 | destroy_output(list->items[i]); | 114 | destroy_output(list->items[i]); |
115 | } else { | ||
116 | return; | ||
111 | } | 117 | } |
112 | if (list->length > 0) { | 118 | if (list->length > 0) { |
113 | // switch to other outputs active workspace | 119 | // switch to other outputs active workspace |
@@ -292,22 +298,12 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
292 | 298 | ||
293 | struct sway_mode *mode = config->current_mode; | 299 | struct sway_mode *mode = config->current_mode; |
294 | 300 | ||
295 | if (sym < 70000 /* bullshit made up number */) { | ||
296 | if (!isalnum(sym) && sym != ' ' && sym != XKB_KEY_Escape && sym != XKB_KEY_Tab) { | ||
297 | // God fucking dammit | ||
298 | return EVENT_PASSTHROUGH; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | // Lowercase if necessary | ||
303 | sym = tolower(sym); | ||
304 | |||
305 | int i; | 301 | int i; |
306 | 302 | ||
307 | if (state == WLC_KEY_STATE_PRESSED) { | 303 | if (state == WLC_KEY_STATE_PRESSED) { |
308 | press_key(sym); | 304 | press_key(sym, key); |
309 | } else { // WLC_KEY_STATE_RELEASED | 305 | } else { // WLC_KEY_STATE_RELEASED |
310 | release_key(sym); | 306 | release_key(sym, key); |
311 | } | 307 | } |
312 | 308 | ||
313 | // TODO: reminder to check conflicts with mod+q+a versus mod+q | 309 | // TODO: reminder to check conflicts with mod+q+a versus mod+q |
@@ -319,7 +315,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
319 | int j; | 315 | int j; |
320 | for (j = 0; j < binding->keys->length; ++j) { | 316 | for (j = 0; j < binding->keys->length; ++j) { |
321 | xkb_keysym_t *key = binding->keys->items[j]; | 317 | xkb_keysym_t *key = binding->keys->items[j]; |
322 | if ((match = check_key(*key)) == false) { | 318 | if ((match = check_key(*key, 0)) == false) { |
323 | break; | 319 | break; |
324 | } | 320 | } |
325 | } | 321 | } |
@@ -467,7 +463,6 @@ static void handle_wlc_ready(void) { | |||
467 | config->active = true; | 463 | config->active = true; |
468 | } | 464 | } |
469 | 465 | ||
470 | |||
471 | struct wlc_interface interface = { | 466 | struct wlc_interface interface = { |
472 | .output = { | 467 | .output = { |
473 | .created = handle_output_created, | 468 | .created = handle_output_created, |