checkpoint. initial support for multiple displays on win32.
This commit is contained in:
parent
29c90a3b6c
commit
bebb63ac53
|
@ -557,13 +557,13 @@ CClient::onQueryInfo()
|
||||||
void
|
void
|
||||||
CClient::onQueryInfoNoLock()
|
CClient::onQueryInfoNoLock()
|
||||||
{
|
{
|
||||||
SInt32 x, y, w, h;
|
SInt32 mx, my, x, y, w, h;
|
||||||
m_screen->getMousePos(&x, &y);
|
m_screen->getMousePos(mx, my);
|
||||||
m_screen->getSize(&w, &h);
|
m_screen->getShape(x, y, w, h);
|
||||||
SInt32 zoneSize = m_screen->getJumpZoneSize();
|
SInt32 zoneSize = m_screen->getJumpZoneSize();
|
||||||
|
|
||||||
log((CLOG_DEBUG1 "sending info size=%d,%d zone=%d pos=%d,%d", 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, w, h, zoneSize, x, y);
|
CProtocolUtil::writef(m_output, kMsgDInfo, x, y, w, h, zoneSize, mx, my);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -339,11 +339,11 @@ CMSWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||||
assert(m_window != NULL);
|
assert(m_window != NULL);
|
||||||
syncDesktop();
|
syncDesktop();
|
||||||
|
|
||||||
SInt32 w, h;
|
SInt32 x0, y0, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x0, y0, w, h);
|
||||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||||
(SInt32)(65535.99 * x / (w - 1)),
|
(SInt32)(65535.99 * x / (w - 1)) + x0,
|
||||||
(SInt32)(65535.99 * y / (h - 1)),
|
(SInt32)(65535.99 * y / (h - 1)) + y0,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,30 +381,28 @@ CMSWindowsSecondaryScreen::grabClipboard(ClipboardID /*id*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
CLock lock(&m_mutex);
|
||||||
assert(m_window != NULL);
|
assert(m_window != NULL);
|
||||||
syncDesktop();
|
syncDesktop();
|
||||||
|
|
||||||
POINT pos;
|
POINT pos;
|
||||||
if (GetCursorPos(&pos)) {
|
if (GetCursorPos(&pos)) {
|
||||||
*x = pos.x;
|
x = pos.x;
|
||||||
*y = pos.y;
|
y = pos.y;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*x = 0;
|
x = 0;
|
||||||
*y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
SInt32
|
||||||
|
@ -547,7 +545,7 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
// screen resolution has changed
|
// screen resolution has changed
|
||||||
updateScreenSize();
|
updateScreenShape();
|
||||||
m_client->onResolutionChanged();
|
m_client->onResolutionChanged();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -559,11 +557,11 @@ void
|
||||||
CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
|
CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
// warp to requested location
|
// warp to requested location
|
||||||
SInt32 w, h;
|
SInt32 x0, y0, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x0, y0, w, h);
|
||||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||||
(DWORD)((65535.99 * x) / (w - 1)),
|
(DWORD)((65535.99 * x) / (w - 1)) + x0,
|
||||||
(DWORD)((65535.99 * y) / (h - 1)),
|
(DWORD)((65535.99 * y) / (h - 1)) + y0,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
// show cursor
|
// show cursor
|
||||||
|
|
|
@ -30,8 +30,8 @@ public:
|
||||||
virtual void mouseWheel(SInt32 delta);
|
virtual void mouseWheel(SInt32 delta);
|
||||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||||
virtual void grabClipboard(ClipboardID);
|
virtual void grabClipboard(ClipboardID);
|
||||||
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ CXWindowsSecondaryScreen::grabClipboard(ClipboardID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
CXWindowsSecondaryScreen::getMousePos(SInt32& x, SInt32& y) const
|
||||||
{
|
{
|
||||||
CDisplayLock display(this);
|
CDisplayLock display(this);
|
||||||
int xTmp, yTmp, dummy;
|
int xTmp, yTmp, dummy;
|
||||||
|
@ -295,14 +295,15 @@ CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||||
Window dummyWindow;
|
Window dummyWindow;
|
||||||
XQueryPointer(display, getRoot(), &dummyWindow, &dummyWindow,
|
XQueryPointer(display, getRoot(), &dummyWindow, &dummyWindow,
|
||||||
&xTmp, &yTmp, &dummy, &dummy, &dummyMask);
|
&xTmp, &yTmp, &dummy, &dummy, &dummyMask);
|
||||||
*x = xTmp;
|
x = xTmp;
|
||||||
*y = yTmp;
|
y = yTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
SInt32
|
||||||
|
|
|
@ -29,8 +29,8 @@ public:
|
||||||
virtual void mouseWheel(SInt32 delta);
|
virtual void mouseWheel(SInt32 delta);
|
||||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||||
virtual void grabClipboard(ClipboardID);
|
virtual void grabClipboard(ClipboardID);
|
||||||
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,15 @@
|
||||||
#include "CString.h"
|
#include "CString.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
//
|
||||||
|
// add backwards compatible multihead support (suppress bogus warning)
|
||||||
|
//
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable: 4706) // assignment within conditional
|
||||||
|
#define COMPILE_MULTIMON_STUBS
|
||||||
|
#include <multimon.h>
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsScreen
|
// CMSWindowsScreen
|
||||||
//
|
//
|
||||||
|
@ -16,6 +25,7 @@ CMSWindowsScreen* CMSWindowsScreen::s_screen = NULL;
|
||||||
CMSWindowsScreen::CMSWindowsScreen() :
|
CMSWindowsScreen::CMSWindowsScreen() :
|
||||||
m_class(0),
|
m_class(0),
|
||||||
m_cursor(NULL),
|
m_cursor(NULL),
|
||||||
|
m_x(0), m_y(0),
|
||||||
m_w(0), m_h(0),
|
m_w(0), m_h(0),
|
||||||
m_thread(0)
|
m_thread(0)
|
||||||
{
|
{
|
||||||
|
@ -99,11 +109,8 @@ CMSWindowsScreen::openDisplay()
|
||||||
classInfo.hIconSm = NULL;
|
classInfo.hIconSm = NULL;
|
||||||
m_class = RegisterClassEx(&classInfo);
|
m_class = RegisterClassEx(&classInfo);
|
||||||
|
|
||||||
// get screen size
|
// get screen shape
|
||||||
// FIXME -- should handle multiple screens
|
updateScreenShape();
|
||||||
m_w = GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
m_h = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
log((CLOG_INFO "display size: %dx%d", m_w, m_h));
|
|
||||||
|
|
||||||
// let subclass prep display
|
// let subclass prep display
|
||||||
onOpenDisplay();
|
onOpenDisplay();
|
||||||
|
@ -142,21 +149,25 @@ CMSWindowsScreen::getClass() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateScreenSize()
|
CMSWindowsScreen::updateScreenShape()
|
||||||
{
|
{
|
||||||
m_w = GetSystemMetrics(SM_CXSCREEN);
|
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
m_h = GetSystemMetrics(SM_CYSCREEN);
|
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
log((CLOG_INFO "display resize: %dx%d", m_w, m_h));
|
m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||||
|
m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||||
|
log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
CMSWindowsScreen::getScreenShape(
|
||||||
|
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
{
|
{
|
||||||
assert(m_class != 0);
|
assert(m_class != 0);
|
||||||
assert(w != NULL && h != NULL);
|
|
||||||
|
|
||||||
*w = m_w;
|
x = m_x;
|
||||||
*h = m_h;
|
y = m_y;
|
||||||
|
w = m_w;
|
||||||
|
h = m_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDESK
|
HDESK
|
||||||
|
|
|
@ -44,10 +44,11 @@ protected:
|
||||||
ATOM getClass() const;
|
ATOM getClass() const;
|
||||||
|
|
||||||
// update screen size cache
|
// update screen size cache
|
||||||
void updateScreenSize();
|
void updateScreenShape();
|
||||||
|
|
||||||
// get the size of the screen
|
// get the size of the screen
|
||||||
void getScreenSize(SInt32* w, SInt32* h) const;
|
void getScreenShape(SInt32& x, SInt32& y,
|
||||||
|
SInt32& width, SInt32& height) const;
|
||||||
|
|
||||||
// get the input desktop. caller must CloseDesktop() the result.
|
// get the input desktop. caller must CloseDesktop() the result.
|
||||||
// do not call under windows 95/98/me.
|
// do not call under windows 95/98/me.
|
||||||
|
@ -87,6 +88,7 @@ private:
|
||||||
ATOM m_class;
|
ATOM m_class;
|
||||||
HICON m_icon;
|
HICON m_icon;
|
||||||
HCURSOR m_cursor;
|
HCURSOR m_cursor;
|
||||||
|
SInt32 m_x, m_y;
|
||||||
SInt32 m_w, m_h;
|
SInt32 m_w, m_h;
|
||||||
DWORD m_thread;
|
DWORD m_thread;
|
||||||
static CMSWindowsScreen* s_screen;
|
static CMSWindowsScreen* s_screen;
|
||||||
|
|
|
@ -19,6 +19,7 @@ CXWindowsScreen* CXWindowsScreen::s_screen = NULL;
|
||||||
CXWindowsScreen::CXWindowsScreen() :
|
CXWindowsScreen::CXWindowsScreen() :
|
||||||
m_display(NULL),
|
m_display(NULL),
|
||||||
m_root(None),
|
m_root(None),
|
||||||
|
m_x(0), m_y(0),
|
||||||
m_w(0), m_h(0),
|
m_w(0), m_h(0),
|
||||||
m_stop(false)
|
m_stop(false)
|
||||||
{
|
{
|
||||||
|
@ -59,10 +60,12 @@ CXWindowsScreen::openDisplay()
|
||||||
m_screen = DefaultScreen(m_display);
|
m_screen = DefaultScreen(m_display);
|
||||||
Screen* screen = ScreenOfDisplay(m_display, m_screen);
|
Screen* screen = ScreenOfDisplay(m_display, m_screen);
|
||||||
|
|
||||||
// get screen size
|
// get screen shape
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
m_w = WidthOfScreen(screen);
|
m_w = WidthOfScreen(screen);
|
||||||
m_h = HeightOfScreen(screen);
|
m_h = HeightOfScreen(screen);
|
||||||
log((CLOG_INFO "display size: %dx%d", m_w, m_h));
|
log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||||
|
|
||||||
// get the root window
|
// get the root window
|
||||||
m_root = RootWindow(m_display, m_screen);
|
m_root = RootWindow(m_display, m_screen);
|
||||||
|
@ -113,13 +116,15 @@ CXWindowsScreen::getRoot() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CXWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
CXWindowsScreen::getScreenShape(
|
||||||
|
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
{
|
{
|
||||||
assert(m_display != NULL);
|
assert(m_display != NULL);
|
||||||
assert(w != NULL && h != NULL);
|
|
||||||
|
|
||||||
*w = m_w;
|
x = m_x;
|
||||||
*h = m_h;
|
y = m_y;
|
||||||
|
w = m_w;
|
||||||
|
h = m_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor
|
Cursor
|
||||||
|
|
|
@ -41,12 +41,13 @@ protected:
|
||||||
// is closed.
|
// is closed.
|
||||||
void closeDisplay();
|
void closeDisplay();
|
||||||
|
|
||||||
// get the opened screen, its size, its root window. to get the
|
// get the opened screen, its shape, its root window. to get the
|
||||||
// display create a CDisplayLock object passing this. while the
|
// display create a CDisplayLock object passing this. while the
|
||||||
// object exists no other threads may access the display. do not
|
// object exists no other threads may access the display. do not
|
||||||
// save the Display* beyond the lifetime of the CDisplayLock.
|
// save the Display* beyond the lifetime of the CDisplayLock.
|
||||||
int getScreen() const;
|
int getScreen() const;
|
||||||
void getScreenSize(SInt32* w, SInt32* h) const;
|
void getScreenShape(
|
||||||
|
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const;
|
||||||
Window getRoot() const;
|
Window getRoot() const;
|
||||||
|
|
||||||
// create a cursor that is transparent everywhere
|
// create a cursor that is transparent everywhere
|
||||||
|
@ -108,6 +109,7 @@ private:
|
||||||
Display* m_display;
|
Display* m_display;
|
||||||
int m_screen;
|
int m_screen;
|
||||||
Window m_root;
|
Window m_root;
|
||||||
|
SInt32 m_x, m_y;
|
||||||
SInt32 m_w, m_h;
|
SInt32 m_w, m_h;
|
||||||
bool m_stop;
|
bool m_stop;
|
||||||
|
|
||||||
|
|
|
@ -111,15 +111,15 @@ CMSWindowsPrimaryScreen::open(CServer* server)
|
||||||
nextMark();
|
nextMark();
|
||||||
|
|
||||||
// send screen info
|
// send screen info
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
POINT pos;
|
POINT pos;
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
m_server->setInfo(w, h, getJumpZoneSize(), pos.x, pos.y);
|
m_server->setInfo(x, y, w, h, getJumpZoneSize(), pos.x, pos.y);
|
||||||
|
|
||||||
// compute center pixel of screen
|
// compute center pixel of primary screen
|
||||||
m_xCenter = w >> 1;
|
m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
|
||||||
m_yCenter = h >> 1;
|
m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
|
||||||
|
|
||||||
// get keyboard state
|
// get keyboard state
|
||||||
updateKeys();
|
updateKeys();
|
||||||
|
@ -228,10 +228,10 @@ void
|
||||||
CMSWindowsPrimaryScreen::onConfigure()
|
CMSWindowsPrimaryScreen::onConfigure()
|
||||||
{
|
{
|
||||||
if ((m_is95Family || m_desk != NULL) && !m_active) {
|
if ((m_is95Family || m_desk != NULL) && !m_active) {
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
m_setZone(m_server->getActivePrimarySides(),
|
m_setZone(m_server->getActivePrimarySides(),
|
||||||
w, h, getJumpZoneSize());
|
x, y, w, h, getJumpZoneSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,9 +264,10 @@ CMSWindowsPrimaryScreen::grabClipboard(ClipboardID /*id*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
|
CMSWindowsPrimaryScreen::getShape(
|
||||||
|
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
{
|
{
|
||||||
getScreenSize(width, height);
|
getScreenShape(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
SInt32
|
SInt32
|
||||||
|
@ -551,17 +552,17 @@ CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
{
|
{
|
||||||
// screen resolution may have changed
|
// screen resolution may have changed
|
||||||
SInt32 wOld, hOld;
|
SInt32 xOld, yOld, wOld, hOld;
|
||||||
getScreenSize(&wOld, &hOld);
|
getScreenShape(xOld, yOld, wOld, hOld);
|
||||||
SInt32 w, h;
|
updateScreenShape();
|
||||||
updateScreenSize();
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
|
|
||||||
// do nothing if resolution hasn't changed
|
// do nothing if resolution hasn't changed
|
||||||
if (w != wOld || h != hOld) {
|
if (x != xOld || y != yOld || w != wOld || h != hOld) {
|
||||||
// recompute center pixel of screen
|
// recompute center pixel of primary screen
|
||||||
m_xCenter = w >> 1;
|
m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
|
||||||
m_yCenter = h >> 1;
|
m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
|
||||||
|
|
||||||
// warp mouse to center if active
|
// warp mouse to center if active
|
||||||
if (m_active) {
|
if (m_active) {
|
||||||
|
@ -576,7 +577,7 @@ CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||||
// send new screen info
|
// send new screen info
|
||||||
POINT pos;
|
POINT pos;
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
m_server->setInfo(w, h, getJumpZoneSize(), pos.x, pos.y);
|
m_server->setInfo(x, y, w, h, getJumpZoneSize(), pos.x, pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -682,8 +683,8 @@ CMSWindowsPrimaryScreen::openDesktop()
|
||||||
// with losing keyboard input (focus?) in that case.
|
// with losing keyboard input (focus?) in that case.
|
||||||
// unfortunately, hiding the full screen window (when entering
|
// unfortunately, hiding the full screen window (when entering
|
||||||
// the scren causes all other windows to redraw).
|
// the scren causes all other windows to redraw).
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
|
|
||||||
// create the window
|
// create the window
|
||||||
m_window = CreateWindowEx(WS_EX_TOPMOST |
|
m_window = CreateWindowEx(WS_EX_TOPMOST |
|
||||||
|
@ -692,7 +693,7 @@ CMSWindowsPrimaryScreen::openDesktop()
|
||||||
(LPCTSTR)getClass(),
|
(LPCTSTR)getClass(),
|
||||||
"Synergy",
|
"Synergy",
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, w, h, NULL, NULL,
|
x, y, w, h, NULL, NULL,
|
||||||
getInstance(),
|
getInstance(),
|
||||||
NULL);
|
NULL);
|
||||||
if (m_window == NULL) {
|
if (m_window == NULL) {
|
||||||
|
@ -792,8 +793,8 @@ CMSWindowsPrimaryScreen::switchDesktop(HDESK desk)
|
||||||
// with losing keyboard input (focus?) in that case.
|
// with losing keyboard input (focus?) in that case.
|
||||||
// unfortunately, hiding the full screen window (when entering
|
// unfortunately, hiding the full screen window (when entering
|
||||||
// the scren causes all other windows to redraw).
|
// the scren causes all other windows to redraw).
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
|
|
||||||
// create the window
|
// create the window
|
||||||
m_window = CreateWindowEx(WS_EX_TOPMOST |
|
m_window = CreateWindowEx(WS_EX_TOPMOST |
|
||||||
|
@ -802,7 +803,7 @@ CMSWindowsPrimaryScreen::switchDesktop(HDESK desk)
|
||||||
(LPCTSTR)getClass(),
|
(LPCTSTR)getClass(),
|
||||||
"Synergy",
|
"Synergy",
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, w, h, NULL, NULL,
|
x, y, w, h, NULL, NULL,
|
||||||
getInstance(),
|
getInstance(),
|
||||||
NULL);
|
NULL);
|
||||||
if (m_window == NULL) {
|
if (m_window == NULL) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||||
virtual void grabClipboard(ClipboardID);
|
virtual void grabClipboard(ClipboardID);
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
virtual KeyModifierMask getToggleMask() const;
|
virtual KeyModifierMask getToggleMask() const;
|
||||||
|
|
|
@ -260,24 +260,27 @@ CServer::getActivePrimarySides() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CServer::setInfo(SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
CServer::setInfo(SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||||
|
SInt32 zoneSize, SInt32 mx, SInt32 my)
|
||||||
{
|
{
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
assert(m_primaryInfo != NULL);
|
assert(m_primaryInfo != NULL);
|
||||||
setInfoNoLock(m_primaryInfo->m_name, w, h, zoneSize, x, y);
|
setInfoNoLock(m_primaryInfo->m_name, x, y, w, h, zoneSize, mx, my);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CServer::setInfo(const CString& client,
|
CServer::setInfo(const CString& client,
|
||||||
SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||||
|
SInt32 zoneSize, SInt32 mx, SInt32 my)
|
||||||
{
|
{
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
setInfoNoLock(client, w, h, zoneSize, x, y);
|
setInfoNoLock(client, x, y, w, h, zoneSize, mx, my);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CServer::setInfoNoLock(const CString& screen,
|
CServer::setInfoNoLock(const CString& screen,
|
||||||
SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||||
|
SInt32 zoneSize, SInt32 mx, SInt32 my)
|
||||||
{
|
{
|
||||||
assert(!screen.empty());
|
assert(!screen.empty());
|
||||||
assert(w > 0);
|
assert(w > 0);
|
||||||
|
@ -297,13 +300,15 @@ CServer::setInfoNoLock(const CString& screen,
|
||||||
// update screen info
|
// update screen info
|
||||||
if (info == m_active) {
|
if (info == m_active) {
|
||||||
// update the remote mouse coordinates
|
// update the remote mouse coordinates
|
||||||
m_x = x;
|
m_x = mx;
|
||||||
m_y = y;
|
m_y = my;
|
||||||
}
|
}
|
||||||
info->m_width = w;
|
info->m_x = x;
|
||||||
info->m_height = h;
|
info->m_y = y;
|
||||||
|
info->m_w = w;
|
||||||
|
info->m_h = h;
|
||||||
info->m_zoneSize = zoneSize;
|
info->m_zoneSize = zoneSize;
|
||||||
log((CLOG_INFO "screen \"%s\" size=%dx%d zone=%d pos=%d,%d", screen.c_str(), w, h, zoneSize, x, y));
|
log((CLOG_INFO "screen \"%s\" shape=%d,%d %dx%d zone=%d pos=%d,%d", screen.c_str(), x, y, w, h, zoneSize, mx, my));
|
||||||
|
|
||||||
// send acknowledgement (if screen isn't the primary)
|
// send acknowledgement (if screen isn't the primary)
|
||||||
if (info->m_protocol != NULL) {
|
if (info->m_protocol != NULL) {
|
||||||
|
@ -313,7 +318,7 @@ CServer::setInfoNoLock(const CString& screen,
|
||||||
// handle resolution change to primary screen
|
// handle resolution change to primary screen
|
||||||
else {
|
else {
|
||||||
if (info == m_active) {
|
if (info == m_active) {
|
||||||
onMouseMovePrimaryNoLock(x, y);
|
onMouseMovePrimaryNoLock(mx, my);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
onMouseMoveSecondaryNoLock(0, 0);
|
onMouseMoveSecondaryNoLock(0, 0);
|
||||||
|
@ -536,22 +541,22 @@ CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
|
||||||
|
|
||||||
// see if we should change screens
|
// see if we should change screens
|
||||||
CConfig::EDirection dir;
|
CConfig::EDirection dir;
|
||||||
if (x < m_active->m_zoneSize) {
|
if (x < m_active->m_x + m_active->m_zoneSize) {
|
||||||
x -= m_active->m_zoneSize;
|
x -= m_active->m_zoneSize;
|
||||||
dir = CConfig::kLeft;
|
dir = CConfig::kLeft;
|
||||||
log((CLOG_DEBUG1 "switch to left"));
|
log((CLOG_DEBUG1 "switch to left"));
|
||||||
}
|
}
|
||||||
else if (x >= m_active->m_width - m_active->m_zoneSize) {
|
else if (x >= m_active->m_x + m_active->m_w - m_active->m_zoneSize) {
|
||||||
x += m_active->m_zoneSize;
|
x += m_active->m_zoneSize;
|
||||||
dir = CConfig::kRight;
|
dir = CConfig::kRight;
|
||||||
log((CLOG_DEBUG1 "switch to right"));
|
log((CLOG_DEBUG1 "switch to right"));
|
||||||
}
|
}
|
||||||
else if (y < m_active->m_zoneSize) {
|
else if (y < m_active->m_y + m_active->m_zoneSize) {
|
||||||
y -= m_active->m_zoneSize;
|
y -= m_active->m_zoneSize;
|
||||||
dir = CConfig::kTop;
|
dir = CConfig::kTop;
|
||||||
log((CLOG_DEBUG1 "switch to top"));
|
log((CLOG_DEBUG1 "switch to top"));
|
||||||
}
|
}
|
||||||
else if (y >= m_active->m_height - m_active->m_zoneSize) {
|
else if (y >= m_active->m_y + m_active->m_h - m_active->m_zoneSize) {
|
||||||
y += m_active->m_zoneSize;
|
y += m_active->m_zoneSize;
|
||||||
dir = CConfig::kBottom;
|
dir = CConfig::kBottom;
|
||||||
log((CLOG_DEBUG1 "switch to bottom"));
|
log((CLOG_DEBUG1 "switch to bottom"));
|
||||||
|
@ -561,17 +566,13 @@ CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get jump destination
|
// get jump destination and, if no screen in jump direction,
|
||||||
|
// then ignore the move.
|
||||||
CScreenInfo* newScreen = getNeighbor(m_active, dir, x, y);
|
CScreenInfo* newScreen = getNeighbor(m_active, dir, x, y);
|
||||||
|
|
||||||
// if no screen in jump direction then ignore the move
|
|
||||||
if (newScreen == NULL) {
|
if (newScreen == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remap position to account for resolution differences
|
|
||||||
mapPosition(m_active, dir, newScreen, x, y);
|
|
||||||
|
|
||||||
// switch screen
|
// switch screen
|
||||||
switchScreen(newScreen, x, y);
|
switchScreen(newScreen, x, y);
|
||||||
return true;
|
return true;
|
||||||
|
@ -615,16 +616,16 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
|
||||||
if (!isLockedToScreenNoLock()) {
|
if (!isLockedToScreenNoLock()) {
|
||||||
// find direction of neighbor
|
// find direction of neighbor
|
||||||
CConfig::EDirection dir;
|
CConfig::EDirection dir;
|
||||||
if (m_x < 0) {
|
if (m_x < m_active->m_x) {
|
||||||
dir = CConfig::kLeft;
|
dir = CConfig::kLeft;
|
||||||
}
|
}
|
||||||
else if (m_x > m_active->m_width - 1) {
|
else if (m_x > m_active->m_x + m_active->m_w - 1) {
|
||||||
dir = CConfig::kRight;
|
dir = CConfig::kRight;
|
||||||
}
|
}
|
||||||
else if (m_y < 0) {
|
else if (m_y < m_active->m_y) {
|
||||||
dir = CConfig::kTop;
|
dir = CConfig::kTop;
|
||||||
}
|
}
|
||||||
else if (m_y > m_active->m_height - 1) {
|
else if (m_y > m_active->m_y + m_active->m_h - 1) {
|
||||||
dir = CConfig::kBottom;
|
dir = CConfig::kBottom;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -638,39 +639,32 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
|
||||||
if (newScreen == NULL) {
|
if (newScreen == NULL) {
|
||||||
log((CLOG_DEBUG1 "leave \"%s\" on %s", m_active->m_name.c_str(), CConfig::dirName(dir)));
|
log((CLOG_DEBUG1 "leave \"%s\" on %s", m_active->m_name.c_str(), CConfig::dirName(dir)));
|
||||||
|
|
||||||
SInt32 x = m_x, y = m_y;
|
// get new position or clamp to current screen
|
||||||
newScreen = getNeighbor(m_active, dir, x, y);
|
newScreen = getNeighbor(m_active, dir, m_x, m_y);
|
||||||
|
if (newScreen == NULL) {
|
||||||
// remap position to account for resolution differences
|
|
||||||
if (newScreen != NULL) {
|
|
||||||
mapPosition(m_active, dir, newScreen, x, y);
|
|
||||||
m_x = x;
|
|
||||||
m_y = y;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
log((CLOG_DEBUG1 "no neighbor; clamping"));
|
log((CLOG_DEBUG1 "no neighbor; clamping"));
|
||||||
if (m_x < 0)
|
if (m_x < m_active->m_x)
|
||||||
m_x = 0;
|
m_x = m_active->m_x;
|
||||||
else if (m_x > m_active->m_width - 1)
|
else if (m_x > m_active->m_x + m_active->m_w - 1)
|
||||||
m_x = m_active->m_width - 1;
|
m_x = m_active->m_x + m_active->m_w - 1;
|
||||||
if (m_y < 0)
|
if (m_y < m_active->m_y)
|
||||||
m_y = 0;
|
m_y = m_active->m_y;
|
||||||
else if (m_y > m_active->m_height - 1)
|
else if (m_y > m_active->m_y + m_active->m_h - 1)
|
||||||
m_y = m_active->m_height - 1;
|
m_y = m_active->m_y + m_active->m_h - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// clamp to edge when locked
|
// clamp to edge when locked
|
||||||
log((CLOG_DEBUG1 "clamp to \"%s\"", m_active->m_name.c_str()));
|
log((CLOG_DEBUG1 "clamp to \"%s\"", m_active->m_name.c_str()));
|
||||||
if (m_x < 0)
|
if (m_x < m_active->m_x)
|
||||||
m_x = 0;
|
m_x = m_active->m_x;
|
||||||
else if (m_x > m_active->m_width - 1)
|
else if (m_x > m_active->m_x + m_active->m_w - 1)
|
||||||
m_x = m_active->m_width - 1;
|
m_x = m_active->m_x + m_active->m_w - 1;
|
||||||
if (m_y < 0)
|
if (m_y < m_active->m_y)
|
||||||
m_y = 0;
|
m_y = m_active->m_y;
|
||||||
else if (m_y > m_active->m_height - 1)
|
else if (m_y > m_active->m_y + m_active->m_h - 1)
|
||||||
m_y = m_active->m_height - 1;
|
m_y = m_active->m_y + m_active->m_h - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// warp cursor if on same screen
|
// warp cursor if on same screen
|
||||||
|
@ -729,7 +723,8 @@ void
|
||||||
CServer::switchScreen(CScreenInfo* dst, SInt32 x, SInt32 y)
|
CServer::switchScreen(CScreenInfo* dst, SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
assert(dst != NULL);
|
assert(dst != NULL);
|
||||||
assert(x >= 0 && y >= 0 && x < dst->m_width && y < dst->m_height);
|
assert(x >= dst->m_x && y >= dst->m_y);
|
||||||
|
assert(x < dst->m_x + dst->m_w && y < dst->m_y + dst->m_h);
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
log((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", m_active->m_name.c_str(), dst->m_name.c_str(), x, y));
|
log((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", m_active->m_name.c_str(), dst->m_name.c_str(), x, y));
|
||||||
|
@ -832,22 +827,27 @@ CServer::getNeighbor(CScreenInfo* src,
|
||||||
assert(src != NULL);
|
assert(src != NULL);
|
||||||
|
|
||||||
// get the first neighbor
|
// get the first neighbor
|
||||||
CScreenInfo* lastGoodScreen = src;
|
|
||||||
CScreenInfo* dst = getNeighbor(src, srcSide);
|
CScreenInfo* dst = getNeighbor(src, srcSide);
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the source screen's size (needed for kRight and kBottom)
|
// get the source screen's size (needed for kRight and kBottom)
|
||||||
SInt32 w = src->m_width, h = src->m_height;
|
SInt32 w = src->m_w, h = src->m_h;
|
||||||
|
|
||||||
// find destination screen, adjusting x or y (but not both)
|
// find destination screen, adjusting x or y (but not both). the
|
||||||
|
// searches are done in a sort of canonical screen space where
|
||||||
|
// the upper-left corner is 0,0 for each screen. we adjust from
|
||||||
|
// actual to canonical position on entry to and from canonical to
|
||||||
|
// actual on exit from the search.
|
||||||
|
CScreenInfo* lastGoodScreen = src;
|
||||||
switch (srcSide) {
|
switch (srcSide) {
|
||||||
case CConfig::kLeft:
|
case CConfig::kLeft:
|
||||||
|
x -= src->m_x;
|
||||||
while (dst != NULL && dst != lastGoodScreen) {
|
while (dst != NULL && dst != lastGoodScreen) {
|
||||||
lastGoodScreen = dst;
|
lastGoodScreen = dst;
|
||||||
w = lastGoodScreen->m_width;
|
w = lastGoodScreen->m_w;
|
||||||
h = lastGoodScreen->m_height;
|
h = lastGoodScreen->m_h;
|
||||||
x += w;
|
x += w;
|
||||||
if (x >= 0) {
|
if (x >= 0) {
|
||||||
break;
|
break;
|
||||||
|
@ -855,27 +855,33 @@ CServer::getNeighbor(CScreenInfo* src,
|
||||||
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
|
assert(lastGoodScreen != NULL);
|
||||||
|
x += lastGoodScreen->m_x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kRight:
|
case CConfig::kRight:
|
||||||
|
x -= src->m_x;
|
||||||
while (dst != NULL) {
|
while (dst != NULL) {
|
||||||
lastGoodScreen = dst;
|
lastGoodScreen = dst;
|
||||||
x -= w;
|
x -= w;
|
||||||
w = lastGoodScreen->m_width;
|
w = lastGoodScreen->m_w;
|
||||||
h = lastGoodScreen->m_height;
|
h = lastGoodScreen->m_h;
|
||||||
if (x < w) {
|
if (x < w) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
|
assert(lastGoodScreen != NULL);
|
||||||
|
x += lastGoodScreen->m_x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kTop:
|
case CConfig::kTop:
|
||||||
|
y -= src->m_y;
|
||||||
while (dst != NULL) {
|
while (dst != NULL) {
|
||||||
lastGoodScreen = dst;
|
lastGoodScreen = dst;
|
||||||
w = lastGoodScreen->m_width;
|
w = lastGoodScreen->m_w;
|
||||||
h = lastGoodScreen->m_height;
|
h = lastGoodScreen->m_h;
|
||||||
y += h;
|
y += h;
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
break;
|
break;
|
||||||
|
@ -883,106 +889,108 @@ CServer::getNeighbor(CScreenInfo* src,
|
||||||
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
|
assert(lastGoodScreen != NULL);
|
||||||
|
y += lastGoodScreen->m_y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kBottom:
|
case CConfig::kBottom:
|
||||||
|
y -= src->m_y;
|
||||||
while (dst != NULL) {
|
while (dst != NULL) {
|
||||||
lastGoodScreen = dst;
|
lastGoodScreen = dst;
|
||||||
y -= h;
|
y -= h;
|
||||||
w = lastGoodScreen->m_width;
|
w = lastGoodScreen->m_w;
|
||||||
h = lastGoodScreen->m_height;
|
h = lastGoodScreen->m_h;
|
||||||
if (y < h) {
|
if (y < h) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
|
assert(lastGoodScreen != NULL);
|
||||||
|
y += lastGoodScreen->m_y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert(lastGoodScreen != NULL);
|
|
||||||
|
|
||||||
/* allow screen to be it's own neighbor to allow wrapping
|
// save destination screen
|
||||||
// no neighbor if best neighbor is the source itself
|
assert(lastGoodScreen != NULL);
|
||||||
if (lastGoodScreen == src)
|
dst = lastGoodScreen;
|
||||||
return NULL;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if entering primary screen then be sure to move in far enough
|
// if entering primary screen then be sure to move in far enough
|
||||||
// to avoid the jump zone. if entering a side that doesn't have
|
// to avoid the jump zone. if entering a side that doesn't have
|
||||||
// a neighbor (i.e. an asymmetrical side) then we don't need to
|
// a neighbor (i.e. an asymmetrical side) then we don't need to
|
||||||
// move inwards because that side can't provoke a jump.
|
// move inwards because that side can't provoke a jump.
|
||||||
if (lastGoodScreen->m_protocol == NULL) {
|
if (dst->m_protocol == NULL) {
|
||||||
const CString dstName(lastGoodScreen->m_name);
|
const CString dstName(dst->m_name);
|
||||||
switch (srcSide) {
|
switch (srcSide) {
|
||||||
case CConfig::kLeft:
|
case CConfig::kLeft:
|
||||||
if (!m_config.getNeighbor(dstName, CConfig::kRight).empty() &&
|
if (!m_config.getNeighbor(dstName, CConfig::kRight).empty() &&
|
||||||
x > w - 1 - lastGoodScreen->m_zoneSize)
|
x > dst->m_x + w - 1 - dst->m_zoneSize)
|
||||||
x = w - 1 - lastGoodScreen->m_zoneSize;
|
x = dst->m_x + w - 1 - dst->m_zoneSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kRight:
|
case CConfig::kRight:
|
||||||
if (!m_config.getNeighbor(dstName, CConfig::kLeft).empty() &&
|
if (!m_config.getNeighbor(dstName, CConfig::kLeft).empty() &&
|
||||||
x < lastGoodScreen->m_zoneSize)
|
x < dst->m_x + dst->m_zoneSize)
|
||||||
x = lastGoodScreen->m_zoneSize;
|
x = dst->m_x + dst->m_zoneSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kTop:
|
case CConfig::kTop:
|
||||||
if (!m_config.getNeighbor(dstName, CConfig::kBottom).empty() &&
|
if (!m_config.getNeighbor(dstName, CConfig::kBottom).empty() &&
|
||||||
y > h - 1 - lastGoodScreen->m_zoneSize)
|
y > dst->m_y + h - 1 - dst->m_zoneSize)
|
||||||
y = h - 1 - lastGoodScreen->m_zoneSize;
|
y = dst->m_y + h - 1 - dst->m_zoneSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kBottom:
|
case CConfig::kBottom:
|
||||||
if (!m_config.getNeighbor(dstName, CConfig::kTop).empty() &&
|
if (!m_config.getNeighbor(dstName, CConfig::kTop).empty() &&
|
||||||
y < lastGoodScreen->m_zoneSize)
|
y < dst->m_y + dst->m_zoneSize)
|
||||||
y = lastGoodScreen->m_zoneSize;
|
y = dst->m_y + dst->m_zoneSize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastGoodScreen;
|
// adjust the coordinate orthogonal to srcSide to account for
|
||||||
}
|
// resolution differences. for example, if y is 200 pixels from
|
||||||
|
// the top on a screen 1000 pixels high (20% from the top) when
|
||||||
void
|
// we cross the left edge onto a screen 600 pixels high then y
|
||||||
CServer::mapPosition(CScreenInfo* src, CConfig::EDirection srcSide,
|
// should be set 120 pixels from the top (again 20% from the
|
||||||
CScreenInfo* dst, SInt32& x, SInt32& y) const
|
// top).
|
||||||
{
|
|
||||||
assert(src != NULL);
|
|
||||||
assert(dst != NULL);
|
|
||||||
assert(srcSide >= CConfig::kFirstDirection &&
|
|
||||||
srcSide <= CConfig::kLastDirection);
|
|
||||||
|
|
||||||
switch (srcSide) {
|
switch (srcSide) {
|
||||||
case CConfig::kLeft:
|
case CConfig::kLeft:
|
||||||
case CConfig::kRight:
|
case CConfig::kRight:
|
||||||
|
y -= src->m_y;
|
||||||
if (y < 0) {
|
if (y < 0) {
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
else if (y >= src->m_height) {
|
else if (y >= src->m_h) {
|
||||||
y = dst->m_height - 1;
|
y = dst->m_h - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
y = static_cast<SInt32>(0.5 + y *
|
y = static_cast<SInt32>(0.5 + y *
|
||||||
static_cast<double>(dst->m_height - 1) /
|
static_cast<double>(dst->m_h - 1) /
|
||||||
(src->m_height - 1));
|
(src->m_h - 1));
|
||||||
}
|
}
|
||||||
|
y += dst->m_y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfig::kTop:
|
case CConfig::kTop:
|
||||||
case CConfig::kBottom:
|
case CConfig::kBottom:
|
||||||
|
x -= src->m_x;
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
else if (x >= src->m_width) {
|
else if (x >= src->m_w) {
|
||||||
x = dst->m_width - 1;
|
x = dst->m_w - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x = static_cast<SInt32>(0.5 + x *
|
x = static_cast<SInt32>(0.5 + x *
|
||||||
static_cast<double>(dst->m_width - 1) /
|
static_cast<double>(dst->m_w - 1) /
|
||||||
(src->m_width - 1));
|
(src->m_w - 1));
|
||||||
}
|
}
|
||||||
|
x += dst->m_x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "CTCPListenSocket.h"
|
#include "CTCPListenSocket.h"
|
||||||
|
@ -1536,8 +1544,8 @@ CServer::removeConnection(const CString& name)
|
||||||
// if this is active screen then we have to jump off of it
|
// if this is active screen then we have to jump off of it
|
||||||
if (m_active == index->second && m_active != m_primaryInfo) {
|
if (m_active == index->second && m_active != m_primaryInfo) {
|
||||||
// record new position (center of primary screen)
|
// record new position (center of primary screen)
|
||||||
m_x = m_primaryInfo->m_width >> 1;
|
m_x = m_primaryInfo->m_x + (m_primaryInfo->m_w >> 1);
|
||||||
m_y = m_primaryInfo->m_height >> 1;
|
m_y = m_primaryInfo->m_y + (m_primaryInfo->m_h >> 1);
|
||||||
|
|
||||||
// don't notify active screen since it probably already disconnected
|
// don't notify active screen since it probably already disconnected
|
||||||
log((CLOG_INFO "jump from \"%s\" to \"%s\" at %d,%d", m_active->m_name.c_str(), m_primaryInfo->m_name.c_str(), m_x, m_y));
|
log((CLOG_INFO "jump from \"%s\" to \"%s\" at %d,%d", m_active->m_name.c_str(), m_primaryInfo->m_name.c_str(), m_x, m_y));
|
||||||
|
@ -1601,8 +1609,10 @@ CServer::CScreenInfo::CScreenInfo(const CString& name,
|
||||||
m_name(name),
|
m_name(name),
|
||||||
m_protocol(protocol),
|
m_protocol(protocol),
|
||||||
m_ready(false),
|
m_ready(false),
|
||||||
m_width(0),
|
m_x(0),
|
||||||
m_height(0),
|
m_y(0),
|
||||||
|
m_w(0),
|
||||||
|
m_h(0),
|
||||||
m_zoneSize(0)
|
m_zoneSize(0)
|
||||||
{
|
{
|
||||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id)
|
for (ClipboardID id = 0; id < kClipboardEnd; ++id)
|
||||||
|
|
|
@ -55,12 +55,14 @@ public:
|
||||||
void grabClipboard(ClipboardID);
|
void grabClipboard(ClipboardID);
|
||||||
|
|
||||||
// handle updates from primary
|
// handle updates from primary
|
||||||
void setInfo(SInt32 wScreen, SInt32 hScreen,
|
void setInfo(SInt32 xScreen, SInt32 yScreen,
|
||||||
|
SInt32 wScreen, SInt32 hScreen,
|
||||||
SInt32 zoneSize,
|
SInt32 zoneSize,
|
||||||
SInt32 xMouse, SInt32 yMouse);
|
SInt32 xMouse, SInt32 yMouse);
|
||||||
|
|
||||||
// handle messages from clients
|
// handle messages from clients
|
||||||
void setInfo(const CString& clientName,
|
void setInfo(const CString& clientName,
|
||||||
|
SInt32 xScreen, SInt32 yScreen,
|
||||||
SInt32 wScreen, SInt32 hScreen,
|
SInt32 wScreen, SInt32 hScreen,
|
||||||
SInt32 zoneSize,
|
SInt32 zoneSize,
|
||||||
SInt32 xMouse, SInt32 yMouse);
|
SInt32 xMouse, SInt32 yMouse);
|
||||||
|
@ -119,8 +121,12 @@ private:
|
||||||
CString m_name;
|
CString m_name;
|
||||||
IServerProtocol* m_protocol;
|
IServerProtocol* m_protocol;
|
||||||
bool m_ready;
|
bool m_ready;
|
||||||
SInt32 m_width, m_height;
|
|
||||||
|
// screen shape and jump zone size
|
||||||
|
SInt32 m_x, m_y;
|
||||||
|
SInt32 m_w, m_h;
|
||||||
SInt32 m_zoneSize;
|
SInt32 m_zoneSize;
|
||||||
|
|
||||||
bool m_gotClipboard[kClipboardEnd];
|
bool m_gotClipboard[kClipboardEnd];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +136,7 @@ private:
|
||||||
|
|
||||||
// update screen info
|
// update screen info
|
||||||
void setInfoNoLock(const CString& screenName,
|
void setInfoNoLock(const CString& screenName,
|
||||||
|
SInt32 xScreen, SInt32 yScreen,
|
||||||
SInt32 wScreen, SInt32 hScreen,
|
SInt32 wScreen, SInt32 hScreen,
|
||||||
SInt32 zoneSize,
|
SInt32 zoneSize,
|
||||||
SInt32 xMouse, SInt32 yMouse);
|
SInt32 xMouse, SInt32 yMouse);
|
||||||
|
@ -150,19 +157,12 @@ private:
|
||||||
// lookup neighboring screen. given a position relative to the
|
// lookup neighboring screen. given a position relative to the
|
||||||
// source screen, find the screen we should move onto and where.
|
// source screen, find the screen we should move onto and where.
|
||||||
// if the position is sufficiently far from the source then we
|
// if the position is sufficiently far from the source then we
|
||||||
// cross multiple screens.
|
// cross multiple screens. if there is no suitable screen then
|
||||||
|
// return NULL and x,y are not modified.
|
||||||
CScreenInfo* getNeighbor(CScreenInfo*,
|
CScreenInfo* getNeighbor(CScreenInfo*,
|
||||||
CConfig::EDirection,
|
CConfig::EDirection,
|
||||||
SInt32& x, SInt32& y) const;
|
SInt32& x, SInt32& y) const;
|
||||||
|
|
||||||
// adjust coordinates to account for resolution differences. the
|
|
||||||
// position is converted to a resolution independent form then
|
|
||||||
// converted back to screen coordinates on the destination screen.
|
|
||||||
void mapPosition(CScreenInfo* src,
|
|
||||||
CConfig::EDirection srcSide,
|
|
||||||
CScreenInfo* dst,
|
|
||||||
SInt32& x, SInt32& y) const;
|
|
||||||
|
|
||||||
// open/close the primary screen
|
// open/close the primary screen
|
||||||
void openPrimaryScreen();
|
void openPrimaryScreen();
|
||||||
void closePrimaryScreen();
|
void closePrimaryScreen();
|
||||||
|
|
|
@ -199,21 +199,21 @@ void
|
||||||
CServerProtocol1_0::recvInfo()
|
CServerProtocol1_0::recvInfo()
|
||||||
{
|
{
|
||||||
// parse the message
|
// parse the message
|
||||||
SInt16 x, y, w, h, zoneInfo;
|
SInt16 x, y, w, h, zoneInfo, mx, my;
|
||||||
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4,
|
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4,
|
||||||
&w, &h, &zoneInfo, &x, &y);
|
&x, &y, &w, &h, &zoneInfo, &mx, &my);
|
||||||
log((CLOG_DEBUG "received client \"%s\" info size=%dx%d, zone=%d, pos=%d,%d", getClient().c_str(), w, h, zoneInfo, x, y));
|
log((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d, zone=%d, pos=%d,%d", getClient().c_str(), x, y, w, h, zoneInfo, mx, my));
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (w <= 0 || h <= 0 || zoneInfo < 0) {
|
if (w <= 0 || h <= 0 || zoneInfo < 0) {
|
||||||
throw XBadClient();
|
throw XBadClient();
|
||||||
}
|
}
|
||||||
if (x < 0 || y < 0 || x >= w || y >= h) {
|
if (mx < x || my < y || mx >= x + w || my >= y + h) {
|
||||||
throw XBadClient();
|
throw XBadClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell server of change
|
// tell server of change
|
||||||
getServer()->setInfo(getClient(), w, h, zoneInfo, x, y);
|
getServer()->setInfo(getClient(), x, y, w, h, zoneInfo, mx, my);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -48,6 +48,8 @@ static HHOOK g_keyboardLL = NULL;
|
||||||
static bool g_relay = false;
|
static bool g_relay = false;
|
||||||
static SInt32 g_zoneSize = 0;
|
static SInt32 g_zoneSize = 0;
|
||||||
static UInt32 g_zoneSides = 0;
|
static UInt32 g_zoneSides = 0;
|
||||||
|
static SInt32 g_xScreen = 0;
|
||||||
|
static SInt32 g_yScreen = 0;
|
||||||
static SInt32 g_wScreen = 0;
|
static SInt32 g_wScreen = 0;
|
||||||
static SInt32 g_hScreen = 0;
|
static SInt32 g_hScreen = 0;
|
||||||
static HCURSOR g_cursor = NULL;
|
static HCURSOR g_cursor = NULL;
|
||||||
|
@ -196,16 +198,16 @@ mouseHook(int code, WPARAM wParam, LPARAM lParam)
|
||||||
SInt32 x = (SInt32)info->pt.x;
|
SInt32 x = (SInt32)info->pt.x;
|
||||||
SInt32 y = (SInt32)info->pt.y;
|
SInt32 y = (SInt32)info->pt.y;
|
||||||
if (!inside && (g_zoneSides & CConfig::kLeftMask) != 0) {
|
if (!inside && (g_zoneSides & CConfig::kLeftMask) != 0) {
|
||||||
inside = (x < g_zoneSize);
|
inside = (x < g_xScreen + g_zoneSize);
|
||||||
}
|
}
|
||||||
if (!inside && (g_zoneSides & CConfig::kRightMask) != 0) {
|
if (!inside && (g_zoneSides & CConfig::kRightMask) != 0) {
|
||||||
inside = (x >= g_wScreen - g_zoneSize);
|
inside = (x >= g_xScreen + g_wScreen - g_zoneSize);
|
||||||
}
|
}
|
||||||
if (!inside && (g_zoneSides & CConfig::kTopMask) != 0) {
|
if (!inside && (g_zoneSides & CConfig::kTopMask) != 0) {
|
||||||
inside = (y < g_zoneSize);
|
inside = (y < g_yScreen + g_zoneSize);
|
||||||
}
|
}
|
||||||
if (!inside && (g_zoneSides & CConfig::kBottomMask) != 0) {
|
if (!inside && (g_zoneSides & CConfig::kBottomMask) != 0) {
|
||||||
inside = (y >= g_hScreen - g_zoneSize);
|
inside = (y >= g_yScreen + g_hScreen - g_zoneSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if inside then eat event and notify our window
|
// if inside then eat event and notify our window
|
||||||
|
@ -463,6 +465,8 @@ install(DWORD threadID)
|
||||||
g_relay = false;
|
g_relay = false;
|
||||||
g_zoneSize = 0;
|
g_zoneSize = 0;
|
||||||
g_zoneSides = 0;
|
g_zoneSides = 0;
|
||||||
|
g_xScreen = 0;
|
||||||
|
g_yScreen = 0;
|
||||||
g_wScreen = 0;
|
g_wScreen = 0;
|
||||||
g_hScreen = 0;
|
g_hScreen = 0;
|
||||||
g_cursor = NULL;
|
g_cursor = NULL;
|
||||||
|
@ -585,10 +589,14 @@ uninstall(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setZone(UInt32 sides, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
|
setZone(UInt32 sides,
|
||||||
|
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||||
|
SInt32 jumpZoneSize)
|
||||||
{
|
{
|
||||||
g_zoneSize = jumpZoneSize;
|
g_zoneSize = jumpZoneSize;
|
||||||
g_zoneSides = sides;
|
g_zoneSides = sides;
|
||||||
|
g_xScreen = x;
|
||||||
|
g_yScreen = y;
|
||||||
g_wScreen = w;
|
g_wScreen = w;
|
||||||
g_hScreen = h;
|
g_hScreen = h;
|
||||||
g_relay = false;
|
g_relay = false;
|
||||||
|
@ -601,6 +609,8 @@ setRelay(void)
|
||||||
g_relay = true;
|
g_relay = true;
|
||||||
g_zoneSize = 0;
|
g_zoneSize = 0;
|
||||||
g_zoneSides = 0;
|
g_zoneSides = 0;
|
||||||
|
g_xScreen = 0;
|
||||||
|
g_yScreen = 0;
|
||||||
g_wScreen = 0;
|
g_wScreen = 0;
|
||||||
g_hScreen = 0;
|
g_hScreen = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,15 @@ extern "C" {
|
||||||
|
|
||||||
typedef int (*InstallFunc)(DWORD targetQueueThreadID);
|
typedef int (*InstallFunc)(DWORD targetQueueThreadID);
|
||||||
typedef int (*UninstallFunc)(void);
|
typedef int (*UninstallFunc)(void);
|
||||||
typedef void (*SetZoneFunc)(UInt32, SInt32, SInt32, SInt32);
|
typedef void (*SetZoneFunc)(UInt32,
|
||||||
|
SInt32, SInt32, SInt32, SInt32, SInt32);
|
||||||
typedef void (*SetRelayFunc)(void);
|
typedef void (*SetRelayFunc)(void);
|
||||||
|
|
||||||
CSYNERGYHOOK_API int install(DWORD);
|
CSYNERGYHOOK_API int install(DWORD);
|
||||||
CSYNERGYHOOK_API int uninstall(void);
|
CSYNERGYHOOK_API int uninstall(void);
|
||||||
CSYNERGYHOOK_API void setZone(UInt32 sides,
|
CSYNERGYHOOK_API void setZone(UInt32 sides,
|
||||||
SInt32 w, SInt32 h, SInt32 jumpZoneSize);
|
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||||
|
SInt32 jumpZoneSize);
|
||||||
CSYNERGYHOOK_API void setRelay(void);
|
CSYNERGYHOOK_API void setRelay(void);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ CXWindowsPrimaryScreen::run()
|
||||||
// FIXME -- slurp up all remaining motion events?
|
// FIXME -- slurp up all remaining motion events?
|
||||||
// probably not since keystrokes may go to wrong place.
|
// probably not since keystrokes may go to wrong place.
|
||||||
|
|
||||||
|
// XXX -- why call XQueryPointer?
|
||||||
// get mouse deltas
|
// get mouse deltas
|
||||||
{
|
{
|
||||||
CDisplayLock display(this);
|
CDisplayLock display(this);
|
||||||
|
@ -173,8 +174,8 @@ CXWindowsPrimaryScreen::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute position of center of window
|
// compute position of center of window
|
||||||
SInt32 w, h;
|
SInt32 x0, y0, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x0, y0, w, h);
|
||||||
x = xRoot - (w >> 1);
|
x = xRoot - (w >> 1);
|
||||||
y = yRoot - (h >> 1);
|
y = yRoot - (h >> 1);
|
||||||
|
|
||||||
|
@ -216,11 +217,11 @@ CXWindowsPrimaryScreen::open(CServer* server)
|
||||||
// m_numLockHalfDuplex = true;
|
// m_numLockHalfDuplex = true;
|
||||||
// m_capsLockHalfDuplex = true;
|
// m_capsLockHalfDuplex = true;
|
||||||
|
|
||||||
// get screen size
|
// get screen shape
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
|
|
||||||
int x, y;
|
int mx, my;
|
||||||
{
|
{
|
||||||
CDisplayLock display(this);
|
CDisplayLock display(this);
|
||||||
|
|
||||||
|
@ -232,14 +233,14 @@ CXWindowsPrimaryScreen::open(CServer* server)
|
||||||
int xWindow, yWindow;
|
int xWindow, yWindow;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
if (!XQueryPointer(display, m_window, &root, &window,
|
if (!XQueryPointer(display, m_window, &root, &window,
|
||||||
&x, &y, &xWindow, &yWindow, &mask)) {
|
&mx, &my, &xWindow, &yWindow, &mask)) {
|
||||||
x = w >> 1;
|
mx = w >> 1;
|
||||||
y = h >> 1;
|
my = h >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// send screen info
|
// send screen info
|
||||||
m_server->setInfo(w, h, getJumpZoneSize(), x, y);
|
m_server->setInfo(x, y, w, h, getJumpZoneSize(), mx, my);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -340,8 +341,8 @@ CXWindowsPrimaryScreen::leave()
|
||||||
log((CLOG_DEBUG1 "grabbed pointer and keyboard"));
|
log((CLOG_DEBUG1 "grabbed pointer and keyboard"));
|
||||||
|
|
||||||
// move the mouse to the center of grab window
|
// move the mouse to the center of grab window
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
warpCursorNoLock(display, w >> 1, h >> 1);
|
warpCursorNoLock(display, w >> 1, h >> 1);
|
||||||
|
|
||||||
// local client now active
|
// local client now active
|
||||||
|
@ -396,9 +397,10 @@ CXWindowsPrimaryScreen::grabClipboard(ClipboardID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CXWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
|
CXWindowsPrimaryScreen::getShape(
|
||||||
|
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
{
|
{
|
||||||
getScreenSize(width, height);
|
getScreenShape(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
SInt32
|
SInt32
|
||||||
|
@ -480,8 +482,8 @@ CXWindowsPrimaryScreen::onOpenDisplay(Display* display)
|
||||||
assert(m_window == None);
|
assert(m_window == None);
|
||||||
|
|
||||||
// get size of screen
|
// get size of screen
|
||||||
SInt32 w, h;
|
SInt32 x, y, w, h;
|
||||||
getScreenSize(&w, &h);
|
getScreenShape(x, y, w, h);
|
||||||
|
|
||||||
// create the grab window. this window is used to capture user
|
// create the grab window. this window is used to capture user
|
||||||
// input when the user is focussed on another client. don't let
|
// input when the user is focussed on another client. don't let
|
||||||
|
@ -494,7 +496,7 @@ CXWindowsPrimaryScreen::onOpenDisplay(Display* display)
|
||||||
attr.do_not_propagate_mask = 0;
|
attr.do_not_propagate_mask = 0;
|
||||||
attr.override_redirect = True;
|
attr.override_redirect = True;
|
||||||
attr.cursor = createBlankCursor();
|
attr.cursor = createBlankCursor();
|
||||||
m_window = XCreateWindow(display, getRoot(), 0, 0, w, h, 0, 0,
|
m_window = XCreateWindow(display, getRoot(), x, y, w, h, 0, 0,
|
||||||
InputOnly, CopyFromParent,
|
InputOnly, CopyFromParent,
|
||||||
CWDontPropagate | CWEventMask |
|
CWDontPropagate | CWEventMask |
|
||||||
CWOverrideRedirect | CWCursor,
|
CWOverrideRedirect | CWCursor,
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||||
virtual void grabClipboard(ClipboardID);
|
virtual void grabClipboard(ClipboardID);
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const;
|
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
virtual KeyModifierMask getToggleMask() const;
|
virtual KeyModifierMask getToggleMask() const;
|
||||||
|
|
|
@ -79,8 +79,9 @@ public:
|
||||||
virtual CString getName() const = 0;
|
virtual CString getName() const = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// get the size of the screen
|
// get the screen region
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const = 0;
|
virtual void getShape(SInt32& x, SInt32& y,
|
||||||
|
SInt32& width, SInt32& height) const = 0;
|
||||||
|
|
||||||
// get the size of jump zone
|
// get the size of jump zone
|
||||||
virtual SInt32 getJumpZoneSize() const = 0;
|
virtual SInt32 getJumpZoneSize() const = 0;
|
||||||
|
|
|
@ -66,10 +66,11 @@ public:
|
||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
// get the position of the mouse on the screen
|
// get the position of the mouse on the screen
|
||||||
virtual void getMousePos(SInt32* x, SInt32* y) const = 0;
|
virtual void getMousePos(SInt32& x, SInt32& y) const = 0;
|
||||||
|
|
||||||
// get the size of the screen
|
// get the size of the screen
|
||||||
virtual void getSize(SInt32* width, SInt32* height) const = 0;
|
virtual void getShape(SInt32& x, SInt32& y,
|
||||||
|
SInt32& width, SInt32& height) const = 0;
|
||||||
|
|
||||||
// get the size of jump zone
|
// get the size of jump zone
|
||||||
virtual SInt32 getJumpZoneSize() const = 0;
|
virtual SInt32 getJumpZoneSize() const = 0;
|
||||||
|
|
|
@ -16,6 +16,10 @@ static const UInt16 kDefaultPort = 24800;
|
||||||
// always 4 bytes optionally followed by message specific parameters.
|
// always 4 bytes optionally followed by message specific parameters.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// positions and sizes are signed 16 bit integers.
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// command codes
|
// command codes
|
||||||
//
|
//
|
||||||
|
@ -101,9 +105,12 @@ static const char kMsgDMouseWheel[] = "DMWM%2i";
|
||||||
static const char kMsgDClipboard[] = "DCLP%1i%4i%s";
|
static const char kMsgDClipboard[] = "DCLP%1i%4i%s";
|
||||||
|
|
||||||
// client data: secondary -> primary
|
// client data: secondary -> primary
|
||||||
// $1 = seconary screen width in pixels, $2 = screen height, $3 =
|
// $1 = coordinate of leftmost pixel on secondary screen,
|
||||||
// size of warp zone. $4 and $5 are the x,y position of the mouse
|
// $2 = coordinate of topmost pixel on secondary screen,
|
||||||
// on the secondary screen.
|
// $3 = width of secondary screen in pixels,
|
||||||
|
// $4 = height of secondary screen in pixels,
|
||||||
|
// $5 = size of warp zone,
|
||||||
|
// $6, $7 = the x,y position of the mouse on the secondary screen.
|
||||||
//
|
//
|
||||||
// the secondary screen must send this message in response to the
|
// the secondary screen must send this message in response to the
|
||||||
// kMsgQInfo message. it must also send this message when the
|
// kMsgQInfo message. it must also send this message when the
|
||||||
|
@ -111,7 +118,7 @@ static const char kMsgDClipboard[] = "DCLP%1i%4i%s";
|
||||||
// should ignore any kMsgDMouseMove messages until it receives a
|
// should ignore any kMsgDMouseMove messages until it receives a
|
||||||
// kMsgCInfoAck in order to prevent attempts to move the mouse off
|
// kMsgCInfoAck in order to prevent attempts to move the mouse off
|
||||||
// the new screen area.
|
// the new screen area.
|
||||||
static const char kMsgDInfo[] = "DINF%2i%2i%2i%2i%2i";
|
static const char kMsgDInfo[] = "DINF%2i%2i%2i%2i%2i%2i%2i";
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue