From 09eade65d558dfc032ac415607fc2c6eb99aea19 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 22 Apr 2004 21:07:57 +0000 Subject: attach area, patch from Mathias Gumz --- src/Window.cc | 13 ++++++++++--- src/fluxbox.cc | 21 ++++++++++++++++++++- src/fluxbox.hh | 5 ++++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index 0b306ef..ff93633 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.281 2004/04/18 21:17:36 fluxgen Exp $ +// $Id: Window.cc,v 1.282 2004/04/22 21:07:57 fluxgen Exp $ #include "Window.hh" @@ -3095,9 +3095,16 @@ void FluxboxWindow::attachTo(int x, int y) { // search for a fluxboxwindow WinClient *client = Fluxbox::instance()->searchWindow(child); FluxboxWindow *attach_to_win = 0; - if (client) + if (client) { + Fluxbox::TabsAttachArea area= Fluxbox::instance()->getTabsAttachArea(); + if (area == Fluxbox::ATTACH_AREA_WINDOW) attach_to_win = client->fbwindow(); - + else if (area == Fluxbox::ATTACH_AREA_TITLEBAR) { + if(client->fbwindow()->hasTitlebar() && + client->fbwindow()->y() + client->fbwindow()->titlebarHeight() > dest_y) + attach_to_win = client->fbwindow(); + } + } if (attach_to_win != this && attach_to_win != 0) { diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 05b4ec2..fbcaa34 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.239 2004/04/19 22:45:44 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.240 2004/04/22 21:07:57 fluxgen Exp $ #include "fluxbox.hh" @@ -193,6 +193,15 @@ setFromString(char const *strval) { } template<> +void FbTk::Resource:: +setFromString(char const *strval) { + if (strcasecmp(strval, "Titlebar")==0) + m_value= Fluxbox::ATTACH_AREA_TITLEBAR; + else + m_value= Fluxbox::ATTACH_AREA_WINDOW; +} + +template<> void FbTk::Resource:: setFromString(const char *strval) { if (sscanf(strval, "%ul", &m_value) != 1) @@ -256,6 +265,15 @@ getString() { } template<> +std::string FbTk::Resource:: +getString() { + if (m_value == Fluxbox::ATTACH_AREA_TITLEBAR) + return "Titlebar"; + else + return "Window"; +} + +template<> string FbTk::Resource:: getString() { char tmpstr[128]; @@ -394,6 +412,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile m_rc_titlebar_right(m_resourcemanager, TitlebarList(&s_titlebar_right[0], &s_titlebar_right[3]), "session.titlebar.right", "Session.Titlebar.Right"), + m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"), m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 2625ec0..ea10e5d 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.86 2004/04/19 22:45:44 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.87 2004/04/22 21:07:57 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -107,6 +107,7 @@ public: /// obsolete enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; + enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR}; @@ -114,6 +115,7 @@ public: inline const std::vector& getTitlebarRight() const { return *m_rc_titlebar_right; } inline const std::vector& getTitlebarLeft() const { return *m_rc_titlebar_left; } + inline const Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } inline const std::string &getMenuFilename() const { return *m_rc_menufile; } @@ -252,6 +254,7 @@ private: FbTk::Resource m_rc_titlebar_left, m_rc_titlebar_right; + FbTk::Resource m_rc_tabs_attach_area; FbTk::Resource m_rc_cache_life, m_rc_cache_max; FbTk::Resource m_rc_auto_raise_delay; FbTk::Resource m_rc_use_mod1; /// temporary!, to disable mod1 for resize/move -- cgit v0.11.2