mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-09 07:22:21 +08:00
checkpoint. initial support for multiple displays on win32.
This commit is contained in:
@@ -557,13 +557,13 @@ CClient::onQueryInfo()
|
||||
void
|
||||
CClient::onQueryInfoNoLock()
|
||||
{
|
||||
SInt32 x, y, w, h;
|
||||
m_screen->getMousePos(&x, &y);
|
||||
m_screen->getSize(&w, &h);
|
||||
SInt32 mx, my, x, y, w, h;
|
||||
m_screen->getMousePos(mx, my);
|
||||
m_screen->getShape(x, y, w, h);
|
||||
SInt32 zoneSize = m_screen->getJumpZoneSize();
|
||||
|
||||
log((CLOG_DEBUG1 "sending info size=%d,%d zone=%d pos=%d,%d", w, h, zoneSize, x, y));
|
||||
CProtocolUtil::writef(m_output, kMsgDInfo, w, h, zoneSize, x, y);
|
||||
log((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d zone=%d pos=%d,%d", x, y, w, h, zoneSize, mx, my));
|
||||
CProtocolUtil::writef(m_output, kMsgDInfo, x, y, w, h, zoneSize, mx, my);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -339,11 +339,11 @@ CMSWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||
assert(m_window != NULL);
|
||||
syncDesktop();
|
||||
|
||||
SInt32 w, h;
|
||||
getScreenSize(&w, &h);
|
||||
SInt32 x0, y0, w, h;
|
||||
getScreenShape(x0, y0, w, h);
|
||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||
(SInt32)(65535.99 * x / (w - 1)),
|
||||
(SInt32)(65535.99 * y / (h - 1)),
|
||||
(SInt32)(65535.99 * x / (w - 1)) + x0,
|
||||
(SInt32)(65535.99 * y / (h - 1)) + y0,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
@@ -381,30 +381,28 @@ CMSWindowsSecondaryScreen::grabClipboard(ClipboardID /*id*/)
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||
CMSWindowsSecondaryScreen::getMousePos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
assert(x != NULL);
|
||||
assert(y != NULL);
|
||||
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
syncDesktop();
|
||||
|
||||
POINT pos;
|
||||
if (GetCursorPos(&pos)) {
|
||||
*x = pos.x;
|
||||
*y = pos.y;
|
||||
x = pos.x;
|
||||
y = pos.y;
|
||||
}
|
||||
else {
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
CMSWindowsSecondaryScreen::getShape(
|
||||
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
getScreenShape(x, y, w, h);
|
||||
}
|
||||
|
||||
SInt32
|
||||
@@ -547,7 +545,7 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
// screen resolution has changed
|
||||
updateScreenSize();
|
||||
updateScreenShape();
|
||||
m_client->onResolutionChanged();
|
||||
return 0;
|
||||
}
|
||||
@@ -559,11 +557,11 @@ void
|
||||
CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
|
||||
{
|
||||
// warp to requested location
|
||||
SInt32 w, h;
|
||||
getScreenSize(&w, &h);
|
||||
SInt32 x0, y0, w, h;
|
||||
getScreenShape(x0, y0, w, h);
|
||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||
(DWORD)((65535.99 * x) / (w - 1)),
|
||||
(DWORD)((65535.99 * y) / (h - 1)),
|
||||
(DWORD)((65535.99 * x) / (w - 1)) + x0,
|
||||
(DWORD)((65535.99 * y) / (h - 1)) + y0,
|
||||
0, 0);
|
||||
|
||||
// show cursor
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
virtual void mouseWheel(SInt32 delta);
|
||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||
virtual void grabClipboard(ClipboardID);
|
||||
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
||||
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
||||
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||
virtual SInt32 getJumpZoneSize() const;
|
||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ CXWindowsSecondaryScreen::grabClipboard(ClipboardID id)
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||
CXWindowsSecondaryScreen::getMousePos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
int xTmp, yTmp, dummy;
|
||||
@@ -295,14 +295,15 @@ CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||
Window dummyWindow;
|
||||
XQueryPointer(display, getRoot(), &dummyWindow, &dummyWindow,
|
||||
&xTmp, &yTmp, &dummy, &dummy, &dummyMask);
|
||||
*x = xTmp;
|
||||
*y = yTmp;
|
||||
x = xTmp;
|
||||
y = yTmp;
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
CXWindowsSecondaryScreen::getShape(
|
||||
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
getScreenShape(x, y, w, h);
|
||||
}
|
||||
|
||||
SInt32
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
virtual void mouseWheel(SInt32 delta);
|
||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||
virtual void grabClipboard(ClipboardID);
|
||||
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
||||
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
||||
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||
virtual SInt32 getJumpZoneSize() const;
|
||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user