diff options
-rw-r--r-- | include/handlers.h | 3 | ||||
-rw-r--r-- | sway/handlers.c | 54 | ||||
-rw-r--r-- | sway/main.c | 3 |
3 files changed, 23 insertions, 37 deletions
diff --git a/include/handlers.h b/include/handlers.h index d7f6ffdd..956b98f4 100644 --- a/include/handlers.h +++ b/include/handlers.h | |||
@@ -4,7 +4,8 @@ | |||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlc/wlc.h> | 5 | #include <wlc/wlc.h> |
6 | 6 | ||
7 | extern struct wlc_interface interface; | 7 | void register_wlc_handlers(); |
8 | |||
8 | extern uint32_t keys_pressed[32]; | 9 | extern uint32_t keys_pressed[32]; |
9 | 10 | ||
10 | #endif | 11 | #endif |
diff --git a/sway/handlers.c b/sway/handlers.c index cec63192..7d4ea263 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -706,38 +706,22 @@ static void handle_wlc_ready(void) { | |||
706 | } | 706 | } |
707 | } | 707 | } |
708 | 708 | ||
709 | struct wlc_interface interface = { | 709 | void register_wlc_handlers() { |
710 | .output = { | 710 | wlc_set_output_created_cb(handle_output_created); |
711 | .created = handle_output_created, | 711 | wlc_set_output_destroyed_cb(handle_output_destroyed); |
712 | .destroyed = handle_output_destroyed, | 712 | wlc_set_output_resolution_cb(handle_output_resolution_change); |
713 | .resolution = handle_output_resolution_change, | 713 | wlc_set_output_focus_cb(handle_output_focused); |
714 | .focus = handle_output_focused, | 714 | wlc_set_output_render_pre_cb(handle_output_pre_render); |
715 | .render = { | 715 | wlc_set_output_render_post_cb(handle_output_post_render); |
716 | .pre = handle_output_pre_render, | 716 | wlc_set_view_created_cb(handle_view_created); |
717 | .post = handle_output_post_render | 717 | wlc_set_view_destroyed_cb(handle_view_destroyed); |
718 | } | 718 | wlc_set_view_focus_cb(handle_view_focus); |
719 | }, | 719 | wlc_set_view_request_geometry_cb(handle_view_geometry_request); |
720 | .view = { | 720 | wlc_set_view_request_state_cb(handle_view_state_request); |
721 | .created = handle_view_created, | 721 | wlc_set_keyboard_key_cb(handle_key); |
722 | .destroyed = handle_view_destroyed, | 722 | wlc_set_pointer_motion_cb(handle_pointer_motion); |
723 | .focus = handle_view_focus, | 723 | wlc_set_pointer_button_cb(handle_pointer_button); |
724 | .request = { | 724 | wlc_set_compositor_ready_cb(handle_wlc_ready); |
725 | .geometry = handle_view_geometry_request, | 725 | wlc_set_input_created_cb(handle_input_created); |
726 | .state = handle_view_state_request | 726 | wlc_set_input_destroyed_cb(handle_input_destroyed); |
727 | } | 727 | } |
728 | }, | ||
729 | .keyboard = { | ||
730 | .key = handle_key | ||
731 | }, | ||
732 | .pointer = { | ||
733 | .motion = handle_pointer_motion, | ||
734 | .button = handle_pointer_button | ||
735 | }, | ||
736 | .compositor = { | ||
737 | .ready = handle_wlc_ready | ||
738 | }, | ||
739 | .input = { | ||
740 | .created = handle_input_created, | ||
741 | .destroyed = handle_input_destroyed | ||
742 | } | ||
743 | }; | ||
diff --git a/sway/main.c b/sway/main.c index 7c712281..d4f18e9a 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -187,7 +187,8 @@ int main(int argc, char **argv) { | |||
187 | /* Changing code earlier than this point requires detailed review */ | 187 | /* Changing code earlier than this point requires detailed review */ |
188 | /* (That code runs as root on systems without logind, and wlc_init drops to | 188 | /* (That code runs as root on systems without logind, and wlc_init drops to |
189 | * another user.) */ | 189 | * another user.) */ |
190 | if (!wlc_init(&interface, argc, argv)) { | 190 | register_wlc_handlers(); |
191 | if (!wlc_init2()) { | ||
191 | return 1; | 192 | return 1; |
192 | } | 193 | } |
193 | register_extensions(); | 194 | register_extensions(); |