Allow to disable insecure protocols at compile-time

This commit is contained in:
Yaroslav Isakov 2020-07-28 20:28:39 +02:00
parent b20d52f71d
commit 4124571b25
5 changed files with 19 additions and 4 deletions

View file

@ -180,7 +180,9 @@ static void seat_send_focus(struct sway_node *node, struct sway_seat *seat) {
seat_keyboard_notify_enter(seat, view->surface);
seat_tablet_pads_notify_enter(seat, view->surface);
#if USE_INSECURE_PROTOCOLS
sway_input_method_relay_set_focus(&seat->im_relay, view->surface);
#endif
struct wlr_pointer_constraint_v1 *constraint =
wlr_pointer_constraints_v1_constraint_for_surface(
@ -592,7 +594,9 @@ struct sway_seat *seat_create(const char *seat_name) {
wl_list_init(&seat->keyboard_groups);
wl_list_init(&seat->keyboard_shortcuts_inhibitors);
#if USE_INSECURE_PROTOCOLS
sway_input_method_relay_init(seat, &seat->im_relay);
#endif
bool first = wl_list_empty(&server.input->seats);
wl_list_insert(&server.input->seats, &seat->link);
@ -1069,7 +1073,9 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
view_close_popups(last_focus->sway_container->view);
}
seat_send_unfocus(last_focus, seat);
#if USE_INSECURE_PROTOCOLS
sway_input_method_relay_set_focus(&seat->im_relay, NULL);
#endif
seat->has_focus = false;
return;
}

View file

@ -32,7 +32,6 @@ sway_sources = files(
'input/seatop_resize_tiling.c',
'input/switch.c',
'input/tablet.c',
'input/text_input.c',
'config/bar.c',
'config/output.c',
@ -221,6 +220,10 @@ if have_xwayland
sway_deps += xcb
endif
if use_insecure_protocols
sway_sources += 'input/text_input.c'
endif
executable(
'sway',
sway_sources,

View file

@ -140,13 +140,14 @@ bool server_init(struct sway_server *server) {
handle_output_power_manager_set_mode;
wl_signal_add(&server->output_power_manager_v1->events.set_mode,
&server->output_power_manager_set_mode);
#if USE_INSECURE_PROTOCOLS
server->input_method = wlr_input_method_manager_v2_create(server->wl_display);
server->text_input = wlr_text_input_manager_v3_create(server->wl_display);
server->foreign_toplevel_manager =
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
wlr_export_dmabuf_manager_v1_create(server->wl_display);
wlr_screencopy_manager_v1_create(server->wl_display);
#endif
server->foreign_toplevel_manager =
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
wlr_data_control_manager_v1_create(server->wl_display);
wlr_primary_selection_v1_device_manager_create(server->wl_display);
wlr_viewporter_create(server->wl_display);