commit 1b447a367081414b05072922bc007ef6f35d3071
parent 67856a4d6df781a69bb66f16b95410a3dee17f53
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 9 Aug 2014 10:24:05 -0700
Reorganize swc.h
Diffstat:
M | example/wm.c | | | 36 | ++++++++++++++++++------------------ |
M | libswc/swc.h | | | 96 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
2 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/example/wm.c b/example/wm.c
@@ -175,23 +175,6 @@ static void window_event(struct wl_listener * listener, void * data)
}
}
-static void new_window(struct swc_window * swc)
-{
- struct window * window;
-
- window = malloc(sizeof *window);
-
- if (!window)
- return;
-
- window->swc = swc;
- window->event_listener.notify = &window_event;
- window->screen = NULL;
-
- /* Register a listener for the window's event signal. */
- wl_signal_add(&swc->event_signal, &window->event_listener);
-}
-
static void screen_event(struct wl_listener * listener, void * data)
{
struct swc_event * event = data;
@@ -230,7 +213,24 @@ static void new_screen(struct swc_screen * swc)
active_screen = screen;
}
-const struct swc_manager manager = { &new_window, &new_screen };
+static void new_window(struct swc_window * swc)
+{
+ struct window * window;
+
+ window = malloc(sizeof *window);
+
+ if (!window)
+ return;
+
+ window->swc = swc;
+ window->event_listener.notify = &window_event;
+ window->screen = NULL;
+
+ /* Register a listener for the window's event signal. */
+ wl_signal_add(&swc->event_signal, &window->event_listener);
+}
+
+const struct swc_manager manager = { &new_screen, &new_window };
static void spawn(void * data, uint32_t time, uint32_t value, uint32_t state)
{
diff --git a/libswc/swc.h b/libswc/swc.h
@@ -38,6 +38,49 @@ struct swc_rectangle
/* }}} */
+/* Screens {{{ */
+
+enum
+{
+ /**
+ * Sent when the screen is about to be destroyed.
+ *
+ * After this event is sent, the screen is not longer valid.
+ */
+ SWC_SCREEN_DESTROYED,
+
+ /**
+ * Sent when the total area of the screen is changed.
+ */
+ SWC_SCREEN_GEOMETRY_CHANGED,
+
+ /**
+ * Sent when the geometry of the screen available for laying out windows is
+ * changed.
+ *
+ * Display servers should respond to this event by making sure all visible
+ * windows are within this area.
+ */
+ SWC_SCREEN_USABLE_GEOMETRY_CHANGED
+};
+
+struct swc_screen
+{
+ struct wl_signal event_signal;
+
+ /**
+ * The total area of the screen.
+ */
+ struct swc_rectangle geometry;
+
+ /**
+ * The area of the screen available for placing windows.
+ */
+ struct swc_rectangle usable_geometry;
+};
+
+/* }}} */
+
/* Windows {{{ */
enum
@@ -190,49 +233,6 @@ void swc_window_end_resize(struct swc_window * window);
/* }}} */
-/* Screens {{{ */
-
-enum
-{
- /**
- * Sent when the screen is about to be destroyed.
- *
- * After this event is sent, the screen is not longer valid.
- */
- SWC_SCREEN_DESTROYED,
-
- /**
- * Sent when the total area of the screen is changed.
- */
- SWC_SCREEN_GEOMETRY_CHANGED,
-
- /**
- * Sent when the geometry of the screen available for laying out windows is
- * changed.
- *
- * Display servers should respond to this event by making sure all visible
- * windows are within this area.
- */
- SWC_SCREEN_USABLE_GEOMETRY_CHANGED
-};
-
-struct swc_screen
-{
- struct wl_signal event_signal;
-
- /**
- * The total area of the screen.
- */
- struct swc_rectangle geometry;
-
- /**
- * The area of the screen available for placing windows.
- */
- struct swc_rectangle usable_geometry;
-};
-
-/* }}} */
-
/* Bindings {{{ */
enum
@@ -298,17 +298,17 @@ struct swc_event
struct swc_manager
{
/**
+ * Called when a new screen is created.
+ */
+ void (* new_screen)(struct swc_screen * screen);
+
+ /**
* Called when a new window is created.
*
* The window begins in the WITHDRAWN state and should not be managed until
* it changes to the TOPLEVEL state.
*/
void (* new_window)(struct swc_window * window);
-
- /**
- * Called when a new screen is created.
- */
- void (* new_screen)(struct swc_screen * screen);
};
/**