From 00d862724a5dae43dbf1cbe4378fb846218fb3c3 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 2 Aug 2006 22:02:31 +0000 Subject: rename session.screen*.iconbar.deiconifyMode to session.screen0.userFollowModel --- ChangeLog | 14 ++++++++++++++ src/Ewmh.cc | 16 ++++++++++++---- src/IconButton.cc | 10 +++++----- src/IconbarTool.cc | 36 ------------------------------------ src/IconbarTool.hh | 9 --------- src/Screen.cc | 1 + src/Screen.hh | 4 +++- src/ScreenResources.cc | 5 +++++ src/Workspace.cc | 21 ++++++++++++++------- 9 files changed, 54 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fa4cc5..44ece83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,20 @@ (Format: Year/Month/Day) Changes for 1.0rc3: *06/08/02: + * Rename session.screen*.iconbar.deiconifyMode to + session.screen*.userFollowModel (Mark) + This resource is used for: + - clicking a window on a different workspace in the iconbar + - _NET_ACTIVE_WINDOW messages where the source is a pager + - clicking a client in the workspace menu (and the opposite is used for + right clicks) + Possible values are: + - Follow: go to the workspace of the selected window + - Current: bring the window to the current workspace + - SemiFollow: act like Current for iconified windows, else Follow + - Ignore: leave it alone + Screen.cc/hh ScreenResources.cc/hh IconbarTool.cc/hh IconButton.cc Ewmh.cc + Workspace.cc * Update _NET_WORKAREA on screen dimension change (Mark) Screen.cc * Fix ClickTabFocus and MouseTabFocus in nls (Thanks Antonio Gomes) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 51f7fa8..96ba209 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -766,23 +766,31 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, return true; // ce.window = window to focus - winclient->focus(); if (winclient->fbwindow()) { FluxboxWindow* fbwin = winclient->fbwindow(); - fbwin->raise(); // if the raised window is on a different workspace // we do what the user wish: // either ignore|go to that workspace|get the window if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber()) { - if (fbwin->screen().getFollowModel() == BScreen::FOLLOW_ACTIVE_WINDOW) { + BScreen::FollowModel model = (ce.data.l[0] == 2) ? + fbwin->screen().getUserFollowModel() : + fbwin->screen().getFollowModel(); + if (model == BScreen::FOLLOW_ACTIVE_WINDOW) { fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber()); - } else if (fbwin->screen().getFollowModel() == BScreen::FETCH_ACTIVE_WINDOW) { + } else if (model == BScreen::FETCH_ACTIVE_WINDOW) { fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin); + } else if (model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW) { + if (fbwin->isIconic()) + fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin); + else + fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber()); } // else we ignore it. my favourite mode :) } + fbwin->raise(); } + winclient->focus(); return true; } else if (ce.message_type == m_net_close_window) { if (winclient == 0) diff --git a/src/IconButton.cc b/src/IconButton.cc index 11b2c02..b9cf523 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc @@ -77,21 +77,21 @@ public: // if the workspace is changed. FluxboxWindow &win = m_win; if(win.isIconic() || !win.isFocused()) { - switch(m_tool.deiconifyMode()) { - case IconbarTool::SEMIFOLLOW: + switch(win.screen().getUserFollowModel()) { + case BScreen::SEMIFOLLOW_ACTIVE_WINDOW: if (win.isIconic()) { win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win); } else { win.screen().changeWorkspaceID(win.workspaceNumber()); } break; - case IconbarTool::CURRENT: + case BScreen::FETCH_ACTIVE_WINDOW: win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win); break; - case IconbarTool::FOLLOW: - default: + case BScreen::FOLLOW_ACTIVE_WINDOW: if (!win.isStuck()) win.screen().changeWorkspaceID(win.workspaceNumber()); + default: break; }; win.raiseAndFocus(); diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 4ce600f..413aebf 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -74,39 +74,6 @@ void FbTk::Resource::setFromString(const char *strval) { } template<> -void FbTk::Resource::setDefaultValue() { - m_value = IconbarTool::FOLLOW; -} - -template<> -void FbTk::Resource::setFromString(const char* strval) { - if (strncasecmp(strval, "Current", strlen("Current")) == 0) - m_value = IconbarTool::CURRENT; - else if (strncasecmp(strval, "Follow", strlen("Follow")) == 0) - m_value = IconbarTool::FOLLOW; - else if (strncasecmp(strval, "SemiFollow", strlen("SemiFollow")) == 0) - m_value = IconbarTool::SEMIFOLLOW; - else - setDefaultValue(); -} - -template<> -std::string FbTk::Resource::getString() const { - switch (m_value) { - case IconbarTool::SEMIFOLLOW: - return std::string("SemiFollow"); - break; - case IconbarTool::CURRENT: - return std::string("Current"); - break; - case IconbarTool::FOLLOW: - default: - return std::string("Follow"); - break; - }; -} - -template<> void FbTk::Resource::setDefaultValue() { m_value = IconbarTool::SCREEN; } @@ -373,9 +340,6 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr m_empty_pm(0), m_rc_mode(screen.resourceManager(), WORKSPACE, screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), - m_deiconify_mode(screen.resourceManager(), FOLLOW, - screen.name() + ".iconbar.deiconifyMode", - screen.name() + ".iconbar.DeiconifyMode"), m_wheel_mode(screen.resourceManager(), OFF, screen.name() + ".iconbar.wheelMode", screen.name() + ".iconbar.WheelMode"), diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh index feae16a..3d7848d 100644 --- a/src/IconbarTool.hh +++ b/src/IconbarTool.hh @@ -56,13 +56,6 @@ public: ALLWINDOWS ///< all windows and all icons from all workspaces }; - /// deiconfiy mode for iconbuttons - enum DeiconifyMode { - CURRENT, ///< raise the window on the current workspace - FOLLOW, ///< raise the window on the workspace it was iconified from - SEMIFOLLOW, ///< like current for iconified windows, and like follow for others - }; - /// wheeling on iconbutton enum WheelMode { OFF, ///< no wheeling, default mode @@ -91,7 +84,6 @@ public: unsigned int borderWidth() const; Mode mode() const { return *m_rc_mode; } - DeiconifyMode deiconifyMode() const { return *m_deiconify_mode; } WheelMode wheelMode() const { return *m_wheel_mode; } void setOrientation(FbTk::Orientation orient); @@ -138,7 +130,6 @@ private: IconList m_icon_list; FbTk::Resource m_rc_mode; - FbTk::Resource m_deiconify_mode; FbTk::Resource m_wheel_mode; FbTk::Resource m_rc_alignment; ///< alignment of buttons FbTk::Resource m_rc_client_width; ///< size of client button in LEFT/RIGHT mode diff --git a/src/Screen.cc b/src/Screen.cc index 69d4444..35df59a 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -262,6 +262,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), + user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"), workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), focused_alpha(rm, 255, scrname+".window.focus.alpha", altscrname+".Window.Focus.Alpha"), diff --git a/src/Screen.hh b/src/Screen.hh index ecfc619..b0eb9dd 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -84,6 +84,7 @@ public: enum FollowModel { IGNORE_OTHER_WORKSPACES = 0, ///< who cares? FOLLOW_ACTIVE_WINDOW, ///< go to that workspace + SEMIFOLLOW_ACTIVE_WINDOW, ///< fetch iconified windows, else follow FETCH_ACTIVE_WINDOW ///< put that window to the current workspace }; @@ -136,6 +137,7 @@ public: ResizeModel getResizeModel() const { return *resource.resize_model; } inline FollowModel getFollowModel() const { return *resource.follow_model; } + inline FollowModel getUserFollowModel() const { return *resource.user_follow_model; } inline const std::string &getScrollAction() const { return *resource.scroll_action; } inline const bool getScrollReverse() const { return *resource.scroll_reverse; } @@ -441,7 +443,7 @@ private: FbTk::Resource resize_model; FbTk::Resource tab_placement; FbTk::Resource windowmenufile; - FbTk::Resource follow_model; + FbTk::Resource follow_model, user_follow_model; bool ordered_dither; FbTk::Resource workspaces, edge_snap_threshold, focused_alpha, unfocused_alpha, menu_alpha, menu_delay, menu_delay_close, tab_width; diff --git a/src/ScreenResources.cc b/src/ScreenResources.cc index ea88c79..83bd7c9 100644 --- a/src/ScreenResources.cc +++ b/src/ScreenResources.cc @@ -88,6 +88,9 @@ std::string FbTk::Resource::getString() const { case BScreen::FETCH_ACTIVE_WINDOW: return std::string("Current"); break; + case BScreen::SEMIFOLLOW_ACTIVE_WINDOW: + return std::string("SemiFollow"); + break; case BScreen::IGNORE_OTHER_WORKSPACES: default: return std::string("Ignore"); @@ -105,6 +108,8 @@ setFromString(char const *strval) { strcasecmp(strval, "CurrentWorkspace") == 0 || strcasecmp(strval, "Fetch") == 0) m_value = BScreen::FETCH_ACTIVE_WINDOW; + else if (strcasecmp(strval, "SemiFollow") == 0) + m_value = BScreen::SEMIFOLLOW_ACTIVE_WINDOW; else setDefaultValue(); } diff --git a/src/Workspace.cc b/src/Workspace.cc index b048480..2ee2768 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -104,15 +104,22 @@ public: return; FluxboxWindow &win = *m_client.fbwindow(); - // fetch the window to the current workspace - if (button == 2 && win.screen().currentWorkspaceID() != win.workspaceNumber()) { + if (win.screen().currentWorkspaceID() != win.workspaceNumber()) { win.menu().hide(); - win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win, true); - } else { // warp to the workspace of the window - win.screen().changeWorkspaceID(win.workspaceNumber()); - win.setCurrentClient(m_client); - win.raiseAndFocus(); + BScreen::FollowModel model = win.screen().getUserFollowModel(); + if (model == BScreen::IGNORE_OTHER_WORKSPACES) + return; + // fetch the window to the current workspace + else if ((button == 3) ^ (model == BScreen::FETCH_ACTIVE_WINDOW || + win.isIconic() && model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW)) { + win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win, true); + return; + } + // warp to the workspace of the window + win.screen().changeWorkspaceID(win.workspaceNumber()); } + win.setCurrentClient(m_client); + win.raiseAndFocus(); } const std::string &label() const { return m_client.title(); } -- cgit v0.11.2