aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-01-30 23:09:21 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-01-30 23:09:21 -0500
commitb28602aa7425cf435150e6008624429737e037d3 (patch)
treedafe7d23c48457299f33803832f6b89e09a915ce /sway/input
parentRemove include/sway/old/ (diff)
downloadsway-b28602aa7425cf435150e6008624429737e037d3.tar.gz
sway-b28602aa7425cf435150e6008624429737e037d3.tar.zst
sway-b28602aa7425cf435150e6008624429737e037d3.zip
Implement workspaces
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/input-manager.c8
-rw-r--r--sway/input/seat.c15
2 files changed, 15 insertions, 8 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 12b3a430..d789c7eb 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -23,6 +23,14 @@ struct sway_input_manager *input_manager;
23struct input_config *current_input_config = NULL; 23struct input_config *current_input_config = NULL;
24struct seat_config *current_seat_config = NULL; 24struct seat_config *current_seat_config = NULL;
25 25
26struct sway_seat *input_manager_current_seat(struct sway_input_manager *input) {
27 struct sway_seat *seat = config->handler_context.seat;
28 if (!seat) {
29 seat = sway_input_manager_get_default_seat(input_manager);
30 }
31 return seat;
32}
33
26struct sway_seat *input_manager_get_seat( 34struct sway_seat *input_manager_get_seat(
27 struct sway_input_manager *input, const char *seat_name) { 35 struct sway_input_manager *input, const char *seat_name) {
28 struct sway_seat *seat = NULL; 36 struct sway_seat *seat = NULL;
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 9ea08eec..5e87986d 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1,6 +1,7 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#include <wlr/types/wlr_cursor.h> 2#include <wlr/types/wlr_cursor.h>
3#include <wlr/types/wlr_xcursor_manager.h> 3#include <wlr/types/wlr_xcursor_manager.h>
4#include "sway/container.h"
4#include "sway/input/seat.h" 5#include "sway/input/seat.h"
5#include "sway/input/cursor.h" 6#include "sway/input/cursor.h"
6#include "sway/input/input-manager.h" 7#include "sway/input/input-manager.h"
@@ -81,7 +82,7 @@ static void seat_configure_keyboard(struct sway_seat *seat,
81 sway_keyboard_configure(seat_device->keyboard); 82 sway_keyboard_configure(seat_device->keyboard);
82 wlr_seat_set_keyboard(seat->wlr_seat, 83 wlr_seat_set_keyboard(seat->wlr_seat,
83 seat_device->input_device->wlr_device); 84 seat_device->input_device->wlr_device);
84 if (seat->focus) { 85 if (seat->focus && seat->focus->type == C_VIEW) {
85 // force notify reenter to pick up the new configuration 86 // force notify reenter to pick up the new configuration
86 wlr_seat_keyboard_clear_focus(seat->wlr_seat); 87 wlr_seat_keyboard_clear_focus(seat->wlr_seat);
87 wlr_seat_keyboard_notify_enter(seat->wlr_seat, 88 wlr_seat_keyboard_notify_enter(seat->wlr_seat,
@@ -205,10 +206,8 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) {
205 206
206static void handle_focus_destroy(struct wl_listener *listener, void *data) { 207static void handle_focus_destroy(struct wl_listener *listener, void *data) {
207 struct sway_seat *seat = wl_container_of(listener, seat, focus_destroy); 208 struct sway_seat *seat = wl_container_of(listener, seat, focus_destroy);
208 //swayc_t *container = data; 209 swayc_t *container = data;
209 210 sway_seat_set_focus(seat, container->parent);
210 // TODO set new focus based on the state of the tree
211 sway_seat_set_focus(seat, NULL);
212} 211}
213 212
214void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { 213void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) {
@@ -218,11 +217,11 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) {
218 return; 217 return;
219 } 218 }
220 219
221 if (last_focus) { 220 if (last_focus && last_focus->type == C_VIEW) {
222 wl_list_remove(&seat->focus_destroy.link); 221 wl_list_remove(&seat->focus_destroy.link);
223 } 222 }
224 223
225 if (container) { 224 if (container && container->type == C_VIEW) {
226 struct sway_view *view = container->sway_view; 225 struct sway_view *view = container->sway_view;
227 view_set_activated(view, true); 226 view_set_activated(view, true);
228 wl_signal_add(&container->events.destroy, &seat->focus_destroy); 227 wl_signal_add(&container->events.destroy, &seat->focus_destroy);
@@ -241,7 +240,7 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) {
241 240
242 seat->focus = container; 241 seat->focus = container;
243 242
244 if (last_focus && 243 if (last_focus && last_focus->type == C_VIEW &&
245 !sway_input_manager_has_focus(seat->input, last_focus)) { 244 !sway_input_manager_has_focus(seat->input, last_focus)) {
246 struct sway_view *view = last_focus->sway_view; 245 struct sway_view *view = last_focus->sway_view;
247 view_set_activated(view, false); 246 view_set_activated(view, false);