added followModel Ressources, dunno if the name is so clever, i am open for other suggestions
This commit is contained in:
parent
9fbf1ab395
commit
a6d4a3563c
3 changed files with 38 additions and 2 deletions
|
@ -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"),
|
||||
|
|
|
@ -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<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;
|
||||
|
|
|
@ -156,6 +156,34 @@ setFromString(char const *strval) {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue