From a1205efc205c4553deeb0ad64118dca2b8126ac0 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 7 Jan 2008 13:38:26 +0100 Subject: [PATCH] move toggle floating function to layout.c and fix problem when moving with mouse tiled windows --- layout.c | 25 +++++++++++++++++++++++++ layout.h | 1 + mouse.c | 2 +- tag.c | 22 ---------------------- tag.h | 1 - 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/layout.c b/layout.c index 9b189df2..abab034b 100644 --- a/layout.c +++ b/layout.c @@ -258,4 +258,29 @@ uicb_tag_setlayout(int screen, char *arg) saveawesomeprops(screen); } +/** Toggle floating state of a client + * \param screen Screen ID + * \param arg unused + * \ingroup ui_callback + */ +void +uicb_client_togglefloating(int screen, char *arg) +{ + Client *sel = globalconf.focus->client; + + if(!sel) + return; + + if((sel->isfloating = !sel->isfloating)) + { + if(!arg) + client_resize(sel, sel->f_geometry, False); + } + else if(sel->ismax) + client_resize(sel, sel->m_geometry, False); + + client_saveprops(sel); + arrange(screen); +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layout.h b/layout.h index 1dbcd4f7..cb7f3597 100644 --- a/layout.h +++ b/layout.h @@ -43,6 +43,7 @@ void saveawesomeprops(int); Uicb uicb_client_focusnext; Uicb uicb_client_focusprev; Uicb uicb_tag_setlayout; +Uicb uicb_client_togglefloating; #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/mouse.c b/mouse.c index c5663338..b1d62476 100644 --- a/mouse.c +++ b/mouse.c @@ -56,7 +56,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused))) if((curtags[0]->layout->arrange != layout_floating) && !c->isfloating) - uicb_client_togglefloating(screen, NULL); + uicb_client_togglefloating(screen, (char *) "be nice"); else restack(screen); diff --git a/tag.c b/tag.c index ba885bf8..1fa7ff41 100644 --- a/tag.c +++ b/tag.c @@ -210,28 +210,6 @@ uicb_client_tag(int screen, char *arg) arrange(screen); } -/** Toggle floating state of a client - * \param screen Screen ID - * \param arg unused - * \ingroup ui_callback - */ -void -uicb_client_togglefloating(int screen, char *arg __attribute__((unused))) -{ - Client *sel = globalconf.focus->client; - - if(!sel) - return; - - if((sel->isfloating = !sel->isfloating)) - client_resize(sel, sel->f_geometry, False); - else if(sel->ismax) - client_resize(sel, sel->m_geometry, False); - - client_saveprops(sel); - arrange(screen); -} - /** Toggle a tag on client * \param screen Screen ID * \param arg Tag name diff --git a/tag.h b/tag.h index 9c964a7c..cb218636 100644 --- a/tag.h +++ b/tag.h @@ -36,7 +36,6 @@ void tag_client_with_rules(Client *); void tag_view(int, int); Uicb uicb_client_tag; -Uicb uicb_client_togglefloating; Uicb uicb_client_toggletag; Uicb uicb_tag_toggleview; Uicb uicb_tag_view;