commit 1b447a3
Michael Forney
·
2014-08-09 17:24:05 +0000 UTC
parent 67856a4
Reorganize swc.h
2 files changed,
+66,
-66
+18,
-18
1@@ -175,23 +175,6 @@ static void window_event(struct wl_listener * listener, void * data)
2 }
3 }
4
5-static void new_window(struct swc_window * swc)
6-{
7- struct window * window;
8-
9- window = malloc(sizeof *window);
10-
11- if (!window)
12- return;
13-
14- window->swc = swc;
15- window->event_listener.notify = &window_event;
16- window->screen = NULL;
17-
18- /* Register a listener for the window's event signal. */
19- wl_signal_add(&swc->event_signal, &window->event_listener);
20-}
21-
22 static void screen_event(struct wl_listener * listener, void * data)
23 {
24 struct swc_event * event = data;
25@@ -230,7 +213,24 @@ static void new_screen(struct swc_screen * swc)
26 active_screen = screen;
27 }
28
29-const struct swc_manager manager = { &new_window, &new_screen };
30+static void new_window(struct swc_window * swc)
31+{
32+ struct window * window;
33+
34+ window = malloc(sizeof *window);
35+
36+ if (!window)
37+ return;
38+
39+ window->swc = swc;
40+ window->event_listener.notify = &window_event;
41+ window->screen = NULL;
42+
43+ /* Register a listener for the window's event signal. */
44+ wl_signal_add(&swc->event_signal, &window->event_listener);
45+}
46+
47+const struct swc_manager manager = { &new_screen, &new_window };
48
49 static void spawn(void * data, uint32_t time, uint32_t value, uint32_t state)
50 {
+48,
-48
1@@ -38,6 +38,49 @@ struct swc_rectangle
2
3 /* }}} */
4
5+/* Screens {{{ */
6+
7+enum
8+{
9+ /**
10+ * Sent when the screen is about to be destroyed.
11+ *
12+ * After this event is sent, the screen is not longer valid.
13+ */
14+ SWC_SCREEN_DESTROYED,
15+
16+ /**
17+ * Sent when the total area of the screen is changed.
18+ */
19+ SWC_SCREEN_GEOMETRY_CHANGED,
20+
21+ /**
22+ * Sent when the geometry of the screen available for laying out windows is
23+ * changed.
24+ *
25+ * Display servers should respond to this event by making sure all visible
26+ * windows are within this area.
27+ */
28+ SWC_SCREEN_USABLE_GEOMETRY_CHANGED
29+};
30+
31+struct swc_screen
32+{
33+ struct wl_signal event_signal;
34+
35+ /**
36+ * The total area of the screen.
37+ */
38+ struct swc_rectangle geometry;
39+
40+ /**
41+ * The area of the screen available for placing windows.
42+ */
43+ struct swc_rectangle usable_geometry;
44+};
45+
46+/* }}} */
47+
48 /* Windows {{{ */
49
50 enum
51@@ -190,49 +233,6 @@ void swc_window_end_resize(struct swc_window * window);
52
53 /* }}} */
54
55-/* Screens {{{ */
56-
57-enum
58-{
59- /**
60- * Sent when the screen is about to be destroyed.
61- *
62- * After this event is sent, the screen is not longer valid.
63- */
64- SWC_SCREEN_DESTROYED,
65-
66- /**
67- * Sent when the total area of the screen is changed.
68- */
69- SWC_SCREEN_GEOMETRY_CHANGED,
70-
71- /**
72- * Sent when the geometry of the screen available for laying out windows is
73- * changed.
74- *
75- * Display servers should respond to this event by making sure all visible
76- * windows are within this area.
77- */
78- SWC_SCREEN_USABLE_GEOMETRY_CHANGED
79-};
80-
81-struct swc_screen
82-{
83- struct wl_signal event_signal;
84-
85- /**
86- * The total area of the screen.
87- */
88- struct swc_rectangle geometry;
89-
90- /**
91- * The area of the screen available for placing windows.
92- */
93- struct swc_rectangle usable_geometry;
94-};
95-
96-/* }}} */
97-
98 /* Bindings {{{ */
99
100 enum
101@@ -297,6 +297,11 @@ struct swc_event
102 */
103 struct swc_manager
104 {
105+ /**
106+ * Called when a new screen is created.
107+ */
108+ void (* new_screen)(struct swc_screen * screen);
109+
110 /**
111 * Called when a new window is created.
112 *
113@@ -304,11 +309,6 @@ struct swc_manager
114 * it changes to the TOPLEVEL state.
115 */
116 void (* new_window)(struct swc_window * window);
117-
118- /**
119- * Called when a new screen is created.
120- */
121- void (* new_screen)(struct swc_screen * screen);
122 };
123
124 /**