using std::string;
using std::abs;
-// change this to change what modifier keys openbox uses for mouse bindings
-// for example: Mod1Mask | ControlMask
-// or: ControlMask| ShiftMask
-const unsigned int ModMask = Mod1Mask;
-
/*
* Initializes the class with default values/the window's set initial values.
*/
void BlackboxWindow::grabButtons(void) {
+ mod_mask = blackbox->getMouseModMask();
+
if (! screen->isSloppyFocus() || screen->doClickRaise())
// grab button 1 for changing focus/raising
blackbox->grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
screen->allowScrollLock());
if (functions & Func_Move)
- blackbox->grabButton(Button1, ModMask, frame.window, True,
+ blackbox->grabButton(Button1, mod_mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, frame.window, None,
screen->allowScrollLock());
if (functions & Func_Resize)
- blackbox->grabButton(Button3, ModMask, frame.window, True,
+ blackbox->grabButton(Button3, mod_mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, frame.window, None,
screen->allowScrollLock());
// alt+middle lowers the window
- blackbox->grabButton(Button2, ModMask, frame.window, True,
+ blackbox->grabButton(Button2, mod_mask, frame.window, True,
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
frame.window, None,
screen->allowScrollLock());
void BlackboxWindow::ungrabButtons(void) {
blackbox->ungrabButton(Button1, 0, frame.plate);
- blackbox->ungrabButton(Button1, ModMask, frame.window);
- blackbox->ungrabButton(Button2, ModMask, frame.window);
- blackbox->ungrabButton(Button3, ModMask, frame.window);
+ blackbox->ungrabButton(Button1, mod_mask, frame.window);
+ blackbox->ungrabButton(Button2, mod_mask, frame.window);
+ blackbox->ungrabButton(Button3, mod_mask, frame.window);
}
if (frame.maximize_button == be->window && be->button <= 3) {
redrawMaximizeButton(True);
- } else if (be->button == 1 || (be->button == 3 && be->state == ModMask)) {
+ } else if (be->button == 1 || (be->button == 3 && be->state == mod_mask)) {
if (! flags.focused)
setInputFocus();
} else if (flags.resizing) {
endResize();
} else if (re->window == frame.window) {
- if (re->button == 2 && re->state == ModMask)
+ if (re->button == 2 && re->state == mod_mask)
XUngrabPointer(blackbox->getXDisplay(), CurrentTime);
}
}
} else if ((functions & Func_Resize) &&
(me->state & Button1Mask && (me->window == frame.right_grip ||
me->window == frame.left_grip)) ||
- (me->state & Button3Mask && me->state & ModMask &&
+ (me->state & Button3Mask && me->state & mod_mask &&
me->window == frame.window)) {
unsigned int zones = screen->getResizeZones();
Corner corner;
config.setValue("session.cacheMax", resource.cache_max);
config.setValue("session.styleFile", resource.style_file);
config.setValue("session.titlebarLayout", resource.titlebar_layout);
+
+ string s;
+ if (resource.mod_mask & Mod1Mask) s += "Mod1-";
+ if (resource.mod_mask & Mod2Mask) s += "Mod2-";
+ if (resource.mod_mask & Mod3Mask) s += "Mod3-";
+ if (resource.mod_mask & Mod4Mask) s += "Mod4-";
+ if (resource.mod_mask & Mod5Mask) s += "Mod5-";
+ if (resource.mod_mask & ShiftMask) s += "Shift-";
+ if (resource.mod_mask & ControlMask) s += "Control-";
+ s.resize(s.size() - 1); // drop the last '-'
+ config.setValue("session.modifierMask", s);
#ifdef XINERAMA
saveXineramaPlacement(resource.xinerama_placement);
resource.xinerama_snap))
resource.xinerama_snap = false;
#endif // XINERAMA
+
+ resource.mod_mask = 0;
+ if (config.getValue("session.modifierMask", s)) {
+ if (s.find("Mod1") != string::npos)
+ resource.mod_mask |= Mod1Mask;
+ if (s.find("Mod2") != string::npos)
+ resource.mod_mask |= Mod2Mask;
+ if (s.find("Mod3") != string::npos)
+ resource.mod_mask |= Mod3Mask;
+ if (s.find("Mod4") != string::npos)
+ resource.mod_mask |= Mod4Mask;
+ if (s.find("Mod5") != string::npos)
+ resource.mod_mask |= Mod5Mask;
+ if (s.find("Shift") != string::npos)
+ resource.mod_mask |= ShiftMask;
+ if (s.find("Control") != string::npos)
+ resource.mod_mask |= ControlMask;
+ }
+ if (! resource.mod_mask)
+ resource.mod_mask = Mod1Mask;
}