aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/input.h11
-rw-r--r--include/sway/server.h5
-rw-r--r--sway/CMakeLists.txt3
-rw-r--r--sway/input/input.c (renamed from sway/input.c)14
-rw-r--r--sway/ipc-server.c2
-rw-r--r--sway/server.c5
6 files changed, 25 insertions, 15 deletions
diff --git a/include/sway/input.h b/include/sway/input.h
index 4ed9bffe..eb92e470 100644
--- a/include/sway/input.h
+++ b/include/sway/input.h
@@ -1,18 +1,19 @@
1#ifndef _SWAY_INPUT_H 1#ifndef _SWAY_INPUT_H
2#define _SWAY_INPUT_H 2#define _SWAY_INPUT_H
3
4#include <libinput.h> 3#include <libinput.h>
4#include "sway/server.h"
5#include "config.h" 5#include "config.h"
6#include "list.h" 6#include "list.h"
7 7
8struct sway_input {
9 list_t *input_devices;
10};
11
8struct input_config *new_input_config(const char* identifier); 12struct input_config *new_input_config(const char* identifier);
9 13
10char* libinput_dev_unique_id(struct libinput_device *dev); 14char* libinput_dev_unique_id(struct libinput_device *dev);
11 15
12/** 16struct sway_input *sway_input_create(struct sway_server *server);
13 * Global input device list.
14 */
15extern list_t *input_devices;
16 17
17/** 18/**
18 * Pointer used when reading input blocked. 19 * Pointer used when reading input blocked.
diff --git a/include/sway/server.h b/include/sway/server.h
index 9cd760ac..22069f9c 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -10,9 +10,6 @@
10#include <wlr/xwayland.h> 10#include <wlr/xwayland.h>
11 11
12struct sway_server { 12struct sway_server {
13 // TODO WLR
14 //struct roots_input *input;
15
16 struct wl_display *wl_display; 13 struct wl_display *wl_display;
17 struct wl_event_loop *wl_event_loop; 14 struct wl_event_loop *wl_event_loop;
18 15
@@ -20,6 +17,8 @@ struct sway_server {
20 struct wlr_renderer *renderer; 17 struct wlr_renderer *renderer;
21 18
22 struct wlr_data_device_manager *data_device_manager; 19 struct wlr_data_device_manager *data_device_manager;
20
21 struct sway_input *input;
23}; 22};
24 23
25bool server_init(struct sway_server *server); 24bool server_init(struct sway_server *server);
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
index ac0530e5..3c78aec9 100644
--- a/sway/CMakeLists.txt
+++ b/sway/CMakeLists.txt
@@ -26,7 +26,6 @@ add_executable(sway
26 criteria.c 26 criteria.c
27 debug_log.c 27 debug_log.c
28 focus.c 28 focus.c
29 input.c
30 input_state.c 29 input_state.c
31 ipc-json.c 30 ipc-json.c
32 ipc-server.c 31 ipc-server.c
@@ -37,6 +36,8 @@ add_executable(sway
37 border.c 36 border.c
38 security.c 37 security.c
39 server.c 38 server.c
39
40 input/input.c
40) 41)
41 42
42add_definitions( 43add_definitions(
diff --git a/sway/input.c b/sway/input/input.c
index 6263f79f..02b4995e 100644
--- a/sway/input.c
+++ b/sway/input/input.c
@@ -7,9 +7,20 @@
7#include <libinput.h> 7#include <libinput.h>
8#include "sway/config.h" 8#include "sway/config.h"
9#include "sway/input.h" 9#include "sway/input.h"
10#include "sway/server.h"
10#include "list.h" 11#include "list.h"
11#include "log.h" 12#include "log.h"
12 13
14struct input_config *current_input_config = NULL;
15
16struct sway_input *sway_input_create(struct sway_server *server) {
17 struct sway_input *input = calloc(1, sizeof(struct sway_input));
18 if (!input) {
19 return NULL;
20 }
21 return input;
22}
23
13struct input_config *new_input_config(const char* identifier) { 24struct input_config *new_input_config(const char* identifier) {
14 struct input_config *input = calloc(1, sizeof(struct input_config)); 25 struct input_config *input = calloc(1, sizeof(struct input_config));
15 if (!input) { 26 if (!input) {
@@ -64,6 +75,3 @@ char *libinput_dev_unique_id(struct libinput_device *device) {
64 free(name); 75 free(name);
65 return identifier; 76 return identifier;
66} 77}
67
68list_t *input_devices = NULL;
69struct input_config *current_input_config = NULL;
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 9ba736d8..d4db4e7a 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -476,12 +476,14 @@ void ipc_client_handle_command(struct ipc_client *client) {
476 goto exit_denied; 476 goto exit_denied;
477 } 477 }
478 json_object *inputs = json_object_new_array(); 478 json_object *inputs = json_object_new_array();
479 /* TODO WLR
479 if (input_devices) { 480 if (input_devices) {
480 for(int i = 0; i<input_devices->length; i++) { 481 for(int i = 0; i<input_devices->length; i++) {
481 struct libinput_device *device = input_devices->items[i]; 482 struct libinput_device *device = input_devices->items[i];
482 json_object_array_add(inputs, ipc_json_describe_input(device)); 483 json_object_array_add(inputs, ipc_json_describe_input(device));
483 } 484 }
484 } 485 }
486 */
485 const char *json_string = json_object_to_json_string(inputs); 487 const char *json_string = json_object_to_json_string(inputs);
486 ipc_send_reply(client, json_string, (uint32_t) strlen(json_string)); 488 ipc_send_reply(client, json_string, (uint32_t) strlen(json_string));
487 json_object_put(inputs); 489 json_object_put(inputs);
diff --git a/sway/server.c b/sway/server.c
index 39fa5d28..4a74cfb5 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -10,6 +10,7 @@
10// TODO WLR: make Xwayland optional 10// TODO WLR: make Xwayland optional
11#include <wlr/xwayland.h> 11#include <wlr/xwayland.h>
12#include "sway/server.h" 12#include "sway/server.h"
13#include "sway/input.h"
13#include "log.h" 14#include "log.h"
14 15
15bool server_init(struct sway_server *server) { 16bool server_init(struct sway_server *server) {
@@ -22,9 +23,7 @@ bool server_init(struct sway_server *server) {
22 server->renderer = wlr_gles2_renderer_create(server->backend); 23 server->renderer = wlr_gles2_renderer_create(server->backend);
23 wl_display_init_shm(server->wl_display); 24 wl_display_init_shm(server->wl_display);
24 25
25 // TODO WLR 26 server->input = sway_input_create(server);
26 //server->desktop = desktop_create(server, server.config);
27 //server->input = input_create(&server, server.config);
28 server->data_device_manager = 27 server->data_device_manager =
29 wlr_data_device_manager_create(server->wl_display); 28 wlr_data_device_manager_create(server->wl_display);
30 29