swc

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

commit f2138d7fdc7aa50b671f210d810c0eec87331f45
parent 4151e5a61bfaceddd50cc30d3ed2785f5fa72b7e
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 19 Nov 2013 18:42:54 -0800

Implement window enter events

Diffstat:
Mlibswc/swc.c | 2++
Mlibswc/window.c | 20++++++++++++++++++++
Mlibswc/window.h | 2++
3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/libswc/swc.c b/libswc/swc.c @@ -38,6 +38,8 @@ const struct swc_manager * swc_manager; static void setup_compositor() { swc.compositor.seat.keyboard.handler = swc_binding_handler; + wl_signal_add(&swc.compositor.seat.pointer.focus.event_signal, + swc_window_enter_listener); } bool swc_initialize(struct wl_display * display, diff --git a/libswc/window.c b/libswc/window.c @@ -31,6 +31,26 @@ #include <stdlib.h> #include <string.h> +static void handle_window_enter(struct wl_listener * listener, void * data) +{ + struct swc_event * event = data; + struct swc_input_focus_event_data * event_data = event->data; + struct swc_window * window; + + if (event->type != SWC_INPUT_FOCUS_EVENT_CHANGED) + return; + + if (!event_data->new || !(window = swc_window_get(event_data->new))) + return; + + swc_send_event(&window->event_signal, SWC_WINDOW_ENTERED, NULL); +} + +static struct wl_listener window_enter_listener = { + .notify = &handle_window_enter +}; +struct wl_listener * swc_window_enter_listener = &window_enter_listener; + void swc_window_show(struct swc_window * window) { swc_compositor_surface_show(INTERNAL(window)->surface); diff --git a/libswc/window.h b/libswc/window.h @@ -43,6 +43,8 @@ struct swc_window_internal const struct swc_window_impl * impl; }; +extern struct wl_listener * swc_window_enter_listener; + bool swc_window_initialize(struct swc_window * window, const struct swc_window_impl * impl, struct swc_surface * surface);