This commit is contained in:
Cole Mickens 2016-01-17 02:53:37 -08:00
parent fe241126bb
commit 28081b7689
16 changed files with 727 additions and 3 deletions

View file

@ -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
};
/**

View file

@ -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"
@ -45,6 +47,25 @@ struct sway_mode {
list_t *bindings;
};
/**
* 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.
*
@ -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.

23
include/input.h Normal file
View file

@ -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

View file

@ -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
};