summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-04-28 14:59:12 (GMT)
committerrathnor <rathnor>2004-04-28 14:59:12 (GMT)
commit4439b3f9b17e9c8bd9682ce967631f03249304bf (patch)
tree3e7fd160b6ba503359da09c5eec9b0f57d40e2f0 /src
parentbb779745f45c917099fde31c4cea8bb6d6bc6f7d (diff)
downloadfluxbox_lack-4439b3f9b17e9c8bd9682ce967631f03249304bf.zip
fluxbox_lack-4439b3f9b17e9c8bd9682ce967631f03249304bf.tar.bz2
fixes for/reimplement parts of directional focus movement
Diffstat (limited to 'src')
-rw-r--r--src/FbCommandFactory.cc14
-rw-r--r--src/Screen.cc10
-rw-r--r--src/Screen.hh4
-rw-r--r--src/WinClient.cc8
-rw-r--r--src/WinClient.hh3
-rw-r--r--src/WorkspaceCmd.cc15
-rw-r--r--src/WorkspaceCmd.hh11
7 files changed, 55 insertions, 10 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index 9853b50..b578759 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: FbCommandFactory.cc,v 1.29 2004/04/22 21:12:34 fluxgen Exp $ 23// $Id: FbCommandFactory.cc,v 1.30 2004/04/28 14:59:11 rathnor Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -69,6 +69,10 @@ FbCommandFactory::FbCommandFactory() {
69 "exec", 69 "exec",
70 "execcommand", 70 "execcommand",
71 "execute", 71 "execute",
72 "focusup",
73 "focusdown",
74 "focusleft",
75 "focusright",
72 "iconify", 76 "iconify",
73 "killwindow", 77 "killwindow",
74 "leftworkspace", 78 "leftworkspace",
@@ -276,6 +280,14 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
276 return new NextWindowCmd(atoi(arguments.c_str())); 280 return new NextWindowCmd(atoi(arguments.c_str()));
277 else if (command == "prevwindow") 281 else if (command == "prevwindow")
278 return new PrevWindowCmd(atoi(arguments.c_str())); 282 return new PrevWindowCmd(atoi(arguments.c_str()));
283 else if (command == "focusup")
284 return new DirFocusCmd(BScreen::FOCUSUP);
285 else if (command == "focusdown")
286 return new DirFocusCmd(BScreen::FOCUSDOWN);
287 else if (command == "focusleft")
288 return new DirFocusCmd(BScreen::FOCUSLEFT);
289 else if (command == "focusright")
290 return new DirFocusCmd(BScreen::FOCUSRIGHT);
279 else if (command == "nextgroup") 291 else if (command == "nextgroup")
280 return new NextWindowCmd(atoi(arguments.c_str()) ^ BScreen::CYCLEGROUPS); 292 return new NextWindowCmd(atoi(arguments.c_str()) ^ BScreen::CYCLEGROUPS);
281 else if (command == "prevgroup") 293 else if (command == "prevgroup")
diff --git a/src/Screen.cc b/src/Screen.cc
index eef61c4..f815f3a 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.275 2004/04/19 22:44:42 fluxgen Exp $ 25// $Id: Screen.cc,v 1.276 2004/04/28 14:59:11 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -1640,7 +1640,7 @@ void BScreen::setFocusedWindow(WinClient &winclient) {
1640 } 1640 }
1641} 1641}
1642 1642
1643void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) { 1643void BScreen::dirFocus(FluxboxWindow &win, const FocusDir dir) {
1644 // change focus to the window in direction dir from the given window 1644 // change focus to the window in direction dir from the given window
1645 1645
1646 // we scan through the list looking for the window that is "closest" 1646 // we scan through the list looking for the window that is "closest"
@@ -1657,7 +1657,11 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
1657 Workspace::Windows &wins = currentWorkspace()->windowList(); 1657 Workspace::Windows &wins = currentWorkspace()->windowList();
1658 Workspace::Windows::iterator it = wins.begin(); 1658 Workspace::Windows::iterator it = wins.begin();
1659 for (; it != wins.end(); ++it) { 1659 for (; it != wins.end(); ++it) {
1660 if ((*it) == &win) continue; // skip slef 1660 if ((*it) == &win
1661 || (*it)->isIconic()
1662 || (*it)->isFocusHidden()
1663 || !(*it)->winClient().acceptsFocus())
1664 continue; // skip self
1661 1665
1662 // we check things against an edge, and within the bounds (draw a picture) 1666 // we check things against an edge, and within the bounds (draw a picture)
1663 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0; 1667 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0;
diff --git a/src/Screen.hh b/src/Screen.hh
index cb08d06..381eea5 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.hh,v 1.139 2004/04/19 22:44:42 fluxgen Exp $ 25// $Id: Screen.hh,v 1.140 2004/04/28 14:59:11 rathnor Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -259,7 +259,7 @@ public:
259 void setFocusedWindow(WinClient &winclient); 259 void setFocusedWindow(WinClient &winclient);
260 260
261 261
262 void dirFocus(FluxboxWindow &win, FocusDir dir); 262 void dirFocus(FluxboxWindow &win, const FocusDir dir);
263 263
264 void reconfigure(); 264 void reconfigure();
265 void rereadMenu(); 265 void rereadMenu();
diff --git a/src/WinClient.cc b/src/WinClient.cc
index 2265f2f..3911d6c 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: WinClient.cc,v 1.38 2004/04/01 14:06:42 rathnor Exp $ 22// $Id: WinClient.cc,v 1.39 2004/04/28 14:59:12 rathnor Exp $
23 23
24#include "WinClient.hh" 24#include "WinClient.hh"
25 25
@@ -147,6 +147,12 @@ void WinClient::updateRect(int x, int y,
147 147
148} 148}
149 149
150bool WinClient::acceptsFocus() const {
151 return (m_focus_mode == F_LOCALLYACTIVE ||
152 m_focus_mode == F_PASSIVE ||
153 m_focus_mode == F_GLOBALLYACTIVE && send_focus_message);
154}
155
150bool WinClient::sendFocus() { 156bool WinClient::sendFocus() {
151 if (!send_focus_message) 157 if (!send_focus_message)
152 return false; 158 return false;
diff --git a/src/WinClient.hh b/src/WinClient.hh
index a3fa8d9..af912e1 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: WinClient.hh,v 1.16 2003/12/17 01:20:49 fluxgen Exp $ 22// $Id: WinClient.hh,v 1.17 2004/04/28 14:59:12 rathnor Exp $
23 23
24#ifndef WINCLIENT_HH 24#ifndef WINCLIENT_HH
25#define WINCLIENT_HH 25#define WINCLIENT_HH
@@ -54,6 +54,7 @@ public:
54 54
55 bool sendFocus(); // returns whether we sent a message or not 55 bool sendFocus(); // returns whether we sent a message or not
56 // i.e. whether we assume the focus will get taken 56 // i.e. whether we assume the focus will get taken
57 bool acceptsFocus() const; // will this window accept focus (according to hints)
57 void sendClose(bool forceful = false); 58 void sendClose(bool forceful = false);
58 // not aware of anything that makes this false at present 59 // not aware of anything that makes this false at present
59 inline bool isClosable() const { return true; } 60 inline bool isClosable() const { return true; }
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 33ff818..946f84b 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: WorkspaceCmd.cc,v 1.10 2004/01/16 09:21:31 fluxgen Exp $ 23// $Id: WorkspaceCmd.cc,v 1.11 2004/04/28 14:59:12 rathnor Exp $
24 24
25#include "WorkspaceCmd.hh" 25#include "WorkspaceCmd.hh"
26 26
@@ -28,6 +28,7 @@
28#include "Window.hh" 28#include "Window.hh"
29#include "Screen.hh" 29#include "Screen.hh"
30#include "fluxbox.hh" 30#include "fluxbox.hh"
31#include "WinClient.hh"
31 32
32#include "FbTk/KeyUtil.hh" 33#include "FbTk/KeyUtil.hh"
33 34
@@ -79,6 +80,18 @@ void PrevWindowCmd::execute() {
79 } 80 }
80} 81}
81 82
83void DirFocusCmd::execute() {
84 BScreen *screen = Fluxbox::instance()->keyScreen();
85 if (screen == 0)
86 return;
87
88 WinClient *client = Fluxbox::instance()->getFocusedWindow();
89 if (client == 0 || client->fbwindow() == 0)
90 return;
91
92 screen->dirFocus(*client->fbwindow(), m_dir);
93}
94
82void NextWorkspaceCmd::execute() { 95void NextWorkspaceCmd::execute() {
83 BScreen *screen = Fluxbox::instance()->mouseScreen(); 96 BScreen *screen = Fluxbox::instance()->mouseScreen();
84 if (screen != 0) 97 if (screen != 0)
diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh
index 8a23bff..9a9c960 100644
--- a/src/WorkspaceCmd.hh
+++ b/src/WorkspaceCmd.hh
@@ -20,11 +20,12 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: WorkspaceCmd.hh,v 1.2 2003/07/01 09:47:41 fluxgen Exp $ 23// $Id: WorkspaceCmd.hh,v 1.3 2004/04/28 14:59:12 rathnor Exp $
24 24
25#ifndef WORKSPACECMD_HH 25#ifndef WORKSPACECMD_HH
26#define WORKSPACECMD_HH 26#define WORKSPACECMD_HH
27#include "Command.hh" 27#include "Command.hh"
28#include "Screen.hh"
28 29
29class NextWindowCmd: public FbTk::Command { 30class NextWindowCmd: public FbTk::Command {
30public: 31public:
@@ -42,6 +43,14 @@ private:
42 const int m_option; 43 const int m_option;
43}; 44};
44 45
46class DirFocusCmd: public FbTk::Command {
47public:
48 explicit DirFocusCmd(const BScreen::FocusDir dir): m_dir(dir) { }
49 void execute();
50private:
51 const BScreen::FocusDir m_dir;
52};
53
45class NextWorkspaceCmd: public FbTk::Command { 54class NextWorkspaceCmd: public FbTk::Command {
46public: 55public:
47 void execute(); 56 void execute();