fixes for/reimplement parts of directional focus movement

This commit is contained in:
rathnor 2004-04-28 14:59:12 +00:00
parent bb779745f4
commit 4439b3f9b1
8 changed files with 59 additions and 11 deletions

View file

@ -1,8 +1,11 @@
(Format: Year/Month/Day)
Changes for 0.9.10:
*04/04/28:
* Fix key bindings for directional focus movement (Simon)
- reminder, key actions are: FocusUp, FocusDown, FocusLeft, FocusRight
WorkspaceCmd.hh/cc Screen.hh/cc WinClient.hh/cc FbCommandFactory.cc
* Add apps file matching on WM_WINDOW_ROLE (Simon)
- use "role=string". Particularly useful for gaim windows
- use "role=string". Particularly useful for gaim+gimp windows
[app] (role=buddy_list) ...
ClientPattern.hh/cc FbWindow.hh/cc
*04/04/27:

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: FbCommandFactory.cc,v 1.29 2004/04/22 21:12:34 fluxgen Exp $
// $Id: FbCommandFactory.cc,v 1.30 2004/04/28 14:59:11 rathnor Exp $
#include "FbCommandFactory.hh"
@ -69,6 +69,10 @@ FbCommandFactory::FbCommandFactory() {
"exec",
"execcommand",
"execute",
"focusup",
"focusdown",
"focusleft",
"focusright",
"iconify",
"killwindow",
"leftworkspace",
@ -276,6 +280,14 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
return new NextWindowCmd(atoi(arguments.c_str()));
else if (command == "prevwindow")
return new PrevWindowCmd(atoi(arguments.c_str()));
else if (command == "focusup")
return new DirFocusCmd(BScreen::FOCUSUP);
else if (command == "focusdown")
return new DirFocusCmd(BScreen::FOCUSDOWN);
else if (command == "focusleft")
return new DirFocusCmd(BScreen::FOCUSLEFT);
else if (command == "focusright")
return new DirFocusCmd(BScreen::FOCUSRIGHT);
else if (command == "nextgroup")
return new NextWindowCmd(atoi(arguments.c_str()) ^ BScreen::CYCLEGROUPS);
else if (command == "prevgroup")

View file

@ -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.275 2004/04/19 22:44:42 fluxgen Exp $
// $Id: Screen.cc,v 1.276 2004/04/28 14:59:11 rathnor Exp $
#include "Screen.hh"
@ -1640,7 +1640,7 @@ void BScreen::setFocusedWindow(WinClient &winclient) {
}
}
void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
void BScreen::dirFocus(FluxboxWindow &win, const FocusDir dir) {
// change focus to the window in direction dir from the given window
// we scan through the list looking for the window that is "closest"
@ -1657,7 +1657,11 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
Workspace::Windows &wins = currentWorkspace()->windowList();
Workspace::Windows::iterator it = wins.begin();
for (; it != wins.end(); ++it) {
if ((*it) == &win) continue; // skip slef
if ((*it) == &win
|| (*it)->isIconic()
|| (*it)->isFocusHidden()
|| !(*it)->winClient().acceptsFocus())
continue; // skip self
// we check things against an edge, and within the bounds (draw a picture)
int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0;

View file

@ -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.139 2004/04/19 22:44:42 fluxgen Exp $
// $Id: Screen.hh,v 1.140 2004/04/28 14:59:11 rathnor Exp $
#ifndef SCREEN_HH
#define SCREEN_HH
@ -259,7 +259,7 @@ public:
void setFocusedWindow(WinClient &winclient);
void dirFocus(FluxboxWindow &win, FocusDir dir);
void dirFocus(FluxboxWindow &win, const FocusDir dir);
void reconfigure();
void rereadMenu();

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WinClient.cc,v 1.38 2004/04/01 14:06:42 rathnor Exp $
// $Id: WinClient.cc,v 1.39 2004/04/28 14:59:12 rathnor Exp $
#include "WinClient.hh"
@ -147,6 +147,12 @@ void WinClient::updateRect(int x, int y,
}
bool WinClient::acceptsFocus() const {
return (m_focus_mode == F_LOCALLYACTIVE ||
m_focus_mode == F_PASSIVE ||
m_focus_mode == F_GLOBALLYACTIVE && send_focus_message);
}
bool WinClient::sendFocus() {
if (!send_focus_message)
return false;

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WinClient.hh,v 1.16 2003/12/17 01:20:49 fluxgen Exp $
// $Id: WinClient.hh,v 1.17 2004/04/28 14:59:12 rathnor Exp $
#ifndef WINCLIENT_HH
#define WINCLIENT_HH
@ -54,6 +54,7 @@ public:
bool sendFocus(); // returns whether we sent a message or not
// i.e. whether we assume the focus will get taken
bool acceptsFocus() const; // will this window accept focus (according to hints)
void sendClose(bool forceful = false);
// not aware of anything that makes this false at present
inline bool isClosable() const { return true; }

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WorkspaceCmd.cc,v 1.10 2004/01/16 09:21:31 fluxgen Exp $
// $Id: WorkspaceCmd.cc,v 1.11 2004/04/28 14:59:12 rathnor Exp $
#include "WorkspaceCmd.hh"
@ -28,6 +28,7 @@
#include "Window.hh"
#include "Screen.hh"
#include "fluxbox.hh"
#include "WinClient.hh"
#include "FbTk/KeyUtil.hh"
@ -79,6 +80,18 @@ void PrevWindowCmd::execute() {
}
}
void DirFocusCmd::execute() {
BScreen *screen = Fluxbox::instance()->keyScreen();
if (screen == 0)
return;
WinClient *client = Fluxbox::instance()->getFocusedWindow();
if (client == 0 || client->fbwindow() == 0)
return;
screen->dirFocus(*client->fbwindow(), m_dir);
}
void NextWorkspaceCmd::execute() {
BScreen *screen = Fluxbox::instance()->mouseScreen();
if (screen != 0)

View file

@ -20,11 +20,12 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WorkspaceCmd.hh,v 1.2 2003/07/01 09:47:41 fluxgen Exp $
// $Id: WorkspaceCmd.hh,v 1.3 2004/04/28 14:59:12 rathnor Exp $
#ifndef WORKSPACECMD_HH
#define WORKSPACECMD_HH
#include "Command.hh"
#include "Screen.hh"
class NextWindowCmd: public FbTk::Command {
public:
@ -42,6 +43,14 @@ private:
const int m_option;
};
class DirFocusCmd: public FbTk::Command {
public:
explicit DirFocusCmd(const BScreen::FocusDir dir): m_dir(dir) { }
void execute();
private:
const BScreen::FocusDir m_dir;
};
class NextWorkspaceCmd: public FbTk::Command {
public:
void execute();