#5785 Fix screen switch problem when cursor is in a corner
This commit is contained in:
parent
b5a81579ed
commit
adf34eba40
|
@ -1766,29 +1766,42 @@ Server::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if we should change screens
|
// see if we should change screens
|
||||||
EDirection dir;
|
// when the cursor is in a corner, there may be a screen either
|
||||||
|
// horizontally or vertically. check both directions.
|
||||||
|
EDirection dirh = kNoDirection, dirv = kNoDirection;
|
||||||
|
SInt32 xh = x, yv = y;
|
||||||
if (x < ax + zoneSize) {
|
if (x < ax + zoneSize) {
|
||||||
x -= zoneSize;
|
xh -= zoneSize;
|
||||||
dir = kLeft;
|
dirh = kLeft;
|
||||||
}
|
}
|
||||||
else if (x >= ax + aw - zoneSize) {
|
else if (x >= ax + aw - zoneSize) {
|
||||||
x += zoneSize;
|
xh += zoneSize;
|
||||||
dir = kRight;
|
dirh = kRight;
|
||||||
}
|
}
|
||||||
else if (y < ay + zoneSize) {
|
if (y < ay + zoneSize) {
|
||||||
y -= zoneSize;
|
yv -= zoneSize;
|
||||||
dir = kTop;
|
dirv = kTop;
|
||||||
}
|
}
|
||||||
else if (y >= ay + ah - zoneSize) {
|
else if (y >= ay + ah - zoneSize) {
|
||||||
y += zoneSize;
|
yv += zoneSize;
|
||||||
dir = kBottom;
|
dirv = kBottom;
|
||||||
}
|
}
|
||||||
else {
|
if (dirh == kNoDirection && dirv == kNoDirection) {
|
||||||
// still on local screen
|
// still on local screen
|
||||||
noSwitch(x, y);
|
noSwitch(x, y);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check both horizontally and vertically
|
||||||
|
EDirection dirs[] = {dirh, dirv};
|
||||||
|
SInt32 xs[] = {xh, x}, ys[] = {y, yv};
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
EDirection dir = dirs[i];
|
||||||
|
if (dir == kNoDirection) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
x = xs[i], y = ys[i];
|
||||||
|
|
||||||
// get jump destination
|
// get jump destination
|
||||||
BaseClientProxy* newScreen = mapToNeighbor(m_active, dir, x, y);
|
BaseClientProxy* newScreen = mapToNeighbor(m_active, dir, x, y);
|
||||||
|
|
||||||
|
@ -1813,6 +1826,7 @@ Server::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
m_waitDragInfoThread = true;
|
m_waitDragInfoThread = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue