aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/commands.h3
-rw-r--r--include/config.h28
-rw-r--r--include/input.h23
-rw-r--r--include/ipc.h6
4 files changed, 57 insertions, 3 deletions
diff --git a/include/commands.h b/include/commands.h
index 52d56e4a..5fa66bb6 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -17,7 +17,8 @@ enum cmd_status {
CMD_BLOCK_END,
CMD_BLOCK_MODE,
CMD_BLOCK_BAR,
- CMD_BLOCK_BAR_COLORS
+ CMD_BLOCK_BAR_COLORS,
+ CMD_BLOCK_INPUT
};
/**
diff --git a/include/config.h b/include/config.h
index e6a85b29..c2b67aa6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1,7 +1,9 @@
#ifndef _SWAY_CONFIG_H
#define _SWAY_CONFIG_H
+#include <libinput.h>
#include <stdint.h>
+#include <wlc/geometry.h>
#include <wlc/wlc.h>
#include <xkbcommon/xkbcommon.h>
#include "wayland-desktop-shell-server-protocol.h"
@@ -46,6 +48,25 @@ struct sway_mode {
};
/**
+ * libinput options for input devices
+ */
+struct input_config {
+ char *identifier;
+ int click_method;
+ int drag_lock;
+ int dwt;
+ int middle_emulation;
+ int natural_scroll;
+ float pointer_accel;
+ int scroll_method;
+ int send_events;
+ int tap;
+
+ bool capturable;
+ struct wlc_geometry region;
+};
+
+/**
* Size and position configuration for a particular output.
*
* This is set via the `output` command.
@@ -136,6 +157,7 @@ struct sway_config {
list_t *cmd_queue;
list_t *workspace_outputs;
list_t *output_configs;
+ list_t *input_configs;
list_t *criteria;
list_t *active_bar_modifiers;
struct sway_mode *current_mode;
@@ -172,6 +194,12 @@ bool read_config(FILE *file, bool is_active);
* Does variable replacement for a string based on the config's currently loaded variables.
*/
char *do_var_replacement(char *str);
+
+int input_identifier_cmp(const void *item, const void *data);
+void merge_input_config(struct input_config *dst, struct input_config *src);
+void apply_input_config(struct input_config *ic, struct libinput_device *dev);
+void free_input_config(struct input_config *ic);
+
int output_name_cmp(const void *item, const void *data);
void merge_output_config(struct output_config *dst, struct output_config *src);
/** Sets up a WLC output handle based on a given output_config.
diff --git a/include/input.h b/include/input.h
new file mode 100644
index 00000000..4ed9bffe
--- /dev/null
+++ b/include/input.h
@@ -0,0 +1,23 @@
+#ifndef _SWAY_INPUT_H
+#define _SWAY_INPUT_H
+
+#include <libinput.h>
+#include "config.h"
+#include "list.h"
+
+struct input_config *new_input_config(const char* identifier);
+
+char* libinput_dev_unique_id(struct libinput_device *dev);
+
+/**
+ * Global input device list.
+ */
+extern list_t *input_devices;
+
+/**
+ * Pointer used when reading input blocked.
+ * Shared so that it can be cleared from commands.c when closing the block
+ */
+extern struct input_config *current_input_config;
+
+#endif
diff --git a/include/ipc.h b/include/ipc.h
index 56593529..934049c2 100644
--- a/include/ipc.h
+++ b/include/ipc.h
@@ -5,11 +5,12 @@ enum ipc_command_type {
IPC_COMMAND = 0,
IPC_GET_WORKSPACES = 1,
IPC_SUBSCRIBE = 2,
- IPC_GET_OUTPUTS = 3,
+ IPC_GET_OUTPUTS = 3,
IPC_GET_TREE = 4,
IPC_GET_MARKS = 5,
IPC_GET_BAR_CONFIG = 6,
- IPC_GET_VERSION = 7,
+ IPC_GET_VERSION = 7,
+ IPC_GET_INPUTS = 8,
// Events send from sway to clients. Events have the higest bit set.
IPC_EVENT_WORKSPACE = (1 << 31 | 0),
IPC_EVENT_OUTPUT = (1 << 31 | 1),
@@ -18,6 +19,7 @@ enum ipc_command_type {
IPC_EVENT_BARCONFIG_UPDATE = (1 << 31 | 4),
IPC_EVENT_BINDING = (1 << 31 | 5),
IPC_EVENT_MODIFIER = (1 << 31 | 6),
+ IPC_EVENT_INPUT = (1 << 31 | 7),
IPC_SWAY_GET_PIXELS = 0x81
};