Added patch from Jim Ramsay (i dot am at jimramsay dot com) to freely
define the used modkey. Added new action SetModKey too
This commit is contained in:
parent
535a88ce90
commit
dedbd7e468
8 changed files with 173 additions and 105 deletions
|
@ -1,5 +1,12 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.0rc2:
|
||||
*06/06/22:
|
||||
* new Resource: session.modKey: <modkey> (thanks Jim Ramsay i dot am at jimramsay dot com)
|
||||
new Command: SetModKey <modkey>
|
||||
eg: session.modKey: Mod4 allows to use the winkey to resize and move
|
||||
windows and have Mod1 (Alt) free for using blender or Maya.
|
||||
FbCommands.cc Window.cc fluxbox.hh FbCommandFactory.cc FbCommands.hh fluxbox.cc
|
||||
doc/fluxbox.1.in
|
||||
*06/06/21:
|
||||
* Fix de_DE translation (thanks Michael Bueker)
|
||||
* Fix nls (Simon)
|
||||
|
|
|
@ -291,11 +291,16 @@ drag it around.
|
|||
You can also use Alt + button 1 to raise a partially visible window.
|
||||
Finally, Alt + button 2 lowers a window, and Alt + button 3 resizes the window.
|
||||
.PP
|
||||
This can be disabled in the resource file
|
||||
This can be disabled or changed to a different modifier in the resource file
|
||||
.I ~/.fluxbox/init
|
||||
with
|
||||
with:
|
||||
.TP
|
||||
session.useMod1: \fItrue\fR or \fIfalse\fR
|
||||
session.modKey: <modifier>
|
||||
(Default: Mod1)
|
||||
.TP
|
||||
Where <modifier> is one of:
|
||||
\fIMod1\fR (Alt), \fIMod4\fR ('Windows' key), \fIControl\fR, or \fINone\fR
|
||||
(disables)
|
||||
.SH MENU FILE
|
||||
A default menu file is installed in
|
||||
.IR @pkgdatadir@/menu .
|
||||
|
|
|
@ -44,7 +44,10 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
// autoregister this module to command parser
|
||||
FbCommandFactory FbCommandFactory::s_autoreg;
|
||||
|
@ -60,7 +63,7 @@ FbCommandFactory::FbCommandFactory() {
|
|||
"arrangewindows",
|
||||
"bindkey",
|
||||
"close",
|
||||
"closeallwindows",
|
||||
"closeallwindows",
|
||||
"commanddialog",
|
||||
"deiconify",
|
||||
"detachclient",
|
||||
|
@ -122,6 +125,7 @@ FbCommandFactory::FbCommandFactory() {
|
|||
"sendtoprevworkspace",
|
||||
"setenv",
|
||||
"sethead",
|
||||
"setmodkey",
|
||||
"setstyle",
|
||||
"setworkspacename",
|
||||
"setworkspacenamedialog",
|
||||
|
@ -186,17 +190,24 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
return new ExitFluxboxCmd();
|
||||
else if (command == "setenv" || command == "export") {
|
||||
|
||||
std::string name = arguments;
|
||||
string name = arguments;
|
||||
FbTk::StringUtil::removeFirstWhitespace(name);
|
||||
FbTk::StringUtil::removeTrailingWhitespace(name);
|
||||
size_t pos = name.find_first_of(command == "setenv" ? " \t" : "=");
|
||||
if (pos == std::string::npos || pos == name.size())
|
||||
if (pos == string::npos || pos == name.size())
|
||||
return 0;
|
||||
|
||||
std::string value = name.substr(pos + 1);
|
||||
|
||||
string value = name.substr(pos + 1);
|
||||
name = name.substr(0, pos);
|
||||
return new ExportCmd(name, value);
|
||||
}
|
||||
else if (command == "setmodkey") {
|
||||
string modkey(arguments);
|
||||
FbTk::StringUtil::removeFirstWhitespace(modkey);
|
||||
FbTk::StringUtil::removeTrailingWhitespace(modkey);
|
||||
|
||||
return new SetModKeyCmd(modkey);
|
||||
}
|
||||
else if (command == "quit")
|
||||
return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown);
|
||||
else if (command == "commanddialog") // run specified fluxbox command
|
||||
|
@ -233,7 +244,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
else if (command == "maximizehorizontal")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
|
||||
else if (command == "resize") {
|
||||
FbTk_istringstream is(arguments.c_str());
|
||||
FbTk_istringstream is(arguments.c_str());
|
||||
int dx = 0, dy = 0;
|
||||
is >> dx >> dy;
|
||||
return new ResizeCmd(dx, dy);
|
||||
|
@ -249,19 +260,19 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
else if (command == "resizevertical")
|
||||
return new ResizeCmd(0,atoi(arguments.c_str()));
|
||||
else if (command == "moveto") {
|
||||
typedef std::vector<std::string> StringTokens;
|
||||
typedef vector<string> StringTokens;
|
||||
StringTokens tokens;
|
||||
FbTk::StringUtil::stringtok<StringTokens>(tokens, arguments);
|
||||
|
||||
|
||||
if (tokens.size() < 2) {
|
||||
cerr<<"*** WARNING: missing arguments for MoveTo\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unsigned int refc = MoveToCmd::UPPER|MoveToCmd::LEFT;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
|
||||
|
||||
if (tokens[0][0] == '*')
|
||||
refc |= MoveToCmd::IGNORE_X;
|
||||
else
|
||||
|
@ -271,17 +282,17 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
refc |= MoveToCmd::IGNORE_Y;
|
||||
else
|
||||
dy = atoi(tokens[1].c_str());
|
||||
|
||||
|
||||
if (tokens.size() >= 3) {
|
||||
tokens[2] = FbTk::StringUtil::toLower(tokens[2]);
|
||||
if (tokens[2] == "left" || tokens[2] == "upperleft" || tokens[2] == "lowerleft") {
|
||||
refc |= MoveToCmd::LEFT;
|
||||
refc &= ~MoveToCmd::RIGHT;
|
||||
refc &= ~MoveToCmd::RIGHT;
|
||||
} else if (tokens[2] == "right" || tokens[2] == "upperright" || tokens[2] == "lowerright") {
|
||||
refc |= MoveToCmd::RIGHT;
|
||||
refc &= ~MoveToCmd::LEFT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (tokens[2] == "upper" || tokens[2] == "upperleft" || tokens[2] == "upperright") {
|
||||
refc |= MoveToCmd::UPPER;
|
||||
refc &= ~MoveToCmd::LOWER;
|
||||
|
@ -290,8 +301,8 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
refc &= ~MoveToCmd::UPPER;
|
||||
}
|
||||
}
|
||||
|
||||
return new MoveToCmd(dx, dy, refc);
|
||||
|
||||
return new MoveToCmd(dx, dy, refc);
|
||||
}
|
||||
else if (command == "move") {
|
||||
FbTk_istringstream is(arguments.c_str());
|
||||
|
@ -328,14 +339,14 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
else if (command == "sethead")
|
||||
return new SetHeadCmd(atoi(arguments.c_str()));
|
||||
else if (command == "sendtoworkspace")
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
return new SendToWorkspaceCmd(getint(arguments.c_str(), 1) - 1);
|
||||
else if (command == "sendtonextworkspace")
|
||||
return new SendToNextWorkspaceCmd(getint(arguments.c_str(), 1));
|
||||
else if (command == "sendtoprevworkspace")
|
||||
return new SendToPrevWorkspaceCmd(getint(arguments.c_str(), 1));
|
||||
else if (command == "taketoworkspace")
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
return new TakeToWorkspaceCmd(getint(arguments.c_str(), 1) - 1);
|
||||
else if (command == "taketonextworkspace")
|
||||
return new TakeToNextWorkspaceCmd(getint(arguments.c_str(), 1));
|
||||
|
@ -357,7 +368,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
return new CurrentWindowCmd(&FluxboxWindow::detachCurrentClient);
|
||||
else if (command == "windowmenu")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::popupMenu);
|
||||
//
|
||||
//
|
||||
// Workspace commands
|
||||
//
|
||||
else if (command == "nextworkspace")
|
||||
|
@ -369,12 +380,12 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
else if (command == "leftworkspace")
|
||||
return new LeftWorkspaceCmd(getint(arguments.c_str(), 1));
|
||||
else if (command == "workspace")
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
return new JumpToWorkspaceCmd(getint(arguments.c_str(), 1) - 1);
|
||||
else if (command.substr(0, 9) == "workspace" && command[9] >= '0' && command[9] <= '9') {
|
||||
cerr<<"*** WARNING: 'Workspace<n>' actions are deprecated! Use 'Workspace <n>' instead"<<endl;
|
||||
return new JumpToWorkspaceCmd(getint(command.substr(9).c_str(), 1) - 1);
|
||||
|
||||
|
||||
} else if (command == "nextwindow")
|
||||
return new NextWindowCmd(atoi(arguments.c_str()));
|
||||
else if (command == "prevwindow")
|
||||
|
@ -421,7 +432,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
if (iss.fail())
|
||||
mode="lastworkspace";
|
||||
mode= FbTk::StringUtil::toLower(mode);
|
||||
|
||||
|
||||
iss >> d;
|
||||
if (iss.fail())
|
||||
d="current";
|
||||
|
@ -432,9 +443,9 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
dest= DeiconifyCmd::ORIGINQUIET;
|
||||
else
|
||||
dest= DeiconifyCmd::CURRENT;
|
||||
|
||||
|
||||
if ( mode == "all" )
|
||||
return new DeiconifyCmd(DeiconifyCmd::ALL, dest);
|
||||
return new DeiconifyCmd(DeiconifyCmd::ALL, dest);
|
||||
else if ( mode == "allworkspace" )
|
||||
return new DeiconifyCmd(DeiconifyCmd::ALLWORKSPACE, dest);
|
||||
else if ( mode == "last" )
|
||||
|
@ -443,23 +454,23 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
|
||||
|
||||
} else if (command == "macrocmd") {
|
||||
std::string cmd;
|
||||
string cmd;
|
||||
int err= 0;
|
||||
int parse_pos= 0;
|
||||
FbTk::MacroCommand* macro= new FbTk::MacroCommand();
|
||||
|
||||
while (true) {
|
||||
parse_pos+= err;
|
||||
err= FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() +
|
||||
err= FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() +
|
||||
parse_pos,
|
||||
'{', '}', " \t\n", true);
|
||||
if ( err > 0 ) {
|
||||
std::string c, a;
|
||||
std::string::size_type first_pos =
|
||||
string c, a;
|
||||
string::size_type first_pos =
|
||||
FbTk::StringUtil::removeFirstWhitespace(cmd);
|
||||
std::string::size_type second_pos =
|
||||
string::size_type second_pos =
|
||||
cmd.find_first_of(" \t", first_pos);
|
||||
if (second_pos != std::string::npos) {
|
||||
if (second_pos != string::npos) {
|
||||
a= cmd.substr(second_pos);
|
||||
FbTk::StringUtil::removeFirstWhitespace(a);
|
||||
cmd.erase(second_pos);
|
||||
|
@ -480,23 +491,23 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
|
||||
delete macro;
|
||||
} else if (command == "togglecmd") {
|
||||
std::string cmd;
|
||||
string cmd;
|
||||
int err= 0;
|
||||
int parse_pos= 0;
|
||||
FbTk::ToggleCommand* macro= new FbTk::ToggleCommand();
|
||||
|
||||
while (true) {
|
||||
parse_pos+= err;
|
||||
err= FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() +
|
||||
err= FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() +
|
||||
parse_pos,
|
||||
'{', '}', " \t\n", true);
|
||||
if ( err > 0 ) {
|
||||
std::string c, a;
|
||||
std::string::size_type first_pos =
|
||||
string c, a;
|
||||
string::size_type first_pos =
|
||||
FbTk::StringUtil::removeFirstWhitespace(cmd);
|
||||
std::string::size_type second_pos=
|
||||
string::size_type second_pos=
|
||||
cmd.find_first_of(" \t", first_pos);
|
||||
if (second_pos != std::string::npos) {
|
||||
if (second_pos != string::npos) {
|
||||
a= cmd.substr(second_pos);
|
||||
FbTk::StringUtil::removeFirstWhitespace(a);
|
||||
cmd.erase(second_pos);
|
||||
|
|
|
@ -71,7 +71,7 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Window root_ret; // not used
|
||||
Window window_ret; // not used
|
||||
|
||||
|
@ -86,9 +86,9 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
|||
int borderw = menu.fbwindow().borderWidth();
|
||||
int head = screen.getHead(rx, ry);
|
||||
|
||||
pair<int, int> m =
|
||||
pair<int, int> m =
|
||||
screen.clampToHead(head,
|
||||
rx - menu.width() / 2,
|
||||
rx - menu.width() / 2,
|
||||
ry - menu.titleWindow().height() / 2,
|
||||
menu.width() + 2*borderw,
|
||||
menu.height() + 2*borderw);
|
||||
|
@ -98,7 +98,7 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
|||
screen.getHeadY(head),
|
||||
screen.getHeadWidth(head),
|
||||
screen.getHeadHeight(head));
|
||||
|
||||
|
||||
menu.show();
|
||||
menu.grabInputFocus();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void ExecuteCmd::execute() {
|
|||
|
||||
int ExecuteCmd::run() {
|
||||
pid_t pid = fork();
|
||||
if (pid)
|
||||
if (pid)
|
||||
return pid;
|
||||
|
||||
std::string displaystring("DISPLAY=");
|
||||
|
@ -149,8 +149,17 @@ int ExecuteCmd::run() {
|
|||
return pid; // compiler happy -> we are happy ;)
|
||||
}
|
||||
|
||||
SetModKeyCmd::SetModKeyCmd(const std::string& modkey) : m_modkey(modkey) { }
|
||||
|
||||
void SetModKeyCmd::execute() {
|
||||
Fluxbox::instance()->setModKey(m_modkey.c_str());
|
||||
Fluxbox::instance()->save_rc();
|
||||
// TODO: we need a better way to do this ...
|
||||
Fluxbox::instance()->reconfigure();
|
||||
}
|
||||
|
||||
ExportCmd::ExportCmd(const std::string& name, const std::string& value) :
|
||||
m_name(name), m_value(value) {
|
||||
m_name(name), m_value(value) {
|
||||
}
|
||||
|
||||
void ExportCmd::execute() {
|
||||
|
@ -161,9 +170,9 @@ void ExportCmd::execute() {
|
|||
static std::set<char*> stored;
|
||||
char* newenv = new char[m_name.size() + m_value.size() + 2];
|
||||
if (newenv) {
|
||||
|
||||
|
||||
char* oldenv = getenv(m_name.c_str());
|
||||
|
||||
|
||||
// oldenv points to the value .. we have to go back a bit
|
||||
if (oldenv && stored.find(oldenv - (m_name.size() + 1)) != stored.end())
|
||||
oldenv -= (m_name.size() + 1);
|
||||
|
@ -221,7 +230,7 @@ SetStyleCmd::SetStyleCmd(const std::string &filename):m_filename(filename) {
|
|||
void SetStyleCmd::execute() {
|
||||
Fluxbox::instance()->saveStyleFilename(m_filename.c_str());
|
||||
Fluxbox::instance()->save_rc();
|
||||
FbTk::ThemeManager::instance().load(m_filename,
|
||||
FbTk::ThemeManager::instance().load(m_filename,
|
||||
Fluxbox::instance()->getStyleOverlayFilename());
|
||||
}
|
||||
|
||||
|
@ -302,8 +311,8 @@ void CommandDialogCmd::execute() {
|
|||
win->show();
|
||||
}
|
||||
|
||||
|
||||
SetResourceValueCmd::SetResourceValueCmd(const std::string &resname,
|
||||
|
||||
SetResourceValueCmd::SetResourceValueCmd(const std::string &resname,
|
||||
const std::string &value):
|
||||
m_resname(resname),
|
||||
m_value(value) {
|
||||
|
@ -334,13 +343,13 @@ void BindKeyCmd::execute() {
|
|||
if (Fluxbox::instance()->keys()->addBinding(m_keybind)) {
|
||||
ofstream ofile(Fluxbox::instance()->keys()->filename().c_str(), ios::app);
|
||||
if (!ofile)
|
||||
return;
|
||||
return;
|
||||
ofile<<m_keybind<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DeiconifyCmd::DeiconifyCmd(Mode mode,
|
||||
DeiconifyCmd::DeiconifyCmd(Mode mode,
|
||||
Destination dest) : m_mode(mode), m_dest(dest) { }
|
||||
|
||||
void DeiconifyCmd::execute() {
|
||||
|
@ -356,12 +365,12 @@ void DeiconifyCmd::execute() {
|
|||
const bool change_ws= m_dest == ORIGIN;
|
||||
|
||||
switch(m_mode) {
|
||||
|
||||
|
||||
case ALL:
|
||||
case ALLWORKSPACE:
|
||||
for(; it != itend; it++) {
|
||||
old_workspace_num= (*it)->workspaceNumber();
|
||||
if (m_mode == ALL || old_workspace_num == workspace_num ||
|
||||
if (m_mode == ALL || old_workspace_num == workspace_num ||
|
||||
(*it)->isStuck()) {
|
||||
if (m_dest == ORIGIN || m_dest == ORIGINQUIET)
|
||||
screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
|
||||
|
@ -378,7 +387,7 @@ void DeiconifyCmd::execute() {
|
|||
old_workspace_num= (*it)->workspaceNumber();
|
||||
if(m_mode == LAST || old_workspace_num == workspace_num ||
|
||||
(*it)->isStuck()) {
|
||||
if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) &&
|
||||
if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) &&
|
||||
m_mode != LASTWORKSPACE)
|
||||
screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
|
||||
else
|
||||
|
@ -389,5 +398,5 @@ void DeiconifyCmd::execute() {
|
|||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}; // end namespace FbCommands
|
||||
|
|
|
@ -96,6 +96,14 @@ private:
|
|||
std::string m_filename;
|
||||
};
|
||||
|
||||
class SetModKeyCmd: public FbTk::Command {
|
||||
public:
|
||||
explicit SetModKeyCmd(const std::string& modkey);
|
||||
void execute();
|
||||
private:
|
||||
std::string m_modkey;
|
||||
};
|
||||
|
||||
class KeyModeCmd: public FbTk::Command {
|
||||
public:
|
||||
explicit KeyModeCmd(const std::string &arguments);
|
||||
|
|
|
@ -98,41 +98,43 @@ void grabButton(unsigned int button,
|
|||
const int capslock = KeyUtil::instance().capslock();
|
||||
const int scrolllock = KeyUtil::instance().scrolllock();
|
||||
|
||||
// Grab with Mod1 and with all lock modifiers
|
||||
// Grab with modkey and with all lock modifiers
|
||||
// (num, scroll and caps)
|
||||
|
||||
unsigned int modkey = Fluxbox::instance()->getModKey();
|
||||
|
||||
//numlock
|
||||
XGrabButton(display, button, Mod1Mask|numlock, window, True,
|
||||
XGrabButton(display, button, modkey|numlock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
//scrolllock
|
||||
XGrabButton(display, button, Mod1Mask|scrolllock, window, True,
|
||||
XGrabButton(display, button, modkey|scrolllock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
//capslock
|
||||
XGrabButton(display, button, Mod1Mask|capslock, window, True,
|
||||
XGrabButton(display, button, modkey|capslock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
//capslock+numlock
|
||||
XGrabButton(display, Button1, Mod1Mask|capslock|numlock, window, True,
|
||||
XGrabButton(display, Button1, modkey|capslock|numlock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
//capslock+scrolllock
|
||||
XGrabButton(display, button, Mod1Mask|capslock|scrolllock, window, True,
|
||||
XGrabButton(display, button, modkey|capslock|scrolllock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
//capslock+numlock+scrolllock
|
||||
XGrabButton(display, button, Mod1Mask|capslock|numlock|scrolllock, window,
|
||||
XGrabButton(display, button, modkey|capslock|numlock|scrolllock, window,
|
||||
True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
//numlock+scrollLock
|
||||
XGrabButton(display, button, Mod1Mask|numlock|scrolllock, window, True,
|
||||
XGrabButton(display, button, modkey|numlock|scrolllock, window, True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor);
|
||||
|
||||
|
@ -1108,20 +1110,23 @@ void FluxboxWindow::grabButtons() {
|
|||
XGrabButton(display, Button1, AnyModifier,
|
||||
frame().window().window(), True, ButtonPressMask,
|
||||
GrabModeSync, GrabModeSync, None, None);
|
||||
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window());
|
||||
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask,
|
||||
frame().window().window());
|
||||
|
||||
if (Fluxbox::instance()->useMod1()) {
|
||||
XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True,
|
||||
unsigned int modkey = Fluxbox::instance()->getModKey();
|
||||
|
||||
if (modkey) {
|
||||
XGrabButton(display, Button1, modkey, frame().window().window(), True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, frame().theme().moveCursor());
|
||||
|
||||
//----grab with "all" modifiers
|
||||
grabButton(Button1, frame().window().window(), frame().theme().moveCursor());
|
||||
|
||||
XGrabButton(display, Button2, Mod1Mask, frame().window().window(), True,
|
||||
XGrabButton(display, Button2, modkey, frame().window().window(), True,
|
||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
|
||||
|
||||
XGrabButton(display, Button3, Mod1Mask, frame().window().window(), True,
|
||||
XGrabButton(display, Button3, modkey, frame().window().window(), True,
|
||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None);
|
||||
|
||||
|
@ -1738,7 +1743,7 @@ void FluxboxWindow::maximize(int type) {
|
|||
m_last_resize_y = new_y;
|
||||
m_last_resize_w = new_w;
|
||||
m_last_resize_h = new_h;
|
||||
|
||||
|
||||
ResizeDirection old_resize_corner = m_resize_corner;
|
||||
m_resize_corner = NOCORNER;
|
||||
fixsize();
|
||||
|
@ -2684,7 +2689,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
|
|||
// check frame events first
|
||||
frame().buttonPressEvent(be);
|
||||
|
||||
if (be.button == 1 || (be.button == 3 && be.state == Mod1Mask)) {
|
||||
if (be.button == 1 || (be.button == 3 &&
|
||||
be.state == Fluxbox::instance()->getModKey())) {
|
||||
if ( (! focused) ) { //check focus
|
||||
setInputFocus();
|
||||
}
|
||||
|
@ -2721,7 +2727,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
|
|||
else if (m_attaching_tab)
|
||||
attachTo(re.x_root, re.y_root);
|
||||
else if (re.window == frame().window()) {
|
||||
if (re.button == 2 && re.state == Mod1Mask)
|
||||
if (re.button == 2 && re.state == Fluxbox::instance()->getModKey())
|
||||
ungrabPointer(CurrentTime);
|
||||
else
|
||||
frame().buttonReleaseEvent(re);
|
||||
|
@ -2743,7 +2749,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
|||
|| frame().window() == me.window);
|
||||
|
||||
if (Fluxbox::instance()->getIgnoreBorder()
|
||||
&& !(me.state & Mod1Mask) // really should check for exact matches
|
||||
&& !(me.state & Fluxbox::instance()->getModKey()) // really should check for exact matches
|
||||
&& !(isMoving() || isResizing() || m_attaching_tab != 0)) {
|
||||
int borderw = frame().window().borderWidth();
|
||||
//!! TODO(tabs): the below test ought to be in FbWinFrame
|
||||
|
@ -2871,7 +2877,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
|||
resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM;
|
||||
|
||||
|
||||
// We are grabbing frame window in startResizing
|
||||
// We are grabbing frame window in startResizing
|
||||
// we need to translate coordinates to it.
|
||||
int start_x = me.x, start_y = me.y;
|
||||
Window child;
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "FbTk/I18n.hh"
|
||||
#include "FbTk/Image.hh"
|
||||
#include "FbTk/FileUtil.hh"
|
||||
#include "FbTk/KeyUtil.hh"
|
||||
#include "FbTk/ImageControl.hh"
|
||||
#include "FbTk/EventManager.hh"
|
||||
#include "FbTk/StringUtil.hh"
|
||||
|
@ -56,6 +55,7 @@
|
|||
#include "FbTk/Transparent.hh"
|
||||
#include "FbTk/Select2nd.hh"
|
||||
#include "FbTk/Compose.hh"
|
||||
#include "FbTk/KeyUtil.hh"
|
||||
|
||||
//Use GNU extensions
|
||||
#ifndef _GNU_SOURCE
|
||||
|
@ -160,8 +160,8 @@ using namespace FbTk;
|
|||
namespace {
|
||||
|
||||
Window last_bad_window = None;
|
||||
|
||||
// *** NOTE: if you want to debug here the X errors are
|
||||
|
||||
// *** NOTE: if you want to debug here the X errors are
|
||||
// coming from, you should turn on the XSynchronise call below
|
||||
int handleXErrors(Display *d, XErrorEvent *e) {
|
||||
if (e->error_code == BadWindow)
|
||||
|
@ -215,7 +215,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
|
|||
m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
|
||||
m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
|
||||
m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"),
|
||||
m_rc_use_mod1(m_resourcemanager, true, "session.useMod1", "Session.UseMod1"),
|
||||
m_rc_mod_key(m_resourcemanager, "Mod1", "session.modKey", "Session.ModKey"),
|
||||
m_masked_window(0),
|
||||
m_mousescreen(0),
|
||||
m_keyscreen(0),
|
||||
|
@ -347,7 +347,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
|
|||
vector<int> scrtmp;
|
||||
int scrnr = 0;
|
||||
FbTk::StringUtil::stringtok(vals, m_argv[i], ",:");
|
||||
for (vector<string>::iterator scrit = vals.begin();
|
||||
for (vector<string>::iterator scrit = vals.begin();
|
||||
scrit != vals.end(); scrit++) {
|
||||
scrnr = atoi(scrit->c_str());
|
||||
if (scrnr >= 0 && scrnr < ScreenCount(disp))
|
||||
|
@ -358,17 +358,17 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
|
|||
swap(scrtmp, screens);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// init all "screens"
|
||||
for(size_t s = 0; s < screens.size(); s++)
|
||||
initScreen(screens[s]);
|
||||
|
||||
|
||||
XAllowEvents(disp, ReplayPointer, CurrentTime);
|
||||
|
||||
|
||||
if (m_screen_list.empty()) {
|
||||
throw _FB_CONSOLETEXT(Fluxbox, ErrorNoScreens,
|
||||
"Couldn't find screens to manage.\nMake sure you don't have another window manager running.",
|
||||
"Couldn't find screens to manage.\nMake sure you don't have another window manager running.",
|
||||
"Error message when no unmanaged screens found - usually means another window manager is running");
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
|
|||
|
||||
m_resourcemanager.unlock();
|
||||
ungrab();
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
if (m_resourcemanager.lockDepth() != 0)
|
||||
cerr<<"--- resource manager lockdepth = "<<m_resourcemanager.lockDepth()<<endl;
|
||||
|
@ -439,7 +439,7 @@ Fluxbox::~Fluxbox() {
|
|||
|
||||
|
||||
int Fluxbox::initScreen(int scrnr) {
|
||||
|
||||
|
||||
Display* disp = display();
|
||||
char scrname[128], altscrname[128];
|
||||
sprintf(scrname, "session.screen%d", scrnr);
|
||||
|
@ -453,7 +453,7 @@ int Fluxbox::initScreen(int scrnr) {
|
|||
delete screen;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// add to our list
|
||||
m_screen_list.push_back(screen);
|
||||
|
||||
|
@ -595,8 +595,8 @@ void Fluxbox::setupConfigFiles() {
|
|||
// create directory with perm 700
|
||||
if (mkdir(dirname.c_str(), 0700)) {
|
||||
fprintf(stderr, _FB_CONSOLETEXT(Fluxbox, ErrorCreatingDirectory,
|
||||
"Can't create %s directory",
|
||||
"Can't create a directory, one %s for directory name").c_str(),
|
||||
"Can't create %s directory",
|
||||
"Can't create a directory, one %s for directory name").c_str(),
|
||||
dirname.c_str());
|
||||
cerr<<endl;
|
||||
return;
|
||||
|
@ -658,7 +658,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
|
|||
} else if (e->type == PropertyNotify) {
|
||||
m_last_time = e->xproperty.time;
|
||||
// check transparency atoms if it's a root pm
|
||||
|
||||
|
||||
BScreen *screen = searchScreen(e->xproperty.window);
|
||||
if (screen) {
|
||||
FbTk::FbPixmap::rootwinPropertyNotify(screen->screenNumber(), e->xproperty.atom);
|
||||
|
@ -966,7 +966,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
|
|||
void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
|
||||
|
||||
BScreen *screen = searchScreen(ue.event);
|
||||
|
||||
|
||||
if (ue.event != ue.window && (!screen || !ue.send_event)) {
|
||||
return;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
|
|||
}
|
||||
|
||||
// according to http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4
|
||||
// a XWithdrawWindow is
|
||||
// a XWithdrawWindow is
|
||||
// 1) unmapping the window (which leads to the upper branch
|
||||
// 2) sends an synthetic unampevent (which is handled below)
|
||||
} else if (screen && ue.send_event) {
|
||||
|
@ -1108,7 +1108,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
|
|||
// won't mask anything if it isn't a mod
|
||||
unsigned int state = FbTk::KeyUtil::instance().isolateModifierMask(ke.state);
|
||||
state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
|
||||
|
||||
|
||||
if ((m_watch_keyrelease & state) == 0) {
|
||||
|
||||
m_watching_screen->notifyReleasedKeys(ke);
|
||||
|
@ -1217,7 +1217,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
|
|||
(*it).first->updateLayer(win);
|
||||
}
|
||||
} else if ((&(win.dieSig())) == changedsub) { // window death signal
|
||||
|
||||
|
||||
for (AtomHandlerContainerIt it= m_atomhandler.begin();
|
||||
it != m_atomhandler.end(); ++it) {
|
||||
if ((*it).first->update())
|
||||
|
@ -1585,7 +1585,7 @@ void Fluxbox::load_rc(BScreen &screen) {
|
|||
|
||||
string values(value.addr);
|
||||
BScreen::WorkspaceNames names;
|
||||
|
||||
|
||||
StringUtil::removeTrailingWhitespace(values);
|
||||
StringUtil::removeFirstWhitespace(values);
|
||||
StringUtil::stringtok<BScreen::WorkspaceNames>(names, values, ",");
|
||||
|
@ -1703,7 +1703,7 @@ bool Fluxbox::menuTimestampsChanged() const {
|
|||
std::list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin();
|
||||
std::list<MenuTimestamp *>::const_iterator it_end = m_menu_timestamps.end();
|
||||
for (; it != it_end; ++it) {
|
||||
|
||||
|
||||
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp((*it)->filename.c_str());
|
||||
|
||||
if (timestamp >= 0) {
|
||||
|
@ -1743,11 +1743,11 @@ void Fluxbox::rereadMenu(bool show_after_reread) {
|
|||
|
||||
|
||||
void Fluxbox::real_rereadMenu() {
|
||||
|
||||
|
||||
clearMenuFilenames();
|
||||
|
||||
for_each(m_screen_list.begin(),
|
||||
m_screen_list.end(),
|
||||
|
||||
for_each(m_screen_list.begin(),
|
||||
m_screen_list.end(),
|
||||
mem_fun(&BScreen::rereadMenu));
|
||||
|
||||
if(m_show_menu_after_reread) {
|
||||
|
@ -1806,7 +1806,7 @@ void Fluxbox::timed_reconfigure() {
|
|||
}
|
||||
|
||||
bool Fluxbox::validateClient(const WinClient *client) const {
|
||||
WinClientMap::const_iterator it =
|
||||
WinClientMap::const_iterator it =
|
||||
find_if(m_window_search.begin(),
|
||||
m_window_search.end(),
|
||||
Compose(bind2nd(equal_to<WinClient *>(), client),
|
||||
|
@ -1834,7 +1834,7 @@ void Fluxbox::updateFocusedWindow(BScreen *screen, BScreen *old_screen) {
|
|||
}
|
||||
|
||||
void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
|
||||
|
||||
|
||||
if (mods == 0) {
|
||||
cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
|
||||
return;
|
||||
|
@ -1855,3 +1855,22 @@ void Fluxbox::updateFrameExtents(FluxboxWindow &win) {
|
|||
(*it).first->updateFrameExtents(win);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Fluxbox::getModKey() const {
|
||||
if (!(m_rc_mod_key->c_str()))
|
||||
return 0;
|
||||
else
|
||||
return FbTk::KeyUtil::instance().getModifier(m_rc_mod_key->c_str());
|
||||
}
|
||||
|
||||
void Fluxbox::setModKey(const char* modkeyname) {
|
||||
|
||||
if (!modkeyname)
|
||||
return;
|
||||
|
||||
unsigned int modkey = FbTk::KeyUtil::instance().getModifier(modkeyname);
|
||||
|
||||
if (modkey > 0) {
|
||||
m_rc_mod_key = modkeyname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,10 @@ public:
|
|||
|
||||
unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; }
|
||||
unsigned int getCacheMax() const { return *m_rc_cache_max; }
|
||||
bool useMod1() const { return *m_rc_use_mod1; }
|
||||
|
||||
|
||||
unsigned int getModKey() const;
|
||||
void setModKey(const char*);
|
||||
|
||||
void maskWindowEvents(Window w, FluxboxWindow *bw)
|
||||
{ m_masked = w; m_masked_window = bw; }
|
||||
|
@ -177,7 +180,7 @@ public:
|
|||
void handleSignal(int signum);
|
||||
void update(FbTk::Subject *changed);
|
||||
/**
|
||||
* Sends update signal to atomhandlers,
|
||||
* Sends update signal to atomhandlers,
|
||||
* @param screen the new screen
|
||||
* @param old_screen the old screen if any, can be the same as new screen
|
||||
*/
|
||||
|
@ -212,7 +215,7 @@ public:
|
|||
const XEvent &lastEvent() const { return m_last_event; }
|
||||
|
||||
AttentionNoticeHandler &attentionHandler() { return m_attention_handler; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef struct MenuTimestamp {
|
||||
|
@ -258,7 +261,7 @@ private:
|
|||
FbTk::Resource<TabsAttachArea> m_rc_tabs_attach_area;
|
||||
FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
|
||||
FbTk::Resource<time_t> m_rc_auto_raise_delay;
|
||||
FbTk::Resource<bool> m_rc_use_mod1; /// temporary!, to disable mod1 for resize/move
|
||||
FbTk::Resource<std::string> m_rc_mod_key;
|
||||
|
||||
typedef std::map<Window, WinClient *> WinClientMap;
|
||||
WinClientMap m_window_search;
|
||||
|
|
Loading…
Reference in a new issue