summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Ewmh.cc16
-rw-r--r--src/IconButton.cc10
-rw-r--r--src/IconbarTool.cc36
-rw-r--r--src/IconbarTool.hh9
-rw-r--r--src/Screen.cc1
-rw-r--r--src/Screen.hh4
-rw-r--r--src/ScreenResources.cc5
-rw-r--r--src/Workspace.cc21
8 files changed, 40 insertions, 62 deletions
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,
766 return true; 766 return true;
767 // ce.window = window to focus 767 // ce.window = window to focus
768 768
769 winclient->focus();
770 if (winclient->fbwindow()) { 769 if (winclient->fbwindow()) {
771 770
772 FluxboxWindow* fbwin = winclient->fbwindow(); 771 FluxboxWindow* fbwin = winclient->fbwindow();
773 fbwin->raise();
774 772
775 // if the raised window is on a different workspace 773 // if the raised window is on a different workspace
776 // we do what the user wish: 774 // we do what the user wish:
777 // either ignore|go to that workspace|get the window 775 // either ignore|go to that workspace|get the window
778 if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber()) { 776 if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber()) {
779 if (fbwin->screen().getFollowModel() == BScreen::FOLLOW_ACTIVE_WINDOW) { 777 BScreen::FollowModel model = (ce.data.l[0] == 2) ?
778 fbwin->screen().getUserFollowModel() :
779 fbwin->screen().getFollowModel();
780 if (model == BScreen::FOLLOW_ACTIVE_WINDOW) {
780 fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber()); 781 fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber());
781 } else if (fbwin->screen().getFollowModel() == BScreen::FETCH_ACTIVE_WINDOW) { 782 } else if (model == BScreen::FETCH_ACTIVE_WINDOW) {
782 fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin); 783 fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin);
784 } else if (model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW) {
785 if (fbwin->isIconic())
786 fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin);
787 else
788 fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber());
783 } // else we ignore it. my favourite mode :) 789 } // else we ignore it. my favourite mode :)
784 } 790 }
791 fbwin->raise();
785 } 792 }
793 winclient->focus();
786 return true; 794 return true;
787 } else if (ce.message_type == m_net_close_window) { 795 } else if (ce.message_type == m_net_close_window) {
788 if (winclient == 0) 796 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:
77 // if the workspace is changed. 77 // if the workspace is changed.
78 FluxboxWindow &win = m_win; 78 FluxboxWindow &win = m_win;
79 if(win.isIconic() || !win.isFocused()) { 79 if(win.isIconic() || !win.isFocused()) {
80 switch(m_tool.deiconifyMode()) { 80 switch(win.screen().getUserFollowModel()) {
81 case IconbarTool::SEMIFOLLOW: 81 case BScreen::SEMIFOLLOW_ACTIVE_WINDOW:
82 if (win.isIconic()) { 82 if (win.isIconic()) {
83 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win); 83 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win);
84 } else { 84 } else {
85 win.screen().changeWorkspaceID(win.workspaceNumber()); 85 win.screen().changeWorkspaceID(win.workspaceNumber());
86 } 86 }
87 break; 87 break;
88 case IconbarTool::CURRENT: 88 case BScreen::FETCH_ACTIVE_WINDOW:
89 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win); 89 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win);
90 break; 90 break;
91 case IconbarTool::FOLLOW: 91 case BScreen::FOLLOW_ACTIVE_WINDOW:
92 default:
93 if (!win.isStuck()) 92 if (!win.isStuck())
94 win.screen().changeWorkspaceID(win.workspaceNumber()); 93 win.screen().changeWorkspaceID(win.workspaceNumber());
94 default:
95 break; 95 break;
96 }; 96 };
97 win.raiseAndFocus(); 97 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<IconbarTool::Mode>::setFromString(const char *strval) {
74} 74}
75 75
76template<> 76template<>
77void FbTk::Resource<IconbarTool::DeiconifyMode>::setDefaultValue() {
78 m_value = IconbarTool::FOLLOW;
79}
80
81template<>
82void FbTk::Resource<IconbarTool::DeiconifyMode>::setFromString(const char* strval) {
83 if (strncasecmp(strval, "Current", strlen("Current")) == 0)
84 m_value = IconbarTool::CURRENT;
85 else if (strncasecmp(strval, "Follow", strlen("Follow")) == 0)
86 m_value = IconbarTool::FOLLOW;
87 else if (strncasecmp(strval, "SemiFollow", strlen("SemiFollow")) == 0)
88 m_value = IconbarTool::SEMIFOLLOW;
89 else
90 setDefaultValue();
91}
92
93template<>
94std::string FbTk::Resource<IconbarTool::DeiconifyMode>::getString() const {
95 switch (m_value) {
96 case IconbarTool::SEMIFOLLOW:
97 return std::string("SemiFollow");
98 break;
99 case IconbarTool::CURRENT:
100 return std::string("Current");
101 break;
102 case IconbarTool::FOLLOW:
103 default:
104 return std::string("Follow");
105 break;
106 };
107}
108
109template<>
110void FbTk::Resource<IconbarTool::WheelMode>::setDefaultValue() { 77void FbTk::Resource<IconbarTool::WheelMode>::setDefaultValue() {
111 m_value = IconbarTool::SCREEN; 78 m_value = IconbarTool::SCREEN;
112} 79}
@@ -373,9 +340,6 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr
373 m_empty_pm(0), 340 m_empty_pm(0),
374 m_rc_mode(screen.resourceManager(), WORKSPACE, 341 m_rc_mode(screen.resourceManager(), WORKSPACE,
375 screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), 342 screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"),
376 m_deiconify_mode(screen.resourceManager(), FOLLOW,
377 screen.name() + ".iconbar.deiconifyMode",
378 screen.name() + ".iconbar.DeiconifyMode"),
379 m_wheel_mode(screen.resourceManager(), OFF, 343 m_wheel_mode(screen.resourceManager(), OFF,
380 screen.name() + ".iconbar.wheelMode", 344 screen.name() + ".iconbar.wheelMode",
381 screen.name() + ".iconbar.WheelMode"), 345 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:
56 ALLWINDOWS ///< all windows and all icons from all workspaces 56 ALLWINDOWS ///< all windows and all icons from all workspaces
57 }; 57 };
58 58
59 /// deiconfiy mode for iconbuttons
60 enum DeiconifyMode {
61 CURRENT, ///< raise the window on the current workspace
62 FOLLOW, ///< raise the window on the workspace it was iconified from
63 SEMIFOLLOW, ///< like current for iconified windows, and like follow for others
64 };
65
66 /// wheeling on iconbutton 59 /// wheeling on iconbutton
67 enum WheelMode { 60 enum WheelMode {
68 OFF, ///< no wheeling, default mode 61 OFF, ///< no wheeling, default mode
@@ -91,7 +84,6 @@ public:
91 unsigned int borderWidth() const; 84 unsigned int borderWidth() const;
92 85
93 Mode mode() const { return *m_rc_mode; } 86 Mode mode() const { return *m_rc_mode; }
94 DeiconifyMode deiconifyMode() const { return *m_deiconify_mode; }
95 WheelMode wheelMode() const { return *m_wheel_mode; } 87 WheelMode wheelMode() const { return *m_wheel_mode; }
96 88
97 void setOrientation(FbTk::Orientation orient); 89 void setOrientation(FbTk::Orientation orient);
@@ -138,7 +130,6 @@ private:
138 130
139 IconList m_icon_list; 131 IconList m_icon_list;
140 FbTk::Resource<Mode> m_rc_mode; 132 FbTk::Resource<Mode> m_rc_mode;
141 FbTk::Resource<DeiconifyMode> m_deiconify_mode;
142 FbTk::Resource<WheelMode> m_wheel_mode; 133 FbTk::Resource<WheelMode> m_wheel_mode;
143 FbTk::Resource<Container::Alignment> m_rc_alignment; ///< alignment of buttons 134 FbTk::Resource<Container::Alignment> m_rc_alignment; ///< alignment of buttons
144 FbTk::Resource<int> m_rc_client_width; ///< size of client button in LEFT/RIGHT mode 135 FbTk::Resource<int> 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,
262 tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), 262 tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"),
263 windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), 263 windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"),
264 follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), 264 follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"),
265 user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"),
265 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), 266 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"),
266 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), 267 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
267 focused_alpha(rm, 255, scrname+".window.focus.alpha", altscrname+".Window.Focus.Alpha"), 268 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:
84 enum FollowModel { 84 enum FollowModel {
85 IGNORE_OTHER_WORKSPACES = 0, ///< who cares? 85 IGNORE_OTHER_WORKSPACES = 0, ///< who cares?
86 FOLLOW_ACTIVE_WINDOW, ///< go to that workspace 86 FOLLOW_ACTIVE_WINDOW, ///< go to that workspace
87 SEMIFOLLOW_ACTIVE_WINDOW, ///< fetch iconified windows, else follow
87 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace 88 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace
88 }; 89 };
89 90
@@ -136,6 +137,7 @@ public:
136 ResizeModel getResizeModel() const { return *resource.resize_model; } 137 ResizeModel getResizeModel() const { return *resource.resize_model; }
137 138
138 inline FollowModel getFollowModel() const { return *resource.follow_model; } 139 inline FollowModel getFollowModel() const { return *resource.follow_model; }
140 inline FollowModel getUserFollowModel() const { return *resource.user_follow_model; }
139 141
140 inline const std::string &getScrollAction() const { return *resource.scroll_action; } 142 inline const std::string &getScrollAction() const { return *resource.scroll_action; }
141 inline const bool getScrollReverse() const { return *resource.scroll_reverse; } 143 inline const bool getScrollReverse() const { return *resource.scroll_reverse; }
@@ -441,7 +443,7 @@ private:
441 FbTk::Resource<ResizeModel> resize_model; 443 FbTk::Resource<ResizeModel> resize_model;
442 FbTk::Resource<FbWinFrame::TabPlacement> tab_placement; 444 FbTk::Resource<FbWinFrame::TabPlacement> tab_placement;
443 FbTk::Resource<std::string> windowmenufile; 445 FbTk::Resource<std::string> windowmenufile;
444 FbTk::Resource<FollowModel> follow_model; 446 FbTk::Resource<FollowModel> follow_model, user_follow_model;
445 bool ordered_dither; 447 bool ordered_dither;
446 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha, 448 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha,
447 unfocused_alpha, menu_alpha, menu_delay, menu_delay_close, tab_width; 449 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<BScreen::FollowModel>::getString() const {
88 case BScreen::FETCH_ACTIVE_WINDOW: 88 case BScreen::FETCH_ACTIVE_WINDOW:
89 return std::string("Current"); 89 return std::string("Current");
90 break; 90 break;
91 case BScreen::SEMIFOLLOW_ACTIVE_WINDOW:
92 return std::string("SemiFollow");
93 break;
91 case BScreen::IGNORE_OTHER_WORKSPACES: 94 case BScreen::IGNORE_OTHER_WORKSPACES:
92 default: 95 default:
93 return std::string("Ignore"); 96 return std::string("Ignore");
@@ -105,6 +108,8 @@ setFromString(char const *strval) {
105 strcasecmp(strval, "CurrentWorkspace") == 0 || 108 strcasecmp(strval, "CurrentWorkspace") == 0 ||
106 strcasecmp(strval, "Fetch") == 0) 109 strcasecmp(strval, "Fetch") == 0)
107 m_value = BScreen::FETCH_ACTIVE_WINDOW; 110 m_value = BScreen::FETCH_ACTIVE_WINDOW;
111 else if (strcasecmp(strval, "SemiFollow") == 0)
112 m_value = BScreen::SEMIFOLLOW_ACTIVE_WINDOW;
108 else 113 else
109 setDefaultValue(); 114 setDefaultValue();
110} 115}
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:
104 return; 104 return;
105 FluxboxWindow &win = *m_client.fbwindow(); 105 FluxboxWindow &win = *m_client.fbwindow();
106 106
107 // fetch the window to the current workspace 107 if (win.screen().currentWorkspaceID() != win.workspaceNumber()) {
108 if (button == 2 && win.screen().currentWorkspaceID() != win.workspaceNumber()) {
109 win.menu().hide(); 108 win.menu().hide();
110 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win, true); 109 BScreen::FollowModel model = win.screen().getUserFollowModel();
111 } else { // warp to the workspace of the window 110 if (model == BScreen::IGNORE_OTHER_WORKSPACES)
112 win.screen().changeWorkspaceID(win.workspaceNumber()); 111 return;
113 win.setCurrentClient(m_client); 112 // fetch the window to the current workspace
114 win.raiseAndFocus(); 113 else if ((button == 3) ^ (model == BScreen::FETCH_ACTIVE_WINDOW ||
114 win.isIconic() && model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW)) {
115 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win, true);
116 return;
117 }
118 // warp to the workspace of the window
119 win.screen().changeWorkspaceID(win.workspaceNumber());
115 } 120 }
121 win.setCurrentClient(m_client);
122 win.raiseAndFocus();
116 } 123 }
117 124
118 const std::string &label() const { return m_client.title(); } 125 const std::string &label() const { return m_client.title(); }