aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
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 {
list_t *workspace_outputs;
list_t *output_configs;
list_t *criteria;
+ list_t *active_bar_modifiers;
struct sway_mode *current_mode;
struct bar_config *current_bar;
uint32_t floating_mod;
@@ -176,6 +177,11 @@ void merge_output_config(struct output_config *dst, struct output_config *src);
void apply_output_config(struct output_config *oc, swayc_t *output);
void free_output_config(struct output_config *oc);
+/**
+ * Updates the list of active bar modifiers
+ */
+void update_active_bar_modifiers(void);
+
int workspace_output_cmp_workspace(const void *a, const void *b);
int 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 {
int mode;
} pointer_state;
+enum modifier_state {
+ MOD_STATE_UNCHANGED = 0,
+ MOD_STATE_PRESSED = 1,
+ MOD_STATE_RELEASED = 2
+};
+
void pointer_position_set(struct wlc_origin *new_origin, bool force_focus);
void center_pointer_on(swayc_t *view);
@@ -75,5 +81,19 @@ void pointer_mode_reset(void);
void input_init(void);
+/**
+ * Check if state of mod changed from current state to new_state.
+ *
+ * Returns MOD_STATE_UNCHANGED if the state didn't change, MOD_STATE_PRESSED if
+ * the state changed to pressed and MOD_STATE_RELEASED if the state changed to
+ * released.
+ */
+uint32_t modifier_state_changed(uint32_t new_state, uint32_t mod);
+
+/**
+ * Update the current modifiers state to new_state.
+ */
+void modifiers_state_update(uint32_t new_state);
+
#endif
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);
* Send IPC mode event to all listening clients
*/
void ipc_event_mode(const char *mode);
+/**
+ * Sends an IPC modifier event to all listening clients. The modifier event
+ * includes a key 'change' with the value of state and a key 'modifier' with
+ * the name of that modifier.
+ */
+void ipc_event_modifier(uint32_t modifier, const char *state);
const char *swayc_type_string(enum swayc_types type);
#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 {
IPC_EVENT_WINDOW = (1 << 31 | 3),
IPC_EVENT_BARCONFIG_UPDATE = (1 << 31 | 4),
IPC_EVENT_BINDING = (1 << 31 | 5),
+ IPC_EVENT_MODIFIER = (1 << 31 | 6),
IPC_SWAY_GET_PIXELS = 0x81
};
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 @@
#ifndef _SWAY_UTIL_H
#define _SWAY_UTIL_H
+#include <stdint.h>
+#include <wlc/wlc.h>
+#include <xkbcommon/xkbcommon.h>
+
/**
* Wrap i into the range [0, max[
*/
@@ -11,4 +15,18 @@ int wrap(int i, int max);
*/
int numlen(int n);
+/**
+ * Get modifier mask from modifier name.
+ *
+ * Returns the modifer mask or 0 if the name isn't found.
+ */
+uint32_t get_modifier_mask_by_name(const char *name);
+
+/**
+ * Get modifier name from modifier mask.
+ *
+ * Returns the modifier name or NULL if it isn't found.
+ */
+const char *get_modifier_name_by_mask(uint32_t modifier);
+
#endif