From ba6034e8c8cd2bbe15f318e511817e0904633bb3 Mon Sep 17 00:00:00 2001 From: taiyu Date: Thu, 20 Aug 2015 04:24:39 -0700 Subject: changes --- sway.5.txt | 20 ++++++++++---------- sway/input_state.c | 18 ++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/sway.5.txt b/sway.5.txt index 9c40558b..5bccbd12 100644 --- a/sway.5.txt +++ b/sway.5.txt @@ -22,11 +22,11 @@ Commands -------- **bindsym** :: - Binds _key combo_ to execute _command_ when pressed. You may use XKB key names - here (**xev**(1) is a good tool for discovering them). An example bindsym - command would be _bindsym Mod1+Shift+f exec firefox_, which would execute - Firefox if the alt, shift, and F keys are pressed together. Any valid sway - command is eligible to be bound to a key combo. + Binds _key combo_ to execute _command_ when pressed. You may use XKB key + names here (**xev**(1) is a good tool for discovering them). An example + bindsym command would be _bindsym Mod1+Shift+f exec firefox_, which would + execute Firefox if the alt, shift, and F keys are pressed together. Any + valid sway command is eligible to be bound to a key combo. **exec** :: Executes _shell command_ with sh. @@ -41,9 +41,6 @@ Commands **floating** toggle:: Toggles the "floating" status of the focused view. -**floating** mode_toggle:: - Toggles focus between floating view and tiled view. - **focus** :: Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The directional focus commands will move the focus in that direction. The parent @@ -51,6 +48,9 @@ Commands container, which is useful, for example, to open a sibling of the parent container, or to move the entire container around. +**focus** mode_toggle:: + Toggles focus between floating view and tiled view. + **focus_follows_mouse** :: If set to _yes_, the currently focused view will change as you move your mouse around the screen to the view that ends up underneath your mouse. @@ -86,10 +86,10 @@ Commands **fullscreen**:: Toggles fullscreen status for the focused view. -**gaps** **:: +**gaps** :: Adds _amount_ pixels between each view, and around each output. -**gaps** **:: +**gaps** :: Adds _amount_ pixels as an _inner_ or _outer_ gap, where the former affects spacing between views and the latter affects the space around each output. diff --git a/sway/input_state.c b/sway/input_state.c index 0769c30f..51213b19 100644 --- a/sway/input_state.c +++ b/sway/input_state.c @@ -4,14 +4,13 @@ #include "input_state.h" -enum { KEY_STATE_MAX_LENGTH = 64 }; +#define KEY_STATE_MAX_LENGTH 64 static keycode key_state_array[KEY_STATE_MAX_LENGTH]; -static uint8_t key_state_length = 0; static uint8_t find_key(keycode key) { int i; - for (i = 0; i < key_state_length; ++i) { + for (i = 0; i < KEY_STATE_MAX_LENGTH; ++i) { if (key_state_array[i] == key) { break; } @@ -20,26 +19,25 @@ static uint8_t find_key(keycode key) { } bool check_key(keycode key) { - return find_key(key) < key_state_length; + return find_key(key) < KEY_STATE_MAX_LENGTH; } void press_key(keycode key) { // Check if key exists if (!check_key(key)) { // Check that we dont exceed buffer length - if (key_state_length < KEY_STATE_MAX_LENGTH) { - key_state_array[key_state_length++] = key; + int insert = find_key(0); + if (insert < KEY_STATE_MAX_LENGTH) { + key_state_array[insert] = key; } } } void release_key(keycode key) { uint8_t index = find_key(key); - if (index < key_state_length) { + if (index < KEY_STATE_MAX_LENGTH) { //shift it over and remove key - memmove(&key_state_array[index], - &key_state_array[index + 1], - sizeof(*key_state_array) * (--key_state_length - index)); + key_state_array[index] = 0; } } -- cgit v1.2.3-54-g00ecf