swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 26ab4aa933badcf46e2ec4f3462a2334c12dc2d8
parent 974114cbf2d79ae8f2d9c34ccb29b7cb3dadf979
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 25 Nov 2013 14:42:23 -0800

Access bindings globals from swc struct

Diffstat:
Mlibswc/bindings.c | 5++++-
Mlibswc/bindings.h | 7++++---
Mlibswc/internal.h | 1+
Mlibswc/swc.c | 4+++-
4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/libswc/bindings.c b/libswc/bindings.c @@ -81,7 +81,10 @@ static bool handle_key(struct swc_keyboard * keyboard, uint32_t time, static const struct swc_keyboard_handler binding_handler = { .key = &handle_key, }; -const struct swc_keyboard_handler * swc_binding_handler = &binding_handler; + +const struct swc_bindings_global swc_bindings_global = { + .keyboard_handler = &binding_handler +}; bool swc_bindings_initialize() { diff --git a/libswc/bindings.h b/libswc/bindings.h @@ -26,9 +26,10 @@ #include <stdbool.h> -struct swc_keyboard_handler; - -extern const struct swc_keyboard_handler * swc_binding_handler; +struct swc_bindings_global +{ + const struct swc_keyboard_handler * keyboard_handler; +}; bool swc_bindings_initialize(); void swc_bindings_finalize(); diff --git a/libswc/internal.h b/libswc/internal.h @@ -32,6 +32,7 @@ struct swc struct udev * udev; + const struct swc_bindings_global * const bindings; struct swc_compositor * compositor; }; diff --git a/libswc/swc.c b/libswc/swc.c @@ -30,15 +30,17 @@ #include <libudev.h> +extern const struct swc_bindings_global swc_bindings_global; static struct swc_compositor compositor; struct swc swc = { + .bindings = &swc_bindings_global, .compositor = &compositor }; static void setup_compositor() { - compositor.seat.keyboard.handler = swc_binding_handler; + compositor.seat.keyboard.handler = swc.bindings->keyboard_handler; wl_signal_add(&compositor.seat.pointer.focus.event_signal, swc_window_enter_listener); }