Drop C prefix on Windows
This commit is contained in:
parent
e5e0a3b653
commit
9fd11da578
|
@ -30,10 +30,10 @@
|
||||||
#include "base/EventTypes.h"
|
#include "base/EventTypes.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClientTaskBarReceiver
|
// MSWindowsClientTaskBarReceiver
|
||||||
//
|
//
|
||||||
|
|
||||||
const UINT CMSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
|
const UINT MSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
{
|
{
|
||||||
IDI_TASKBAR_NOT_RUNNING,
|
IDI_TASKBAR_NOT_RUNNING,
|
||||||
IDI_TASKBAR_NOT_WORKING,
|
IDI_TASKBAR_NOT_WORKING,
|
||||||
|
@ -42,7 +42,7 @@ const UINT CMSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
IDI_TASKBAR_CONNECTED
|
IDI_TASKBAR_CONNECTED
|
||||||
};
|
};
|
||||||
|
|
||||||
CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver(
|
MSWindowsClientTaskBarReceiver::MSWindowsClientTaskBarReceiver(
|
||||||
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
||||||
ClientTaskBarReceiver(events),
|
ClientTaskBarReceiver(events),
|
||||||
m_appInstance(appInstance),
|
m_appInstance(appInstance),
|
||||||
|
@ -63,13 +63,13 @@ CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver(
|
||||||
ARCH->addReceiver(this);
|
ARCH->addReceiver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClientTaskBarReceiver::~CMSWindowsClientTaskBarReceiver()
|
MSWindowsClientTaskBarReceiver::~MSWindowsClientTaskBarReceiver()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::cleanup()
|
MSWindowsClientTaskBarReceiver::cleanup()
|
||||||
{
|
{
|
||||||
ARCH->removeReceiver(this);
|
ARCH->removeReceiver(this);
|
||||||
for (UInt32 i = 0; i < kMaxState; ++i) {
|
for (UInt32 i = 0; i < kMaxState; ++i) {
|
||||||
|
@ -80,7 +80,7 @@ CMSWindowsClientTaskBarReceiver::cleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::showStatus()
|
MSWindowsClientTaskBarReceiver::showStatus()
|
||||||
{
|
{
|
||||||
// create the window
|
// create the window
|
||||||
createWindow();
|
createWindow();
|
||||||
|
@ -142,7 +142,7 @@ CMSWindowsClientTaskBarReceiver::showStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::runMenu(int x, int y)
|
MSWindowsClientTaskBarReceiver::runMenu(int x, int y)
|
||||||
{
|
{
|
||||||
// do popup menu. we need a window to pass to TrackPopupMenu().
|
// do popup menu. we need a window to pass to TrackPopupMenu().
|
||||||
// the SetForegroundWindow() and SendMessage() calls around
|
// the SetForegroundWindow() and SendMessage() calls around
|
||||||
|
@ -213,19 +213,19 @@ CMSWindowsClientTaskBarReceiver::runMenu(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::primaryAction()
|
MSWindowsClientTaskBarReceiver::primaryAction()
|
||||||
{
|
{
|
||||||
showStatus();
|
showStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IArchTaskBarReceiver::Icon
|
const IArchTaskBarReceiver::Icon
|
||||||
CMSWindowsClientTaskBarReceiver::getIcon() const
|
MSWindowsClientTaskBarReceiver::getIcon() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::copyLog() const
|
MSWindowsClientTaskBarReceiver::copyLog() const
|
||||||
{
|
{
|
||||||
if (m_logBuffer != NULL) {
|
if (m_logBuffer != NULL) {
|
||||||
// collect log buffer
|
// collect log buffer
|
||||||
|
@ -238,7 +238,7 @@ CMSWindowsClientTaskBarReceiver::copyLog() const
|
||||||
|
|
||||||
// copy log to clipboard
|
// copy log to clipboard
|
||||||
if (!data.empty()) {
|
if (!data.empty()) {
|
||||||
CMSWindowsClipboard clipboard(m_window);
|
MSWindowsClipboard clipboard(m_window);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.emptyUnowned();
|
clipboard.emptyUnowned();
|
||||||
clipboard.add(IClipboard::kText, data);
|
clipboard.add(IClipboard::kText, data);
|
||||||
|
@ -248,7 +248,7 @@ CMSWindowsClientTaskBarReceiver::copyLog() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::onStatusChanged()
|
MSWindowsClientTaskBarReceiver::onStatusChanged()
|
||||||
{
|
{
|
||||||
if (IsWindowVisible(m_window)) {
|
if (IsWindowVisible(m_window)) {
|
||||||
showStatus();
|
showStatus();
|
||||||
|
@ -256,7 +256,7 @@ CMSWindowsClientTaskBarReceiver::onStatusChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON
|
HICON
|
||||||
CMSWindowsClientTaskBarReceiver::loadIcon(UINT id)
|
MSWindowsClientTaskBarReceiver::loadIcon(UINT id)
|
||||||
{
|
{
|
||||||
HANDLE icon = LoadImage(m_appInstance,
|
HANDLE icon = LoadImage(m_appInstance,
|
||||||
MAKEINTRESOURCE(id),
|
MAKEINTRESOURCE(id),
|
||||||
|
@ -267,7 +267,7 @@ CMSWindowsClientTaskBarReceiver::loadIcon(UINT id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::deleteIcon(HICON icon)
|
MSWindowsClientTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
{
|
{
|
||||||
if (icon != NULL) {
|
if (icon != NULL) {
|
||||||
DestroyIcon(icon);
|
DestroyIcon(icon);
|
||||||
|
@ -275,7 +275,7 @@ CMSWindowsClientTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::createWindow()
|
MSWindowsClientTaskBarReceiver::createWindow()
|
||||||
{
|
{
|
||||||
// ignore if already created
|
// ignore if already created
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
|
@ -286,7 +286,7 @@ CMSWindowsClientTaskBarReceiver::createWindow()
|
||||||
m_window = CreateDialogParam(m_appInstance,
|
m_window = CreateDialogParam(m_appInstance,
|
||||||
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
||||||
NULL,
|
NULL,
|
||||||
(DLGPROC)&CMSWindowsClientTaskBarReceiver::staticDlgProc,
|
(DLGPROC)&MSWindowsClientTaskBarReceiver::staticDlgProc,
|
||||||
reinterpret_cast<LPARAM>(
|
reinterpret_cast<LPARAM>(
|
||||||
reinterpret_cast<void*>(this)));
|
reinterpret_cast<void*>(this)));
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ CMSWindowsClientTaskBarReceiver::createWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClientTaskBarReceiver::destroyWindow()
|
MSWindowsClientTaskBarReceiver::destroyWindow()
|
||||||
{
|
{
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
ArchTaskBarWindows::removeDialog(m_window);
|
ArchTaskBarWindows::removeDialog(m_window);
|
||||||
|
@ -311,7 +311,7 @@ CMSWindowsClientTaskBarReceiver::destroyWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd,
|
MSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM)
|
UINT msg, WPARAM wParam, LPARAM)
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
@ -330,14 +330,14 @@ CMSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK
|
BOOL CALLBACK
|
||||||
CMSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
|
MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM lParam)
|
UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// if msg is WM_INITDIALOG, extract the CMSWindowsClientTaskBarReceiver*
|
// if msg is WM_INITDIALOG, extract the MSWindowsClientTaskBarReceiver*
|
||||||
// and put it in the extra window data then forward the call.
|
// and put it in the extra window data then forward the call.
|
||||||
CMSWindowsClientTaskBarReceiver* self = NULL;
|
MSWindowsClientTaskBarReceiver* self = NULL;
|
||||||
if (msg == WM_INITDIALOG) {
|
if (msg == WM_INITDIALOG) {
|
||||||
self = reinterpret_cast<CMSWindowsClientTaskBarReceiver*>(
|
self = reinterpret_cast<MSWindowsClientTaskBarReceiver*>(
|
||||||
reinterpret_cast<void*>(lParam));
|
reinterpret_cast<void*>(lParam));
|
||||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam);
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ CMSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
// get the extra window data and forward the call
|
// get the extra window data and forward the call
|
||||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||||
if (data != 0) {
|
if (data != 0) {
|
||||||
self = (CMSWindowsClientTaskBarReceiver*) data;
|
self = (MSWindowsClientTaskBarReceiver*) data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +371,6 @@ createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
16, 16, LR_SHARED));
|
16, 16, LR_SHARED));
|
||||||
|
|
||||||
return new CMSWindowsClientTaskBarReceiver(
|
return new MSWindowsClientTaskBarReceiver(
|
||||||
CMSWindowsScreen::getWindowInstance(), logBuffer, events);
|
MSWindowsScreen::getWindowInstance(), logBuffer, events);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ class BufferedLogOutputter;
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
|
|
||||||
//! Implementation of ClientTaskBarReceiver for Microsoft Windows
|
//! Implementation of ClientTaskBarReceiver for Microsoft Windows
|
||||||
class CMSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
|
class MSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
MSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
||||||
virtual ~CMSWindowsClientTaskBarReceiver();
|
virtual ~MSWindowsClientTaskBarReceiver();
|
||||||
|
|
||||||
// IArchTaskBarReceiver overrides
|
// IArchTaskBarReceiver overrides
|
||||||
virtual void showStatus();
|
virtual void showStatus();
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
#include "base/EventTypes.h"
|
#include "base/EventTypes.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsPortableTaskBarReceiver
|
// MSWindowsPortableTaskBarReceiver
|
||||||
//
|
//
|
||||||
|
|
||||||
const UINT CMSWindowsPortableTaskBarReceiver::s_stateToIconID[kMaxState] =
|
const UINT MSWindowsPortableTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
{
|
{
|
||||||
IDI_TASKBAR_NOT_RUNNING,
|
IDI_TASKBAR_NOT_RUNNING,
|
||||||
IDI_TASKBAR_NOT_WORKING,
|
IDI_TASKBAR_NOT_WORKING,
|
||||||
|
@ -41,7 +41,7 @@ const UINT CMSWindowsPortableTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
IDI_TASKBAR_CONNECTED
|
IDI_TASKBAR_CONNECTED
|
||||||
};
|
};
|
||||||
|
|
||||||
CMSWindowsPortableTaskBarReceiver::CMSWindowsPortableTaskBarReceiver(
|
MSWindowsPortableTaskBarReceiver::MSWindowsPortableTaskBarReceiver(
|
||||||
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
||||||
PortableTaskBarReceiver(events),
|
PortableTaskBarReceiver(events),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
|
@ -64,7 +64,7 @@ CMSWindowsPortableTaskBarReceiver::CMSWindowsPortableTaskBarReceiver(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::cleanup()
|
MSWindowsPortableTaskBarReceiver::cleanup()
|
||||||
{
|
{
|
||||||
ARCH->removeReceiver(this);
|
ARCH->removeReceiver(this);
|
||||||
for (UInt32 i = 0; i < kMaxState; ++i) {
|
for (UInt32 i = 0; i < kMaxState; ++i) {
|
||||||
|
@ -74,13 +74,13 @@ CMSWindowsPortableTaskBarReceiver::cleanup()
|
||||||
destroyWindow();
|
destroyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsPortableTaskBarReceiver::~CMSWindowsPortableTaskBarReceiver()
|
MSWindowsPortableTaskBarReceiver::~MSWindowsPortableTaskBarReceiver()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::showStatus()
|
MSWindowsPortableTaskBarReceiver::showStatus()
|
||||||
{
|
{
|
||||||
// create the window
|
// create the window
|
||||||
createWindow();
|
createWindow();
|
||||||
|
@ -144,7 +144,7 @@ CMSWindowsPortableTaskBarReceiver::showStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::runMenu(int x, int y)
|
MSWindowsPortableTaskBarReceiver::runMenu(int x, int y)
|
||||||
{
|
{
|
||||||
// do popup menu. we need a window to pass to TrackPopupMenu().
|
// do popup menu. we need a window to pass to TrackPopupMenu().
|
||||||
// the SetForegroundWindow() and SendMessage() calls around
|
// the SetForegroundWindow() and SendMessage() calls around
|
||||||
|
@ -230,19 +230,19 @@ CMSWindowsPortableTaskBarReceiver::runMenu(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::primaryAction()
|
MSWindowsPortableTaskBarReceiver::primaryAction()
|
||||||
{
|
{
|
||||||
showStatus();
|
showStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IArchTaskBarReceiver::Icon
|
const IArchTaskBarReceiver::Icon
|
||||||
CMSWindowsPortableTaskBarReceiver::getIcon() const
|
MSWindowsPortableTaskBarReceiver::getIcon() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::copyLog() const
|
MSWindowsPortableTaskBarReceiver::copyLog() const
|
||||||
{
|
{
|
||||||
if (m_logBuffer != NULL) {
|
if (m_logBuffer != NULL) {
|
||||||
// collect log buffer
|
// collect log buffer
|
||||||
|
@ -255,7 +255,7 @@ CMSWindowsPortableTaskBarReceiver::copyLog() const
|
||||||
|
|
||||||
// copy log to clipboard
|
// copy log to clipboard
|
||||||
if (!data.empty()) {
|
if (!data.empty()) {
|
||||||
CMSWindowsClipboard clipboard(m_window);
|
MSWindowsClipboard clipboard(m_window);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.emptyUnowned();
|
clipboard.emptyUnowned();
|
||||||
clipboard.add(IClipboard::kText, data);
|
clipboard.add(IClipboard::kText, data);
|
||||||
|
@ -265,7 +265,7 @@ CMSWindowsPortableTaskBarReceiver::copyLog() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::onStatusChanged()
|
MSWindowsPortableTaskBarReceiver::onStatusChanged()
|
||||||
{
|
{
|
||||||
if (IsWindowVisible(m_window)) {
|
if (IsWindowVisible(m_window)) {
|
||||||
showStatus();
|
showStatus();
|
||||||
|
@ -273,7 +273,7 @@ CMSWindowsPortableTaskBarReceiver::onStatusChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON
|
HICON
|
||||||
CMSWindowsPortableTaskBarReceiver::loadIcon(UINT id)
|
MSWindowsPortableTaskBarReceiver::loadIcon(UINT id)
|
||||||
{
|
{
|
||||||
HANDLE icon = LoadImage(m_appInstance,
|
HANDLE icon = LoadImage(m_appInstance,
|
||||||
MAKEINTRESOURCE(id),
|
MAKEINTRESOURCE(id),
|
||||||
|
@ -284,7 +284,7 @@ CMSWindowsPortableTaskBarReceiver::loadIcon(UINT id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::deleteIcon(HICON icon)
|
MSWindowsPortableTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
{
|
{
|
||||||
if (icon != NULL) {
|
if (icon != NULL) {
|
||||||
DestroyIcon(icon);
|
DestroyIcon(icon);
|
||||||
|
@ -292,7 +292,7 @@ CMSWindowsPortableTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::createWindow()
|
MSWindowsPortableTaskBarReceiver::createWindow()
|
||||||
{
|
{
|
||||||
// ignore if already created
|
// ignore if already created
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
|
@ -303,7 +303,7 @@ CMSWindowsPortableTaskBarReceiver::createWindow()
|
||||||
m_window = CreateDialogParam(m_appInstance,
|
m_window = CreateDialogParam(m_appInstance,
|
||||||
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
||||||
NULL,
|
NULL,
|
||||||
(DLGPROC)&CMSWindowsPortableTaskBarReceiver::staticDlgProc,
|
(DLGPROC)&MSWindowsPortableTaskBarReceiver::staticDlgProc,
|
||||||
reinterpret_cast<LPARAM>(
|
reinterpret_cast<LPARAM>(
|
||||||
reinterpret_cast<void*>(this)));
|
reinterpret_cast<void*>(this)));
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ CMSWindowsPortableTaskBarReceiver::createWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsPortableTaskBarReceiver::destroyWindow()
|
MSWindowsPortableTaskBarReceiver::destroyWindow()
|
||||||
{
|
{
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
ArchTaskBarWindows::removeDialog(m_window);
|
ArchTaskBarWindows::removeDialog(m_window);
|
||||||
|
@ -328,7 +328,7 @@ CMSWindowsPortableTaskBarReceiver::destroyWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMSWindowsPortableTaskBarReceiver::dlgProc(HWND hwnd,
|
MSWindowsPortableTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM)
|
UINT msg, WPARAM wParam, LPARAM)
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
@ -347,14 +347,14 @@ CMSWindowsPortableTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK
|
BOOL CALLBACK
|
||||||
CMSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
|
MSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM lParam)
|
UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// if msg is WM_INITDIALOG, extract the CMSWindowsPortableTaskBarReceiver*
|
// if msg is WM_INITDIALOG, extract the MSWindowsPortableTaskBarReceiver*
|
||||||
// and put it in the extra window data then forward the call.
|
// and put it in the extra window data then forward the call.
|
||||||
CMSWindowsPortableTaskBarReceiver* self = NULL;
|
MSWindowsPortableTaskBarReceiver* self = NULL;
|
||||||
if (msg == WM_INITDIALOG) {
|
if (msg == WM_INITDIALOG) {
|
||||||
self = reinterpret_cast<CMSWindowsPortableTaskBarReceiver*>(
|
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||||
reinterpret_cast<void*>(lParam));
|
reinterpret_cast<void*>(lParam));
|
||||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ CMSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
// get the extra window data and forward the call
|
// get the extra window data and forward the call
|
||||||
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||||
if (data != 0) {
|
if (data != 0) {
|
||||||
self = reinterpret_cast<CMSWindowsPortableTaskBarReceiver*>(
|
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||||
reinterpret_cast<void*>(data));
|
reinterpret_cast<void*>(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,6 +389,6 @@ createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
16, 16, LR_SHARED));
|
16, 16, LR_SHARED));
|
||||||
|
|
||||||
return new CMSWindowsPortableTaskBarReceiver(
|
return new MSWindowsPortableTaskBarReceiver(
|
||||||
CMSWindowsScreen::getWindowInstance(), logBuffer, events);
|
MSWindowsScreen::getWindowInstance(), logBuffer, events);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ class BufferedLogOutputter;
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
|
|
||||||
//! Implementation of PortableTaskBarReceiver for Microsoft Windows
|
//! Implementation of PortableTaskBarReceiver for Microsoft Windows
|
||||||
class CMSWindowsPortableTaskBarReceiver : public PortableTaskBarReceiver {
|
class MSWindowsPortableTaskBarReceiver : public PortableTaskBarReceiver {
|
||||||
public:
|
public:
|
||||||
CMSWindowsPortableTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
MSWindowsPortableTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
||||||
virtual ~CMSWindowsPortableTaskBarReceiver();
|
virtual ~MSWindowsPortableTaskBarReceiver();
|
||||||
|
|
||||||
// IArchTaskBarReceiver overrides
|
// IArchTaskBarReceiver overrides
|
||||||
virtual void showStatus();
|
virtual void showStatus();
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
#include "base/EventTypes.h"
|
#include "base/EventTypes.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsServerTaskBarReceiver
|
// MSWindowsServerTaskBarReceiver
|
||||||
//
|
//
|
||||||
|
|
||||||
const UINT CMSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
|
const UINT MSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
{
|
{
|
||||||
IDI_TASKBAR_NOT_RUNNING,
|
IDI_TASKBAR_NOT_RUNNING,
|
||||||
IDI_TASKBAR_NOT_WORKING,
|
IDI_TASKBAR_NOT_WORKING,
|
||||||
|
@ -42,7 +42,7 @@ const UINT CMSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
|
||||||
IDI_TASKBAR_CONNECTED
|
IDI_TASKBAR_CONNECTED
|
||||||
};
|
};
|
||||||
|
|
||||||
CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver(
|
MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver(
|
||||||
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
|
||||||
ServerTaskBarReceiver(events),
|
ServerTaskBarReceiver(events),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
|
@ -65,7 +65,7 @@ CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::cleanup()
|
MSWindowsServerTaskBarReceiver::cleanup()
|
||||||
{
|
{
|
||||||
ARCH->removeReceiver(this);
|
ARCH->removeReceiver(this);
|
||||||
for (UInt32 i = 0; i < kMaxState; ++i) {
|
for (UInt32 i = 0; i < kMaxState; ++i) {
|
||||||
|
@ -75,13 +75,13 @@ CMSWindowsServerTaskBarReceiver::cleanup()
|
||||||
destroyWindow();
|
destroyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsServerTaskBarReceiver::~CMSWindowsServerTaskBarReceiver()
|
MSWindowsServerTaskBarReceiver::~MSWindowsServerTaskBarReceiver()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::showStatus()
|
MSWindowsServerTaskBarReceiver::showStatus()
|
||||||
{
|
{
|
||||||
// create the window
|
// create the window
|
||||||
createWindow();
|
createWindow();
|
||||||
|
@ -158,7 +158,7 @@ CMSWindowsServerTaskBarReceiver::showStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::runMenu(int x, int y)
|
MSWindowsServerTaskBarReceiver::runMenu(int x, int y)
|
||||||
{
|
{
|
||||||
// do popup menu. we need a window to pass to TrackPopupMenu().
|
// do popup menu. we need a window to pass to TrackPopupMenu().
|
||||||
// the SetForegroundWindow() and SendMessage() calls around
|
// the SetForegroundWindow() and SendMessage() calls around
|
||||||
|
@ -244,19 +244,19 @@ CMSWindowsServerTaskBarReceiver::runMenu(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::primaryAction()
|
MSWindowsServerTaskBarReceiver::primaryAction()
|
||||||
{
|
{
|
||||||
showStatus();
|
showStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IArchTaskBarReceiver::Icon
|
const IArchTaskBarReceiver::Icon
|
||||||
CMSWindowsServerTaskBarReceiver::getIcon() const
|
MSWindowsServerTaskBarReceiver::getIcon() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::copyLog() const
|
MSWindowsServerTaskBarReceiver::copyLog() const
|
||||||
{
|
{
|
||||||
if (m_logBuffer != NULL) {
|
if (m_logBuffer != NULL) {
|
||||||
// collect log buffer
|
// collect log buffer
|
||||||
|
@ -269,7 +269,7 @@ CMSWindowsServerTaskBarReceiver::copyLog() const
|
||||||
|
|
||||||
// copy log to clipboard
|
// copy log to clipboard
|
||||||
if (!data.empty()) {
|
if (!data.empty()) {
|
||||||
CMSWindowsClipboard clipboard(m_window);
|
MSWindowsClipboard clipboard(m_window);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.emptyUnowned();
|
clipboard.emptyUnowned();
|
||||||
clipboard.add(IClipboard::kText, data);
|
clipboard.add(IClipboard::kText, data);
|
||||||
|
@ -279,7 +279,7 @@ CMSWindowsServerTaskBarReceiver::copyLog() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::onStatusChanged()
|
MSWindowsServerTaskBarReceiver::onStatusChanged()
|
||||||
{
|
{
|
||||||
if (IsWindowVisible(m_window)) {
|
if (IsWindowVisible(m_window)) {
|
||||||
showStatus();
|
showStatus();
|
||||||
|
@ -287,7 +287,7 @@ CMSWindowsServerTaskBarReceiver::onStatusChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON
|
HICON
|
||||||
CMSWindowsServerTaskBarReceiver::loadIcon(UINT id)
|
MSWindowsServerTaskBarReceiver::loadIcon(UINT id)
|
||||||
{
|
{
|
||||||
HANDLE icon = LoadImage(m_appInstance,
|
HANDLE icon = LoadImage(m_appInstance,
|
||||||
MAKEINTRESOURCE(id),
|
MAKEINTRESOURCE(id),
|
||||||
|
@ -298,7 +298,7 @@ CMSWindowsServerTaskBarReceiver::loadIcon(UINT id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::deleteIcon(HICON icon)
|
MSWindowsServerTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
{
|
{
|
||||||
if (icon != NULL) {
|
if (icon != NULL) {
|
||||||
DestroyIcon(icon);
|
DestroyIcon(icon);
|
||||||
|
@ -306,7 +306,7 @@ CMSWindowsServerTaskBarReceiver::deleteIcon(HICON icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::createWindow()
|
MSWindowsServerTaskBarReceiver::createWindow()
|
||||||
{
|
{
|
||||||
// ignore if already created
|
// ignore if already created
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
|
@ -317,7 +317,7 @@ CMSWindowsServerTaskBarReceiver::createWindow()
|
||||||
m_window = CreateDialogParam(m_appInstance,
|
m_window = CreateDialogParam(m_appInstance,
|
||||||
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
|
||||||
NULL,
|
NULL,
|
||||||
(DLGPROC)&CMSWindowsServerTaskBarReceiver::staticDlgProc,
|
(DLGPROC)&MSWindowsServerTaskBarReceiver::staticDlgProc,
|
||||||
reinterpret_cast<LPARAM>(
|
reinterpret_cast<LPARAM>(
|
||||||
reinterpret_cast<void*>(this)));
|
reinterpret_cast<void*>(this)));
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ CMSWindowsServerTaskBarReceiver::createWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsServerTaskBarReceiver::destroyWindow()
|
MSWindowsServerTaskBarReceiver::destroyWindow()
|
||||||
{
|
{
|
||||||
if (m_window != NULL) {
|
if (m_window != NULL) {
|
||||||
ArchTaskBarWindows::removeDialog(m_window);
|
ArchTaskBarWindows::removeDialog(m_window);
|
||||||
|
@ -342,7 +342,7 @@ CMSWindowsServerTaskBarReceiver::destroyWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd,
|
MSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM)
|
UINT msg, WPARAM wParam, LPARAM)
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
@ -361,14 +361,14 @@ CMSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK
|
BOOL CALLBACK
|
||||||
CMSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
|
MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
UINT msg, WPARAM wParam, LPARAM lParam)
|
UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// if msg is WM_INITDIALOG, extract the CMSWindowsServerTaskBarReceiver*
|
// if msg is WM_INITDIALOG, extract the MSWindowsServerTaskBarReceiver*
|
||||||
// and put it in the extra window data then forward the call.
|
// and put it in the extra window data then forward the call.
|
||||||
CMSWindowsServerTaskBarReceiver* self = NULL;
|
MSWindowsServerTaskBarReceiver* self = NULL;
|
||||||
if (msg == WM_INITDIALOG) {
|
if (msg == WM_INITDIALOG) {
|
||||||
self = reinterpret_cast<CMSWindowsServerTaskBarReceiver*>(
|
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>(
|
||||||
reinterpret_cast<void*>(lParam));
|
reinterpret_cast<void*>(lParam));
|
||||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ CMSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||||
// get the extra window data and forward the call
|
// get the extra window data and forward the call
|
||||||
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||||
if (data != 0) {
|
if (data != 0) {
|
||||||
self = reinterpret_cast<CMSWindowsServerTaskBarReceiver*>(
|
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>(
|
||||||
reinterpret_cast<void*>(data));
|
reinterpret_cast<void*>(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,6 +403,6 @@ createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
16, 16, LR_SHARED));
|
16, 16, LR_SHARED));
|
||||||
|
|
||||||
return new CMSWindowsServerTaskBarReceiver(
|
return new MSWindowsServerTaskBarReceiver(
|
||||||
CMSWindowsScreen::getWindowInstance(), logBuffer, events);
|
MSWindowsScreen::getWindowInstance(), logBuffer, events);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ class BufferedLogOutputter;
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
|
|
||||||
//! Implementation of ServerTaskBarReceiver for Microsoft Windows
|
//! Implementation of ServerTaskBarReceiver for Microsoft Windows
|
||||||
class CMSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
|
class MSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
|
||||||
public:
|
public:
|
||||||
CMSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
MSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
|
||||||
virtual ~CMSWindowsServerTaskBarReceiver();
|
virtual ~MSWindowsServerTaskBarReceiver();
|
||||||
|
|
||||||
// IArchTaskBarReceiver overrides
|
// IArchTaskBarReceiver overrides
|
||||||
virtual void showStatus();
|
virtual void showStatus();
|
||||||
|
|
|
@ -27,24 +27,24 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboard
|
// MSWindowsClipboard
|
||||||
//
|
//
|
||||||
|
|
||||||
UINT CMSWindowsClipboard::s_ownershipFormat = 0;
|
UINT MSWindowsClipboard::s_ownershipFormat = 0;
|
||||||
|
|
||||||
CMSWindowsClipboard::CMSWindowsClipboard(HWND window) :
|
MSWindowsClipboard::MSWindowsClipboard(HWND window) :
|
||||||
m_window(window),
|
m_window(window),
|
||||||
m_time(0),
|
m_time(0),
|
||||||
m_facade(new CMSWindowsClipboardFacade()),
|
m_facade(new MSWindowsClipboardFacade()),
|
||||||
m_deleteFacade(true)
|
m_deleteFacade(true)
|
||||||
{
|
{
|
||||||
// add converters, most desired first
|
// add converters, most desired first
|
||||||
m_converters.push_back(new CMSWindowsClipboardUTF16Converter);
|
m_converters.push_back(new MSWindowsClipboardUTF16Converter);
|
||||||
m_converters.push_back(new CMSWindowsClipboardBitmapConverter);
|
m_converters.push_back(new MSWindowsClipboardBitmapConverter);
|
||||||
m_converters.push_back(new CMSWindowsClipboardHTMLConverter);
|
m_converters.push_back(new MSWindowsClipboardHTMLConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboard::~CMSWindowsClipboard()
|
MSWindowsClipboard::~MSWindowsClipboard()
|
||||||
{
|
{
|
||||||
clearConverters();
|
clearConverters();
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ CMSWindowsClipboard::~CMSWindowsClipboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClipboard::setFacade(IMSWindowsClipboardFacade& facade)
|
MSWindowsClipboard::setFacade(IMSWindowsClipboardFacade& facade)
|
||||||
{
|
{
|
||||||
delete m_facade;
|
delete m_facade;
|
||||||
m_facade = &facade;
|
m_facade = &facade;
|
||||||
|
@ -64,7 +64,7 @@ CMSWindowsClipboard::setFacade(IMSWindowsClipboardFacade& facade)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsClipboard::emptyUnowned()
|
MSWindowsClipboard::emptyUnowned()
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "empty clipboard"));
|
LOG((CLOG_DEBUG "empty clipboard"));
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ CMSWindowsClipboard::emptyUnowned()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsClipboard::empty()
|
MSWindowsClipboard::empty()
|
||||||
{
|
{
|
||||||
if (!emptyUnowned()) {
|
if (!emptyUnowned()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,7 +94,7 @@ CMSWindowsClipboard::empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClipboard::add(EFormat format, const String& data)
|
MSWindowsClipboard::add(EFormat format, const String& data)
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ CMSWindowsClipboard::add(EFormat format, const String& data)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsClipboard::open(Time time) const
|
MSWindowsClipboard::open(Time time) const
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "open clipboard"));
|
LOG((CLOG_DEBUG "open clipboard"));
|
||||||
|
|
||||||
|
@ -134,20 +134,20 @@ CMSWindowsClipboard::open(Time time) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClipboard::close() const
|
MSWindowsClipboard::close() const
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "close clipboard"));
|
LOG((CLOG_DEBUG "close clipboard"));
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
IClipboard::Time
|
IClipboard::Time
|
||||||
CMSWindowsClipboard::getTime() const
|
MSWindowsClipboard::getTime() const
|
||||||
{
|
{
|
||||||
return m_time;
|
return m_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsClipboard::has(EFormat format) const
|
MSWindowsClipboard::has(EFormat format) const
|
||||||
{
|
{
|
||||||
for (ConverterList::const_iterator index = m_converters.begin();
|
for (ConverterList::const_iterator index = m_converters.begin();
|
||||||
index != m_converters.end(); ++index) {
|
index != m_converters.end(); ++index) {
|
||||||
|
@ -162,7 +162,7 @@ CMSWindowsClipboard::has(EFormat format) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboard::get(EFormat format) const
|
MSWindowsClipboard::get(EFormat format) const
|
||||||
{
|
{
|
||||||
// find the converter for the first clipboard format we can handle
|
// find the converter for the first clipboard format we can handle
|
||||||
IMSWindowsClipboardConverter* converter = NULL;
|
IMSWindowsClipboardConverter* converter = NULL;
|
||||||
|
@ -199,7 +199,7 @@ CMSWindowsClipboard::get(EFormat format) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsClipboard::clearConverters()
|
MSWindowsClipboard::clearConverters()
|
||||||
{
|
{
|
||||||
for (ConverterList::iterator index = m_converters.begin();
|
for (ConverterList::iterator index = m_converters.begin();
|
||||||
index != m_converters.end(); ++index) {
|
index != m_converters.end(); ++index) {
|
||||||
|
@ -209,7 +209,7 @@ CMSWindowsClipboard::clearConverters()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsClipboard::isOwnedBySynergy()
|
MSWindowsClipboard::isOwnedBySynergy()
|
||||||
{
|
{
|
||||||
// create ownership format if we haven't yet
|
// create ownership format if we haven't yet
|
||||||
if (s_ownershipFormat == 0) {
|
if (s_ownershipFormat == 0) {
|
||||||
|
@ -219,7 +219,7 @@ CMSWindowsClipboard::isOwnedBySynergy()
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsClipboard::getOwnershipFormat()
|
MSWindowsClipboard::getOwnershipFormat()
|
||||||
{
|
{
|
||||||
// create ownership format if we haven't yet
|
// create ownership format if we haven't yet
|
||||||
if (s_ownershipFormat == 0) {
|
if (s_ownershipFormat == 0) {
|
||||||
|
|
|
@ -29,11 +29,11 @@ class IMSWindowsClipboardConverter;
|
||||||
class IMSWindowsClipboardFacade;
|
class IMSWindowsClipboardFacade;
|
||||||
|
|
||||||
//! Microsoft windows clipboard implementation
|
//! Microsoft windows clipboard implementation
|
||||||
class CMSWindowsClipboard : public IClipboard {
|
class MSWindowsClipboard : public IClipboard {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboard(HWND window);
|
MSWindowsClipboard(HWND window);
|
||||||
CMSWindowsClipboard(HWND window, IMSWindowsClipboardFacade &facade);
|
MSWindowsClipboard(HWND window, IMSWindowsClipboardFacade &facade);
|
||||||
virtual ~CMSWindowsClipboard();
|
virtual ~MSWindowsClipboard();
|
||||||
|
|
||||||
//! Empty clipboard without ownership
|
//! Empty clipboard without ownership
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -19,27 +19,27 @@
|
||||||
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboardAnyTextConverter
|
// MSWindowsClipboardAnyTextConverter
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsClipboardAnyTextConverter::CMSWindowsClipboardAnyTextConverter()
|
MSWindowsClipboardAnyTextConverter::MSWindowsClipboardAnyTextConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboardAnyTextConverter::~CMSWindowsClipboardAnyTextConverter()
|
MSWindowsClipboardAnyTextConverter::~MSWindowsClipboardAnyTextConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
IClipboard::EFormat
|
IClipboard::EFormat
|
||||||
CMSWindowsClipboardAnyTextConverter::getFormat() const
|
MSWindowsClipboardAnyTextConverter::getFormat() const
|
||||||
{
|
{
|
||||||
return IClipboard::kText;
|
return IClipboard::kText;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
CMSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const
|
MSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// convert linefeeds and then convert to desired encoding
|
// convert linefeeds and then convert to desired encoding
|
||||||
String text = doFromIClipboard(convertLinefeedToWin32(data));
|
String text = doFromIClipboard(convertLinefeedToWin32(data));
|
||||||
|
@ -64,7 +64,7 @@ CMSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
|
MSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
|
||||||
{
|
{
|
||||||
// get datator
|
// get datator
|
||||||
const char* src = (const char*)GlobalLock(data);
|
const char* src = (const char*)GlobalLock(data);
|
||||||
|
@ -84,7 +84,7 @@ CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
|
MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
|
||||||
const String& src) const
|
const String& src) const
|
||||||
{
|
{
|
||||||
// note -- we assume src is a valid UTF-8 string
|
// note -- we assume src is a valid UTF-8 string
|
||||||
|
@ -118,7 +118,7 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(
|
MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(
|
||||||
const String& src) const
|
const String& src) const
|
||||||
{
|
{
|
||||||
// count newlines in string
|
// count newlines in string
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#include "platform/MSWindowsClipboard.h"
|
#include "platform/MSWindowsClipboard.h"
|
||||||
|
|
||||||
//! Convert to/from some text encoding
|
//! Convert to/from some text encoding
|
||||||
class CMSWindowsClipboardAnyTextConverter :
|
class MSWindowsClipboardAnyTextConverter :
|
||||||
public IMSWindowsClipboardConverter {
|
public IMSWindowsClipboardConverter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboardAnyTextConverter();
|
MSWindowsClipboardAnyTextConverter();
|
||||||
virtual ~CMSWindowsClipboardAnyTextConverter();
|
virtual ~MSWindowsClipboardAnyTextConverter();
|
||||||
|
|
||||||
// IMSWindowsClipboardConverter overrides
|
// IMSWindowsClipboardConverter overrides
|
||||||
virtual IClipboard::EFormat
|
virtual IClipboard::EFormat
|
||||||
|
|
|
@ -21,33 +21,33 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboardBitmapConverter
|
// MSWindowsClipboardBitmapConverter
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsClipboardBitmapConverter::CMSWindowsClipboardBitmapConverter()
|
MSWindowsClipboardBitmapConverter::MSWindowsClipboardBitmapConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboardBitmapConverter::~CMSWindowsClipboardBitmapConverter()
|
MSWindowsClipboardBitmapConverter::~MSWindowsClipboardBitmapConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
IClipboard::EFormat
|
IClipboard::EFormat
|
||||||
CMSWindowsClipboardBitmapConverter::getFormat() const
|
MSWindowsClipboardBitmapConverter::getFormat() const
|
||||||
{
|
{
|
||||||
return IClipboard::kBitmap;
|
return IClipboard::kBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsClipboardBitmapConverter::getWin32Format() const
|
MSWindowsClipboardBitmapConverter::getWin32Format() const
|
||||||
{
|
{
|
||||||
return CF_DIB;
|
return CF_DIB;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
CMSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const
|
MSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// copy to memory handle
|
// copy to memory handle
|
||||||
HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, data.size());
|
HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, data.size());
|
||||||
|
@ -68,7 +68,7 @@ CMSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
|
MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
|
||||||
{
|
{
|
||||||
// get datator
|
// get datator
|
||||||
const char* src = (const char*)GlobalLock(data);
|
const char* src = (const char*)GlobalLock(data);
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#include "platform/MSWindowsClipboard.h"
|
#include "platform/MSWindowsClipboard.h"
|
||||||
|
|
||||||
//! Convert to/from some text encoding
|
//! Convert to/from some text encoding
|
||||||
class CMSWindowsClipboardBitmapConverter :
|
class MSWindowsClipboardBitmapConverter :
|
||||||
public IMSWindowsClipboardConverter {
|
public IMSWindowsClipboardConverter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboardBitmapConverter();
|
MSWindowsClipboardBitmapConverter();
|
||||||
virtual ~CMSWindowsClipboardBitmapConverter();
|
virtual ~MSWindowsClipboardBitmapConverter();
|
||||||
|
|
||||||
// IMSWindowsClipboardConverter overrides
|
// IMSWindowsClipboardConverter overrides
|
||||||
virtual IClipboard::EFormat
|
virtual IClipboard::EFormat
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "platform/MSWindowsClipboard.h"
|
#include "platform/MSWindowsClipboard.h"
|
||||||
|
|
||||||
void CMSWindowsClipboardFacade::write(HANDLE win32Data, UINT win32Format)
|
void MSWindowsClipboardFacade::write(HANDLE win32Data, UINT win32Format)
|
||||||
{
|
{
|
||||||
if (SetClipboardData(win32Format, win32Data) == NULL) {
|
if (SetClipboardData(win32Format, win32Data) == NULL) {
|
||||||
// free converted data if we couldn't put it on
|
// free converted data if we couldn't put it on
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "synergy/IClipboard.h"
|
#include "synergy/IClipboard.h"
|
||||||
|
|
||||||
class CMSWindowsClipboardFacade : public IMSWindowsClipboardFacade
|
class MSWindowsClipboardFacade : public IMSWindowsClipboardFacade
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void write(HANDLE win32Data, UINT win32Format);
|
virtual void write(HANDLE win32Data, UINT win32Format);
|
||||||
|
|
|
@ -21,33 +21,33 @@
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboardHTMLConverter
|
// MSWindowsClipboardHTMLConverter
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsClipboardHTMLConverter::CMSWindowsClipboardHTMLConverter()
|
MSWindowsClipboardHTMLConverter::MSWindowsClipboardHTMLConverter()
|
||||||
{
|
{
|
||||||
m_format = RegisterClipboardFormat("HTML Format");
|
m_format = RegisterClipboardFormat("HTML Format");
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboardHTMLConverter::~CMSWindowsClipboardHTMLConverter()
|
MSWindowsClipboardHTMLConverter::~MSWindowsClipboardHTMLConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
IClipboard::EFormat
|
IClipboard::EFormat
|
||||||
CMSWindowsClipboardHTMLConverter::getFormat() const
|
MSWindowsClipboardHTMLConverter::getFormat() const
|
||||||
{
|
{
|
||||||
return IClipboard::kHTML;
|
return IClipboard::kHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsClipboardHTMLConverter::getWin32Format() const
|
MSWindowsClipboardHTMLConverter::getWin32Format() const
|
||||||
{
|
{
|
||||||
return m_format;
|
return m_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const
|
MSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// prepare to CF_HTML format prefix and suffix
|
// prepare to CF_HTML format prefix and suffix
|
||||||
String prefix("Version:0.9\r\nStartHTML:0000000105\r\n"
|
String prefix("Version:0.9\r\nStartHTML:0000000105\r\n"
|
||||||
|
@ -76,7 +76,7 @@ CMSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const
|
MSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// get fragment start/end args
|
// get fragment start/end args
|
||||||
String startArg = findArg(data, "StartFragment");
|
String startArg = findArg(data, "StartFragment");
|
||||||
|
@ -97,7 +97,7 @@ CMSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardHTMLConverter::findArg(
|
MSWindowsClipboardHTMLConverter::findArg(
|
||||||
const String& data, const String& name) const
|
const String& data, const String& name) const
|
||||||
{
|
{
|
||||||
String::size_type i = data.find(name);
|
String::size_type i = data.find(name);
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
||||||
|
|
||||||
//! Convert to/from HTML encoding
|
//! Convert to/from HTML encoding
|
||||||
class CMSWindowsClipboardHTMLConverter :
|
class MSWindowsClipboardHTMLConverter :
|
||||||
public CMSWindowsClipboardAnyTextConverter {
|
public MSWindowsClipboardAnyTextConverter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboardHTMLConverter();
|
MSWindowsClipboardHTMLConverter();
|
||||||
virtual ~CMSWindowsClipboardHTMLConverter();
|
virtual ~MSWindowsClipboardHTMLConverter();
|
||||||
|
|
||||||
// IMSWindowsClipboardConverter overrides
|
// IMSWindowsClipboardConverter overrides
|
||||||
virtual IClipboard::EFormat
|
virtual IClipboard::EFormat
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
virtual UINT getWin32Format() const;
|
virtual UINT getWin32Format() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CMSWindowsClipboardAnyTextConverter overrides
|
// MSWindowsClipboardAnyTextConverter overrides
|
||||||
virtual String doFromIClipboard(const String&) const;
|
virtual String doFromIClipboard(const String&) const;
|
||||||
virtual String doToIClipboard(const String&) const;
|
virtual String doToIClipboard(const String&) const;
|
||||||
|
|
||||||
|
|
|
@ -21,34 +21,34 @@
|
||||||
#include "base/Unicode.h"
|
#include "base/Unicode.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboardTextConverter
|
// MSWindowsClipboardTextConverter
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsClipboardTextConverter::CMSWindowsClipboardTextConverter()
|
MSWindowsClipboardTextConverter::MSWindowsClipboardTextConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboardTextConverter::~CMSWindowsClipboardTextConverter()
|
MSWindowsClipboardTextConverter::~MSWindowsClipboardTextConverter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsClipboardTextConverter::getWin32Format() const
|
MSWindowsClipboardTextConverter::getWin32Format() const
|
||||||
{
|
{
|
||||||
return CF_TEXT;
|
return CF_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardTextConverter::doFromIClipboard(const String& data) const
|
MSWindowsClipboardTextConverter::doFromIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// convert and add nul terminator
|
// convert and add nul terminator
|
||||||
return Unicode::UTF8ToText(data) += '\0';
|
return Unicode::UTF8ToText(data) += '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardTextConverter::doToIClipboard(const String& data) const
|
MSWindowsClipboardTextConverter::doToIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// convert and truncate at first nul terminator
|
// convert and truncate at first nul terminator
|
||||||
String dst = Unicode::textToUTF8(data);
|
String dst = Unicode::textToUTF8(data);
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
||||||
|
|
||||||
//! Convert to/from locale text encoding
|
//! Convert to/from locale text encoding
|
||||||
class CMSWindowsClipboardTextConverter :
|
class MSWindowsClipboardTextConverter :
|
||||||
public CMSWindowsClipboardAnyTextConverter {
|
public MSWindowsClipboardAnyTextConverter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboardTextConverter();
|
MSWindowsClipboardTextConverter();
|
||||||
virtual ~CMSWindowsClipboardTextConverter();
|
virtual ~MSWindowsClipboardTextConverter();
|
||||||
|
|
||||||
// IMSWindowsClipboardConverter overrides
|
// IMSWindowsClipboardConverter overrides
|
||||||
virtual UINT getWin32Format() const;
|
virtual UINT getWin32Format() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CMSWindowsClipboardAnyTextConverter overrides
|
// MSWindowsClipboardAnyTextConverter overrides
|
||||||
virtual String doFromIClipboard(const String&) const;
|
virtual String doFromIClipboard(const String&) const;
|
||||||
virtual String doToIClipboard(const String&) const;
|
virtual String doToIClipboard(const String&) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,34 +21,34 @@
|
||||||
#include "base/Unicode.h"
|
#include "base/Unicode.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsClipboardUTF16Converter
|
// MSWindowsClipboardUTF16Converter
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsClipboardUTF16Converter::CMSWindowsClipboardUTF16Converter()
|
MSWindowsClipboardUTF16Converter::MSWindowsClipboardUTF16Converter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsClipboardUTF16Converter::~CMSWindowsClipboardUTF16Converter()
|
MSWindowsClipboardUTF16Converter::~MSWindowsClipboardUTF16Converter()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsClipboardUTF16Converter::getWin32Format() const
|
MSWindowsClipboardUTF16Converter::getWin32Format() const
|
||||||
{
|
{
|
||||||
return CF_UNICODETEXT;
|
return CF_UNICODETEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardUTF16Converter::doFromIClipboard(const String& data) const
|
MSWindowsClipboardUTF16Converter::doFromIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// convert and add nul terminator
|
// convert and add nul terminator
|
||||||
return Unicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0);
|
return Unicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsClipboardUTF16Converter::doToIClipboard(const String& data) const
|
MSWindowsClipboardUTF16Converter::doToIClipboard(const String& data) const
|
||||||
{
|
{
|
||||||
// convert and strip nul terminator
|
// convert and strip nul terminator
|
||||||
String dst = Unicode::UTF16ToUTF8(data);
|
String dst = Unicode::UTF16ToUTF8(data);
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
#include "platform/MSWindowsClipboardAnyTextConverter.h"
|
||||||
|
|
||||||
//! Convert to/from UTF-16 encoding
|
//! Convert to/from UTF-16 encoding
|
||||||
class CMSWindowsClipboardUTF16Converter :
|
class MSWindowsClipboardUTF16Converter :
|
||||||
public CMSWindowsClipboardAnyTextConverter {
|
public MSWindowsClipboardAnyTextConverter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboardUTF16Converter();
|
MSWindowsClipboardUTF16Converter();
|
||||||
virtual ~CMSWindowsClipboardUTF16Converter();
|
virtual ~MSWindowsClipboardUTF16Converter();
|
||||||
|
|
||||||
// IMSWindowsClipboardConverter overrides
|
// IMSWindowsClipboardConverter overrides
|
||||||
virtual UINT getWin32Format() const;
|
virtual UINT getWin32Format() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CMSWindowsClipboardAnyTextConverter overrides
|
// MSWindowsClipboardAnyTextConverter overrides
|
||||||
virtual String doFromIClipboard(const String&) const;
|
virtual String doFromIClipboard(const String&) const;
|
||||||
virtual String doToIClipboard(const String&) const;
|
virtual String doToIClipboard(const String&) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,37 +22,37 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
CMSWindowsDebugOutputter::CMSWindowsDebugOutputter()
|
MSWindowsDebugOutputter::MSWindowsDebugOutputter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDebugOutputter::~CMSWindowsDebugOutputter()
|
MSWindowsDebugOutputter::~MSWindowsDebugOutputter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDebugOutputter::open(const char* title)
|
MSWindowsDebugOutputter::open(const char* title)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDebugOutputter::close()
|
MSWindowsDebugOutputter::close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDebugOutputter::show(bool showIfEmpty)
|
MSWindowsDebugOutputter::show(bool showIfEmpty)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsDebugOutputter::write(ELevel level, const char* msg)
|
MSWindowsDebugOutputter::write(ELevel level, const char* msg)
|
||||||
{
|
{
|
||||||
OutputDebugString((std::string(msg) + "\n").c_str());
|
OutputDebugString((std::string(msg) + "\n").c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDebugOutputter::flush()
|
MSWindowsDebugOutputter::flush()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
This outputter writes output to the debugger. In Visual Studio, this
|
This outputter writes output to the debugger. In Visual Studio, this
|
||||||
can be seen in the Output window.
|
can be seen in the Output window.
|
||||||
*/
|
*/
|
||||||
class CMSWindowsDebugOutputter : public ILogOutputter {
|
class MSWindowsDebugOutputter : public ILogOutputter {
|
||||||
public:
|
public:
|
||||||
CMSWindowsDebugOutputter();
|
MSWindowsDebugOutputter();
|
||||||
virtual ~CMSWindowsDebugOutputter();
|
virtual ~MSWindowsDebugOutputter();
|
||||||
|
|
||||||
// ILogOutputter overrides
|
// ILogOutputter overrides
|
||||||
virtual void open(const char* title);
|
virtual void open(const char* title);
|
||||||
|
|
|
@ -89,10 +89,10 @@
|
||||||
#define SYNERGY_MSG_FAKE_INPUT SYNERGY_HOOK_LAST_MSG + 12
|
#define SYNERGY_MSG_FAKE_INPUT SYNERGY_HOOK_LAST_MSG + 12
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsDesks
|
// MSWindowsDesks
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsDesks::CMSWindowsDesks(
|
MSWindowsDesks::MSWindowsDesks(
|
||||||
bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
||||||
const IScreenSaver* screensaver, IEventQueue* events,
|
const IScreenSaver* screensaver, IEventQueue* events,
|
||||||
IJob* updateKeys, bool stopOnDeskSwitch) :
|
IJob* updateKeys, bool stopOnDeskSwitch) :
|
||||||
|
@ -123,7 +123,7 @@ CMSWindowsDesks::CMSWindowsDesks(
|
||||||
resetOptions();
|
resetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDesks::~CMSWindowsDesks()
|
MSWindowsDesks::~MSWindowsDesks()
|
||||||
{
|
{
|
||||||
disable();
|
disable();
|
||||||
destroyClass(m_deskClass);
|
destroyClass(m_deskClass);
|
||||||
|
@ -132,7 +132,7 @@ CMSWindowsDesks::~CMSWindowsDesks()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::enable()
|
MSWindowsDesks::enable()
|
||||||
{
|
{
|
||||||
m_threadID = GetCurrentThreadId();
|
m_threadID = GetCurrentThreadId();
|
||||||
|
|
||||||
|
@ -145,14 +145,14 @@ CMSWindowsDesks::enable()
|
||||||
// change but as far as i can tell it doesn't.
|
// change but as far as i can tell it doesn't.
|
||||||
m_timer = m_events->newTimer(0.2, NULL);
|
m_timer = m_events->newTimer(0.2, NULL);
|
||||||
m_events->adoptHandler(Event::kTimer, m_timer,
|
m_events->adoptHandler(Event::kTimer, m_timer,
|
||||||
new TMethodEventJob<CMSWindowsDesks>(
|
new TMethodEventJob<MSWindowsDesks>(
|
||||||
this, &CMSWindowsDesks::handleCheckDesk));
|
this, &MSWindowsDesks::handleCheckDesk));
|
||||||
|
|
||||||
updateKeys();
|
updateKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::disable()
|
MSWindowsDesks::disable()
|
||||||
{
|
{
|
||||||
// remove timer
|
// remove timer
|
||||||
if (m_timer != NULL) {
|
if (m_timer != NULL) {
|
||||||
|
@ -168,25 +168,25 @@ CMSWindowsDesks::disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::enter()
|
MSWindowsDesks::enter()
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_ENTER, 0, 0);
|
sendMessage(SYNERGY_MSG_ENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::leave(HKL keyLayout)
|
MSWindowsDesks::leave(HKL keyLayout)
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_LEAVE, (WPARAM)keyLayout, 0);
|
sendMessage(SYNERGY_MSG_LEAVE, (WPARAM)keyLayout, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::resetOptions()
|
MSWindowsDesks::resetOptions()
|
||||||
{
|
{
|
||||||
m_leaveForegroundOption = false;
|
m_leaveForegroundOption = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::setOptions(const OptionsList& options)
|
MSWindowsDesks::setOptions(const OptionsList& options)
|
||||||
{
|
{
|
||||||
for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
|
for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
|
||||||
if (options[i] == kOptionWin32KeepForeground) {
|
if (options[i] == kOptionWin32KeepForeground) {
|
||||||
|
@ -197,13 +197,13 @@ CMSWindowsDesks::setOptions(const OptionsList& options)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::updateKeys()
|
MSWindowsDesks::updateKeys()
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_SYNC_KEYS, 0, 0);
|
sendMessage(SYNERGY_MSG_SYNC_KEYS, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::setShape(SInt32 x, SInt32 y,
|
MSWindowsDesks::setShape(SInt32 x, SInt32 y,
|
||||||
SInt32 width, SInt32 height,
|
SInt32 width, SInt32 height,
|
||||||
SInt32 xCenter, SInt32 yCenter, bool isMultimon)
|
SInt32 xCenter, SInt32 yCenter, bool isMultimon)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ CMSWindowsDesks::setShape(SInt32 x, SInt32 y,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::installScreensaverHooks(bool install)
|
MSWindowsDesks::installScreensaverHooks(bool install)
|
||||||
{
|
{
|
||||||
if (m_isPrimary && m_screensaverNotify != install) {
|
if (m_isPrimary && m_screensaverNotify != install) {
|
||||||
m_screensaverNotify = install;
|
m_screensaverNotify = install;
|
||||||
|
@ -226,19 +226,19 @@ CMSWindowsDesks::installScreensaverHooks(bool install)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeInputBegin()
|
MSWindowsDesks::fakeInputBegin()
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_FAKE_INPUT, 1, 0);
|
sendMessage(SYNERGY_MSG_FAKE_INPUT, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeInputEnd()
|
MSWindowsDesks::fakeInputEnd()
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_FAKE_INPUT, 0, 0);
|
sendMessage(SYNERGY_MSG_FAKE_INPUT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const
|
MSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const
|
||||||
{
|
{
|
||||||
POINT pos;
|
POINT pos;
|
||||||
sendMessage(SYNERGY_MSG_CURSOR_POS, reinterpret_cast<WPARAM>(&pos), 0);
|
sendMessage(SYNERGY_MSG_CURSOR_POS, reinterpret_cast<WPARAM>(&pos), 0);
|
||||||
|
@ -247,7 +247,7 @@ CMSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeKeyEvent(
|
MSWindowsDesks::fakeKeyEvent(
|
||||||
KeyButton button, UINT virtualKey,
|
KeyButton button, UINT virtualKey,
|
||||||
bool press, bool /*isAutoRepeat*/) const
|
bool press, bool /*isAutoRepeat*/) const
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ CMSWindowsDesks::fakeKeyEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeMouseButton(ButtonID button, bool press)
|
MSWindowsDesks::fakeMouseButton(ButtonID button, bool press)
|
||||||
{
|
{
|
||||||
// the system will swap the meaning of left/right for us if
|
// the system will swap the meaning of left/right for us if
|
||||||
// the user has configured a left-handed mouse but we don't
|
// the user has configured a left-handed mouse but we don't
|
||||||
|
@ -318,7 +318,7 @@ CMSWindowsDesks::fakeMouseButton(ButtonID button, bool press)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeMouseMove(SInt32 x, SInt32 y) const
|
MSWindowsDesks::fakeMouseMove(SInt32 x, SInt32 y) const
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_FAKE_MOVE,
|
sendMessage(SYNERGY_MSG_FAKE_MOVE,
|
||||||
static_cast<WPARAM>(x),
|
static_cast<WPARAM>(x),
|
||||||
|
@ -326,7 +326,7 @@ CMSWindowsDesks::fakeMouseMove(SInt32 x, SInt32 y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
MSWindowsDesks::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_FAKE_REL_MOVE,
|
sendMessage(SYNERGY_MSG_FAKE_REL_MOVE,
|
||||||
static_cast<WPARAM>(dx),
|
static_cast<WPARAM>(dx),
|
||||||
|
@ -334,13 +334,13 @@ CMSWindowsDesks::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
MSWindowsDesks::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
||||||
{
|
{
|
||||||
sendMessage(SYNERGY_MSG_FAKE_WHEEL, xDelta, yDelta);
|
sendMessage(SYNERGY_MSG_FAKE_WHEEL, xDelta, yDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::sendMessage(UINT msg, WPARAM wParam, LPARAM lParam) const
|
MSWindowsDesks::sendMessage(UINT msg, WPARAM wParam, LPARAM lParam) const
|
||||||
{
|
{
|
||||||
if (m_activeDesk != NULL && m_activeDesk->m_window != NULL) {
|
if (m_activeDesk != NULL && m_activeDesk->m_window != NULL) {
|
||||||
PostThreadMessage(m_activeDesk->m_threadID, msg, wParam, lParam);
|
PostThreadMessage(m_activeDesk->m_threadID, msg, wParam, lParam);
|
||||||
|
@ -349,7 +349,7 @@ CMSWindowsDesks::sendMessage(UINT msg, WPARAM wParam, LPARAM lParam) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary)
|
MSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary)
|
||||||
{
|
{
|
||||||
// look up functions
|
// look up functions
|
||||||
if (m_isPrimary && !m_noHooks) {
|
if (m_isPrimary && !m_noHooks) {
|
||||||
|
@ -378,7 +378,7 @@ CMSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary)
|
||||||
}
|
}
|
||||||
|
|
||||||
HCURSOR
|
HCURSOR
|
||||||
CMSWindowsDesks::createBlankCursor() const
|
MSWindowsDesks::createBlankCursor() const
|
||||||
{
|
{
|
||||||
// create a transparent cursor
|
// create a transparent cursor
|
||||||
int cw = GetSystemMetrics(SM_CXCURSOR);
|
int cw = GetSystemMetrics(SM_CXCURSOR);
|
||||||
|
@ -387,7 +387,7 @@ CMSWindowsDesks::createBlankCursor() const
|
||||||
UInt8* cursorXOR = new UInt8[ch * ((cw + 31) >> 2)];
|
UInt8* cursorXOR = new UInt8[ch * ((cw + 31) >> 2)];
|
||||||
memset(cursorAND, 0xff, ch * ((cw + 31) >> 2));
|
memset(cursorAND, 0xff, ch * ((cw + 31) >> 2));
|
||||||
memset(cursorXOR, 0x00, ch * ((cw + 31) >> 2));
|
memset(cursorXOR, 0x00, ch * ((cw + 31) >> 2));
|
||||||
HCURSOR c = CreateCursor(CMSWindowsScreen::getWindowInstance(),
|
HCURSOR c = CreateCursor(MSWindowsScreen::getWindowInstance(),
|
||||||
0, 0, cw, ch, cursorAND, cursorXOR);
|
0, 0, cw, ch, cursorAND, cursorXOR);
|
||||||
delete[] cursorXOR;
|
delete[] cursorXOR;
|
||||||
delete[] cursorAND;
|
delete[] cursorAND;
|
||||||
|
@ -395,7 +395,7 @@ CMSWindowsDesks::createBlankCursor() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::destroyCursor(HCURSOR cursor) const
|
MSWindowsDesks::destroyCursor(HCURSOR cursor) const
|
||||||
{
|
{
|
||||||
if (cursor != NULL) {
|
if (cursor != NULL) {
|
||||||
DestroyCursor(cursor);
|
DestroyCursor(cursor);
|
||||||
|
@ -403,17 +403,17 @@ CMSWindowsDesks::destroyCursor(HCURSOR cursor) const
|
||||||
}
|
}
|
||||||
|
|
||||||
ATOM
|
ATOM
|
||||||
CMSWindowsDesks::createDeskWindowClass(bool isPrimary) const
|
MSWindowsDesks::createDeskWindowClass(bool isPrimary) const
|
||||||
{
|
{
|
||||||
WNDCLASSEX classInfo;
|
WNDCLASSEX classInfo;
|
||||||
classInfo.cbSize = sizeof(classInfo);
|
classInfo.cbSize = sizeof(classInfo);
|
||||||
classInfo.style = CS_DBLCLKS | CS_NOCLOSE;
|
classInfo.style = CS_DBLCLKS | CS_NOCLOSE;
|
||||||
classInfo.lpfnWndProc = isPrimary ?
|
classInfo.lpfnWndProc = isPrimary ?
|
||||||
&CMSWindowsDesks::primaryDeskProc :
|
&MSWindowsDesks::primaryDeskProc :
|
||||||
&CMSWindowsDesks::secondaryDeskProc;
|
&MSWindowsDesks::secondaryDeskProc;
|
||||||
classInfo.cbClsExtra = 0;
|
classInfo.cbClsExtra = 0;
|
||||||
classInfo.cbWndExtra = 0;
|
classInfo.cbWndExtra = 0;
|
||||||
classInfo.hInstance = CMSWindowsScreen::getWindowInstance();
|
classInfo.hInstance = MSWindowsScreen::getWindowInstance();
|
||||||
classInfo.hIcon = NULL;
|
classInfo.hIcon = NULL;
|
||||||
classInfo.hCursor = m_cursor;
|
classInfo.hCursor = m_cursor;
|
||||||
classInfo.hbrBackground = NULL;
|
classInfo.hbrBackground = NULL;
|
||||||
|
@ -424,16 +424,16 @@ CMSWindowsDesks::createDeskWindowClass(bool isPrimary) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::destroyClass(ATOM windowClass) const
|
MSWindowsDesks::destroyClass(ATOM windowClass) const
|
||||||
{
|
{
|
||||||
if (windowClass != 0) {
|
if (windowClass != 0) {
|
||||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass),
|
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass),
|
||||||
CMSWindowsScreen::getWindowInstance());
|
MSWindowsScreen::getWindowInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND
|
||||||
CMSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
|
MSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
|
||||||
{
|
{
|
||||||
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
||||||
WS_EX_TRANSPARENT |
|
WS_EX_TRANSPARENT |
|
||||||
|
@ -443,7 +443,7 @@ CMSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
CMSWindowsScreen::getWindowInstance(),
|
MSWindowsScreen::getWindowInstance(),
|
||||||
NULL);
|
NULL);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
|
LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
|
||||||
|
@ -453,7 +453,7 @@ CMSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::destroyWindow(HWND hwnd) const
|
MSWindowsDesks::destroyWindow(HWND hwnd) const
|
||||||
{
|
{
|
||||||
if (hwnd != NULL) {
|
if (hwnd != NULL) {
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
@ -461,14 +461,14 @@ CMSWindowsDesks::destroyWindow(HWND hwnd) const
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
CMSWindowsDesks::primaryDeskProc(
|
MSWindowsDesks::primaryDeskProc(
|
||||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
CMSWindowsDesks::secondaryDeskProc(
|
MSWindowsDesks::secondaryDeskProc(
|
||||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// would like to detect any local user input and hide the hider
|
// would like to detect any local user input and hide the hider
|
||||||
|
@ -493,7 +493,7 @@ CMSWindowsDesks::secondaryDeskProc(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::deskMouseMove(SInt32 x, SInt32 y) const
|
MSWindowsDesks::deskMouseMove(SInt32 x, SInt32 y) const
|
||||||
{
|
{
|
||||||
// when using absolute positioning with mouse_event(),
|
// when using absolute positioning with mouse_event(),
|
||||||
// the normalized device coordinates range over only
|
// the normalized device coordinates range over only
|
||||||
|
@ -507,7 +507,7 @@ CMSWindowsDesks::deskMouseMove(SInt32 x, SInt32 y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
MSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
{
|
{
|
||||||
// relative moves are subject to cursor acceleration which we don't
|
// relative moves are subject to cursor acceleration which we don't
|
||||||
// want.so we disable acceleration, do the relative move, then
|
// want.so we disable acceleration, do the relative move, then
|
||||||
|
@ -543,7 +543,7 @@ CMSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::deskEnter(Desk* desk)
|
MSWindowsDesks::deskEnter(Desk* desk)
|
||||||
{
|
{
|
||||||
if (!m_isPrimary) {
|
if (!m_isPrimary) {
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
|
@ -571,7 +571,7 @@ CMSWindowsDesks::deskEnter(Desk* desk)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
|
MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
|
||||||
{
|
{
|
||||||
ShowCursor(FALSE);
|
ShowCursor(FALSE);
|
||||||
if (m_isPrimary) {
|
if (m_isPrimary) {
|
||||||
|
@ -652,7 +652,7 @@ CMSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::deskThread(void* vdesk)
|
MSWindowsDesks::deskThread(void* vdesk)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
|
@ -804,22 +804,22 @@ CMSWindowsDesks::deskThread(void* vdesk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDesks::Desk*
|
MSWindowsDesks::Desk*
|
||||||
CMSWindowsDesks::addDesk(const String& name, HDESK hdesk)
|
MSWindowsDesks::addDesk(const String& name, HDESK hdesk)
|
||||||
{
|
{
|
||||||
Desk* desk = new Desk;
|
Desk* desk = new Desk;
|
||||||
desk->m_name = name;
|
desk->m_name = name;
|
||||||
desk->m_desk = hdesk;
|
desk->m_desk = hdesk;
|
||||||
desk->m_targetID = GetCurrentThreadId();
|
desk->m_targetID = GetCurrentThreadId();
|
||||||
desk->m_thread = new Thread(new TMethodJob<CMSWindowsDesks>(
|
desk->m_thread = new Thread(new TMethodJob<MSWindowsDesks>(
|
||||||
this, &CMSWindowsDesks::deskThread, desk));
|
this, &MSWindowsDesks::deskThread, desk));
|
||||||
waitForDesk();
|
waitForDesk();
|
||||||
m_desks.insert(std::make_pair(name, desk));
|
m_desks.insert(std::make_pair(name, desk));
|
||||||
return desk;
|
return desk;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::removeDesks()
|
MSWindowsDesks::removeDesks()
|
||||||
{
|
{
|
||||||
for (Desks::iterator index = m_desks.begin();
|
for (Desks::iterator index = m_desks.begin();
|
||||||
index != m_desks.end(); ++index) {
|
index != m_desks.end(); ++index) {
|
||||||
|
@ -835,7 +835,7 @@ CMSWindowsDesks::removeDesks()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::checkDesk()
|
MSWindowsDesks::checkDesk()
|
||||||
{
|
{
|
||||||
// get current desktop. if we already know about it then return.
|
// get current desktop. if we already know about it then return.
|
||||||
Desk* desk;
|
Desk* desk;
|
||||||
|
@ -911,15 +911,15 @@ CMSWindowsDesks::checkDesk()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsDesks::isDeskAccessible(const Desk* desk) const
|
MSWindowsDesks::isDeskAccessible(const Desk* desk) const
|
||||||
{
|
{
|
||||||
return (desk != NULL && desk->m_desk != NULL);
|
return (desk != NULL && desk->m_desk != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::waitForDesk() const
|
MSWindowsDesks::waitForDesk() const
|
||||||
{
|
{
|
||||||
CMSWindowsDesks* self = const_cast<CMSWindowsDesks*>(this);
|
MSWindowsDesks* self = const_cast<MSWindowsDesks*>(this);
|
||||||
|
|
||||||
Lock lock(&m_mutex);
|
Lock lock(&m_mutex);
|
||||||
while (!(bool)m_deskReady) {
|
while (!(bool)m_deskReady) {
|
||||||
|
@ -929,7 +929,7 @@ CMSWindowsDesks::waitForDesk() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::handleCheckDesk(const Event&, void*)
|
MSWindowsDesks::handleCheckDesk(const Event&, void*)
|
||||||
{
|
{
|
||||||
checkDesk();
|
checkDesk();
|
||||||
|
|
||||||
|
@ -943,7 +943,7 @@ CMSWindowsDesks::handleCheckDesk(const Event&, void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
HDESK
|
HDESK
|
||||||
CMSWindowsDesks::openInputDesktop()
|
MSWindowsDesks::openInputDesktop()
|
||||||
{
|
{
|
||||||
return OpenInputDesktop(
|
return OpenInputDesktop(
|
||||||
DF_ALLOWOTHERACCOUNTHOOK, TRUE,
|
DF_ALLOWOTHERACCOUNTHOOK, TRUE,
|
||||||
|
@ -951,7 +951,7 @@ CMSWindowsDesks::openInputDesktop()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDesks::closeDesktop(HDESK desk)
|
MSWindowsDesks::closeDesktop(HDESK desk)
|
||||||
{
|
{
|
||||||
if (desk != NULL) {
|
if (desk != NULL) {
|
||||||
CloseDesktop(desk);
|
CloseDesktop(desk);
|
||||||
|
@ -959,7 +959,7 @@ CMSWindowsDesks::closeDesktop(HDESK desk)
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsDesks::getDesktopName(HDESK desk)
|
MSWindowsDesks::getDesktopName(HDESK desk)
|
||||||
{
|
{
|
||||||
if (desk == NULL) {
|
if (desk == NULL) {
|
||||||
return String();
|
return String();
|
||||||
|
@ -975,7 +975,7 @@ CMSWindowsDesks::getDesktopName(HDESK desk)
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND
|
||||||
CMSWindowsDesks::getForegroundWindow() const
|
MSWindowsDesks::getForegroundWindow() const
|
||||||
{
|
{
|
||||||
// Ideally we'd return NULL as much as possible, only returning
|
// Ideally we'd return NULL as much as possible, only returning
|
||||||
// the actual foreground window when we know it's going to mess
|
// the actual foreground window when we know it's going to mess
|
||||||
|
|
|
@ -53,7 +53,7 @@ synergy should work on those too.
|
||||||
This class encapsulates all the desk nastiness. Clients of this
|
This class encapsulates all the desk nastiness. Clients of this
|
||||||
object don't have to know anything about desks.
|
object don't have to know anything about desks.
|
||||||
*/
|
*/
|
||||||
class CMSWindowsDesks {
|
class MSWindowsDesks {
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*!
|
/*!
|
||||||
|
@ -64,11 +64,11 @@ public:
|
||||||
updated in a thread attached to the current desk.
|
updated in a thread attached to the current desk.
|
||||||
\p hookLibrary must be a handle to the hook library.
|
\p hookLibrary must be a handle to the hook library.
|
||||||
*/
|
*/
|
||||||
CMSWindowsDesks(
|
MSWindowsDesks(
|
||||||
bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
||||||
const IScreenSaver* screensaver, IEventQueue* events,
|
const IScreenSaver* screensaver, IEventQueue* events,
|
||||||
IJob* updateKeys, bool stopOnDeskSwitch);
|
IJob* updateKeys, bool stopOnDeskSwitch);
|
||||||
~CMSWindowsDesks();
|
~MSWindowsDesks();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -25,28 +25,28 @@
|
||||||
|
|
||||||
void getDropData(IDataObject *pDataObject);
|
void getDropData(IDataObject *pDataObject);
|
||||||
|
|
||||||
CMSWindowsDropTarget* CMSWindowsDropTarget::s_instance = NULL;
|
MSWindowsDropTarget* MSWindowsDropTarget::s_instance = NULL;
|
||||||
|
|
||||||
CMSWindowsDropTarget::CMSWindowsDropTarget() :
|
MSWindowsDropTarget::MSWindowsDropTarget() :
|
||||||
m_refCount(1),
|
m_refCount(1),
|
||||||
m_allowDrop(false)
|
m_allowDrop(false)
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDropTarget::~CMSWindowsDropTarget()
|
MSWindowsDropTarget::~MSWindowsDropTarget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDropTarget&
|
MSWindowsDropTarget&
|
||||||
CMSWindowsDropTarget::instance()
|
MSWindowsDropTarget::instance()
|
||||||
{
|
{
|
||||||
assert(s_instance != NULL);
|
assert(s_instance != NULL);
|
||||||
return *s_instance;
|
return *s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
CMSWindowsDropTarget::DragEnter(IDataObject* dataObject, DWORD keyState, POINTL point, DWORD* effect)
|
MSWindowsDropTarget::DragEnter(IDataObject* dataObject, DWORD keyState, POINTL point, DWORD* effect)
|
||||||
{
|
{
|
||||||
// check if data object contain drop
|
// check if data object contain drop
|
||||||
m_allowDrop = queryDataObject(dataObject);
|
m_allowDrop = queryDataObject(dataObject);
|
||||||
|
@ -60,7 +60,7 @@ CMSWindowsDropTarget::DragEnter(IDataObject* dataObject, DWORD keyState, POINTL
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
CMSWindowsDropTarget::DragOver(DWORD keyState, POINTL point, DWORD* effect)
|
MSWindowsDropTarget::DragOver(DWORD keyState, POINTL point, DWORD* effect)
|
||||||
{
|
{
|
||||||
*effect = DROPEFFECT_NONE;
|
*effect = DROPEFFECT_NONE;
|
||||||
|
|
||||||
|
@ -68,13 +68,13 @@ CMSWindowsDropTarget::DragOver(DWORD keyState, POINTL point, DWORD* effect)
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
CMSWindowsDropTarget::DragLeave(void)
|
MSWindowsDropTarget::DragLeave(void)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
CMSWindowsDropTarget::Drop(IDataObject* dataObject, DWORD keyState, POINTL point, DWORD* effect)
|
MSWindowsDropTarget::Drop(IDataObject* dataObject, DWORD keyState, POINTL point, DWORD* effect)
|
||||||
{
|
{
|
||||||
*effect = DROPEFFECT_NONE;
|
*effect = DROPEFFECT_NONE;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ CMSWindowsDropTarget::Drop(IDataObject* dataObject, DWORD keyState, POINTL point
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsDropTarget::queryDataObject(IDataObject* dataObject)
|
MSWindowsDropTarget::queryDataObject(IDataObject* dataObject)
|
||||||
{
|
{
|
||||||
// check if it supports CF_HDROP using a HGLOBAL
|
// check if it supports CF_HDROP using a HGLOBAL
|
||||||
FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||||
|
@ -91,19 +91,19 @@ CMSWindowsDropTarget::queryDataObject(IDataObject* dataObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDropTarget::setDraggingFilename(char* const filename)
|
MSWindowsDropTarget::setDraggingFilename(char* const filename)
|
||||||
{
|
{
|
||||||
m_dragFilename = filename;
|
m_dragFilename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
CMSWindowsDropTarget::getDraggingFilename()
|
MSWindowsDropTarget::getDraggingFilename()
|
||||||
{
|
{
|
||||||
return m_dragFilename;
|
return m_dragFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsDropTarget::clearDraggingFilename()
|
MSWindowsDropTarget::clearDraggingFilename()
|
||||||
{
|
{
|
||||||
m_dragFilename.clear();
|
m_dragFilename.clear();
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ getDropData(IDataObject* dataObject)
|
||||||
filename[wcslen(wcData)] = '\0';
|
filename[wcslen(wcData)] = '\0';
|
||||||
wcstombs(filename, wcData, wcslen(wcData));
|
wcstombs(filename, wcData, wcslen(wcData));
|
||||||
|
|
||||||
CMSWindowsDropTarget::instance().setDraggingFilename(filename);
|
MSWindowsDropTarget::instance().setDraggingFilename(filename);
|
||||||
|
|
||||||
GlobalUnlock(stgMed.hGlobal);
|
GlobalUnlock(stgMed.hGlobal);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ getDropData(IDataObject* dataObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT __stdcall
|
HRESULT __stdcall
|
||||||
CMSWindowsDropTarget::QueryInterface (REFIID iid, void ** object)
|
MSWindowsDropTarget::QueryInterface (REFIID iid, void ** object)
|
||||||
{
|
{
|
||||||
if (iid == IID_IDropTarget || iid == IID_IUnknown) {
|
if (iid == IID_IDropTarget || iid == IID_IUnknown) {
|
||||||
AddRef();
|
AddRef();
|
||||||
|
@ -158,13 +158,13 @@ CMSWindowsDropTarget::QueryInterface (REFIID iid, void ** object)
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG __stdcall
|
ULONG __stdcall
|
||||||
CMSWindowsDropTarget::AddRef(void)
|
MSWindowsDropTarget::AddRef(void)
|
||||||
{
|
{
|
||||||
return InterlockedIncrement(&m_refCount);
|
return InterlockedIncrement(&m_refCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG __stdcall
|
ULONG __stdcall
|
||||||
CMSWindowsDropTarget::Release(void)
|
MSWindowsDropTarget::Release(void)
|
||||||
{
|
{
|
||||||
LONG count = InterlockedDecrement(&m_refCount);
|
LONG count = InterlockedDecrement(&m_refCount);
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <oleidl.h>
|
#include <oleidl.h>
|
||||||
|
|
||||||
class CMSWindowsScreen;
|
class MSWindowsScreen;
|
||||||
|
|
||||||
class CMSWindowsDropTarget : public IDropTarget {
|
class MSWindowsDropTarget : public IDropTarget {
|
||||||
public:
|
public:
|
||||||
CMSWindowsDropTarget();
|
MSWindowsDropTarget();
|
||||||
~CMSWindowsDropTarget();
|
~MSWindowsDropTarget();
|
||||||
|
|
||||||
// IUnknown implementation
|
// IUnknown implementation
|
||||||
HRESULT __stdcall QueryInterface(REFIID iid, void** object);
|
HRESULT __stdcall QueryInterface(REFIID iid, void** object);
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
std::string getDraggingFilename();
|
std::string getDraggingFilename();
|
||||||
void clearDraggingFilename();
|
void clearDraggingFilename();
|
||||||
|
|
||||||
static CMSWindowsDropTarget&
|
static MSWindowsDropTarget&
|
||||||
instance();
|
instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -54,6 +54,6 @@ private:
|
||||||
bool m_allowDrop;
|
bool m_allowDrop;
|
||||||
std::string m_dragFilename;
|
std::string m_dragFilename;
|
||||||
|
|
||||||
static CMSWindowsDropTarget*
|
static MSWindowsDropTarget*
|
||||||
s_instance;
|
s_instance;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,10 +30,10 @@ class EventQueueTimer { };
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsEventQueueBuffer
|
// MSWindowsEventQueueBuffer
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsEventQueueBuffer::CMSWindowsEventQueueBuffer(IEventQueue* events) :
|
MSWindowsEventQueueBuffer::MSWindowsEventQueueBuffer(IEventQueue* events) :
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
// remember thread. we'll be posting messages to it.
|
// remember thread. we'll be posting messages to it.
|
||||||
|
@ -50,13 +50,13 @@ CMSWindowsEventQueueBuffer::CMSWindowsEventQueueBuffer(IEventQueue* events) :
|
||||||
PeekMessage(&dummy, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
PeekMessage(&dummy, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsEventQueueBuffer::~CMSWindowsEventQueueBuffer()
|
MSWindowsEventQueueBuffer::~MSWindowsEventQueueBuffer()
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsEventQueueBuffer::waitForEvent(double timeout)
|
MSWindowsEventQueueBuffer::waitForEvent(double timeout)
|
||||||
{
|
{
|
||||||
// check if messages are available first. if we don't do this then
|
// check if messages are available first. if we don't do this then
|
||||||
// MsgWaitForMultipleObjects() will block even if the queue isn't
|
// MsgWaitForMultipleObjects() will block even if the queue isn't
|
||||||
|
@ -83,7 +83,7 @@ CMSWindowsEventQueueBuffer::waitForEvent(double timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
IEventQueueBuffer::Type
|
IEventQueueBuffer::Type
|
||||||
CMSWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
|
MSWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
|
||||||
{
|
{
|
||||||
// peek at messages first. waiting for QS_ALLINPUT will return
|
// peek at messages first. waiting for QS_ALLINPUT will return
|
||||||
// if a message has been sent to our window but GetMessage will
|
// if a message has been sent to our window but GetMessage will
|
||||||
|
@ -119,26 +119,26 @@ CMSWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsEventQueueBuffer::addEvent(UInt32 dataID)
|
MSWindowsEventQueueBuffer::addEvent(UInt32 dataID)
|
||||||
{
|
{
|
||||||
return (PostThreadMessage(m_thread, m_userEvent,
|
return (PostThreadMessage(m_thread, m_userEvent,
|
||||||
static_cast<WPARAM>(dataID), 0) != 0);
|
static_cast<WPARAM>(dataID), 0) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsEventQueueBuffer::isEmpty() const
|
MSWindowsEventQueueBuffer::isEmpty() const
|
||||||
{
|
{
|
||||||
return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0);
|
return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventQueueTimer*
|
EventQueueTimer*
|
||||||
CMSWindowsEventQueueBuffer::newTimer(double, bool) const
|
MSWindowsEventQueueBuffer::newTimer(double, bool) const
|
||||||
{
|
{
|
||||||
return new EventQueueTimer;
|
return new EventQueueTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
|
MSWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
|
||||||
{
|
{
|
||||||
delete timer;
|
delete timer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
|
|
||||||
//! Event queue buffer for Win32
|
//! Event queue buffer for Win32
|
||||||
class CMSWindowsEventQueueBuffer : public IEventQueueBuffer {
|
class MSWindowsEventQueueBuffer : public IEventQueueBuffer {
|
||||||
public:
|
public:
|
||||||
CMSWindowsEventQueueBuffer(IEventQueue* events);
|
MSWindowsEventQueueBuffer(IEventQueue* events);
|
||||||
virtual ~CMSWindowsEventQueueBuffer();
|
virtual ~MSWindowsEventQueueBuffer();
|
||||||
|
|
||||||
// IEventQueueBuffer overrides
|
// IEventQueueBuffer overrides
|
||||||
virtual void init() { }
|
virtual void init() { }
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
static const char* g_name = "synwinhk";
|
static const char* g_name = "synwinhk";
|
||||||
|
|
||||||
CMSWindowsHook::CMSWindowsHook() :
|
MSWindowsHook::MSWindowsHook() :
|
||||||
m_initFunc(NULL),
|
m_initFunc(NULL),
|
||||||
m_cleanupFunc(NULL),
|
m_cleanupFunc(NULL),
|
||||||
m_setSidesFunc(NULL),
|
m_setSidesFunc(NULL),
|
||||||
|
@ -33,7 +33,7 @@ CMSWindowsHook::CMSWindowsHook() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsHook::~CMSWindowsHook()
|
MSWindowsHook::~MSWindowsHook()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ CMSWindowsHook::~CMSWindowsHook()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsHook::loadLibrary()
|
MSWindowsHook::loadLibrary()
|
||||||
{
|
{
|
||||||
// load library
|
// load library
|
||||||
m_instance = LoadLibrary(g_name);
|
m_instance = LoadLibrary(g_name);
|
||||||
|
@ -77,13 +77,13 @@ CMSWindowsHook::loadLibrary()
|
||||||
}
|
}
|
||||||
|
|
||||||
HINSTANCE
|
HINSTANCE
|
||||||
CMSWindowsHook::getInstance() const
|
MSWindowsHook::getInstance() const
|
||||||
{
|
{
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
CMSWindowsHook::init(DWORD threadID)
|
MSWindowsHook::init(DWORD threadID)
|
||||||
{
|
{
|
||||||
if (m_initFunc == NULL) {
|
if (m_initFunc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -92,7 +92,7 @@ CMSWindowsHook::init(DWORD threadID)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
CMSWindowsHook::cleanup()
|
MSWindowsHook::cleanup()
|
||||||
{
|
{
|
||||||
if (m_cleanupFunc == NULL) {
|
if (m_cleanupFunc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -101,7 +101,7 @@ CMSWindowsHook::cleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsHook::setSides(UInt32 sides)
|
MSWindowsHook::setSides(UInt32 sides)
|
||||||
{
|
{
|
||||||
if (m_setSidesFunc == NULL) {
|
if (m_setSidesFunc == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -110,7 +110,7 @@ CMSWindowsHook::setSides(UInt32 sides)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsHook::setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
|
MSWindowsHook::setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
|
||||||
{
|
{
|
||||||
if (m_setZoneFunc == NULL) {
|
if (m_setZoneFunc == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +119,7 @@ CMSWindowsHook::setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneS
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsHook::setMode(EHookMode mode)
|
MSWindowsHook::setMode(EHookMode mode)
|
||||||
{
|
{
|
||||||
if (m_setModeFunc == NULL) {
|
if (m_setModeFunc == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
//! Loads and provides functions for the Windows hook
|
//! Loads and provides functions for the Windows hook
|
||||||
class CMSWindowsHook
|
class MSWindowsHook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMSWindowsHook();
|
MSWindowsHook();
|
||||||
virtual ~CMSWindowsHook();
|
virtual ~MSWindowsHook();
|
||||||
|
|
||||||
void loadLibrary();
|
void loadLibrary();
|
||||||
HINSTANCE getInstance() const;
|
HINSTANCE getInstance() const;
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsKeyState
|
// MSWindowsKeyState
|
||||||
//
|
//
|
||||||
|
|
||||||
// map virtual keys to synergy key enumeration
|
// map virtual keys to synergy key enumeration
|
||||||
const KeyID CMSWindowsKeyState::s_virtualKey[] =
|
const KeyID MSWindowsKeyState::s_virtualKey[] =
|
||||||
{
|
{
|
||||||
/* 0x000 */ { kKeyNone }, // reserved
|
/* 0x000 */ { kKeyNone }, // reserved
|
||||||
/* 0x001 */ { kKeyNone }, // VK_LBUTTON
|
/* 0x001 */ { kKeyNone }, // VK_LBUTTON
|
||||||
|
@ -576,8 +576,8 @@ static const Win32Modifiers s_modifiers[] =
|
||||||
{ VK_RWIN, KeyModifierSuper }
|
{ VK_RWIN, KeyModifierSuper }
|
||||||
};
|
};
|
||||||
|
|
||||||
CMSWindowsKeyState::CMSWindowsKeyState(
|
MSWindowsKeyState::MSWindowsKeyState(
|
||||||
CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events) :
|
MSWindowsDesks* desks, void* eventTarget, IEventQueue* events) :
|
||||||
KeyState(events),
|
KeyState(events),
|
||||||
m_eventTarget(eventTarget),
|
m_eventTarget(eventTarget),
|
||||||
m_desks(desks),
|
m_desks(desks),
|
||||||
|
@ -592,8 +592,8 @@ CMSWindowsKeyState::CMSWindowsKeyState(
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsKeyState::CMSWindowsKeyState(
|
MSWindowsKeyState::MSWindowsKeyState(
|
||||||
CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap) :
|
MSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap) :
|
||||||
KeyState(events, keyMap),
|
KeyState(events, keyMap),
|
||||||
m_eventTarget(eventTarget),
|
m_eventTarget(eventTarget),
|
||||||
m_desks(desks),
|
m_desks(desks),
|
||||||
|
@ -608,13 +608,13 @@ CMSWindowsKeyState::CMSWindowsKeyState(
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsKeyState::~CMSWindowsKeyState()
|
MSWindowsKeyState::~MSWindowsKeyState()
|
||||||
{
|
{
|
||||||
disable();
|
disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::init()
|
MSWindowsKeyState::init()
|
||||||
{
|
{
|
||||||
// look up symbol that's available on winNT family but not win95
|
// look up symbol that's available on winNT family but not win95
|
||||||
HMODULE userModule = GetModuleHandle("user32.dll");
|
HMODULE userModule = GetModuleHandle("user32.dll");
|
||||||
|
@ -622,7 +622,7 @@ CMSWindowsKeyState::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::disable()
|
MSWindowsKeyState::disable()
|
||||||
{
|
{
|
||||||
if (m_fixTimer != NULL) {
|
if (m_fixTimer != NULL) {
|
||||||
m_events->removeHandler(Event::kTimer, m_fixTimer);
|
m_events->removeHandler(Event::kTimer, m_fixTimer);
|
||||||
|
@ -633,19 +633,19 @@ CMSWindowsKeyState::disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyButton
|
KeyButton
|
||||||
CMSWindowsKeyState::virtualKeyToButton(UINT virtualKey) const
|
MSWindowsKeyState::virtualKeyToButton(UINT virtualKey) const
|
||||||
{
|
{
|
||||||
return m_virtualKeyToButton[virtualKey & 0xffu];
|
return m_virtualKeyToButton[virtualKey & 0xffu];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::setKeyLayout(HKL keyLayout)
|
MSWindowsKeyState::setKeyLayout(HKL keyLayout)
|
||||||
{
|
{
|
||||||
m_keyLayout = keyLayout;
|
m_keyLayout = keyLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsKeyState::testAutoRepeat(bool press, bool isRepeat, KeyButton button)
|
MSWindowsKeyState::testAutoRepeat(bool press, bool isRepeat, KeyButton button)
|
||||||
{
|
{
|
||||||
if (!isRepeat) {
|
if (!isRepeat) {
|
||||||
isRepeat = (press && m_lastDown != 0 && button == m_lastDown);
|
isRepeat = (press && m_lastDown != 0 && button == m_lastDown);
|
||||||
|
@ -660,14 +660,14 @@ CMSWindowsKeyState::testAutoRepeat(bool press, bool isRepeat, KeyButton button)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::saveModifiers()
|
MSWindowsKeyState::saveModifiers()
|
||||||
{
|
{
|
||||||
m_savedModifiers = getActiveModifiers();
|
m_savedModifiers = getActiveModifiers();
|
||||||
m_originalSavedModifiers = m_savedModifiers;
|
m_originalSavedModifiers = m_savedModifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::useSavedModifiers(bool enable)
|
MSWindowsKeyState::useSavedModifiers(bool enable)
|
||||||
{
|
{
|
||||||
if (enable != m_useSavedModifiers) {
|
if (enable != m_useSavedModifiers) {
|
||||||
m_useSavedModifiers = enable;
|
m_useSavedModifiers = enable;
|
||||||
|
@ -681,7 +681,7 @@ CMSWindowsKeyState::useSavedModifiers(bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyID
|
KeyID
|
||||||
CMSWindowsKeyState::mapKeyFromEvent(WPARAM charAndVirtKey,
|
MSWindowsKeyState::mapKeyFromEvent(WPARAM charAndVirtKey,
|
||||||
LPARAM info, KeyModifierMask* maskOut) const
|
LPARAM info, KeyModifierMask* maskOut) const
|
||||||
{
|
{
|
||||||
static const KeyModifierMask s_controlAlt =
|
static const KeyModifierMask s_controlAlt =
|
||||||
|
@ -735,14 +735,14 @@ CMSWindowsKeyState::mapKeyFromEvent(WPARAM charAndVirtKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsKeyState::didGroupsChange() const
|
MSWindowsKeyState::didGroupsChange() const
|
||||||
{
|
{
|
||||||
GroupList groups;
|
GroupList groups;
|
||||||
return (getGroups(groups) && groups != m_groups);
|
return (getGroups(groups) && groups != m_groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsKeyState::mapKeyToVirtualKey(KeyID key) const
|
MSWindowsKeyState::mapKeyToVirtualKey(KeyID key) const
|
||||||
{
|
{
|
||||||
if (key == kKeyNone) {
|
if (key == kKeyNone) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -757,13 +757,13 @@ CMSWindowsKeyState::mapKeyToVirtualKey(KeyID key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState)
|
MSWindowsKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState)
|
||||||
{
|
{
|
||||||
KeyState::onKey(button, down, newState);
|
KeyState::onKey(button, down, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::sendKeyEvent(void* target,
|
MSWindowsKeyState::sendKeyEvent(void* target,
|
||||||
bool press, bool isAutoRepeat,
|
bool press, bool isAutoRepeat,
|
||||||
KeyID key, KeyModifierMask mask,
|
KeyID key, KeyModifierMask mask,
|
||||||
SInt32 count, KeyButton button)
|
SInt32 count, KeyButton button)
|
||||||
|
@ -789,21 +789,21 @@ CMSWindowsKeyState::sendKeyEvent(void* target,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask,
|
MSWindowsKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask,
|
||||||
KeyButton button)
|
KeyButton button)
|
||||||
{
|
{
|
||||||
KeyState::fakeKeyDown(id, mask, button);
|
KeyState::fakeKeyDown(id, mask, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsKeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
|
MSWindowsKeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
|
||||||
SInt32 count, KeyButton button)
|
SInt32 count, KeyButton button)
|
||||||
{
|
{
|
||||||
return KeyState::fakeKeyRepeat(id, mask, count, button);
|
return KeyState::fakeKeyRepeat(id, mask, count, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsKeyState::fakeCtrlAltDel()
|
MSWindowsKeyState::fakeCtrlAltDel()
|
||||||
{
|
{
|
||||||
// to fake ctrl+alt+del on the NT family we broadcast a suitable
|
// to fake ctrl+alt+del on the NT family we broadcast a suitable
|
||||||
// hotkey to all windows on the winlogon desktop. however, the
|
// hotkey to all windows on the winlogon desktop. however, the
|
||||||
|
@ -817,7 +817,7 @@ CMSWindowsKeyState::fakeCtrlAltDel()
|
||||||
CloseHandle( hEvtSendSas );
|
CloseHandle( hEvtSendSas );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Thread cad(new FunctionJob(&CMSWindowsKeyState::ctrlAltDelThread));
|
Thread cad(new FunctionJob(&MSWindowsKeyState::ctrlAltDelThread));
|
||||||
cad.wait();
|
cad.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ CMSWindowsKeyState::fakeCtrlAltDel()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::ctrlAltDelThread(void*)
|
MSWindowsKeyState::ctrlAltDelThread(void*)
|
||||||
{
|
{
|
||||||
// get the Winlogon desktop at whatever privilege we can
|
// get the Winlogon desktop at whatever privilege we can
|
||||||
HDESK desk = OpenDesktop("Winlogon", 0, FALSE, MAXIMUM_ALLOWED);
|
HDESK desk = OpenDesktop("Winlogon", 0, FALSE, MAXIMUM_ALLOWED);
|
||||||
|
@ -845,7 +845,7 @@ CMSWindowsKeyState::ctrlAltDelThread(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyModifierMask
|
KeyModifierMask
|
||||||
CMSWindowsKeyState::pollActiveModifiers() const
|
MSWindowsKeyState::pollActiveModifiers() const
|
||||||
{
|
{
|
||||||
KeyModifierMask state = 0;
|
KeyModifierMask state = 0;
|
||||||
|
|
||||||
|
@ -872,7 +872,7 @@ CMSWindowsKeyState::pollActiveModifiers() const
|
||||||
}
|
}
|
||||||
|
|
||||||
SInt32
|
SInt32
|
||||||
CMSWindowsKeyState::pollActiveGroup() const
|
MSWindowsKeyState::pollActiveGroup() const
|
||||||
{
|
{
|
||||||
// determine the thread that'll receive this event
|
// determine the thread that'll receive this event
|
||||||
HWND targetWindow = GetForegroundWindow();
|
HWND targetWindow = GetForegroundWindow();
|
||||||
|
@ -900,7 +900,7 @@ CMSWindowsKeyState::pollActiveGroup() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
|
MSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
|
||||||
{
|
{
|
||||||
BYTE keyState[256];
|
BYTE keyState[256];
|
||||||
if (!GetKeyboardState(keyState)) {
|
if (!GetKeyboardState(keyState)) {
|
||||||
|
@ -918,7 +918,7 @@ CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
|
MSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
|
||||||
{
|
{
|
||||||
// update keyboard groups
|
// update keyboard groups
|
||||||
if (getGroups(m_groups)) {
|
if (getGroups(m_groups)) {
|
||||||
|
@ -1230,7 +1230,7 @@ CMSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::fakeKey(const Keystroke& keystroke)
|
MSWindowsKeyState::fakeKey(const Keystroke& keystroke)
|
||||||
{
|
{
|
||||||
switch (keystroke.m_type) {
|
switch (keystroke.m_type) {
|
||||||
case Keystroke::kButton: {
|
case Keystroke::kButton: {
|
||||||
|
@ -1286,7 +1286,7 @@ CMSWindowsKeyState::fakeKey(const Keystroke& keystroke)
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyModifierMask&
|
KeyModifierMask&
|
||||||
CMSWindowsKeyState::getActiveModifiersRValue()
|
MSWindowsKeyState::getActiveModifiersRValue()
|
||||||
{
|
{
|
||||||
if (m_useSavedModifiers) {
|
if (m_useSavedModifiers) {
|
||||||
return m_savedModifiers;
|
return m_savedModifiers;
|
||||||
|
@ -1297,7 +1297,7 @@ CMSWindowsKeyState::getActiveModifiersRValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsKeyState::getGroups(GroupList& groups) const
|
MSWindowsKeyState::getGroups(GroupList& groups) const
|
||||||
{
|
{
|
||||||
// get keyboard layouts
|
// get keyboard layouts
|
||||||
UInt32 newNumLayouts = GetKeyboardLayoutList(0, NULL);
|
UInt32 newNumLayouts = GetKeyboardLayoutList(0, NULL);
|
||||||
|
@ -1320,7 +1320,7 @@ CMSWindowsKeyState::getGroups(GroupList& groups) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::setWindowGroup(SInt32 group)
|
MSWindowsKeyState::setWindowGroup(SInt32 group)
|
||||||
{
|
{
|
||||||
HWND targetWindow = GetForegroundWindow();
|
HWND targetWindow = GetForegroundWindow();
|
||||||
|
|
||||||
|
@ -1339,7 +1339,7 @@ CMSWindowsKeyState::setWindowGroup(SInt32 group)
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyID
|
KeyID
|
||||||
CMSWindowsKeyState::getKeyID(UINT virtualKey, KeyButton button)
|
MSWindowsKeyState::getKeyID(UINT virtualKey, KeyButton button)
|
||||||
{
|
{
|
||||||
if ((button & 0x100u) != 0) {
|
if ((button & 0x100u) != 0) {
|
||||||
virtualKey += 0x100u;
|
virtualKey += 0x100u;
|
||||||
|
@ -1348,13 +1348,13 @@ CMSWindowsKeyState::getKeyID(UINT virtualKey, KeyButton button)
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsKeyState::mapButtonToVirtualKey(KeyButton button) const
|
MSWindowsKeyState::mapButtonToVirtualKey(KeyButton button) const
|
||||||
{
|
{
|
||||||
return m_buttonToVK[button];
|
return m_buttonToVK[button];
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyID
|
KeyID
|
||||||
CMSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item,
|
MSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item,
|
||||||
KeyButton button, UINT virtualKey,
|
KeyButton button, UINT virtualKey,
|
||||||
PBYTE keyState, HKL hkl) const
|
PBYTE keyState, HKL hkl) const
|
||||||
{
|
{
|
||||||
|
@ -1385,7 +1385,7 @@ CMSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsKeyState::addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item)
|
MSWindowsKeyState::addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item)
|
||||||
{
|
{
|
||||||
keyMap.addKeyEntry(item);
|
keyMap.addKeyEntry(item);
|
||||||
if (item.m_group == 0) {
|
if (item.m_group == 0) {
|
||||||
|
|
|
@ -27,18 +27,18 @@
|
||||||
|
|
||||||
class Event;
|
class Event;
|
||||||
class EventQueueTimer;
|
class EventQueueTimer;
|
||||||
class CMSWindowsDesks;
|
class MSWindowsDesks;
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
|
|
||||||
//! Microsoft Windows key mapper
|
//! Microsoft Windows key mapper
|
||||||
/*!
|
/*!
|
||||||
This class maps KeyIDs to keystrokes.
|
This class maps KeyIDs to keystrokes.
|
||||||
*/
|
*/
|
||||||
class CMSWindowsKeyState : public KeyState {
|
class MSWindowsKeyState : public KeyState {
|
||||||
public:
|
public:
|
||||||
CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events);
|
MSWindowsKeyState(MSWindowsDesks* desks, void* eventTarget, IEventQueue* events);
|
||||||
CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap);
|
MSWindowsKeyState(MSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap);
|
||||||
virtual ~CMSWindowsKeyState();
|
virtual ~MSWindowsKeyState();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
@ -185,15 +185,15 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// not implemented
|
// not implemented
|
||||||
CMSWindowsKeyState(const CMSWindowsKeyState&);
|
MSWindowsKeyState(const MSWindowsKeyState&);
|
||||||
CMSWindowsKeyState& operator=(const CMSWindowsKeyState&);
|
MSWindowsKeyState& operator=(const MSWindowsKeyState&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<HKL, SInt32> GroupMap;
|
typedef std::map<HKL, SInt32> GroupMap;
|
||||||
typedef std::map<KeyID, UINT> KeyToVKMap;
|
typedef std::map<KeyID, UINT> KeyToVKMap;
|
||||||
|
|
||||||
void* m_eventTarget;
|
void* m_eventTarget;
|
||||||
CMSWindowsDesks* m_desks;
|
MSWindowsDesks* m_desks;
|
||||||
HKL m_keyLayout;
|
HKL m_keyLayout;
|
||||||
UINT m_buttonToVK[512];
|
UINT m_buttonToVK[512];
|
||||||
UINT m_buttonToNumpadVK[512];
|
UINT m_buttonToNumpadVK[512];
|
||||||
|
|
|
@ -84,13 +84,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsScreen
|
// MSWindowsScreen
|
||||||
//
|
//
|
||||||
|
|
||||||
HINSTANCE CMSWindowsScreen::s_windowInstance = NULL;
|
HINSTANCE MSWindowsScreen::s_windowInstance = NULL;
|
||||||
CMSWindowsScreen* CMSWindowsScreen::s_screen = NULL;
|
MSWindowsScreen* MSWindowsScreen::s_screen = NULL;
|
||||||
|
|
||||||
CMSWindowsScreen::CMSWindowsScreen(
|
MSWindowsScreen::MSWindowsScreen(
|
||||||
bool isPrimary,
|
bool isPrimary,
|
||||||
bool noHooks,
|
bool noHooks,
|
||||||
bool stopOnDeskSwitch,
|
bool stopOnDeskSwitch,
|
||||||
|
@ -133,17 +133,17 @@ CMSWindowsScreen::CMSWindowsScreen(
|
||||||
m_hook.loadLibrary();
|
m_hook.loadLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_screensaver = new CMSWindowsScreenSaver();
|
m_screensaver = new MSWindowsScreenSaver();
|
||||||
m_desks = new CMSWindowsDesks(
|
m_desks = new MSWindowsDesks(
|
||||||
m_isPrimary,
|
m_isPrimary,
|
||||||
m_noHooks,
|
m_noHooks,
|
||||||
m_hook.getInstance(),
|
m_hook.getInstance(),
|
||||||
m_screensaver,
|
m_screensaver,
|
||||||
m_events,
|
m_events,
|
||||||
new TMethodJob<CMSWindowsScreen>(
|
new TMethodJob<MSWindowsScreen>(
|
||||||
this, &CMSWindowsScreen::updateKeysCB),
|
this, &MSWindowsScreen::updateKeysCB),
|
||||||
stopOnDeskSwitch);
|
stopOnDeskSwitch);
|
||||||
m_keyState = new CMSWindowsKeyState(m_desks, getEventTarget(), m_events);
|
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
|
||||||
updateScreenShape();
|
updateScreenShape();
|
||||||
m_class = createWindowClass();
|
m_class = createWindowClass();
|
||||||
m_window = createWindow(m_class, "Synergy");
|
m_window = createWindow(m_class, "Synergy");
|
||||||
|
@ -163,7 +163,7 @@ CMSWindowsScreen::CMSWindowsScreen(
|
||||||
|
|
||||||
OleInitialize(0);
|
OleInitialize(0);
|
||||||
m_dropWindow = createDropWindow(m_class, "DropWindow");
|
m_dropWindow = createDropWindow(m_class, "DropWindow");
|
||||||
m_dropTarget = new CMSWindowsDropTarget();
|
m_dropTarget = new MSWindowsDropTarget();
|
||||||
RegisterDragDrop(m_dropWindow, m_dropTarget);
|
RegisterDragDrop(m_dropWindow, m_dropTarget);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
@ -178,14 +178,14 @@ CMSWindowsScreen::CMSWindowsScreen(
|
||||||
|
|
||||||
// install event handlers
|
// install event handlers
|
||||||
m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(),
|
m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(),
|
||||||
new TMethodEventJob<CMSWindowsScreen>(this,
|
new TMethodEventJob<MSWindowsScreen>(this,
|
||||||
&CMSWindowsScreen::handleSystemEvent));
|
&MSWindowsScreen::handleSystemEvent));
|
||||||
|
|
||||||
// install the platform event queue
|
// install the platform event queue
|
||||||
m_events->adoptBuffer(new CMSWindowsEventQueueBuffer(m_events));
|
m_events->adoptBuffer(new MSWindowsEventQueueBuffer(m_events));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsScreen::~CMSWindowsScreen()
|
MSWindowsScreen::~MSWindowsScreen()
|
||||||
{
|
{
|
||||||
assert(s_screen != NULL);
|
assert(s_screen != NULL);
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ CMSWindowsScreen::~CMSWindowsScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::init(HINSTANCE windowInstance)
|
MSWindowsScreen::init(HINSTANCE windowInstance)
|
||||||
{
|
{
|
||||||
assert(s_windowInstance == NULL);
|
assert(s_windowInstance == NULL);
|
||||||
assert(windowInstance != NULL);
|
assert(windowInstance != NULL);
|
||||||
|
@ -216,21 +216,21 @@ CMSWindowsScreen::init(HINSTANCE windowInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
HINSTANCE
|
HINSTANCE
|
||||||
CMSWindowsScreen::getWindowInstance()
|
MSWindowsScreen::getWindowInstance()
|
||||||
{
|
{
|
||||||
return s_windowInstance;
|
return s_windowInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::enable()
|
MSWindowsScreen::enable()
|
||||||
{
|
{
|
||||||
assert(m_isOnScreen == m_isPrimary);
|
assert(m_isOnScreen == m_isPrimary);
|
||||||
|
|
||||||
// we need to poll some things to fix them
|
// we need to poll some things to fix them
|
||||||
m_fixTimer = m_events->newTimer(1.0, NULL);
|
m_fixTimer = m_events->newTimer(1.0, NULL);
|
||||||
m_events->adoptHandler(Event::kTimer, m_fixTimer,
|
m_events->adoptHandler(Event::kTimer, m_fixTimer,
|
||||||
new TMethodEventJob<CMSWindowsScreen>(this,
|
new TMethodEventJob<MSWindowsScreen>(this,
|
||||||
&CMSWindowsScreen::handleFixes));
|
&MSWindowsScreen::handleFixes));
|
||||||
|
|
||||||
// install our clipboard snooper
|
// install our clipboard snooper
|
||||||
m_nextClipboardWindow = SetClipboardViewer(m_window);
|
m_nextClipboardWindow = SetClipboardViewer(m_window);
|
||||||
|
@ -254,7 +254,7 @@ CMSWindowsScreen::enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::disable()
|
MSWindowsScreen::disable()
|
||||||
{
|
{
|
||||||
// stop tracking the active desk
|
// stop tracking the active desk
|
||||||
m_desks->disable();
|
m_desks->disable();
|
||||||
|
@ -291,7 +291,7 @@ CMSWindowsScreen::disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::enter()
|
MSWindowsScreen::enter()
|
||||||
{
|
{
|
||||||
m_desks->enter();
|
m_desks->enter();
|
||||||
if (m_isPrimary) {
|
if (m_isPrimary) {
|
||||||
|
@ -324,7 +324,7 @@ CMSWindowsScreen::enter()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::leave()
|
MSWindowsScreen::leave()
|
||||||
{
|
{
|
||||||
// get keyboard layout of foreground window. we'll use this
|
// get keyboard layout of foreground window. we'll use this
|
||||||
// keyboard layout for translating keys sent to clients.
|
// keyboard layout for translating keys sent to clients.
|
||||||
|
@ -371,16 +371,16 @@ CMSWindowsScreen::leave()
|
||||||
|
|
||||||
if (isDraggingStarted() && !m_isPrimary) {
|
if (isDraggingStarted() && !m_isPrimary) {
|
||||||
m_sendDragThread = new Thread(
|
m_sendDragThread = new Thread(
|
||||||
new TMethodJob<CMSWindowsScreen>(
|
new TMethodJob<MSWindowsScreen>(
|
||||||
this,
|
this,
|
||||||
&CMSWindowsScreen::sendDragThread));
|
&MSWindowsScreen::sendDragThread));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::sendDragThread(void*)
|
MSWindowsScreen::sendDragThread(void*)
|
||||||
{
|
{
|
||||||
String& draggingFilename = getDraggingFilename();
|
String& draggingFilename = getDraggingFilename();
|
||||||
size_t size = draggingFilename.size();
|
size_t size = draggingFilename.size();
|
||||||
|
@ -399,9 +399,9 @@ CMSWindowsScreen::sendDragThread(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src)
|
MSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard dst(m_window);
|
MSWindowsClipboard dst(m_window);
|
||||||
if (src != NULL) {
|
if (src != NULL) {
|
||||||
// save clipboard data
|
// save clipboard data
|
||||||
return Clipboard::copy(&dst, src);
|
return Clipboard::copy(&dst, src);
|
||||||
|
@ -418,7 +418,7 @@ CMSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::checkClipboards()
|
MSWindowsScreen::checkClipboards()
|
||||||
{
|
{
|
||||||
// if we think we own the clipboard but we don't then somebody
|
// if we think we own the clipboard but we don't then somebody
|
||||||
// grabbed the clipboard on this screen without us knowing.
|
// grabbed the clipboard on this screen without us knowing.
|
||||||
|
@ -431,7 +431,7 @@ CMSWindowsScreen::checkClipboards()
|
||||||
// next reboot we do this double check. clipboard ownership
|
// next reboot we do this double check. clipboard ownership
|
||||||
// won't be reflected on other screens until we leave but at
|
// won't be reflected on other screens until we leave but at
|
||||||
// least the clipboard itself will work.
|
// least the clipboard itself will work.
|
||||||
if (m_ownClipboard && !CMSWindowsClipboard::isOwnedBySynergy()) {
|
if (m_ownClipboard && !MSWindowsClipboard::isOwnedBySynergy()) {
|
||||||
LOG((CLOG_DEBUG "clipboard changed: lost ownership and no notification received"));
|
LOG((CLOG_DEBUG "clipboard changed: lost ownership and no notification received"));
|
||||||
m_ownClipboard = false;
|
m_ownClipboard = false;
|
||||||
sendClipboardEvent(m_events->forIScreen().clipboardGrabbed(), kClipboardClipboard);
|
sendClipboardEvent(m_events->forIScreen().clipboardGrabbed(), kClipboardClipboard);
|
||||||
|
@ -440,7 +440,7 @@ CMSWindowsScreen::checkClipboards()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::openScreensaver(bool notify)
|
MSWindowsScreen::openScreensaver(bool notify)
|
||||||
{
|
{
|
||||||
assert(m_screensaver != NULL);
|
assert(m_screensaver != NULL);
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ CMSWindowsScreen::openScreensaver(bool notify)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::closeScreensaver()
|
MSWindowsScreen::closeScreensaver()
|
||||||
{
|
{
|
||||||
if (m_screensaver != NULL) {
|
if (m_screensaver != NULL) {
|
||||||
if (m_screensaverNotify) {
|
if (m_screensaverNotify) {
|
||||||
|
@ -468,7 +468,7 @@ CMSWindowsScreen::closeScreensaver()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::screensaver(bool activate)
|
MSWindowsScreen::screensaver(bool activate)
|
||||||
{
|
{
|
||||||
assert(m_screensaver != NULL);
|
assert(m_screensaver != NULL);
|
||||||
if (m_screensaver==NULL) return;
|
if (m_screensaver==NULL) return;
|
||||||
|
@ -482,45 +482,45 @@ CMSWindowsScreen::screensaver(bool activate)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::resetOptions()
|
MSWindowsScreen::resetOptions()
|
||||||
{
|
{
|
||||||
m_desks->resetOptions();
|
m_desks->resetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::setOptions(const OptionsList& options)
|
MSWindowsScreen::setOptions(const OptionsList& options)
|
||||||
{
|
{
|
||||||
m_desks->setOptions(options);
|
m_desks->setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::setSequenceNumber(UInt32 seqNum)
|
MSWindowsScreen::setSequenceNumber(UInt32 seqNum)
|
||||||
{
|
{
|
||||||
m_sequenceNumber = seqNum;
|
m_sequenceNumber = seqNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::isPrimary() const
|
MSWindowsScreen::isPrimary() const
|
||||||
{
|
{
|
||||||
return m_isPrimary;
|
return m_isPrimary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void*
|
||||||
CMSWindowsScreen::getEventTarget() const
|
MSWindowsScreen::getEventTarget() const
|
||||||
{
|
{
|
||||||
return const_cast<CMSWindowsScreen*>(this);
|
return const_cast<MSWindowsScreen*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::getClipboard(ClipboardID, IClipboard* dst) const
|
MSWindowsScreen::getClipboard(ClipboardID, IClipboard* dst) const
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard src(m_window);
|
MSWindowsClipboard src(m_window);
|
||||||
Clipboard::copy(dst, &src);
|
Clipboard::copy(dst, &src);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
MSWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
{
|
{
|
||||||
assert(m_class != 0);
|
assert(m_class != 0);
|
||||||
|
|
||||||
|
@ -531,13 +531,13 @@ CMSWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
|
MSWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
|
||||||
{
|
{
|
||||||
m_desks->getCursorPos(x, y);
|
m_desks->getCursorPos(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::reconfigure(UInt32 activeSides)
|
MSWindowsScreen::reconfigure(UInt32 activeSides)
|
||||||
{
|
{
|
||||||
assert(m_isPrimary);
|
assert(m_isPrimary);
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ CMSWindowsScreen::reconfigure(UInt32 activeSides)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::warpCursor(SInt32 x, SInt32 y)
|
MSWindowsScreen::warpCursor(SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
// warp mouse
|
// warp mouse
|
||||||
warpCursorNoFlush(x, y);
|
warpCursorNoFlush(x, y);
|
||||||
|
@ -562,7 +562,7 @@ CMSWindowsScreen::warpCursor(SInt32 x, SInt32 y)
|
||||||
saveMousePosition(x, y);
|
saveMousePosition(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
|
void MSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
|
||||||
|
|
||||||
m_xCursor = x;
|
m_xCursor = x;
|
||||||
m_yCursor = y;
|
m_yCursor = y;
|
||||||
|
@ -571,7 +571,7 @@ void CMSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32
|
UInt32
|
||||||
CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
// only allow certain modifiers
|
// only allow certain modifiers
|
||||||
if ((mask & ~(KeyModifierShift | KeyModifierControl |
|
if ((mask & ~(KeyModifierShift | KeyModifierControl |
|
||||||
|
@ -648,7 +648,7 @@ CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::unregisterHotKey(UInt32 id)
|
MSWindowsScreen::unregisterHotKey(UInt32 id)
|
||||||
{
|
{
|
||||||
// look up hotkey
|
// look up hotkey
|
||||||
HotKeyMap::iterator i = m_hotKeys.find(id);
|
HotKeyMap::iterator i = m_hotKeys.find(id);
|
||||||
|
@ -678,7 +678,7 @@ CMSWindowsScreen::unregisterHotKey(UInt32 id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeInputBegin()
|
MSWindowsScreen::fakeInputBegin()
|
||||||
{
|
{
|
||||||
assert(m_isPrimary);
|
assert(m_isPrimary);
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ CMSWindowsScreen::fakeInputBegin()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeInputEnd()
|
MSWindowsScreen::fakeInputEnd()
|
||||||
{
|
{
|
||||||
assert(m_isPrimary);
|
assert(m_isPrimary);
|
||||||
|
|
||||||
|
@ -700,13 +700,13 @@ CMSWindowsScreen::fakeInputEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
SInt32
|
SInt32
|
||||||
CMSWindowsScreen::getJumpZoneSize() const
|
MSWindowsScreen::getJumpZoneSize() const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
|
MSWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
|
||||||
{
|
{
|
||||||
static const char* buttonToName[] = {
|
static const char* buttonToName[] = {
|
||||||
"<invalid>",
|
"<invalid>",
|
||||||
|
@ -729,14 +729,14 @@ CMSWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::getCursorCenter(SInt32& x, SInt32& y) const
|
MSWindowsScreen::getCursorCenter(SInt32& x, SInt32& y) const
|
||||||
{
|
{
|
||||||
x = m_xCenter;
|
x = m_xCenter;
|
||||||
y = m_yCenter;
|
y = m_yCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeMouseButton(ButtonID id, bool press)
|
MSWindowsScreen::fakeMouseButton(ButtonID id, bool press)
|
||||||
{
|
{
|
||||||
m_desks->fakeMouseButton(id, press);
|
m_desks->fakeMouseButton(id, press);
|
||||||
|
|
||||||
|
@ -753,7 +753,7 @@ CMSWindowsScreen::fakeMouseButton(ButtonID id, bool press)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
|
MSWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
m_desks->fakeMouseMove(x, y);
|
m_desks->fakeMouseMove(x, y);
|
||||||
if (m_buttons[kButtonLeft]) {
|
if (m_buttons[kButtonLeft]) {
|
||||||
|
@ -762,25 +762,25 @@ CMSWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
MSWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
{
|
{
|
||||||
m_desks->fakeMouseRelativeMove(dx, dy);
|
m_desks->fakeMouseRelativeMove(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
MSWindowsScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
||||||
{
|
{
|
||||||
m_desks->fakeMouseWheel(xDelta, yDelta);
|
m_desks->fakeMouseWheel(xDelta, yDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateKeys()
|
MSWindowsScreen::updateKeys()
|
||||||
{
|
{
|
||||||
m_desks->updateKeys();
|
m_desks->updateKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
|
MSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
|
||||||
KeyButton button)
|
KeyButton button)
|
||||||
{
|
{
|
||||||
PlatformScreen::fakeKeyDown(id, mask, button);
|
PlatformScreen::fakeKeyDown(id, mask, button);
|
||||||
|
@ -788,7 +788,7 @@ CMSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
|
MSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
|
||||||
SInt32 count, KeyButton button)
|
SInt32 count, KeyButton button)
|
||||||
{
|
{
|
||||||
bool result = PlatformScreen::fakeKeyRepeat(id, mask, count, button);
|
bool result = PlatformScreen::fakeKeyRepeat(id, mask, count, button);
|
||||||
|
@ -797,7 +797,7 @@ CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::fakeKeyUp(KeyButton button)
|
MSWindowsScreen::fakeKeyUp(KeyButton button)
|
||||||
{
|
{
|
||||||
bool result = PlatformScreen::fakeKeyUp(button);
|
bool result = PlatformScreen::fakeKeyUp(button);
|
||||||
updateForceShowCursor();
|
updateForceShowCursor();
|
||||||
|
@ -805,14 +805,14 @@ CMSWindowsScreen::fakeKeyUp(KeyButton button)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeAllKeysUp()
|
MSWindowsScreen::fakeAllKeysUp()
|
||||||
{
|
{
|
||||||
PlatformScreen::fakeAllKeysUp();
|
PlatformScreen::fakeAllKeysUp();
|
||||||
updateForceShowCursor();
|
updateForceShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
HCURSOR
|
HCURSOR
|
||||||
CMSWindowsScreen::createBlankCursor() const
|
MSWindowsScreen::createBlankCursor() const
|
||||||
{
|
{
|
||||||
// create a transparent cursor
|
// create a transparent cursor
|
||||||
int cw = GetSystemMetrics(SM_CXCURSOR);
|
int cw = GetSystemMetrics(SM_CXCURSOR);
|
||||||
|
@ -829,7 +829,7 @@ CMSWindowsScreen::createBlankCursor() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::destroyCursor(HCURSOR cursor) const
|
MSWindowsScreen::destroyCursor(HCURSOR cursor) const
|
||||||
{
|
{
|
||||||
if (cursor != NULL) {
|
if (cursor != NULL) {
|
||||||
DestroyCursor(cursor);
|
DestroyCursor(cursor);
|
||||||
|
@ -837,12 +837,12 @@ CMSWindowsScreen::destroyCursor(HCURSOR cursor) const
|
||||||
}
|
}
|
||||||
|
|
||||||
ATOM
|
ATOM
|
||||||
CMSWindowsScreen::createWindowClass() const
|
MSWindowsScreen::createWindowClass() const
|
||||||
{
|
{
|
||||||
WNDCLASSEX classInfo;
|
WNDCLASSEX classInfo;
|
||||||
classInfo.cbSize = sizeof(classInfo);
|
classInfo.cbSize = sizeof(classInfo);
|
||||||
classInfo.style = CS_DBLCLKS | CS_NOCLOSE;
|
classInfo.style = CS_DBLCLKS | CS_NOCLOSE;
|
||||||
classInfo.lpfnWndProc = &CMSWindowsScreen::wndProc;
|
classInfo.lpfnWndProc = &MSWindowsScreen::wndProc;
|
||||||
classInfo.cbClsExtra = 0;
|
classInfo.cbClsExtra = 0;
|
||||||
classInfo.cbWndExtra = 0;
|
classInfo.cbWndExtra = 0;
|
||||||
classInfo.hInstance = s_windowInstance;
|
classInfo.hInstance = s_windowInstance;
|
||||||
|
@ -856,7 +856,7 @@ CMSWindowsScreen::createWindowClass() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::destroyClass(ATOM windowClass) const
|
MSWindowsScreen::destroyClass(ATOM windowClass) const
|
||||||
{
|
{
|
||||||
if (windowClass != 0) {
|
if (windowClass != 0) {
|
||||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), s_windowInstance);
|
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), s_windowInstance);
|
||||||
|
@ -864,7 +864,7 @@ CMSWindowsScreen::destroyClass(ATOM windowClass) const
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND
|
||||||
CMSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
|
MSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
|
||||||
{
|
{
|
||||||
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
||||||
WS_EX_TRANSPARENT |
|
WS_EX_TRANSPARENT |
|
||||||
|
@ -884,7 +884,7 @@ CMSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND
|
||||||
CMSWindowsScreen::createDropWindow(ATOM windowClass, const char* name) const
|
MSWindowsScreen::createDropWindow(ATOM windowClass, const char* name) const
|
||||||
{
|
{
|
||||||
HWND window = CreateWindowEx(
|
HWND window = CreateWindowEx(
|
||||||
WS_EX_TOPMOST |
|
WS_EX_TOPMOST |
|
||||||
|
@ -907,7 +907,7 @@ CMSWindowsScreen::createDropWindow(ATOM windowClass, const char* name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::destroyWindow(HWND hwnd) const
|
MSWindowsScreen::destroyWindow(HWND hwnd) const
|
||||||
{
|
{
|
||||||
if (hwnd != NULL) {
|
if (hwnd != NULL) {
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
@ -915,13 +915,13 @@ CMSWindowsScreen::destroyWindow(HWND hwnd) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::sendEvent(Event::Type type, void* data)
|
MSWindowsScreen::sendEvent(Event::Type type, void* data)
|
||||||
{
|
{
|
||||||
m_events->addEvent(Event(type, getEventTarget(), data));
|
m_events->addEvent(Event(type, getEventTarget(), data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
|
MSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
|
||||||
{
|
{
|
||||||
ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo));
|
ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo));
|
||||||
if(info == NULL) {
|
if(info == NULL) {
|
||||||
|
@ -934,7 +934,7 @@ CMSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::handleSystemEvent(const Event& event, void*)
|
MSWindowsScreen::handleSystemEvent(const Event& event, void*)
|
||||||
{
|
{
|
||||||
MSG* msg = reinterpret_cast<MSG*>(event.getData());
|
MSG* msg = reinterpret_cast<MSG*>(event.getData());
|
||||||
assert(msg != NULL);
|
assert(msg != NULL);
|
||||||
|
@ -950,7 +950,7 @@ CMSWindowsScreen::handleSystemEvent(const Event& event, void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateButtons()
|
MSWindowsScreen::updateButtons()
|
||||||
{
|
{
|
||||||
int numButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
|
int numButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
|
||||||
m_buttons[kButtonNone] = false;
|
m_buttons[kButtonNone] = false;
|
||||||
|
@ -964,13 +964,13 @@ CMSWindowsScreen::updateButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
IKeyState*
|
IKeyState*
|
||||||
CMSWindowsScreen::getKeyState() const
|
MSWindowsScreen::getKeyState() const
|
||||||
{
|
{
|
||||||
return m_keyState;
|
return m_keyState;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onPreDispatch(HWND hwnd,
|
MSWindowsScreen::onPreDispatch(HWND hwnd,
|
||||||
UINT message, WPARAM wParam, LPARAM lParam)
|
UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// handle event
|
// handle event
|
||||||
|
@ -991,7 +991,7 @@ CMSWindowsScreen::onPreDispatch(HWND hwnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onPreDispatchPrimary(HWND,
|
MSWindowsScreen::onPreDispatchPrimary(HWND,
|
||||||
UINT message, WPARAM wParam, LPARAM lParam)
|
UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG5 "handling pre-dispatch primary"));
|
LOG((CLOG_DEBUG5 "handling pre-dispatch primary"));
|
||||||
|
@ -1049,7 +1049,7 @@ CMSWindowsScreen::onPreDispatchPrimary(HWND,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onEvent(HWND, UINT msg,
|
MSWindowsScreen::onEvent(HWND, UINT msg,
|
||||||
WPARAM wParam, LPARAM lParam, LRESULT* result)
|
WPARAM wParam, LPARAM lParam, LRESULT* result)
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
@ -1109,14 +1109,14 @@ CMSWindowsScreen::onEvent(HWND, UINT msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onMark(UInt32 mark)
|
MSWindowsScreen::onMark(UInt32 mark)
|
||||||
{
|
{
|
||||||
m_markReceived = mark;
|
m_markReceived = mark;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
|
MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static const KeyModifierMask s_ctrlAlt =
|
static const KeyModifierMask s_ctrlAlt =
|
||||||
KeyModifierControl | KeyModifierAlt;
|
KeyModifierControl | KeyModifierAlt;
|
||||||
|
@ -1245,7 +1245,7 @@ CMSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
|
MSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// get the key info
|
// get the key info
|
||||||
KeyModifierMask state = getActiveModifiers();
|
KeyModifierMask state = getActiveModifiers();
|
||||||
|
@ -1292,7 +1292,7 @@ CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
|
MSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// get which button
|
// get which button
|
||||||
bool pressed = mapPressFromEvent(wParam, lParam);
|
bool pressed = mapPressFromEvent(wParam, lParam);
|
||||||
|
@ -1346,7 +1346,7 @@ CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
|
||||||
// - this actually records the current x,y as "last" a second time (it seems)
|
// - this actually records the current x,y as "last" a second time (it seems)
|
||||||
// 5. sends the delta movement to the client (could be +1,+1 or -1,+4 for example)
|
// 5. sends the delta movement to the client (could be +1,+1 or -1,+4 for example)
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||||
{
|
{
|
||||||
// compute motion delta (relative to the last known
|
// compute motion delta (relative to the last known
|
||||||
// mouse position)
|
// mouse position)
|
||||||
|
@ -1409,7 +1409,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
|
MSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
|
||||||
{
|
{
|
||||||
// ignore message if posted prior to last mark change
|
// ignore message if posted prior to last mark change
|
||||||
if (!ignore()) {
|
if (!ignore()) {
|
||||||
|
@ -1420,7 +1420,7 @@ CMSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onScreensaver(bool activated)
|
MSWindowsScreen::onScreensaver(bool activated)
|
||||||
{
|
{
|
||||||
// ignore this message if there are any other screen saver
|
// ignore this message if there are any other screen saver
|
||||||
// messages already in the queue. this is important because
|
// messages already in the queue. this is important because
|
||||||
|
@ -1460,7 +1460,7 @@ CMSWindowsScreen::onScreensaver(bool activated)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onDisplayChange()
|
MSWindowsScreen::onDisplayChange()
|
||||||
{
|
{
|
||||||
// screen resolution may have changed. save old shape.
|
// screen resolution may have changed. save old shape.
|
||||||
SInt32 xOld = m_x, yOld = m_y, wOld = m_w, hOld = m_h;
|
SInt32 xOld = m_x, yOld = m_y, wOld = m_w, hOld = m_h;
|
||||||
|
@ -1494,11 +1494,11 @@ CMSWindowsScreen::onDisplayChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::onClipboardChange()
|
MSWindowsScreen::onClipboardChange()
|
||||||
{
|
{
|
||||||
// now notify client that somebody changed the clipboard (unless
|
// now notify client that somebody changed the clipboard (unless
|
||||||
// we're the owner).
|
// we're the owner).
|
||||||
if (!CMSWindowsClipboard::isOwnedBySynergy()) {
|
if (!MSWindowsClipboard::isOwnedBySynergy()) {
|
||||||
if (m_ownClipboard) {
|
if (m_ownClipboard) {
|
||||||
LOG((CLOG_DEBUG "clipboard changed: lost ownership"));
|
LOG((CLOG_DEBUG "clipboard changed: lost ownership"));
|
||||||
m_ownClipboard = false;
|
m_ownClipboard = false;
|
||||||
|
@ -1515,7 +1515,7 @@ CMSWindowsScreen::onClipboardChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
|
MSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
// send an event that we can recognize before the mouse warp
|
// send an event that we can recognize before the mouse warp
|
||||||
PostThreadMessage(GetCurrentThreadId(), SYNERGY_MSG_PRE_WARP, x, y);
|
PostThreadMessage(GetCurrentThreadId(), SYNERGY_MSG_PRE_WARP, x, y);
|
||||||
|
@ -1565,7 +1565,7 @@ CMSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::nextMark()
|
MSWindowsScreen::nextMark()
|
||||||
{
|
{
|
||||||
// next mark
|
// next mark
|
||||||
++m_mark;
|
++m_mark;
|
||||||
|
@ -1575,13 +1575,13 @@ CMSWindowsScreen::nextMark()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::ignore() const
|
MSWindowsScreen::ignore() const
|
||||||
{
|
{
|
||||||
return (m_mark != m_markReceived);
|
return (m_mark != m_markReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateScreenShape()
|
MSWindowsScreen::updateScreenShape()
|
||||||
{
|
{
|
||||||
// get shape
|
// get shape
|
||||||
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
|
@ -1602,7 +1602,7 @@ CMSWindowsScreen::updateScreenShape()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::handleFixes(const Event&, void*)
|
MSWindowsScreen::handleFixes(const Event&, void*)
|
||||||
{
|
{
|
||||||
// fix clipboard chain
|
// fix clipboard chain
|
||||||
fixClipboardViewer();
|
fixClipboardViewer();
|
||||||
|
@ -1614,7 +1614,7 @@ CMSWindowsScreen::handleFixes(const Event&, void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fixClipboardViewer()
|
MSWindowsScreen::fixClipboardViewer()
|
||||||
{
|
{
|
||||||
// XXX -- disable this code for now. somehow it can cause an infinite
|
// XXX -- disable this code for now. somehow it can cause an infinite
|
||||||
// recursion in the WM_DRAWCLIPBOARD handler. either we're sending
|
// recursion in the WM_DRAWCLIPBOARD handler. either we're sending
|
||||||
|
@ -1631,12 +1631,12 @@ CMSWindowsScreen::fixClipboardViewer()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::enableSpecialKeys(bool enable) const
|
MSWindowsScreen::enableSpecialKeys(bool enable) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonID
|
ButtonID
|
||||||
CMSWindowsScreen::mapButtonFromEvent(WPARAM msg, LPARAM button) const
|
MSWindowsScreen::mapButtonFromEvent(WPARAM msg, LPARAM button) const
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
@ -1690,7 +1690,7 @@ CMSWindowsScreen::mapButtonFromEvent(WPARAM msg, LPARAM button) const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::mapPressFromEvent(WPARAM msg, LPARAM) const
|
MSWindowsScreen::mapPressFromEvent(WPARAM msg, LPARAM) const
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
@ -1727,7 +1727,7 @@ CMSWindowsScreen::mapPressFromEvent(WPARAM msg, LPARAM) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateKeysCB(void*)
|
MSWindowsScreen::updateKeysCB(void*)
|
||||||
{
|
{
|
||||||
// record which keys we think are down
|
// record which keys we think are down
|
||||||
bool down[IKeyState::kNumButtons];
|
bool down[IKeyState::kNumButtons];
|
||||||
|
@ -1760,7 +1760,7 @@ CMSWindowsScreen::updateKeysCB(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::forceShowCursor()
|
MSWindowsScreen::forceShowCursor()
|
||||||
{
|
{
|
||||||
// check for mouse
|
// check for mouse
|
||||||
m_hasMouse = (GetSystemMetrics(SM_MOUSEPRESENT) != 0);
|
m_hasMouse = (GetSystemMetrics(SM_MOUSEPRESENT) != 0);
|
||||||
|
@ -1793,7 +1793,7 @@ CMSWindowsScreen::forceShowCursor()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::updateForceShowCursor()
|
MSWindowsScreen::updateForceShowCursor()
|
||||||
{
|
{
|
||||||
DWORD oldFlags = m_mouseKeys.dwFlags;
|
DWORD oldFlags = m_mouseKeys.dwFlags;
|
||||||
|
|
||||||
|
@ -1814,7 +1814,7 @@ CMSWindowsScreen::updateForceShowCursor()
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
MSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
assert(s_screen != NULL);
|
assert(s_screen != NULL);
|
||||||
|
|
||||||
|
@ -1827,7 +1827,7 @@ CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeLocalKey(KeyButton button, bool press) const
|
MSWindowsScreen::fakeLocalKey(KeyButton button, bool press) const
|
||||||
{
|
{
|
||||||
INPUT input;
|
INPUT input;
|
||||||
input.type = INPUT_KEYBOARD;
|
input.type = INPUT_KEYBOARD;
|
||||||
|
@ -1840,10 +1840,10 @@ CMSWindowsScreen::fakeLocalKey(KeyButton button, bool press) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsScreen::HotKeyItem
|
// MSWindowsScreen::HotKeyItem
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsScreen::HotKeyItem::HotKeyItem(UINT keycode, UINT mask) :
|
MSWindowsScreen::HotKeyItem::HotKeyItem(UINT keycode, UINT mask) :
|
||||||
m_keycode(keycode),
|
m_keycode(keycode),
|
||||||
m_mask(mask)
|
m_mask(mask)
|
||||||
{
|
{
|
||||||
|
@ -1851,27 +1851,27 @@ CMSWindowsScreen::HotKeyItem::HotKeyItem(UINT keycode, UINT mask) :
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsScreen::HotKeyItem::getVirtualKey() const
|
MSWindowsScreen::HotKeyItem::getVirtualKey() const
|
||||||
{
|
{
|
||||||
return m_keycode;
|
return m_keycode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
|
MSWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
|
||||||
{
|
{
|
||||||
return (m_keycode < x.m_keycode ||
|
return (m_keycode < x.m_keycode ||
|
||||||
(m_keycode == x.m_keycode && m_mask < x.m_mask));
|
(m_keycode == x.m_keycode && m_mask < x.m_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreen::fakeDraggingFiles(DragFileList fileList)
|
MSWindowsScreen::fakeDraggingFiles(DragFileList fileList)
|
||||||
{
|
{
|
||||||
// possible design flaw: this function stops a "not implemented"
|
// possible design flaw: this function stops a "not implemented"
|
||||||
// exception from being thrown.
|
// exception from being thrown.
|
||||||
}
|
}
|
||||||
|
|
||||||
String&
|
String&
|
||||||
CMSWindowsScreen::getDraggingFilename()
|
MSWindowsScreen::getDraggingFilename()
|
||||||
{
|
{
|
||||||
if (m_draggingStarted) {
|
if (m_draggingStarted) {
|
||||||
m_dropTarget->clearDraggingFilename();
|
m_dropTarget->clearDraggingFilename();
|
||||||
|
@ -1927,13 +1927,13 @@ CMSWindowsScreen::getDraggingFilename()
|
||||||
}
|
}
|
||||||
|
|
||||||
const String&
|
const String&
|
||||||
CMSWindowsScreen::getDropTarget() const
|
MSWindowsScreen::getDropTarget() const
|
||||||
{
|
{
|
||||||
return m_desktopPath;
|
return m_desktopPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreen::isModifierRepeat(KeyModifierMask oldState, KeyModifierMask state, WPARAM wParam) const
|
MSWindowsScreen::isModifierRepeat(KeyModifierMask oldState, KeyModifierMask state, WPARAM wParam) const
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
|
|
@ -30,21 +30,21 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
class EventQueueTimer;
|
class EventQueueTimer;
|
||||||
class CMSWindowsDesks;
|
class MSWindowsDesks;
|
||||||
class CMSWindowsKeyState;
|
class MSWindowsKeyState;
|
||||||
class CMSWindowsScreenSaver;
|
class MSWindowsScreenSaver;
|
||||||
class Thread;
|
class Thread;
|
||||||
class CMSWindowsDropTarget;
|
class MSWindowsDropTarget;
|
||||||
|
|
||||||
//! Implementation of IPlatformScreen for Microsoft Windows
|
//! Implementation of IPlatformScreen for Microsoft Windows
|
||||||
class CMSWindowsScreen : public PlatformScreen {
|
class MSWindowsScreen : public PlatformScreen {
|
||||||
public:
|
public:
|
||||||
CMSWindowsScreen(
|
MSWindowsScreen(
|
||||||
bool isPrimary,
|
bool isPrimary,
|
||||||
bool noHooks,
|
bool noHooks,
|
||||||
bool stopOnDeskSwitch,
|
bool stopOnDeskSwitch,
|
||||||
IEventQueue* events);
|
IEventQueue* events);
|
||||||
virtual ~CMSWindowsScreen();
|
virtual ~MSWindowsScreen();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
@ -283,7 +283,7 @@ private:
|
||||||
HKL m_keyLayout;
|
HKL m_keyLayout;
|
||||||
|
|
||||||
// screen saver stuff
|
// screen saver stuff
|
||||||
CMSWindowsScreenSaver* m_screensaver;
|
MSWindowsScreenSaver* m_screensaver;
|
||||||
bool m_screensaverNotify;
|
bool m_screensaverNotify;
|
||||||
bool m_screensaverActive;
|
bool m_screensaverActive;
|
||||||
|
|
||||||
|
@ -294,10 +294,10 @@ private:
|
||||||
bool m_ownClipboard;
|
bool m_ownClipboard;
|
||||||
|
|
||||||
// one desk per desktop and a cond var to communicate with it
|
// one desk per desktop and a cond var to communicate with it
|
||||||
CMSWindowsDesks* m_desks;
|
MSWindowsDesks* m_desks;
|
||||||
|
|
||||||
// keyboard stuff
|
// keyboard stuff
|
||||||
CMSWindowsKeyState* m_keyState;
|
MSWindowsKeyState* m_keyState;
|
||||||
|
|
||||||
// hot key stuff
|
// hot key stuff
|
||||||
HotKeyMap m_hotKeys;
|
HotKeyMap m_hotKeys;
|
||||||
|
@ -324,16 +324,16 @@ private:
|
||||||
MOUSEKEYS m_mouseKeys;
|
MOUSEKEYS m_mouseKeys;
|
||||||
MOUSEKEYS m_oldMouseKeys;
|
MOUSEKEYS m_oldMouseKeys;
|
||||||
|
|
||||||
CMSWindowsHook m_hook;
|
MSWindowsHook m_hook;
|
||||||
|
|
||||||
static CMSWindowsScreen*
|
static MSWindowsScreen*
|
||||||
s_screen;
|
s_screen;
|
||||||
|
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
|
|
||||||
String m_desktopPath;
|
String m_desktopPath;
|
||||||
|
|
||||||
CMSWindowsDropTarget*
|
MSWindowsDropTarget*
|
||||||
m_dropTarget;
|
m_dropTarget;
|
||||||
HWND m_dropWindow;
|
HWND m_dropWindow;
|
||||||
const int m_dropWindowSize;
|
const int m_dropWindowSize;
|
||||||
|
|
|
@ -41,10 +41,10 @@ static const TCHAR* const g_pathScreenSaverIsSecure[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsScreenSaver
|
// MSWindowsScreenSaver
|
||||||
//
|
//
|
||||||
|
|
||||||
CMSWindowsScreenSaver::CMSWindowsScreenSaver() :
|
MSWindowsScreenSaver::MSWindowsScreenSaver() :
|
||||||
m_wasSecure(false),
|
m_wasSecure(false),
|
||||||
m_wasSecureAnInt(false),
|
m_wasSecureAnInt(false),
|
||||||
m_process(NULL),
|
m_process(NULL),
|
||||||
|
@ -56,13 +56,13 @@ CMSWindowsScreenSaver::CMSWindowsScreenSaver() :
|
||||||
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &m_wasEnabled, 0);
|
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &m_wasEnabled, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsScreenSaver::~CMSWindowsScreenSaver()
|
MSWindowsScreenSaver::~MSWindowsScreenSaver()
|
||||||
{
|
{
|
||||||
unwatchProcess();
|
unwatchProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
|
MSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// if already started then say it didn't just start
|
// if already started then say it didn't just start
|
||||||
if (m_active) {
|
if (m_active) {
|
||||||
|
@ -102,7 +102,7 @@ CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::enable()
|
MSWindowsScreenSaver::enable()
|
||||||
{
|
{
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, m_wasEnabled, 0, 0);
|
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, m_wasEnabled, 0, 0);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ CMSWindowsScreenSaver::enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::disable()
|
MSWindowsScreenSaver::disable()
|
||||||
{
|
{
|
||||||
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &m_wasEnabled, 0);
|
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &m_wasEnabled, 0);
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0);
|
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0);
|
||||||
|
@ -132,7 +132,7 @@ CMSWindowsScreenSaver::disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::activate()
|
MSWindowsScreenSaver::activate()
|
||||||
{
|
{
|
||||||
// don't activate if already active
|
// don't activate if already active
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
|
@ -152,7 +152,7 @@ CMSWindowsScreenSaver::activate()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::deactivate()
|
MSWindowsScreenSaver::deactivate()
|
||||||
{
|
{
|
||||||
bool killed = false;
|
bool killed = false;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ CMSWindowsScreenSaver::deactivate()
|
||||||
DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS);
|
DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS);
|
||||||
if (desktop != NULL) {
|
if (desktop != NULL) {
|
||||||
EnumDesktopWindows(desktop,
|
EnumDesktopWindows(desktop,
|
||||||
&CMSWindowsScreenSaver::killScreenSaverFunc,
|
&MSWindowsScreenSaver::killScreenSaverFunc,
|
||||||
reinterpret_cast<LPARAM>(&killed));
|
reinterpret_cast<LPARAM>(&killed));
|
||||||
CloseDesktop(desktop);
|
CloseDesktop(desktop);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ CMSWindowsScreenSaver::deactivate()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreenSaver::isActive() const
|
MSWindowsScreenSaver::isActive() const
|
||||||
{
|
{
|
||||||
BOOL running;
|
BOOL running;
|
||||||
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &running, 0);
|
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &running, 0);
|
||||||
|
@ -199,11 +199,11 @@ CMSWindowsScreenSaver::isActive() const
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK
|
BOOL CALLBACK
|
||||||
CMSWindowsScreenSaver::killScreenSaverFunc(HWND hwnd, LPARAM arg)
|
MSWindowsScreenSaver::killScreenSaverFunc(HWND hwnd, LPARAM arg)
|
||||||
{
|
{
|
||||||
if (IsWindowVisible(hwnd)) {
|
if (IsWindowVisible(hwnd)) {
|
||||||
HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
|
HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
|
||||||
if (instance != CMSWindowsScreen::getWindowInstance()) {
|
if (instance != MSWindowsScreen::getWindowInstance()) {
|
||||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
*reinterpret_cast<bool*>(arg) = true;
|
*reinterpret_cast<bool*>(arg) = true;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ CMSWindowsScreenSaver::killScreenSaverFunc(HWND hwnd, LPARAM arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::watchDesktop()
|
MSWindowsScreenSaver::watchDesktop()
|
||||||
{
|
{
|
||||||
// stop watching previous process/desktop
|
// stop watching previous process/desktop
|
||||||
unwatchProcess();
|
unwatchProcess();
|
||||||
|
@ -220,12 +220,12 @@ CMSWindowsScreenSaver::watchDesktop()
|
||||||
// watch desktop in another thread
|
// watch desktop in another thread
|
||||||
LOG((CLOG_DEBUG "watching screen saver desktop"));
|
LOG((CLOG_DEBUG "watching screen saver desktop"));
|
||||||
m_active = true;
|
m_active = true;
|
||||||
m_watch = new Thread(new TMethodJob<CMSWindowsScreenSaver>(this,
|
m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this,
|
||||||
&CMSWindowsScreenSaver::watchDesktopThread));
|
&MSWindowsScreenSaver::watchDesktopThread));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::watchProcess(HANDLE process)
|
MSWindowsScreenSaver::watchProcess(HANDLE process)
|
||||||
{
|
{
|
||||||
// stop watching previous process/desktop
|
// stop watching previous process/desktop
|
||||||
unwatchProcess();
|
unwatchProcess();
|
||||||
|
@ -235,13 +235,13 @@ CMSWindowsScreenSaver::watchProcess(HANDLE process)
|
||||||
LOG((CLOG_DEBUG "watching screen saver process"));
|
LOG((CLOG_DEBUG "watching screen saver process"));
|
||||||
m_process = process;
|
m_process = process;
|
||||||
m_active = true;
|
m_active = true;
|
||||||
m_watch = new Thread(new TMethodJob<CMSWindowsScreenSaver>(this,
|
m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this,
|
||||||
&CMSWindowsScreenSaver::watchProcessThread));
|
&MSWindowsScreenSaver::watchProcessThread));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::unwatchProcess()
|
MSWindowsScreenSaver::unwatchProcess()
|
||||||
{
|
{
|
||||||
if (m_watch != NULL) {
|
if (m_watch != NULL) {
|
||||||
LOG((CLOG_DEBUG "stopped watching screen saver process/desktop"));
|
LOG((CLOG_DEBUG "stopped watching screen saver process/desktop"));
|
||||||
|
@ -258,7 +258,7 @@ CMSWindowsScreenSaver::unwatchProcess()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::watchDesktopThread(void*)
|
MSWindowsScreenSaver::watchDesktopThread(void*)
|
||||||
{
|
{
|
||||||
DWORD reserved = 0;
|
DWORD reserved = 0;
|
||||||
TCHAR* name = NULL;
|
TCHAR* name = NULL;
|
||||||
|
@ -281,7 +281,7 @@ CMSWindowsScreenSaver::watchDesktopThread(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::watchProcessThread(void*)
|
MSWindowsScreenSaver::watchProcessThread(void*)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Thread::testCancel();
|
Thread::testCancel();
|
||||||
|
@ -298,7 +298,7 @@ CMSWindowsScreenSaver::watchProcessThread(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsScreenSaver::setSecure(bool secure, bool saveSecureAsInt)
|
MSWindowsScreenSaver::setSecure(bool secure, bool saveSecureAsInt)
|
||||||
{
|
{
|
||||||
HKEY hkey =
|
HKEY hkey =
|
||||||
ArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
|
ArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
|
||||||
|
@ -317,7 +317,7 @@ CMSWindowsScreenSaver::setSecure(bool secure, bool saveSecureAsInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const
|
MSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const
|
||||||
{
|
{
|
||||||
// get the password protection setting key
|
// get the password protection setting key
|
||||||
HKEY hkey =
|
HKEY hkey =
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
class Thread;
|
class Thread;
|
||||||
|
|
||||||
//! Microsoft windows screen saver implementation
|
//! Microsoft windows screen saver implementation
|
||||||
class CMSWindowsScreenSaver : public IScreenSaver {
|
class MSWindowsScreenSaver : public IScreenSaver {
|
||||||
public:
|
public:
|
||||||
CMSWindowsScreenSaver();
|
MSWindowsScreenSaver();
|
||||||
virtual ~CMSWindowsScreenSaver();
|
virtual ~MSWindowsScreenSaver();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -23,17 +23,17 @@
|
||||||
|
|
||||||
#include <Wtsapi32.h>
|
#include <Wtsapi32.h>
|
||||||
|
|
||||||
CMSWindowsSession::CMSWindowsSession() :
|
MSWindowsSession::MSWindowsSession() :
|
||||||
m_activeSessionId(-1)
|
m_activeSessionId(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsSession::~CMSWindowsSession()
|
MSWindowsSession::~MSWindowsSession()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
|
MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
|
||||||
{
|
{
|
||||||
// first we need to take a snapshot of the running processes
|
// first we need to take a snapshot of the running processes
|
||||||
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
|
@ -120,7 +120,7 @@ CMSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
CMSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
|
MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
|
||||||
{
|
{
|
||||||
HANDLE sourceToken;
|
HANDLE sourceToken;
|
||||||
if (!WTSQueryUserToken(m_activeSessionId, &sourceToken)) {
|
if (!WTSQueryUserToken(m_activeSessionId, &sourceToken)) {
|
||||||
|
@ -142,20 +142,20 @@ CMSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMSWindowsSession::hasChanged()
|
MSWindowsSession::hasChanged()
|
||||||
{
|
{
|
||||||
return (m_activeSessionId != WTSGetActiveConsoleSessionId());
|
return (m_activeSessionId != WTSGetActiveConsoleSessionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsSession::updateActiveSession()
|
MSWindowsSession::updateActiveSession()
|
||||||
{
|
{
|
||||||
m_activeSessionId = WTSGetActiveConsoleSessionId();
|
m_activeSessionId = WTSGetActiveConsoleSessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
|
MSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
|
||||||
{
|
{
|
||||||
BOOL gotEntry = Process32Next(snapshot, entry);
|
BOOL gotEntry = Process32Next(snapshot, entry);
|
||||||
if (!gotEntry) {
|
if (!gotEntry) {
|
||||||
|
@ -173,7 +173,7 @@ CMSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsSession::getActiveDesktopName()
|
MSWindowsSession::getActiveDesktopName()
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <Tlhelp32.h>
|
#include <Tlhelp32.h>
|
||||||
|
|
||||||
class CMSWindowsSession {
|
class MSWindowsSession {
|
||||||
public:
|
public:
|
||||||
CMSWindowsSession();
|
MSWindowsSession();
|
||||||
~CMSWindowsSession();
|
~MSWindowsSession();
|
||||||
|
|
||||||
//!
|
//!
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// CMSWindowsUtil
|
// MSWindowsUtil
|
||||||
//
|
//
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsUtil::getString(HINSTANCE instance, DWORD id)
|
MSWindowsUtil::getString(HINSTANCE instance, DWORD id)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int size = static_cast<int>(sizeof(buffer) / sizeof(buffer[0]));
|
int size = static_cast<int>(sizeof(buffer) / sizeof(buffer[0]));
|
||||||
|
@ -57,7 +57,7 @@ CMSWindowsUtil::getString(HINSTANCE instance, DWORD id)
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
CMSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id)
|
MSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id)
|
||||||
{
|
{
|
||||||
char* buffer;
|
char* buffer;
|
||||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define WINDOWS_LEAN_AND_MEAN
|
#define WINDOWS_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
class CMSWindowsUtil {
|
class MSWindowsUtil {
|
||||||
public:
|
public:
|
||||||
//! Get message string
|
//! Get message string
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -72,7 +72,7 @@ private:
|
||||||
IpcServer& m_ipcServer;
|
IpcServer& m_ipcServer;
|
||||||
IpcLogOutputter& m_ipcLogOutputter;
|
IpcLogOutputter& m_ipcLogOutputter;
|
||||||
bool m_elevateProcess;
|
bool m_elevateProcess;
|
||||||
CMSWindowsSession m_session;
|
MSWindowsSession m_session;
|
||||||
PROCESS_INFORMATION m_processInfo;
|
PROCESS_INFORMATION m_processInfo;
|
||||||
int m_processFailures;
|
int m_processFailures;
|
||||||
bool m_processRunning;
|
bool m_processRunning;
|
||||||
|
|
|
@ -173,7 +173,7 @@ synergy::Screen*
|
||||||
ClientApp::createScreen()
|
ClientApp::createScreen()
|
||||||
{
|
{
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_MSWINDOWS
|
||||||
return new synergy::Screen(new CMSWindowsScreen(
|
return new synergy::Screen(new MSWindowsScreen(
|
||||||
false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
||||||
#elif WINAPI_XWINDOWS
|
#elif WINAPI_XWINDOWS
|
||||||
return new synergy::Screen(new XWindowsScreen(
|
return new synergy::Screen(new XWindowsScreen(
|
||||||
|
|
|
@ -117,7 +117,7 @@ DaemonApp::run(int argc, char** argv)
|
||||||
{
|
{
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
// sends debug messages to visual studio console window.
|
// sends debug messages to visual studio console window.
|
||||||
log.insert(new CMSWindowsDebugOutputter());
|
log.insert(new MSWindowsDebugOutputter());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// default log level to system setting.
|
// default log level to system setting.
|
||||||
|
@ -228,7 +228,7 @@ DaemonApp::mainLoop(bool logToFile)
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
|
|
||||||
// install the platform event queue to handle service stop events.
|
// install the platform event queue to handle service stop events.
|
||||||
m_events->adoptBuffer(new CMSWindowsEventQueueBuffer(m_events));
|
m_events->adoptBuffer(new MSWindowsEventQueueBuffer(m_events));
|
||||||
|
|
||||||
String command = ARCH->setting("Command");
|
String command = ARCH->setting("Command");
|
||||||
bool elevate = ARCH->setting("Elevate") == "1";
|
bool elevate = ARCH->setting("Elevate") == "1";
|
||||||
|
|
|
@ -581,7 +581,7 @@ synergy::Screen*
|
||||||
ServerApp::createScreen()
|
ServerApp::createScreen()
|
||||||
{
|
{
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_MSWINDOWS
|
||||||
return new synergy::Screen(new CMSWindowsScreen(
|
return new synergy::Screen(new MSWindowsScreen(
|
||||||
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
||||||
#elif WINAPI_XWINDOWS
|
#elif WINAPI_XWINDOWS
|
||||||
return new synergy::Screen(new XWindowsScreen(
|
return new synergy::Screen(new XWindowsScreen(
|
||||||
|
|
|
@ -54,7 +54,7 @@ ToolApp::run(int argc, char** argv)
|
||||||
|
|
||||||
if (m_args.m_printActiveDesktopName) {
|
if (m_args.m_printActiveDesktopName) {
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
CMSWindowsSession session;
|
MSWindowsSession session;
|
||||||
String name = session.getActiveDesktopName();
|
String name = session.getActiveDesktopName();
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
LOG((CLOG_CRIT "failed to get active desktop name"));
|
LOG((CLOG_CRIT "failed to get active desktop name"));
|
||||||
|
|
|
@ -145,7 +145,7 @@ AppUtilWindows::run(int argc, char** argv)
|
||||||
// record window instance for tray icon, etc
|
// record window instance for tray icon, etc
|
||||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||||
|
|
||||||
CMSWindowsScreen::init(ArchMiscWindows::instanceWin32());
|
MSWindowsScreen::init(ArchMiscWindows::instanceWin32());
|
||||||
Thread::getCurrentThread().setPriority(-14);
|
Thread::getCurrentThread().setPriority(-14);
|
||||||
|
|
||||||
StartupFunc startup;
|
StartupFunc startup;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "test/global/gmock.h"
|
#include "test/global/gmock.h"
|
||||||
#include "test/global/gtest.h"
|
#include "test/global/gtest.h"
|
||||||
|
|
||||||
class CMSWindowsClipboardTests : public ::testing::Test
|
class MSWindowsClipboardTests : public ::testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
|
@ -38,7 +38,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void emptyClipboard()
|
void emptyClipboard()
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@ public:
|
||||||
MOCK_METHOD2(write, void(HANDLE, UINT));
|
MOCK_METHOD2(write, void(HANDLE, UINT));
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, emptyUnowned_openCalled_returnsTrue)
|
TEST_F(MSWindowsClipboardTests, emptyUnowned_openCalled_returnsTrue)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
bool actual = clipboard.emptyUnowned();
|
bool actual = clipboard.emptyUnowned();
|
||||||
|
@ -60,9 +60,9 @@ TEST_F(CMSWindowsClipboardTests, emptyUnowned_openCalled_returnsTrue)
|
||||||
EXPECT_EQ(true, actual);
|
EXPECT_EQ(true, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, empty_openCalled_returnsTrue)
|
TEST_F(MSWindowsClipboardTests, empty_openCalled_returnsTrue)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
bool actual = clipboard.empty();
|
bool actual = clipboard.empty();
|
||||||
|
@ -70,21 +70,21 @@ TEST_F(CMSWindowsClipboardTests, empty_openCalled_returnsTrue)
|
||||||
EXPECT_EQ(true, actual);
|
EXPECT_EQ(true, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, empty_singleFormat_hasReturnsFalse)
|
TEST_F(MSWindowsClipboardTests, empty_singleFormat_hasReturnsFalse)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.add(CMSWindowsClipboard::kText, "synergy rocks!");
|
clipboard.add(MSWindowsClipboard::kText, "synergy rocks!");
|
||||||
|
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
|
|
||||||
bool actual = clipboard.has(CMSWindowsClipboard::kText);
|
bool actual = clipboard.has(MSWindowsClipboard::kText);
|
||||||
EXPECT_EQ(false, actual);
|
EXPECT_EQ(false, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, add_newValue_valueWasStored)
|
TEST_F(MSWindowsClipboardTests, add_newValue_valueWasStored)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
clipboard.add(IClipboard::kText, "synergy rocks!");
|
clipboard.add(IClipboard::kText, "synergy rocks!");
|
||||||
|
@ -93,21 +93,21 @@ TEST_F(CMSWindowsClipboardTests, add_newValue_valueWasStored)
|
||||||
EXPECT_EQ("synergy rocks!", actual);
|
EXPECT_EQ("synergy rocks!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, add_newValue_writeWasCalled)
|
TEST_F(MSWindowsClipboardTests, add_newValue_writeWasCalled)
|
||||||
{
|
{
|
||||||
MockFacade facade;
|
MockFacade facade;
|
||||||
EXPECT_CALL(facade, write(testing::_, testing::_));
|
EXPECT_CALL(facade, write(testing::_, testing::_));
|
||||||
|
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.setFacade(facade);
|
clipboard.setFacade(facade);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
clipboard.add(IClipboard::kText, "synergy rocks!");
|
clipboard.add(IClipboard::kText, "synergy rocks!");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, add_replaceValue_valueWasReplaced)
|
TEST_F(MSWindowsClipboardTests, add_replaceValue_valueWasReplaced)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
clipboard.add(IClipboard::kText, "synergy rocks!");
|
clipboard.add(IClipboard::kText, "synergy rocks!");
|
||||||
|
@ -117,27 +117,27 @@ TEST_F(CMSWindowsClipboardTests, add_replaceValue_valueWasReplaced)
|
||||||
EXPECT_EQ("maxivista sucks", actual);
|
EXPECT_EQ("maxivista sucks", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, open_timeIsZero_returnsTrue)
|
TEST_F(MSWindowsClipboardTests, open_timeIsZero_returnsTrue)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
|
|
||||||
bool actual = clipboard.open(0);
|
bool actual = clipboard.open(0);
|
||||||
|
|
||||||
EXPECT_EQ(true, actual);
|
EXPECT_EQ(true, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, open_timeIsOne_returnsTrue)
|
TEST_F(MSWindowsClipboardTests, open_timeIsOne_returnsTrue)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
|
|
||||||
bool actual = clipboard.open(1);
|
bool actual = clipboard.open(1);
|
||||||
|
|
||||||
EXPECT_EQ(true, actual);
|
EXPECT_EQ(true, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, close_isOpen_noErrors)
|
TEST_F(MSWindowsClipboardTests, close_isOpen_noErrors)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
clipboard.close();
|
clipboard.close();
|
||||||
|
@ -147,12 +147,12 @@ TEST_F(CMSWindowsClipboardTests, close_isOpen_noErrors)
|
||||||
|
|
||||||
// looks like this test may fail intermittently:
|
// looks like this test may fail intermittently:
|
||||||
// * http://buildbot.synergy-project.org:8000/builders/trunk-win32/builds/246/steps/shell_3/logs/stdio
|
// * http://buildbot.synergy-project.org:8000/builders/trunk-win32/builds/246/steps/shell_3/logs/stdio
|
||||||
/*TEST_F(CMSWindowsClipboardTests, getTime_openWithNoEmpty_returnsOne)
|
/*TEST_F(MSWindowsClipboardTests, getTime_openWithNoEmpty_returnsOne)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(1);
|
clipboard.open(1);
|
||||||
|
|
||||||
CMSWindowsClipboard::Time actual = clipboard.getTime();
|
MSWindowsClipboard::Time actual = clipboard.getTime();
|
||||||
|
|
||||||
// this behavior is different to that of Clipboard which only
|
// this behavior is different to that of Clipboard which only
|
||||||
// returns the value passed into open(t) after empty() is called.
|
// returns the value passed into open(t) after empty() is called.
|
||||||
|
@ -161,20 +161,20 @@ TEST_F(CMSWindowsClipboardTests, close_isOpen_noErrors)
|
||||||
|
|
||||||
// this also fails intermittently:
|
// this also fails intermittently:
|
||||||
// http://buildbot.synergy-project.org:8000/builders/trunk-win32/builds/266/steps/shell_3/logs/stdio
|
// http://buildbot.synergy-project.org:8000/builders/trunk-win32/builds/266/steps/shell_3/logs/stdio
|
||||||
/*TEST_F(CMSWindowsClipboardTests, getTime_openAndEmpty_returnsOne)
|
/*TEST_F(MSWindowsClipboardTests, getTime_openAndEmpty_returnsOne)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(1);
|
clipboard.open(1);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
|
|
||||||
CMSWindowsClipboard::Time actual = clipboard.getTime();
|
MSWindowsClipboard::Time actual = clipboard.getTime();
|
||||||
|
|
||||||
EXPECT_EQ(1, actual);
|
EXPECT_EQ(1, actual);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, has_withFormatAdded_returnsTrue)
|
TEST_F(MSWindowsClipboardTests, has_withFormatAdded_returnsTrue)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
clipboard.add(IClipboard::kText, "synergy rocks!");
|
clipboard.add(IClipboard::kText, "synergy rocks!");
|
||||||
|
@ -184,9 +184,9 @@ TEST_F(CMSWindowsClipboardTests, has_withFormatAdded_returnsTrue)
|
||||||
EXPECT_EQ(true, actual);
|
EXPECT_EQ(true, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, has_withNoFormats_returnsFalse)
|
TEST_F(MSWindowsClipboardTests, has_withNoFormats_returnsFalse)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
|
|
||||||
|
@ -195,9 +195,9 @@ TEST_F(CMSWindowsClipboardTests, has_withNoFormats_returnsFalse)
|
||||||
EXPECT_EQ(false, actual);
|
EXPECT_EQ(false, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, get_withNoFormats_returnsEmpty)
|
TEST_F(MSWindowsClipboardTests, get_withNoFormats_returnsEmpty)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
|
|
||||||
|
@ -206,9 +206,9 @@ TEST_F(CMSWindowsClipboardTests, get_withNoFormats_returnsEmpty)
|
||||||
EXPECT_EQ("", actual);
|
EXPECT_EQ("", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, get_withFormatAdded_returnsExpected)
|
TEST_F(MSWindowsClipboardTests, get_withFormatAdded_returnsExpected)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
clipboard.empty();
|
clipboard.empty();
|
||||||
clipboard.add(IClipboard::kText, "synergy rocks!");
|
clipboard.add(IClipboard::kText, "synergy rocks!");
|
||||||
|
@ -218,9 +218,9 @@ TEST_F(CMSWindowsClipboardTests, get_withFormatAdded_returnsExpected)
|
||||||
EXPECT_EQ("synergy rocks!", actual);
|
EXPECT_EQ("synergy rocks!", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsClipboardTests, isOwnedBySynergy_defaultState_noError)
|
TEST_F(MSWindowsClipboardTests, isOwnedBySynergy_defaultState_noError)
|
||||||
{
|
{
|
||||||
CMSWindowsClipboard clipboard(NULL);
|
MSWindowsClipboard clipboard(NULL);
|
||||||
clipboard.open(0);
|
clipboard.open(0);
|
||||||
|
|
||||||
bool actual = clipboard.isOwnedBySynergy();
|
bool actual = clipboard.isOwnedBySynergy();
|
||||||
|
|
|
@ -35,13 +35,13 @@
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using ::testing::NiceMock;
|
using ::testing::NiceMock;
|
||||||
|
|
||||||
class CMSWindowsKeyStateTests : public ::testing::Test
|
class MSWindowsKeyStateTests : public ::testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
m_hook.loadLibrary();
|
m_hook.loadLibrary();
|
||||||
m_screensaver = new CMSWindowsScreenSaver();
|
m_screensaver = new MSWindowsScreenSaver();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown()
|
virtual void TearDown()
|
||||||
|
@ -49,31 +49,31 @@ protected:
|
||||||
delete m_screensaver;
|
delete m_screensaver;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSWindowsDesks* newDesks(IEventQueue* eventQueue)
|
MSWindowsDesks* newDesks(IEventQueue* eventQueue)
|
||||||
{
|
{
|
||||||
return new CMSWindowsDesks(
|
return new MSWindowsDesks(
|
||||||
true, false, m_hook.getInstance(), m_screensaver, eventQueue,
|
true, false, m_hook.getInstance(), m_screensaver, eventQueue,
|
||||||
new TMethodJob<CMSWindowsKeyStateTests>(
|
new TMethodJob<MSWindowsKeyStateTests>(
|
||||||
this, &CMSWindowsKeyStateTests::updateKeysCB), false);
|
this, &MSWindowsKeyStateTests::updateKeysCB), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* getEventTarget() const
|
void* getEventTarget() const
|
||||||
{
|
{
|
||||||
return const_cast<CMSWindowsKeyStateTests*>(this);
|
return const_cast<MSWindowsKeyStateTests*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateKeysCB(void*) { }
|
void updateKeysCB(void*) { }
|
||||||
IScreenSaver* m_screensaver;
|
IScreenSaver* m_screensaver;
|
||||||
CMSWindowsHook m_hook;
|
MSWindowsHook m_hook;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(CMSWindowsKeyStateTests, disable_eventQueueNotUsed)
|
TEST_F(MSWindowsKeyStateTests, disable_eventQueueNotUsed)
|
||||||
{
|
{
|
||||||
NiceMock<MockEventQueue> eventQueue;
|
NiceMock<MockEventQueue> eventQueue;
|
||||||
CMSWindowsDesks* desks = newDesks(&eventQueue);
|
MSWindowsDesks* desks = newDesks(&eventQueue);
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
MSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
||||||
|
|
||||||
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(0);
|
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(0);
|
||||||
|
|
||||||
|
@ -81,12 +81,12 @@ TEST_F(CMSWindowsKeyStateTests, disable_eventQueueNotUsed)
|
||||||
delete desks;
|
delete desks;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_noRepeatAndButtonIsZero_resultIsTrue)
|
TEST_F(MSWindowsKeyStateTests, testAutoRepeat_noRepeatAndButtonIsZero_resultIsTrue)
|
||||||
{
|
{
|
||||||
NiceMock<MockEventQueue> eventQueue;
|
NiceMock<MockEventQueue> eventQueue;
|
||||||
CMSWindowsDesks* desks = newDesks(&eventQueue);
|
MSWindowsDesks* desks = newDesks(&eventQueue);
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
MSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
||||||
keyState.setLastDown(1);
|
keyState.setLastDown(1);
|
||||||
|
|
||||||
bool actual = keyState.testAutoRepeat(true, false, 1);
|
bool actual = keyState.testAutoRepeat(true, false, 1);
|
||||||
|
@ -95,12 +95,12 @@ TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_noRepeatAndButtonIsZero_resultIsT
|
||||||
delete desks;
|
delete desks;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_pressFalse_lastDownIsZero)
|
TEST_F(MSWindowsKeyStateTests, testAutoRepeat_pressFalse_lastDownIsZero)
|
||||||
{
|
{
|
||||||
NiceMock<MockEventQueue> eventQueue;
|
NiceMock<MockEventQueue> eventQueue;
|
||||||
CMSWindowsDesks* desks = newDesks(&eventQueue);
|
MSWindowsDesks* desks = newDesks(&eventQueue);
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
MSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
||||||
keyState.setLastDown(1);
|
keyState.setLastDown(1);
|
||||||
|
|
||||||
keyState.testAutoRepeat(false, false, 1);
|
keyState.testAutoRepeat(false, false, 1);
|
||||||
|
@ -109,12 +109,12 @@ TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_pressFalse_lastDownIsZero)
|
||||||
delete desks;
|
delete desks;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CMSWindowsKeyStateTests, saveModifiers_noModifiers_savedModifiers0)
|
TEST_F(MSWindowsKeyStateTests, saveModifiers_noModifiers_savedModifiers0)
|
||||||
{
|
{
|
||||||
NiceMock<MockEventQueue> eventQueue;
|
NiceMock<MockEventQueue> eventQueue;
|
||||||
CMSWindowsDesks* desks = newDesks(&eventQueue);
|
MSWindowsDesks* desks = newDesks(&eventQueue);
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
MSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap);
|
||||||
|
|
||||||
keyState.saveModifiers();
|
keyState.saveModifiers();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue