2015-08-20 13:22:15 +10:00
|
|
|
#ifndef _SWAY_KEY_STATE_H
|
|
|
|
#define _SWAY_KEY_STATE_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "container.h"
|
|
|
|
|
|
|
|
/* Keyboard state */
|
|
|
|
|
|
|
|
typedef uint32_t keycode;
|
|
|
|
|
|
|
|
// returns true if key has been pressed, otherwise false
|
|
|
|
bool check_key(keycode key);
|
|
|
|
|
|
|
|
// sets a key as pressed
|
|
|
|
void press_key(keycode key);
|
|
|
|
|
|
|
|
// unsets a key as pressed
|
|
|
|
void release_key(keycode key);
|
|
|
|
|
|
|
|
/* Pointer state */
|
|
|
|
|
|
|
|
enum pointer_values {
|
|
|
|
M_LEFT_CLICK = 272,
|
|
|
|
M_RIGHT_CLICK = 273,
|
|
|
|
M_SCROLL_CLICK = 274,
|
|
|
|
M_SCROLL_UP = 275,
|
|
|
|
M_SCROLL_DOWN = 276,
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct pointer_state {
|
|
|
|
bool l_held;
|
|
|
|
bool r_held;
|
|
|
|
struct pointer_floating {
|
|
|
|
bool drag;
|
|
|
|
bool resize;
|
|
|
|
} floating;
|
2015-08-21 15:17:26 +10:00
|
|
|
struct pointer_tiling {
|
|
|
|
bool resize;
|
2015-08-21 15:49:47 +10:00
|
|
|
swayc_t *init_view;
|
2015-08-22 02:19:06 +10:00
|
|
|
struct wlc_origin lock_pos;
|
2015-08-21 15:17:26 +10:00
|
|
|
} tiling;
|
2015-08-20 13:22:15 +10:00
|
|
|
struct pointer_lock {
|
2015-08-22 02:19:06 +10:00
|
|
|
// Lock movement for certain edges
|
2015-08-20 13:22:15 +10:00
|
|
|
bool left;
|
|
|
|
bool right;
|
|
|
|
bool top;
|
|
|
|
bool bottom;
|
2015-08-22 02:19:06 +10:00
|
|
|
// Lock movement in certain directions
|
|
|
|
bool temp_left;
|
|
|
|
bool temp_right;
|
|
|
|
bool temp_up;
|
|
|
|
bool temp_down;
|
2015-08-20 13:22:15 +10:00
|
|
|
} lock;
|
|
|
|
} pointer_state;
|
|
|
|
|
|
|
|
void start_floating(swayc_t *view);
|
|
|
|
void reset_floating(swayc_t *view);
|
2015-08-21 07:14:26 +10:00
|
|
|
void input_init(void);
|
2015-08-20 13:22:15 +10:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|