swc

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

commit bf9ee7c8e70917cc7d1a0b05ae0d333abeb49812
parent 32a260879853762d9d187e54042533655cfc04ed
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 29 Nov 2014 23:42:11 -0800

window: Allow window manager to handle move/resize requests

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

diff --git a/libswc/swc.h b/libswc/swc.h @@ -124,6 +124,24 @@ struct swc_window_handler * Called when the pointer enters the window. */ void (* entered)(void * data); + + /** + * Called when the window wants to initiate an interactive move, but the + * window is not in stacked mode. + * + * The window manager may respond by changing the window's mode, after which + * the interactive move will be honored. + */ + void (* move)(void * data); + + /** + * Called when the window wants to initiate an interactive resize, but the + * window is not in stacked mode. + * + * The window manager may respond by changing the window's mode, after which + * the interactive resize will be honored. + */ + void (* resize)(void * data); }; struct swc_window diff --git a/libswc/window.c b/libswc/window.c @@ -483,6 +483,9 @@ void window_set_parent(struct window * window, struct window * parent) void window_begin_move(struct window * window, struct button * button) { + if (window->mode != WINDOW_MODE_STACKED && window->handler->move) + window->handler->move(window->handler_data); + if (window->mode != WINDOW_MODE_STACKED || window->move.interaction.active) return; @@ -498,6 +501,9 @@ void window_begin_move(struct window * window, struct button * button) void window_begin_resize(struct window * window, uint32_t edges, struct button * button) { + if (window->mode != WINDOW_MODE_STACKED && window->handler->resize) + window->handler->resize(window->handler_data); + if (window->mode != WINDOW_MODE_STACKED || window->resize.interaction.active) {