removed unnecessary global scoping operators.
This commit is contained in:
parent
dbdf20e804
commit
ef3149cead
|
@ -61,7 +61,7 @@ UInt32 CBufferedInputStream::readNoLock(
|
||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if (dst != NULL) {
|
if (dst != NULL) {
|
||||||
::memcpy(dst, m_buffer.peek(n), n);
|
memcpy(dst, m_buffer.peek(n), n);
|
||||||
}
|
}
|
||||||
m_buffer.pop(n);
|
m_buffer.pop(n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,11 +262,11 @@ bool CCondVarBase::wait(
|
||||||
m_mutex->unlock();
|
m_mutex->unlock();
|
||||||
|
|
||||||
// wait for a signal or broadcast
|
// wait for a signal or broadcast
|
||||||
DWORD result = ::WaitForMultipleObjects(n, handles, FALSE, winTimeout);
|
DWORD result = WaitForMultipleObjects(n, handles, FALSE, winTimeout);
|
||||||
|
|
||||||
// cancel takes priority
|
// cancel takes priority
|
||||||
if (n == 3 && result != WAIT_OBJECT_0 + 2 &&
|
if (n == 3 && result != WAIT_OBJECT_0 + 2 &&
|
||||||
::WaitForSingleObject(handles[2], 0) == WAIT_OBJECT_0)
|
WaitForSingleObject(handles[2], 0) == WAIT_OBJECT_0)
|
||||||
result = WAIT_OBJECT_0 + 2;
|
result = WAIT_OBJECT_0 + 2;
|
||||||
|
|
||||||
// update the waiter count and check if we're the last waiter
|
// update the waiter count and check if we're the last waiter
|
||||||
|
|
|
@ -107,25 +107,25 @@ void CMutex::unlock() const
|
||||||
void CMutex::init()
|
void CMutex::init()
|
||||||
{
|
{
|
||||||
CRITICAL_SECTION* mutex = new CRITICAL_SECTION;
|
CRITICAL_SECTION* mutex = new CRITICAL_SECTION;
|
||||||
::InitializeCriticalSection(mutex);
|
InitializeCriticalSection(mutex);
|
||||||
m_mutex = reinterpret_cast<void*>(mutex);
|
m_mutex = reinterpret_cast<void*>(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMutex::fini()
|
void CMutex::fini()
|
||||||
{
|
{
|
||||||
CRITICAL_SECTION* mutex = reinterpret_cast<CRITICAL_SECTION*>(m_mutex);
|
CRITICAL_SECTION* mutex = reinterpret_cast<CRITICAL_SECTION*>(m_mutex);
|
||||||
::DeleteCriticalSection(mutex);
|
DeleteCriticalSection(mutex);
|
||||||
delete mutex;
|
delete mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMutex::lock() const
|
void CMutex::lock() const
|
||||||
{
|
{
|
||||||
::EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMutex::unlock() const
|
void CMutex::unlock() const
|
||||||
{
|
{
|
||||||
::LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_WIN32
|
#endif // CONFIG_PLATFORM_WIN32
|
||||||
|
|
|
@ -449,7 +449,7 @@ void CThreadRep::sleep(double timeout)
|
||||||
if (isCancellable())
|
if (isCancellable())
|
||||||
WaitForSingleObject(m_cancel, (DWORD)(1000.0 * timeout));
|
WaitForSingleObject(m_cancel, (DWORD)(1000.0 * timeout));
|
||||||
else
|
else
|
||||||
::Sleep((DWORD)(1000.0 * timeout));
|
Sleep((DWORD)(1000.0 * timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CThreadRep::cancel()
|
void CThreadRep::cancel()
|
||||||
|
@ -461,7 +461,7 @@ void CThreadRep::cancel()
|
||||||
void CThreadRep::testCancel()
|
void CThreadRep::testCancel()
|
||||||
{
|
{
|
||||||
// poll cancel event. return if not set.
|
// poll cancel event. return if not set.
|
||||||
const DWORD result = ::WaitForSingleObject(getCancelEvent(), 0);
|
const DWORD result = WaitForSingleObject(getCancelEvent(), 0);
|
||||||
if (result != WAIT_OBJECT_0)
|
if (result != WAIT_OBJECT_0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -504,11 +504,11 @@ bool CThreadRep::wait(CThreadRep* target, double timeout)
|
||||||
HANDLE handles[2];
|
HANDLE handles[2];
|
||||||
handles[0] = target->getExitEvent();
|
handles[0] = target->getExitEvent();
|
||||||
handles[1] = m_cancel;
|
handles[1] = m_cancel;
|
||||||
DWORD result = ::WaitForMultipleObjects(n, handles, FALSE, t);
|
DWORD result = WaitForMultipleObjects(n, handles, FALSE, t);
|
||||||
|
|
||||||
// cancel takes priority
|
// cancel takes priority
|
||||||
if (n == 2 && result != WAIT_OBJECT_0 + 1 &&
|
if (n == 2 && result != WAIT_OBJECT_0 + 1 &&
|
||||||
::WaitForSingleObject(handles[1], 0) == WAIT_OBJECT_0)
|
WaitForSingleObject(handles[1], 0) == WAIT_OBJECT_0)
|
||||||
result = WAIT_OBJECT_0 + 1;
|
result = WAIT_OBJECT_0 + 1;
|
||||||
|
|
||||||
// handle result
|
// handle result
|
||||||
|
@ -563,7 +563,7 @@ unsigned int __stdcall CThreadRep::threadFunc(void* arg)
|
||||||
CThreadRep* rep = (CThreadRep*)arg;
|
CThreadRep* rep = (CThreadRep*)arg;
|
||||||
|
|
||||||
// initialize OLE
|
// initialize OLE
|
||||||
const HRESULT hr = ::OleInitialize(NULL);
|
const HRESULT hr = OleInitialize(NULL);
|
||||||
|
|
||||||
// run thread
|
// run thread
|
||||||
rep->doThreadFunc();
|
rep->doThreadFunc();
|
||||||
|
|
|
@ -17,7 +17,7 @@ CNetworkAddress::CNetworkAddress(UInt16 port)
|
||||||
inetAddress->sin_family = AF_INET;
|
inetAddress->sin_family = AF_INET;
|
||||||
inetAddress->sin_port = htons(port);
|
inetAddress->sin_port = htons(port);
|
||||||
inetAddress->sin_addr.s_addr = INADDR_ANY;
|
inetAddress->sin_addr.s_addr = INADDR_ANY;
|
||||||
::memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
CNetworkAddress::CNetworkAddress(const CString& hostname, UInt16 port)
|
CNetworkAddress::CNetworkAddress(const CString& hostname, UInt16 port)
|
||||||
|
@ -44,8 +44,8 @@ CNetworkAddress::CNetworkAddress(const CString& hostname, UInt16 port)
|
||||||
struct sockaddr_in* inetAddress = reinterpret_cast<struct sockaddr_in*>(&m_address);
|
struct sockaddr_in* inetAddress = reinterpret_cast<struct sockaddr_in*>(&m_address);
|
||||||
inetAddress->sin_family = hent->h_addrtype;
|
inetAddress->sin_family = hent->h_addrtype;
|
||||||
inetAddress->sin_port = htons(port);
|
inetAddress->sin_port = htons(port);
|
||||||
::memcpy(&inetAddress->sin_addr, hent->h_addr_list[0], hent->h_length);
|
memcpy(&inetAddress->sin_addr, hent->h_addr_list[0], hent->h_length);
|
||||||
::memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
CNetworkAddress::~CNetworkAddress()
|
CNetworkAddress::~CNetworkAddress()
|
||||||
|
|
|
@ -74,7 +74,7 @@ UInt32 CSocketInputStream::read(
|
||||||
n = count;
|
n = count;
|
||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
::memcpy(dst, m_buffer.peek(n), n);
|
memcpy(dst, m_buffer.peek(n), n);
|
||||||
m_buffer.pop(n);
|
m_buffer.pop(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void CXWindowsPrimaryScreen::open(CServer* server)
|
||||||
|
|
||||||
// open the display
|
// open the display
|
||||||
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
|
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
|
||||||
m_display = ::XOpenDisplay(NULL); // FIXME -- allow non-default
|
m_display = XOpenDisplay(NULL); // FIXME -- allow non-default
|
||||||
if (m_display == NULL)
|
if (m_display == NULL)
|
||||||
throw int(5); // FIXME -- make exception for this
|
throw int(5); // FIXME -- make exception for this
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ void CXWindowsPrimaryScreen::open(CServer* server)
|
||||||
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(m_display, m_root, 0, 0, m_w, m_h, 0, 0,
|
m_window = XCreateWindow(m_display, m_root, 0, 0, m_w, m_h, 0, 0,
|
||||||
InputOnly, CopyFromParent,
|
InputOnly, CopyFromParent,
|
||||||
CWDontPropagate | CWEventMask |
|
CWDontPropagate | CWEventMask |
|
||||||
CWOverrideRedirect | CWCursor,
|
CWOverrideRedirect | CWCursor,
|
||||||
|
@ -92,11 +92,11 @@ void CXWindowsPrimaryScreen::close()
|
||||||
log((CLOG_DEBUG "stopped event thread"));
|
log((CLOG_DEBUG "stopped event thread"));
|
||||||
|
|
||||||
// destroy window
|
// destroy window
|
||||||
::XDestroyWindow(m_display, m_window);
|
XDestroyWindow(m_display, m_window);
|
||||||
m_window = None;
|
m_window = None;
|
||||||
|
|
||||||
// close the display
|
// close the display
|
||||||
::XCloseDisplay(m_display);
|
XCloseDisplay(m_display);
|
||||||
m_display = NULL;
|
m_display = NULL;
|
||||||
log((CLOG_DEBUG "closed display"));
|
log((CLOG_DEBUG "closed display"));
|
||||||
}
|
}
|
||||||
|
@ -111,14 +111,14 @@ void CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
// warp to requested location
|
// warp to requested location
|
||||||
::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, x, y);
|
XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, x, y);
|
||||||
|
|
||||||
// unmap the grab window. this also ungrabs the mouse and keyboard.
|
// unmap the grab window. this also ungrabs the mouse and keyboard.
|
||||||
::XUnmapWindow(m_display, m_window);
|
XUnmapWindow(m_display, m_window);
|
||||||
|
|
||||||
// remove all input events for grab window
|
// remove all input events for grab window
|
||||||
XEvent event;
|
XEvent event;
|
||||||
while (::XCheckWindowEvent(m_display, m_window,
|
while (XCheckWindowEvent(m_display, m_window,
|
||||||
PointerMotionMask |
|
PointerMotionMask |
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
KeyPressMask | KeyReleaseMask |
|
KeyPressMask | KeyReleaseMask |
|
||||||
|
@ -141,7 +141,7 @@ void CXWindowsPrimaryScreen::leave()
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
// raise and show the input window
|
// raise and show the input window
|
||||||
::XMapRaised(m_display, m_window);
|
XMapRaised(m_display, m_window);
|
||||||
|
|
||||||
// grab the mouse and keyboard. keep trying until we get them.
|
// grab the mouse and keyboard. keep trying until we get them.
|
||||||
// if we can't grab one after grabbing the other then ungrab
|
// if we can't grab one after grabbing the other then ungrab
|
||||||
|
@ -150,7 +150,7 @@ void CXWindowsPrimaryScreen::leave()
|
||||||
do {
|
do {
|
||||||
// mouse first
|
// mouse first
|
||||||
do {
|
do {
|
||||||
result = ::XGrabPointer(m_display, m_window, True, 0,
|
result = XGrabPointer(m_display, m_window, True, 0,
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
m_window, None, CurrentTime);
|
m_window, None, CurrentTime);
|
||||||
assert(result != GrabNotViewable);
|
assert(result != GrabNotViewable);
|
||||||
|
@ -162,11 +162,11 @@ void CXWindowsPrimaryScreen::leave()
|
||||||
log((CLOG_DEBUG "grabbed pointer"));
|
log((CLOG_DEBUG "grabbed pointer"));
|
||||||
|
|
||||||
// now the keyboard
|
// now the keyboard
|
||||||
result = ::XGrabKeyboard(m_display, m_window, True,
|
result = XGrabKeyboard(m_display, m_window, True,
|
||||||
GrabModeAsync, GrabModeAsync, CurrentTime);
|
GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
assert(result != GrabNotViewable);
|
assert(result != GrabNotViewable);
|
||||||
if (result != GrabSuccess) {
|
if (result != GrabSuccess) {
|
||||||
::XUngrabPointer(m_display, CurrentTime);
|
XUngrabPointer(m_display, CurrentTime);
|
||||||
log((CLOG_DEBUG "ungrabbed pointer, waiting to grab keyboard"));
|
log((CLOG_DEBUG "ungrabbed pointer, waiting to grab keyboard"));
|
||||||
CThread::sleep(0.25);
|
CThread::sleep(0.25);
|
||||||
}
|
}
|
||||||
|
@ -190,13 +190,13 @@ void CXWindowsPrimaryScreen::warpCursorNoLock(
|
||||||
SInt32 x, SInt32 y)
|
SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
// warp the mouse
|
// warp the mouse
|
||||||
::XWarpPointer(m_display, None, m_root, 0, 0, 0, 0, x, y);
|
XWarpPointer(m_display, None, m_root, 0, 0, 0, 0, x, y);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
log((CLOG_DEBUG "warped to %d,%d", x, y));
|
log((CLOG_DEBUG "warped to %d,%d", x, y));
|
||||||
|
|
||||||
// discard mouse events since we just added one we don't want
|
// discard mouse events since we just added one we don't want
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
while (::XCheckWindowEvent(m_display, m_window,
|
while (XCheckWindowEvent(m_display, m_window,
|
||||||
PointerMotionMask, &xevent)) {
|
PointerMotionMask, &xevent)) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -231,15 +231,15 @@ void CXWindowsPrimaryScreen::selectEvents(Window w) const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// select events of interest
|
// select events of interest
|
||||||
::XSelectInput(m_display, w, PointerMotionMask | SubstructureNotifyMask);
|
XSelectInput(m_display, w, PointerMotionMask | SubstructureNotifyMask);
|
||||||
|
|
||||||
// recurse on child windows
|
// recurse on child windows
|
||||||
Window rw, pw, *cw;
|
Window rw, pw, *cw;
|
||||||
unsigned int nc;
|
unsigned int nc;
|
||||||
if (::XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) {
|
if (XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) {
|
||||||
for (unsigned int i = 0; i < nc; ++i)
|
for (unsigned int i = 0; i < nc; ++i)
|
||||||
selectEvents(cw[i]);
|
selectEvents(cw[i]);
|
||||||
::XFree(cw);
|
XFree(cw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
|
||||||
|
|
||||||
// get the closet cursor size to 1x1
|
// get the closet cursor size to 1x1
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
::XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
|
XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
|
||||||
|
|
||||||
// make bitmap data for cursor of closet size. since the cursor
|
// make bitmap data for cursor of closet size. since the cursor
|
||||||
// is blank we can use the same bitmap for shape and mask: all
|
// is blank we can use the same bitmap for shape and mask: all
|
||||||
|
@ -259,7 +259,7 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
|
||||||
memset(data, 0, size);
|
memset(data, 0, size);
|
||||||
|
|
||||||
// make bitmap
|
// make bitmap
|
||||||
Pixmap bitmap = ::XCreateBitmapFromData(m_display, m_root, data, w, h);
|
Pixmap bitmap = XCreateBitmapFromData(m_display, m_root, data, w, h);
|
||||||
|
|
||||||
// need an arbitrary color for the cursor
|
// need an arbitrary color for the cursor
|
||||||
XColor color;
|
XColor color;
|
||||||
|
@ -268,12 +268,12 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
|
||||||
color.flags = DoRed | DoGreen | DoBlue;
|
color.flags = DoRed | DoGreen | DoBlue;
|
||||||
|
|
||||||
// make cursor from bitmap
|
// make cursor from bitmap
|
||||||
Cursor cursor = ::XCreatePixmapCursor(m_display, bitmap, bitmap,
|
Cursor cursor = XCreatePixmapCursor(m_display, bitmap, bitmap,
|
||||||
&color, &color, 0, 0);
|
&color, &color, 0, 0);
|
||||||
|
|
||||||
// don't need bitmap or the data anymore
|
// don't need bitmap or the data anymore
|
||||||
delete[] data;
|
delete[] data;
|
||||||
::XFreePixmap(m_display, bitmap);
|
XFreePixmap(m_display, bitmap);
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ void CXWindowsPrimaryScreen::eventThread(void*)
|
||||||
Window root, window;
|
Window root, window;
|
||||||
int xRoot, yRoot, xWindow, yWindow;
|
int xRoot, yRoot, xWindow, yWindow;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
if (!::XQueryPointer(m_display, m_window, &root, &window,
|
if (!XQueryPointer(m_display, m_window, &root, &window,
|
||||||
&xRoot, &yRoot, &xWindow, &yWindow, &mask))
|
&xRoot, &yRoot, &xWindow, &yWindow, &mask))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ KeyID CXWindowsPrimaryScreen::mapKey(
|
||||||
index = 1;
|
index = 1;
|
||||||
else
|
else
|
||||||
index = 0;
|
index = 0;
|
||||||
return static_cast<KeyID>(::XKeycodeToKeysym(m_display, keycode, index));
|
return static_cast<KeyID>(XKeycodeToKeysym(m_display, keycode, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonID CXWindowsPrimaryScreen::mapButton(
|
ButtonID CXWindowsPrimaryScreen::mapButton(
|
||||||
|
|
|
@ -36,7 +36,7 @@ void CXWindowsSecondaryScreen::open(CClient* client)
|
||||||
|
|
||||||
// open the display
|
// open the display
|
||||||
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
|
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
|
||||||
m_display = ::XOpenDisplay(NULL); // FIXME -- allow non-default
|
m_display = XOpenDisplay(NULL); // FIXME -- allow non-default
|
||||||
if (m_display == NULL)
|
if (m_display == NULL)
|
||||||
throw int(5); // FIXME -- make exception for this
|
throw int(5); // FIXME -- make exception for this
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ void CXWindowsSecondaryScreen::open(CClient* client)
|
||||||
|
|
||||||
// verify the availability of the XTest extension
|
// verify the availability of the XTest extension
|
||||||
int majorOpcode, firstEvent, firstError;
|
int majorOpcode, firstEvent, firstError;
|
||||||
if (!::XQueryExtension(m_display, XTestExtensionName,
|
if (!XQueryExtension(m_display, XTestExtensionName,
|
||||||
&majorOpcode, &firstEvent, &firstError))
|
&majorOpcode, &firstEvent, &firstError))
|
||||||
throw int(6); // FIXME -- make exception for this
|
throw int(6); // FIXME -- make exception for this
|
||||||
|
|
||||||
|
@ -67,14 +67,14 @@ void CXWindowsSecondaryScreen::open(CClient* client)
|
||||||
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(m_display, m_root, 0, 0, 1, 1, 0, 0,
|
m_window = XCreateWindow(m_display, m_root, 0, 0, 1, 1, 0, 0,
|
||||||
InputOnly, CopyFromParent,
|
InputOnly, CopyFromParent,
|
||||||
CWDontPropagate | CWEventMask |
|
CWDontPropagate | CWEventMask |
|
||||||
CWOverrideRedirect | CWCursor,
|
CWOverrideRedirect | CWCursor,
|
||||||
&attr);
|
&attr);
|
||||||
|
|
||||||
// become impervious to server grabs
|
// become impervious to server grabs
|
||||||
::XTestGrabControl(m_display, True);
|
XTestGrabControl(m_display, True);
|
||||||
|
|
||||||
// hide the cursor
|
// hide the cursor
|
||||||
leave();
|
leave();
|
||||||
|
@ -96,14 +96,14 @@ void CXWindowsSecondaryScreen::close()
|
||||||
m_eventThread = NULL;
|
m_eventThread = NULL;
|
||||||
|
|
||||||
// no longer impervious to server grabs
|
// no longer impervious to server grabs
|
||||||
::XTestGrabControl(m_display, False);
|
XTestGrabControl(m_display, False);
|
||||||
|
|
||||||
// destroy window
|
// destroy window
|
||||||
::XDestroyWindow(m_display, m_window);
|
XDestroyWindow(m_display, m_window);
|
||||||
m_window = None;
|
m_window = None;
|
||||||
|
|
||||||
// close the display
|
// close the display
|
||||||
::XCloseDisplay(m_display);
|
XCloseDisplay(m_display);
|
||||||
m_display = NULL;
|
m_display = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,11 +115,11 @@ void CXWindowsSecondaryScreen::enter(SInt32 x, SInt32 y)
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
// warp to requested location
|
// warp to requested location
|
||||||
::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
|
XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
|
|
||||||
// show cursor
|
// show cursor
|
||||||
::XUnmapWindow(m_display, m_window);
|
XUnmapWindow(m_display, m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::leave()
|
void CXWindowsSecondaryScreen::leave()
|
||||||
|
@ -129,19 +129,20 @@ void CXWindowsSecondaryScreen::leave()
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
// move hider window under the mouse
|
// move hider window under the mouse (rather than moving the mouse
|
||||||
|
// somewhere else on the screen)
|
||||||
int x, y, dummy;
|
int x, y, dummy;
|
||||||
unsigned int dummyMask;
|
unsigned int dummyMask;
|
||||||
Window dummyWindow;
|
Window dummyWindow;
|
||||||
::XQueryPointer(m_display, m_root, &dummyWindow, &dummyWindow,
|
XQueryPointer(m_display, m_root, &dummyWindow, &dummyWindow,
|
||||||
&x, &y, &dummy, &dummy, &dummyMask);
|
&x, &y, &dummy, &dummy, &dummyMask);
|
||||||
::XMoveWindow(m_display, m_window, x, y);
|
XMoveWindow(m_display, m_window, x, y);
|
||||||
|
|
||||||
// raise and show the hider window
|
// raise and show the hider window
|
||||||
::XMapRaised(m_display, m_window);
|
XMapRaised(m_display, m_window);
|
||||||
|
|
||||||
// hide cursor by moving it into the hider window
|
// hide cursor by moving it into the hider window
|
||||||
::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0);
|
XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::keyDown(
|
void CXWindowsSecondaryScreen::keyDown(
|
||||||
|
@ -151,8 +152,8 @@ void CXWindowsSecondaryScreen::keyDown(
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
::XTestFakeKeyEvent(m_display, mapKey(key, mask), True, CurrentTime);
|
XTestFakeKeyEvent(m_display, mapKey(key, mask), True, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::keyRepeat(
|
void CXWindowsSecondaryScreen::keyRepeat(
|
||||||
|
@ -172,8 +173,8 @@ void CXWindowsSecondaryScreen::keyUp(
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
::XTestFakeKeyEvent(m_display, mapKey(key, mask), False, CurrentTime);
|
XTestFakeKeyEvent(m_display, mapKey(key, mask), False, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
|
void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
|
||||||
|
@ -182,8 +183,8 @@ void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
::XTestFakeButtonEvent(m_display, mapButton(button), True, CurrentTime);
|
XTestFakeButtonEvent(m_display, mapButton(button), True, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
|
void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
|
||||||
|
@ -192,8 +193,8 @@ void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
::XTestFakeButtonEvent(m_display, mapButton(button), False, CurrentTime);
|
XTestFakeButtonEvent(m_display, mapButton(button), False, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||||
|
@ -202,8 +203,8 @@ void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||||
|
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
|
||||||
::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
|
XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
|
||||||
::XSync(m_display, False);
|
XSync(m_display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::mouseWheel(SInt32)
|
void CXWindowsSecondaryScreen::mouseWheel(SInt32)
|
||||||
|
@ -238,7 +239,7 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
|
||||||
|
|
||||||
// get the closet cursor size to 1x1
|
// get the closet cursor size to 1x1
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
::XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
|
XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
|
||||||
|
|
||||||
// make bitmap data for cursor of closet size. since the cursor
|
// make bitmap data for cursor of closet size. since the cursor
|
||||||
// is blank we can use the same bitmap for shape and mask: all
|
// is blank we can use the same bitmap for shape and mask: all
|
||||||
|
@ -248,7 +249,7 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
|
||||||
memset(data, 0, size);
|
memset(data, 0, size);
|
||||||
|
|
||||||
// make bitmap
|
// make bitmap
|
||||||
Pixmap bitmap = ::XCreateBitmapFromData(m_display, m_root, data, w, h);
|
Pixmap bitmap = XCreateBitmapFromData(m_display, m_root, data, w, h);
|
||||||
|
|
||||||
// need an arbitrary color for the cursor
|
// need an arbitrary color for the cursor
|
||||||
XColor color;
|
XColor color;
|
||||||
|
@ -257,12 +258,12 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
|
||||||
color.flags = DoRed | DoGreen | DoBlue;
|
color.flags = DoRed | DoGreen | DoBlue;
|
||||||
|
|
||||||
// make cursor from bitmap
|
// make cursor from bitmap
|
||||||
Cursor cursor = ::XCreatePixmapCursor(m_display, bitmap, bitmap,
|
Cursor cursor = XCreatePixmapCursor(m_display, bitmap, bitmap,
|
||||||
&color, &color, 0, 0);
|
&color, &color, 0, 0);
|
||||||
|
|
||||||
// don't need bitmap or the data anymore
|
// don't need bitmap or the data anymore
|
||||||
delete[] data;
|
delete[] data;
|
||||||
::XFreePixmap(m_display, bitmap);
|
XFreePixmap(m_display, bitmap);
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +290,7 @@ void CXWindowsSecondaryScreen::eventThread(void*)
|
||||||
case LeaveNotify: {
|
case LeaveNotify: {
|
||||||
// mouse moved out of hider window somehow. hide the window.
|
// mouse moved out of hider window somehow. hide the window.
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
::XUnmapWindow(m_display, m_window);
|
XUnmapWindow(m_display, m_window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ KeyCode CXWindowsSecondaryScreen::mapKey(
|
||||||
KeyID id, KeyModifierMask /*mask*/) const
|
KeyID id, KeyModifierMask /*mask*/) const
|
||||||
{
|
{
|
||||||
// FIXME -- use mask
|
// FIXME -- use mask
|
||||||
return ::XKeysymToKeycode(m_display, static_cast<KeySym>(id));
|
return XKeysymToKeycode(m_display, static_cast<KeySym>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CXWindowsSecondaryScreen::mapButton(
|
unsigned int CXWindowsSecondaryScreen::mapButton(
|
||||||
|
|
Loading…
Reference in New Issue