aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-01-06 07:26:54 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-01-06 07:26:54 -0500
commit8f5de70c93b2afaab0dd7d384c58ff3d3007193c (patch)
tree4826eca48ec5d4d2b827477c74de7d500f39f0fa /include
parentFix whitespaces in cmake config (diff)
parentOnly send modifier event once for active modifiers (diff)
downloadsway-8f5de70c93b2afaab0dd7d384c58ff3d3007193c.tar.gz
sway-8f5de70c93b2afaab0dd7d384c58ff3d3007193c.tar.zst
sway-8f5de70c93b2afaab0dd7d384c58ff3d3007193c.zip
Merge pull request #434 from mikkeloscar/detect-modifier
Send IPC modifier event on bar_modifier up/down
Diffstat (limited to 'include')
-rw-r--r--include/config.h6
-rw-r--r--include/input_state.h20
-rw-r--r--include/ipc-server.h6
-rw-r--r--include/ipc.h1
-rw-r--r--include/util.h18
5 files changed, 51 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index a915fbed..5e1c39f3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -135,6 +135,7 @@ struct sway_config {
135 list_t *workspace_outputs; 135 list_t *workspace_outputs;
136 list_t *output_configs; 136 list_t *output_configs;
137 list_t *criteria; 137 list_t *criteria;
138 list_t *active_bar_modifiers;
138 struct sway_mode *current_mode; 139 struct sway_mode *current_mode;
139 struct bar_config *current_bar; 140 struct bar_config *current_bar;
140 uint32_t floating_mod; 141 uint32_t floating_mod;
@@ -176,6 +177,11 @@ void merge_output_config(struct output_config *dst, struct output_config *src);
176void apply_output_config(struct output_config *oc, swayc_t *output); 177void apply_output_config(struct output_config *oc, swayc_t *output);
177void free_output_config(struct output_config *oc); 178void free_output_config(struct output_config *oc);
178 179
180/**
181 * Updates the list of active bar modifiers
182 */
183void update_active_bar_modifiers(void);
184
179int workspace_output_cmp_workspace(const void *a, const void *b); 185int workspace_output_cmp_workspace(const void *a, const void *b);
180 186
181int sway_binding_cmp(const void *a, const void *b); 187int sway_binding_cmp(const void *a, const void *b);
diff --git a/include/input_state.h b/include/input_state.h
index a1f238e1..79e27d91 100644
--- a/include/input_state.h
+++ b/include/input_state.h
@@ -60,6 +60,12 @@ extern struct pointer_state {
60 int mode; 60 int mode;
61} pointer_state; 61} pointer_state;
62 62
63enum modifier_state {
64 MOD_STATE_UNCHANGED = 0,
65 MOD_STATE_PRESSED = 1,
66 MOD_STATE_RELEASED = 2
67};
68
63void pointer_position_set(struct wlc_origin *new_origin, bool force_focus); 69void pointer_position_set(struct wlc_origin *new_origin, bool force_focus);
64void center_pointer_on(swayc_t *view); 70void center_pointer_on(swayc_t *view);
65 71
@@ -75,5 +81,19 @@ void pointer_mode_reset(void);
75 81
76void input_init(void); 82void input_init(void);
77 83
84/**
85 * Check if state of mod changed from current state to new_state.
86 *
87 * Returns MOD_STATE_UNCHANGED if the state didn't change, MOD_STATE_PRESSED if
88 * the state changed to pressed and MOD_STATE_RELEASED if the state changed to
89 * released.
90 */
91uint32_t modifier_state_changed(uint32_t new_state, uint32_t mod);
92
93/**
94 * Update the current modifiers state to new_state.
95 */
96void modifiers_state_update(uint32_t new_state);
97
78#endif 98#endif
79 99
diff --git a/include/ipc-server.h b/include/ipc-server.h
index 04975093..47026bfd 100644
--- a/include/ipc-server.h
+++ b/include/ipc-server.h
@@ -15,6 +15,12 @@ void ipc_event_barconfig_update(struct bar_config *bar);
15 * Send IPC mode event to all listening clients 15 * Send IPC mode event to all listening clients
16 */ 16 */
17void ipc_event_mode(const char *mode); 17void ipc_event_mode(const char *mode);
18/**
19 * Sends an IPC modifier event to all listening clients. The modifier event
20 * includes a key 'change' with the value of state and a key 'modifier' with
21 * the name of that modifier.
22 */
23void ipc_event_modifier(uint32_t modifier, const char *state);
18const char *swayc_type_string(enum swayc_types type); 24const char *swayc_type_string(enum swayc_types type);
19 25
20#endif 26#endif
diff --git a/include/ipc.h b/include/ipc.h
index e0b3b736..56593529 100644
--- a/include/ipc.h
+++ b/include/ipc.h
@@ -17,6 +17,7 @@ enum ipc_command_type {
17 IPC_EVENT_WINDOW = (1 << 31 | 3), 17 IPC_EVENT_WINDOW = (1 << 31 | 3),
18 IPC_EVENT_BARCONFIG_UPDATE = (1 << 31 | 4), 18 IPC_EVENT_BARCONFIG_UPDATE = (1 << 31 | 4),
19 IPC_EVENT_BINDING = (1 << 31 | 5), 19 IPC_EVENT_BINDING = (1 << 31 | 5),
20 IPC_EVENT_MODIFIER = (1 << 31 | 6),
20 IPC_SWAY_GET_PIXELS = 0x81 21 IPC_SWAY_GET_PIXELS = 0x81
21}; 22};
22 23
diff --git a/include/util.h b/include/util.h
index 9cb861dd..4bbb64c8 100644
--- a/include/util.h
+++ b/include/util.h
@@ -1,6 +1,10 @@
1#ifndef _SWAY_UTIL_H 1#ifndef _SWAY_UTIL_H
2#define _SWAY_UTIL_H 2#define _SWAY_UTIL_H
3 3
4#include <stdint.h>
5#include <wlc/wlc.h>
6#include <xkbcommon/xkbcommon.h>
7
4/** 8/**
5 * Wrap i into the range [0, max[ 9 * Wrap i into the range [0, max[
6 */ 10 */
@@ -11,4 +15,18 @@ int wrap(int i, int max);
11 */ 15 */
12int numlen(int n); 16int numlen(int n);
13 17
18/**
19 * Get modifier mask from modifier name.
20 *
21 * Returns the modifer mask or 0 if the name isn't found.
22 */
23uint32_t get_modifier_mask_by_name(const char *name);
24
25/**
26 * Get modifier name from modifier mask.
27 *
28 * Returns the modifier name or NULL if it isn't found.
29 */
30const char *get_modifier_name_by_mask(uint32_t modifier);
31
14#endif 32#endif