rename input-manager functions

This commit is contained in:
Tony Crisci 2018-04-02 08:49:38 -04:00
parent e677c5b204
commit 0828c77251
11 changed files with 31 additions and 32 deletions

View file

@ -27,24 +27,23 @@ struct sway_input_manager {
struct wl_listener new_input; struct wl_listener new_input;
}; };
struct sway_input_manager *sway_input_manager_create( struct sway_input_manager *input_manager_create(struct sway_server *server);
struct sway_server *server);
bool sway_input_manager_has_focus(struct sway_input_manager *input, bool input_manager_has_focus(struct sway_input_manager *input,
struct sway_container *container); struct sway_container *container);
void sway_input_manager_set_focus(struct sway_input_manager *input, void input_manager_set_focus(struct sway_input_manager *input,
struct sway_container *container); struct sway_container *container);
void sway_input_manager_configure_xcursor(struct sway_input_manager *input); void input_manager_configure_xcursor(struct sway_input_manager *input);
void sway_input_manager_apply_input_config(struct sway_input_manager *input, void input_manager_apply_input_config(struct sway_input_manager *input,
struct input_config *input_config); struct input_config *input_config);
void sway_input_manager_apply_seat_config(struct sway_input_manager *input, void input_manager_apply_seat_config(struct sway_input_manager *input,
struct seat_config *seat_config); struct seat_config *seat_config);
struct sway_seat *sway_input_manager_get_default_seat( struct sway_seat *input_manager_get_default_seat(
struct sway_input_manager *input); struct sway_input_manager *input);
struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, struct sway_seat *input_manager_get_seat(struct sway_input_manager *input,

View file

@ -72,7 +72,7 @@ void apply_input_config(struct input_config *input) {
list_add(config->input_configs, input); list_add(config->input_configs, input);
} }
sway_input_manager_apply_input_config(input_manager, input); input_manager_apply_input_config(input_manager, input);
} }
void apply_seat_config(struct seat_config *seat) { void apply_seat_config(struct seat_config *seat) {
@ -88,7 +88,7 @@ void apply_seat_config(struct seat_config *seat) {
list_add(config->seat_configs, seat); list_add(config->seat_configs, seat);
} }
sway_input_manager_apply_seat_config(input_manager, seat); input_manager_apply_seat_config(input_manager, seat);
} }
/* Keep alphabetized */ /* Keep alphabetized */
@ -262,7 +262,7 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) {
if (seat == NULL) { if (seat == NULL) {
// passing a NULL seat means we just pick the default seat // passing a NULL seat means we just pick the default seat
seat = sway_input_manager_get_default_seat(input_manager); seat = input_manager_get_default_seat(input_manager);
if (!sway_assert(seat, "could not find a seat to run the command on")) { if (!sway_assert(seat, "could not find a seat to run the command on")) {
return NULL; return NULL;
} }

View file

@ -370,7 +370,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
wl_list_init(&output->layers[i]); wl_list_init(&output->layers[i]);
} }
sway_input_manager_configure_xcursor(input_manager); input_manager_configure_xcursor(input_manager);
wl_signal_add(&wlr_output->events.destroy, &output->destroy); wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->destroy.notify = handle_destroy; output->destroy.notify = handle_destroy;

View file

@ -138,5 +138,5 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
sway_view->swayc = cont; sway_view->swayc = cont;
arrange_windows(cont->parent, -1, -1); arrange_windows(cont->parent, -1, -1);
sway_input_manager_set_focus(input_manager, cont); input_manager_set_focus(input_manager, cont);
} }

View file

@ -102,7 +102,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
struct sway_container *cont = container_view_create(focus, view); struct sway_container *cont = container_view_create(focus, view);
view->swayc = cont; view->swayc = cont;
arrange_windows(cont->parent, -1, -1); arrange_windows(cont->parent, -1, -1);
sway_input_manager_set_focus(input_manager, cont); input_manager_set_focus(input_manager, cont);
view_damage_whole(sway_surface->view); view_damage_whole(sway_surface->view);
} }

View file

@ -148,7 +148,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
struct sway_container *cont = container_view_create(focus, view); struct sway_container *cont = container_view_create(focus, view);
view->swayc = cont; view->swayc = cont;
arrange_windows(cont->parent, -1, -1); arrange_windows(cont->parent, -1, -1);
sway_input_manager_set_focus(input_manager, cont); input_manager_set_focus(input_manager, cont);
} }
view_damage_whole(sway_surface->view); view_damage_whole(sway_surface->view);

View file

@ -26,7 +26,7 @@ struct seat_config *current_seat_config = NULL;
struct sway_seat *input_manager_current_seat(struct sway_input_manager *input) { struct sway_seat *input_manager_current_seat(struct sway_input_manager *input) {
struct sway_seat *seat = config->handler_context.seat; struct sway_seat *seat = config->handler_context.seat;
if (!seat) { if (!seat) {
seat = sway_input_manager_get_default_seat(input_manager); seat = input_manager_get_default_seat(input_manager);
} }
return seat; return seat;
} }
@ -91,7 +91,7 @@ static bool input_has_seat_configuration(struct sway_input_manager *input) {
return false; return false;
} }
static void sway_input_manager_libinput_config_pointer(struct sway_input_device *input_device) { static void input_manager_libinput_config_pointer(struct sway_input_device *input_device) {
struct wlr_input_device *wlr_device = input_device->wlr_device; struct wlr_input_device *wlr_device = input_device->wlr_device;
struct input_config *ic = input_device->config; struct input_config *ic = input_device->config;
struct libinput_device *libinput_device; struct libinput_device *libinput_device;
@ -101,7 +101,7 @@ static void sway_input_manager_libinput_config_pointer(struct sway_input_device
} }
libinput_device = wlr_libinput_get_device_handle(wlr_device); libinput_device = wlr_libinput_get_device_handle(wlr_device);
wlr_log(L_DEBUG, "sway_input_manager_libinput_config_pointer(%s)", ic->identifier); wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)", ic->identifier);
if (ic->accel_profile != INT_MIN) { if (ic->accel_profile != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
@ -214,7 +214,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
} }
if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
sway_input_manager_libinput_config_pointer(input_device); input_manager_libinput_config_pointer(input_device);
} }
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
@ -256,7 +256,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
input_device->device_destroy.notify = handle_device_destroy; input_device->device_destroy.notify = handle_device_destroy;
} }
struct sway_input_manager *sway_input_manager_create( struct sway_input_manager *input_manager_create(
struct sway_server *server) { struct sway_server *server) {
struct sway_input_manager *input = struct sway_input_manager *input =
calloc(1, sizeof(struct sway_input_manager)); calloc(1, sizeof(struct sway_input_manager));
@ -277,7 +277,7 @@ struct sway_input_manager *sway_input_manager_create(
return input; return input;
} }
bool sway_input_manager_has_focus(struct sway_input_manager *input, bool input_manager_has_focus(struct sway_input_manager *input,
struct sway_container *container) { struct sway_container *container) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input->seats, link) { wl_list_for_each(seat, &input->seats, link) {
@ -289,7 +289,7 @@ bool sway_input_manager_has_focus(struct sway_input_manager *input,
return false; return false;
} }
void sway_input_manager_set_focus(struct sway_input_manager *input, void input_manager_set_focus(struct sway_input_manager *input,
struct sway_container *container) { struct sway_container *container) {
struct sway_seat *seat ; struct sway_seat *seat ;
wl_list_for_each(seat, &input->seats, link) { wl_list_for_each(seat, &input->seats, link) {
@ -297,7 +297,7 @@ void sway_input_manager_set_focus(struct sway_input_manager *input,
} }
} }
void sway_input_manager_apply_input_config(struct sway_input_manager *input, void input_manager_apply_input_config(struct sway_input_manager *input,
struct input_config *input_config) { struct input_config *input_config) {
struct sway_input_device *input_device = NULL; struct sway_input_device *input_device = NULL;
wl_list_for_each(input_device, &input->devices, link) { wl_list_for_each(input_device, &input->devices, link) {
@ -306,7 +306,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
input_device->config = copy_input_config(input_config); input_device->config = copy_input_config(input_config);
if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
sway_input_manager_libinput_config_pointer(input_device); input_manager_libinput_config_pointer(input_device);
} }
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
@ -317,7 +317,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
} }
} }
void sway_input_manager_apply_seat_config(struct sway_input_manager *input, void input_manager_apply_seat_config(struct sway_input_manager *input,
struct seat_config *seat_config) { struct seat_config *seat_config) {
wlr_log(L_DEBUG, "applying new seat config for seat %s", wlr_log(L_DEBUG, "applying new seat config for seat %s",
seat_config->name); seat_config->name);
@ -373,14 +373,14 @@ void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
} }
} }
void sway_input_manager_configure_xcursor(struct sway_input_manager *input) { void input_manager_configure_xcursor(struct sway_input_manager *input) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input->seats, link) { wl_list_for_each(seat, &input->seats, link) {
seat_configure_xcursor(seat); seat_configure_xcursor(seat);
} }
} }
struct sway_seat *sway_input_manager_get_default_seat( struct sway_seat *input_manager_get_default_seat(
struct sway_input_manager *input) { struct sway_input_manager *input) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input->seats, link) { wl_list_for_each(seat, &input->seats, link) {

View file

@ -364,7 +364,7 @@ void seat_set_focus_warp(struct sway_seat *seat,
} }
if (last_focus && last_focus->type == C_VIEW && if (last_focus && last_focus->type == C_VIEW &&
!sway_input_manager_has_focus(seat->input, last_focus)) { !input_manager_has_focus(seat->input, last_focus)) {
struct sway_view *view = last_focus->sway_view; struct sway_view *view = last_focus->sway_view;
view_set_activated(view, false); view_set_activated(view, false);
} }

View file

@ -88,7 +88,7 @@ static void ipc_json_describe_output(struct sway_container *container, json_obje
json_object_new_string( json_object_new_string(
ipc_json_get_output_transform(wlr_output->transform))); ipc_json_get_output_transform(wlr_output->transform)));
struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); struct sway_seat *seat = input_manager_get_default_seat(input_manager);
const char *ws = NULL; const char *ws = NULL;
if (seat) { if (seat) {
struct sway_container *focus = struct sway_container *focus =
@ -139,7 +139,7 @@ json_object *ipc_json_describe_container(struct sway_container *c) {
return NULL; return NULL;
} }
struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); struct sway_seat *seat = input_manager_get_default_seat(input_manager);
bool focused = seat_get_focus(seat) == c; bool focused = seat_get_focus(seat) == c;
json_object *object = json_object_new_object(); json_object *object = json_object_new_object();

View file

@ -388,7 +388,7 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace,
// override the default focused indicator because // override the default focused indicator because
// it's set differently for the get_workspaces reply // it's set differently for the get_workspaces reply
struct sway_seat *seat = struct sway_seat *seat =
sway_input_manager_get_default_seat(input_manager); input_manager_get_default_seat(input_manager);
struct sway_container *focused_ws = seat_get_focus(seat); struct sway_container *focused_ws = seat_get_focus(seat);
if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) { if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) {
focused_ws = container_parent(focused_ws, C_WORKSPACE); focused_ws = container_parent(focused_ws, C_WORKSPACE);

View file

@ -109,7 +109,7 @@ bool server_init(struct sway_server *server) {
return false; return false;
} }
input_manager = sway_input_manager_create(server); input_manager = input_manager_create(server);
return true; return true;
} }