Update to new WLC API

master
Drew DeVault 9 years ago
parent 686530d5e8
commit 5c85c018b4

@ -4,7 +4,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <wlc/wlc.h> #include <wlc/wlc.h>
extern struct wlc_interface interface; void register_wlc_handlers();
extern uint32_t keys_pressed[32]; extern uint32_t keys_pressed[32];
#endif #endif

@ -706,38 +706,22 @@ static void handle_wlc_ready(void) {
} }
} }
struct wlc_interface interface = { void register_wlc_handlers() {
.output = { wlc_set_output_created_cb(handle_output_created);
.created = handle_output_created, wlc_set_output_destroyed_cb(handle_output_destroyed);
.destroyed = handle_output_destroyed, wlc_set_output_resolution_cb(handle_output_resolution_change);
.resolution = handle_output_resolution_change, wlc_set_output_focus_cb(handle_output_focused);
.focus = handle_output_focused, wlc_set_output_render_pre_cb(handle_output_pre_render);
.render = { wlc_set_output_render_post_cb(handle_output_post_render);
.pre = handle_output_pre_render, wlc_set_view_created_cb(handle_view_created);
.post = handle_output_post_render wlc_set_view_destroyed_cb(handle_view_destroyed);
} wlc_set_view_focus_cb(handle_view_focus);
}, wlc_set_view_request_geometry_cb(handle_view_geometry_request);
.view = { wlc_set_view_request_state_cb(handle_view_state_request);
.created = handle_view_created, wlc_set_keyboard_key_cb(handle_key);
.destroyed = handle_view_destroyed, wlc_set_pointer_motion_cb(handle_pointer_motion);
.focus = handle_view_focus, wlc_set_pointer_button_cb(handle_pointer_button);
.request = { wlc_set_compositor_ready_cb(handle_wlc_ready);
.geometry = handle_view_geometry_request, wlc_set_input_created_cb(handle_input_created);
.state = handle_view_state_request wlc_set_input_destroyed_cb(handle_input_destroyed);
} }
},
.keyboard = {
.key = handle_key
},
.pointer = {
.motion = handle_pointer_motion,
.button = handle_pointer_button
},
.compositor = {
.ready = handle_wlc_ready
},
.input = {
.created = handle_input_created,
.destroyed = handle_input_destroyed
}
};

@ -187,7 +187,8 @@ int main(int argc, char **argv) {
/* Changing code earlier than this point requires detailed review */ /* Changing code earlier than this point requires detailed review */
/* (That code runs as root on systems without logind, and wlc_init drops to /* (That code runs as root on systems without logind, and wlc_init drops to
* another user.) */ * another user.) */
if (!wlc_init(&interface, argc, argv)) { register_wlc_handlers();
if (!wlc_init2()) {
return 1; return 1;
} }
register_extensions(); register_extensions();

Loading…
Cancel
Save