added followModel Ressources, dunno if the name is so clever, i am open for other suggestions
akir akir
3 files changed,
38 insertions(+),
2 deletions(-)
M
src/Screen.cc
→
src/Screen.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
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"),
M
src/Screen.hh
→
src/Screen.hh
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 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 @@
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 @@ FbTk::Resource<std::string> rootcommand;
FbTk::Resource<std::string> resizemode; FbTk::Resource<std::string> windowmenufile; FbTk::Resource<FocusModel> focus_model; + FbTk::Resource<FollowModel> follow_model; bool ordered_dither; FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha, unfocused_alpha, menu_alpha, menu_delay, menu_delay_close;
M
src/ScreenResources.cc
→
src/ScreenResources.cc
@@ -157,6 +157,34 @@ setDefaultValue();
} template<> +std::string FbTk::Resource<BScreen::FollowModel>:: +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<BScreen::FollowModel>:: +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<FbTk::GContext::LineStyle>::setDefaultValue() { *(*this) = FbTk::GContext::LINESOLID; }