commit bf9ee7c

Michael Forney  ·  2014-11-30 07:42:11 +0000 UTC
parent 32a2608
window: Allow window manager to handle move/resize requests
2 files changed,  +24, -0
+18, -0
 1@@ -124,6 +124,24 @@ struct swc_window_handler
 2      * Called when the pointer enters the window.
 3      */
 4     void (* entered)(void * data);
 5+
 6+    /**
 7+     * Called when the window wants to initiate an interactive move, but the
 8+     * window is not in stacked mode.
 9+     *
10+     * The window manager may respond by changing the window's mode, after which
11+     * the interactive move will be honored.
12+     */
13+    void (* move)(void * data);
14+
15+    /**
16+     * Called when the window wants to initiate an interactive resize, but the
17+     * window is not in stacked mode.
18+     *
19+     * The window manager may respond by changing the window's mode, after which
20+     * the interactive resize will be honored.
21+     */
22+    void (* resize)(void * data);
23 };
24 
25 struct swc_window
+6, -0
 1@@ -483,6 +483,9 @@ void window_set_parent(struct window * window, struct window * parent)
 2 
 3 void window_begin_move(struct window * window, struct button * button)
 4 {
 5+    if (window->mode != WINDOW_MODE_STACKED && window->handler->move)
 6+        window->handler->move(window->handler_data);
 7+
 8     if (window->mode != WINDOW_MODE_STACKED || window->move.interaction.active)
 9         return;
10 
11@@ -498,6 +501,9 @@ void window_begin_move(struct window * window, struct button * button)
12 void window_begin_resize(struct window * window, uint32_t edges,
13                          struct button * button)
14 {
15+    if (window->mode != WINDOW_MODE_STACKED && window->handler->resize)
16+        window->handler->resize(window->handler_data);
17+
18     if (window->mode != WINDOW_MODE_STACKED
19         || window->resize.interaction.active)
20     {