From a6d4a3563c524e5fd6ee9ca18c0f5126a493108d Mon Sep 17 00:00:00 2001 From: akir Date: Sat, 16 Oct 2004 22:18:56 +0000 Subject: added followModel Ressources, dunno if the name is so clever, i am open for other suggestions --- src/Screen.cc | 3 ++- src/Screen.hh | 9 ++++++++- src/ScreenResources.cc | 28 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 24e75b0..9a8d2a0 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.294 2004/10/04 15:37:58 rathnor Exp $ +// $Id: Screen.cc,v 1.295 2004/10/16 22:18:56 akir Exp $ #include "Screen.hh" @@ -175,6 +175,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, resizemode(rm, "", scrname+".resizeMode", altscrname+".ResizeMode"), windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), focus_model(rm, CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"), + follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), 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 039f9f3..4788fff 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.147 2004/09/16 10:10:37 fluxgen Exp $ +// $Id: Screen.hh,v 1.148 2004/10/16 22:18:56 akir Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -78,6 +78,11 @@ class Subject; class BScreen : public FbTk::Observer, private FbTk::NotCopyable { public: enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS }; + enum FollowModel { ///< a window becomes active / focussed on a different workspace + IGNORE_OTHER_WORKSPACES = 0, ///< who cares? + FOLLOW_ACTIVE_WINDOW, ///< go to that workspace + FETCH_ACTIVE_WINDOW ///< put that window to the current workspace + }; enum FocusDir { FOCUSUP, FOCUSDOWN, FOCUSLEFT, FOCUSRIGHT }; enum PlacementPolicy { ROWSMARTPLACEMENT, COLSMARTPLACEMENT, CASCADEPLACEMENT, UNDERMOUSEPLACEMENT}; @@ -125,6 +130,7 @@ public: inline const std::string &getRootCommand() const { return *resource.rootcommand; } inline const std::string &getResizeMode() const { return *resource.resizemode; } inline FocusModel getFocusModel() const { return *resource.focus_model; } + inline FollowModel getFollowModel() const { return *resource.follow_model; } inline Slit *slit() { return m_slit.get(); } inline const Slit *slit() const { return m_slit.get(); } @@ -434,6 +440,7 @@ private: FbTk::Resource resizemode; FbTk::Resource windowmenufile; FbTk::Resource focus_model; + FbTk::Resource follow_model; bool ordered_dither; FbTk::Resource workspaces, edge_snap_threshold, focused_alpha, unfocused_alpha, menu_alpha, menu_delay, menu_delay_close; diff --git a/src/ScreenResources.cc b/src/ScreenResources.cc index cd5bb8d..70179b6 100644 --- a/src/ScreenResources.cc +++ b/src/ScreenResources.cc @@ -157,6 +157,34 @@ setFromString(char const *strval) { } template<> +std::string FbTk::Resource:: +getString() { + switch (m_value) { + case BScreen::FOLLOW_ACTIVE_WINDOW: + return std::string("Follow"); + break; + case BScreen::FETCH_ACTIVE_WINDOW: + return std::string("Current"); + break; + }; + + return std::string("Ignore"); +} + +template<> +void FbTk::Resource:: +setFromString(char const *strval) { + if (strcasecmp(strval, "Follow") == 0) + m_value = BScreen::FOLLOW_ACTIVE_WINDOW; + else if (strcasecmp(strval, "Current") == 0 || + strcasecmp(strval, "CurrentWorkspace") == 0 || + strcasecmp(strval, "Fetch") == 0) + m_value = BScreen::FETCH_ACTIVE_WINDOW; + else + setDefaultValue(); +} + +template<> void FbTk::Resource::setDefaultValue() { *(*this) = FbTk::GContext::LINESOLID; } -- cgit v0.11.2