respect modkey state for the cursor shape

BUG: 228959
FIXED-IN: 4.9
REVIEW: 104986
This commit is contained in:
Thomas Lübking 2012-05-18 22:38:04 +02:00
parent f6a0c6907a
commit d546fea565

View file

@ -1080,6 +1080,13 @@ bool Client::eventFilter(QObject* o, QEvent* e)
return false; return false;
} }
static bool modKeyDown(int state) {
const uint keyModX = (options->keyCmdAllModKey() == Qt::Key_Meta) ?
KKeyServer::modXMeta() : KKeyServer::modXAlt();
return keyModX && (state & KKeyServer::accelModMaskX()) == keyModX;
}
// return value matters only when filtering events before decoration gets them // return value matters only when filtering events before decoration gets them
bool Client::buttonPressEvent(Window w, int button, int state, int x, int y, int x_root, int y_root) bool Client::buttonPressEvent(Window w, int button, int state, int x, int y, int x_root, int y_root)
{ {
@ -1093,10 +1100,7 @@ bool Client::buttonPressEvent(Window w, int button, int state, int x, int y, int
// FRAME neco s tohohle by se melo zpracovat, nez to dostane dekorace // FRAME neco s tohohle by se melo zpracovat, nez to dostane dekorace
updateUserTime(); updateUserTime();
workspace()->setWasUserInteraction(); workspace()->setWasUserInteraction();
uint keyModX = (options->keyCmdAllModKey() == Qt::Key_Meta) ? const bool bModKeyHeld = modKeyDown(state);
KKeyServer::modXMeta() :
KKeyServer::modXAlt();
bool bModKeyHeld = keyModX != 0 && (state & KKeyServer::accelModMaskX()) == keyModX;
if (isSplash() if (isSplash()
&& button == Button1 && !bModKeyHeld) { && button == Button1 && !bModKeyHeld) {
@ -1349,7 +1353,7 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
} }
// return value matters only when filtering events before decoration gets them // return value matters only when filtering events before decoration gets them
bool Client::motionNotifyEvent(Window w, int /*state*/, int x, int y, int x_root, int y_root) bool Client::motionNotifyEvent(Window w, int state, int x, int y, int x_root, int y_root)
{ {
if (w != frameId() && w != decorationId() && w != inputId() && w != moveResizeGrabWindow()) if (w != frameId() && w != decorationId() && w != inputId() && w != moveResizeGrabWindow())
return true; // care only about the whole frame return true; // care only about the whole frame
@ -1362,7 +1366,7 @@ bool Client::motionNotifyEvent(Window w, int /*state*/, int x, int y, int x_root
int y = y_root - geometry().y() + padding_top; int y = y_root - geometry().y() + padding_top;
mousePos = QPoint(x, y); mousePos = QPoint(x, y);
} }
Position newmode = mousePosition(mousePos); Position newmode = modKeyDown(state) ? PositionCenter : mousePosition(mousePos);
if (newmode != mode) { if (newmode != mode) {
mode = newmode; mode = newmode;
updateCursor(); updateCursor();