dropped "c" prefix from class names

This commit is contained in:
Nick Bolton
2014-11-11 13:51:47 +00:00
parent f6c05e7635
commit e8e156f0e2
382 changed files with 7430 additions and 7423 deletions

View File

@@ -94,7 +94,7 @@ CMSWindowsClipboard::empty()
}
void
CMSWindowsClipboard::add(EFormat format, const CString& data)
CMSWindowsClipboard::add(EFormat format, const String& data)
{
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
@@ -161,7 +161,7 @@ CMSWindowsClipboard::has(EFormat format) const
return false;
}
CString
String
CMSWindowsClipboard::get(EFormat format) const
{
// find the converter for the first clipboard format we can handle
@@ -182,7 +182,7 @@ CMSWindowsClipboard::get(EFormat format) const
// if no converter then we don't recognize any formats
if (converter == NULL) {
return CString();
return String();
}
// get a handle to the clipboard data
@@ -191,7 +191,7 @@ CMSWindowsClipboard::get(EFormat format) const
// nb: can't cause this using integ tests; this is only caused when
// the selected converter returns an invalid format -- which you
// cannot cause using public functions.
return CString();
return String();
}
// convert

View File

@@ -55,12 +55,12 @@ public:
// IClipboard overrides
virtual bool empty();
virtual void add(EFormat, const CString& data);
virtual void add(EFormat, const String& data);
virtual bool open(Time) const;
virtual void close() const;
virtual Time getTime() const;
virtual bool has(EFormat) const;
virtual CString get(EFormat) const;
virtual String get(EFormat) const;
void setFacade(IMSWindowsClipboardFacade& facade);
@@ -68,8 +68,8 @@ private:
void clearConverters();
UINT convertFormatToWin32(EFormat) const;
HANDLE convertTextToWin32(const CString& data) const;
CString convertTextFromWin32(HANDLE) const;
HANDLE convertTextToWin32(const String& data) const;
String convertTextFromWin32(HANDLE) const;
static UINT getOwnershipFormat();
@@ -105,9 +105,9 @@ public:
// the input data must be in the IClipboard format returned by
// getFormat(). the return data will be in the win32 clipboard
// format returned by getWin32Format(), allocated by GlobalAlloc().
virtual HANDLE fromIClipboard(const CString&) const = 0;
virtual HANDLE fromIClipboard(const String&) const = 0;
// convert from the win32 clipboard format to the IClipboard format
// (i.e., the reverse of fromIClipboard()).
virtual CString toIClipboard(HANDLE data) const = 0;
virtual String toIClipboard(HANDLE data) const = 0;
};

View File

@@ -39,10 +39,10 @@ CMSWindowsClipboardAnyTextConverter::getFormat() const
}
HANDLE
CMSWindowsClipboardAnyTextConverter::fromIClipboard(const CString& data) const
CMSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const
{
// convert linefeeds and then convert to desired encoding
CString text = doFromIClipboard(convertLinefeedToWin32(data));
String text = doFromIClipboard(convertLinefeedToWin32(data));
UInt32 size = (UInt32)text.size();
// copy to memory handle
@@ -63,18 +63,18 @@ CMSWindowsClipboardAnyTextConverter::fromIClipboard(const CString& data) const
return gData;
}
CString
String
CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
{
// get datator
const char* src = (const char*)GlobalLock(data);
UInt32 srcSize = (UInt32)GlobalSize(data);
if (src == NULL || srcSize <= 1) {
return CString();
return String();
}
// convert text
CString text = doToIClipboard(CString(src, srcSize));
String text = doToIClipboard(String(src, srcSize));
// release handle
GlobalUnlock(data);
@@ -83,9 +83,9 @@ CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
return convertLinefeedToUnix(text);
}
CString
String
CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
const CString& src) const
const String& src) const
{
// note -- we assume src is a valid UTF-8 string
@@ -102,7 +102,7 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
}
// allocate new string
CString dst;
String dst;
dst.reserve(src.size() + numNewlines);
// copy string, converting newlines
@@ -117,9 +117,9 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(
return dst;
}
CString
String
CMSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(
const CString& src) const
const String& src) const
{
// count newlines in string
UInt32 numNewlines = 0;
@@ -134,7 +134,7 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(
}
// allocate new string
CString dst;
String dst;
dst.reserve(src.size());
// copy string, converting newlines

View File

@@ -31,8 +31,8 @@ public:
virtual IClipboard::EFormat
getFormat() const;
virtual UINT getWin32Format() const = 0;
virtual HANDLE fromIClipboard(const CString&) const;
virtual CString toIClipboard(HANDLE) const;
virtual HANDLE fromIClipboard(const String&) const;
virtual String toIClipboard(HANDLE) const;
protected:
//! Convert from IClipboard format
@@ -40,18 +40,18 @@ protected:
Do UTF-8 conversion only. Memory handle allocation and
linefeed conversion is done by this class. doFromIClipboard()
must include the nul terminator in the returned string (not
including the CString's nul terminator).
including the String's nul terminator).
*/
virtual CString doFromIClipboard(const CString&) const = 0;
virtual String doFromIClipboard(const String&) const = 0;
//! Convert to IClipboard format
/*!
Do UTF-8 conversion only. Memory handle allocation and
linefeed conversion is done by this class.
*/
virtual CString doToIClipboard(const CString&) const = 0;
virtual String doToIClipboard(const String&) const = 0;
private:
CString convertLinefeedToWin32(const CString&) const;
CString convertLinefeedToUnix(const CString&) const;
String convertLinefeedToWin32(const String&) const;
String convertLinefeedToUnix(const String&) const;
};

View File

@@ -47,7 +47,7 @@ CMSWindowsClipboardBitmapConverter::getWin32Format() const
}
HANDLE
CMSWindowsClipboardBitmapConverter::fromIClipboard(const CString& data) const
CMSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const
{
// copy to memory handle
HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, data.size());
@@ -67,13 +67,13 @@ CMSWindowsClipboardBitmapConverter::fromIClipboard(const CString& data) const
return gData;
}
CString
String
CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
{
// get datator
const char* src = (const char*)GlobalLock(data);
if (src == NULL) {
return CString();
return String();
}
UInt32 srcSize = (UInt32)GlobalSize(data);
@@ -85,7 +85,7 @@ CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
bitmap->bmiHeader.biBitCount == 32) &&
bitmap->bmiHeader.biCompression == BI_RGB) {
// already in canonical form
CString image(src, srcSize);
String image(src, srcSize);
GlobalUnlock(data);
return image;
}
@@ -138,7 +138,7 @@ CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
GdiFlush();
// extract data
CString image((const char*)&info, info.biSize);
String image((const char*)&info, info.biSize);
image.append((const char*)raw, 4 * w * h);
// clean up GDI

View File

@@ -31,6 +31,6 @@ public:
virtual IClipboard::EFormat
getFormat() const;
virtual UINT getWin32Format() const;
virtual HANDLE fromIClipboard(const CString&) const;
virtual CString toIClipboard(HANDLE) const;
virtual HANDLE fromIClipboard(const String&) const;
virtual String toIClipboard(HANDLE) const;
};

View File

@@ -46,15 +46,15 @@ CMSWindowsClipboardHTMLConverter::getWin32Format() const
return m_format;
}
CString
CMSWindowsClipboardHTMLConverter::doFromIClipboard(const CString& data) const
String
CMSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const
{
// prepare to CF_HTML format prefix and suffix
CString prefix("Version:0.9\r\nStartHTML:0000000105\r\n"
String prefix("Version:0.9\r\nStartHTML:0000000105\r\n"
"EndHTML:ZZZZZZZZZZ\r\n"
"StartFragment:XXXXXXXXXX\r\nEndFragment:YYYYYYYYYY\r\n"
"<!DOCTYPE><HTML><BODY><!--StartFragment-->");
CString suffix("<!--EndFragment--></BODY></HTML>\r\n");
String suffix("<!--EndFragment--></BODY></HTML>\r\n");
// Get byte offsets for header
UInt32 StartFragment = (UInt32)prefix.size();
@@ -75,45 +75,45 @@ CMSWindowsClipboardHTMLConverter::doFromIClipboard(const CString& data) const
return prefix;
}
CString
CMSWindowsClipboardHTMLConverter::doToIClipboard(const CString& data) const
String
CMSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const
{
// get fragment start/end args
CString startArg = findArg(data, "StartFragment");
CString endArg = findArg(data, "EndFragment");
String startArg = findArg(data, "StartFragment");
String endArg = findArg(data, "EndFragment");
if (startArg.empty() || endArg.empty()) {
return CString();
return String();
}
// convert args to integers
SInt32 start = (SInt32)atoi(startArg.c_str());
SInt32 end = (SInt32)atoi(endArg.c_str());
if (start <= 0 || end <= 0 || start >= end) {
return CString();
return String();
}
// extract the fragment
return data.substr(start, end - start);
}
CString
String
CMSWindowsClipboardHTMLConverter::findArg(
const CString& data, const CString& name) const
const String& data, const String& name) const
{
CString::size_type i = data.find(name);
if (i == CString::npos) {
return CString();
String::size_type i = data.find(name);
if (i == String::npos) {
return String();
}
i = data.find_first_of(":\r\n", i);
if (i == CString::npos || data[i] != ':') {
return CString();
if (i == String::npos || data[i] != ':') {
return String();
}
i = data.find_first_of("0123456789\r\n", i + 1);
if (i == CString::npos || data[i] == '\r' || data[i] == '\n') {
return CString();
if (i == String::npos || data[i] == '\r' || data[i] == '\n') {
return String();
}
CString::size_type j = data.find_first_not_of("0123456789", i);
if (j == CString::npos) {
String::size_type j = data.find_first_not_of("0123456789", i);
if (j == String::npos) {
j = data.size();
}
return data.substr(i, j - i);

View File

@@ -34,11 +34,11 @@ public:
protected:
// CMSWindowsClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
private:
CString findArg(const CString& data, const CString& name) const;
String findArg(const String& data, const String& name) const;
private:
UINT m_format;

View File

@@ -40,20 +40,20 @@ CMSWindowsClipboardTextConverter::getWin32Format() const
return CF_TEXT;
}
CString
CMSWindowsClipboardTextConverter::doFromIClipboard(const CString& data) const
String
CMSWindowsClipboardTextConverter::doFromIClipboard(const String& data) const
{
// convert and add nul terminator
return CUnicode::UTF8ToText(data) += '\0';
return Unicode::UTF8ToText(data) += '\0';
}
CString
CMSWindowsClipboardTextConverter::doToIClipboard(const CString& data) const
String
CMSWindowsClipboardTextConverter::doToIClipboard(const String& data) const
{
// convert and truncate at first nul terminator
CString dst = CUnicode::textToUTF8(data);
CString::size_type n = dst.find('\0');
if (n != CString::npos) {
String dst = Unicode::textToUTF8(data);
String::size_type n = dst.find('\0');
if (n != String::npos) {
dst.erase(n);
}
return dst;

View File

@@ -32,6 +32,6 @@ public:
protected:
// CMSWindowsClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
};

View File

@@ -40,20 +40,20 @@ CMSWindowsClipboardUTF16Converter::getWin32Format() const
return CF_UNICODETEXT;
}
CString
CMSWindowsClipboardUTF16Converter::doFromIClipboard(const CString& data) const
String
CMSWindowsClipboardUTF16Converter::doFromIClipboard(const String& data) const
{
// convert and add nul terminator
return CUnicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0);
return Unicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0);
}
CString
CMSWindowsClipboardUTF16Converter::doToIClipboard(const CString& data) const
String
CMSWindowsClipboardUTF16Converter::doToIClipboard(const String& data) const
{
// convert and strip nul terminator
CString dst = CUnicode::UTF16ToUTF8(data);
CString::size_type n = dst.find('\0');
if (n != CString::npos) {
String dst = Unicode::UTF16ToUTF8(data);
String::size_type n = dst.find('\0');
if (n != String::npos) {
dst.erase(n);
}
return dst;

View File

@@ -32,6 +32,6 @@ public:
protected:
// CMSWindowsClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
};

View File

@@ -144,7 +144,7 @@ CMSWindowsDesks::enable()
// we wouldn't need this if windows notified us of a desktop
// change but as far as i can tell it doesn't.
m_timer = m_events->newTimer(0.2, NULL);
m_events->adoptHandler(CEvent::kTimer, m_timer,
m_events->adoptHandler(Event::kTimer, m_timer,
new TMethodEventJob<CMSWindowsDesks>(
this, &CMSWindowsDesks::handleCheckDesk));
@@ -156,7 +156,7 @@ CMSWindowsDesks::disable()
{
// remove timer
if (m_timer != NULL) {
m_events->removeHandler(CEvent::kTimer, m_timer);
m_events->removeHandler(Event::kTimer, m_timer);
m_events->deleteTimer(m_timer);
m_timer = NULL;
}
@@ -186,7 +186,7 @@ CMSWindowsDesks::resetOptions()
}
void
CMSWindowsDesks::setOptions(const COptionsList& options)
CMSWindowsDesks::setOptions(const OptionsList& options)
{
for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
if (options[i] == kOptionWin32KeepForeground) {
@@ -543,7 +543,7 @@ CMSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const
}
void
CMSWindowsDesks::deskEnter(CDesk* desk)
CMSWindowsDesks::deskEnter(Desk* desk)
{
if (!m_isPrimary) {
ReleaseCapture();
@@ -571,7 +571,7 @@ CMSWindowsDesks::deskEnter(CDesk* desk)
}
void
CMSWindowsDesks::deskLeave(CDesk* desk, HKL keyLayout)
CMSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
{
ShowCursor(FALSE);
if (m_isPrimary) {
@@ -657,7 +657,7 @@ CMSWindowsDesks::deskThread(void* vdesk)
MSG msg;
// use given desktop for this thread
CDesk* desk = reinterpret_cast<CDesk*>(vdesk);
Desk* desk = reinterpret_cast<Desk*>(vdesk);
desk->m_threadID = GetCurrentThreadId();
desk->m_window = NULL;
desk->m_foregroundWindow = NULL;
@@ -678,7 +678,7 @@ CMSWindowsDesks::deskThread(void* vdesk)
// tell main thread that we're ready
{
CLock lock(&m_mutex);
Lock lock(&m_mutex);
m_deskReady = true;
m_deskReady.broadcast();
}
@@ -789,7 +789,7 @@ CMSWindowsDesks::deskThread(void* vdesk)
}
// notify that message was processed
CLock lock(&m_mutex);
Lock lock(&m_mutex);
m_deskReady = true;
m_deskReady.broadcast();
}
@@ -804,14 +804,14 @@ CMSWindowsDesks::deskThread(void* vdesk)
}
}
CMSWindowsDesks::CDesk*
CMSWindowsDesks::addDesk(const CString& name, HDESK hdesk)
CMSWindowsDesks::Desk*
CMSWindowsDesks::addDesk(const String& name, HDESK hdesk)
{
CDesk* desk = new CDesk;
Desk* desk = new Desk;
desk->m_name = name;
desk->m_desk = hdesk;
desk->m_targetID = GetCurrentThreadId();
desk->m_thread = new CThread(new TMethodJob<CMSWindowsDesks>(
desk->m_thread = new Thread(new TMethodJob<CMSWindowsDesks>(
this, &CMSWindowsDesks::deskThread, desk));
waitForDesk();
m_desks.insert(std::make_pair(name, desk));
@@ -821,9 +821,9 @@ CMSWindowsDesks::addDesk(const CString& name, HDESK hdesk)
void
CMSWindowsDesks::removeDesks()
{
for (CDesks::iterator index = m_desks.begin();
for (Desks::iterator index = m_desks.begin();
index != m_desks.end(); ++index) {
CDesk* desk = index->second;
Desk* desk = index->second;
PostThreadMessage(desk->m_threadID, WM_QUIT, 0, 0);
desk->m_thread->wait();
delete desk->m_thread;
@@ -838,10 +838,10 @@ void
CMSWindowsDesks::checkDesk()
{
// get current desktop. if we already know about it then return.
CDesk* desk;
Desk* desk;
HDESK hdesk = openInputDesktop();
CString name = getDesktopName(hdesk);
CDesks::const_iterator index = m_desks.find(name);
String name = getDesktopName(hdesk);
Desks::const_iterator index = m_desks.find(name);
if (index == m_desks.end()) {
desk = addDesk(name, hdesk);
// hold on to hdesk until thread exits so the desk can't
@@ -856,7 +856,7 @@ CMSWindowsDesks::checkDesk()
// first switch, then shut down.
if (m_stopOnDeskSwitch && m_activeDesk != NULL && name != m_activeDeskName) {
LOG((CLOG_DEBUG "shutting down because of desk switch to \"%s\"", name.c_str()));
m_events->addEvent(CEvent(CEvent::kQuit));
m_events->addEvent(Event(Event::kQuit));
return;
}
@@ -911,7 +911,7 @@ CMSWindowsDesks::checkDesk()
}
bool
CMSWindowsDesks::isDeskAccessible(const CDesk* desk) const
CMSWindowsDesks::isDeskAccessible(const Desk* desk) const
{
return (desk != NULL && desk->m_desk != NULL);
}
@@ -921,7 +921,7 @@ CMSWindowsDesks::waitForDesk() const
{
CMSWindowsDesks* self = const_cast<CMSWindowsDesks*>(this);
CLock lock(&m_mutex);
Lock lock(&m_mutex);
while (!(bool)m_deskReady) {
m_deskReady.wait();
}
@@ -929,7 +929,7 @@ CMSWindowsDesks::waitForDesk() const
}
void
CMSWindowsDesks::handleCheckDesk(const CEvent&, void*)
CMSWindowsDesks::handleCheckDesk(const Event&, void*)
{
checkDesk();
@@ -958,18 +958,18 @@ CMSWindowsDesks::closeDesktop(HDESK desk)
}
}
CString
String
CMSWindowsDesks::getDesktopName(HDESK desk)
{
if (desk == NULL) {
return CString();
return String();
}
else {
DWORD size;
GetUserObjectInformation(desk, UOI_NAME, NULL, 0, &size);
TCHAR* name = (TCHAR*)alloca(size + sizeof(TCHAR));
GetUserObjectInformation(desk, UOI_NAME, name, size, &size);
CString result(name);
String result(name);
return result;
}
}

View File

@@ -30,9 +30,9 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class CEvent;
class CEventQueueTimer;
class CThread;
class Event;
class EventQueueTimer;
class Thread;
class IJob;
class IScreenSaver;
class IEventQueue;
@@ -111,7 +111,7 @@ public:
Set options to given values. Ignores unknown options and doesn't
modify options that aren't given in \c options.
*/
void setOptions(const COptionsList& options);
void setOptions(const OptionsList& options);
//! Update the key state
/*!
@@ -192,10 +192,10 @@ public:
//@}
private:
class CDesk {
class Desk {
public:
CString m_name;
CThread* m_thread;
String m_name;
Thread* m_thread;
DWORD m_threadID;
DWORD m_targetID;
HDESK m_desk;
@@ -203,7 +203,7 @@ private:
HWND m_foregroundWindow;
bool m_lowLevel;
};
typedef std::map<CString, CDesk*> CDesks;
typedef std::map<String, Desk*> Desks;
// initialization and shutdown operations
void queryHookLibrary(HINSTANCE hookLibrary);
@@ -217,16 +217,16 @@ private:
// message handlers
void deskMouseMove(SInt32 x, SInt32 y) const;
void deskMouseRelativeMove(SInt32 dx, SInt32 dy) const;
void deskEnter(CDesk* desk);
void deskLeave(CDesk* desk, HKL keyLayout);
void deskEnter(Desk* desk);
void deskLeave(Desk* desk, HKL keyLayout);
void deskThread(void* vdesk);
// desk switch checking and handling
CDesk* addDesk(const CString& name, HDESK hdesk);
Desk* addDesk(const String& name, HDESK hdesk);
void removeDesks();
void checkDesk();
bool isDeskAccessible(const CDesk* desk) const;
void handleCheckDesk(const CEvent& event, void*);
bool isDeskAccessible(const Desk* desk) const;
void handleCheckDesk(const Event& event, void*);
// communication with desk threads
void waitForDesk() const;
@@ -238,7 +238,7 @@ private:
// desk API wrappers
HDESK openInputDesktop();
void closeDesktop(HDESK);
CString getDesktopName(HDESK);
String getDesktopName(HDESK);
// our desk window procs
static LRESULT CALLBACK primaryDeskProc(HWND, UINT, WPARAM, LPARAM);
@@ -267,7 +267,7 @@ private:
bool m_multimon;
// the timer used to check for desktop switching
CEventQueueTimer* m_timer;
EventQueueTimer* m_timer;
// screen saver stuff
DWORD m_threadID;
@@ -275,13 +275,13 @@ private:
bool m_screensaverNotify;
// the current desk and it's name
CDesk* m_activeDesk;
CString m_activeDeskName;
Desk* m_activeDesk;
String m_activeDeskName;
// one desk per desktop and a cond var to communicate with it
CMutex m_mutex;
CCondVar<bool> m_deskReady;
CDesks m_desks;
Mutex m_mutex;
CondVar<bool> m_deskReady;
Desks m_desks;
// hook library stuff
InstallFunc m_install;

View File

@@ -23,10 +23,10 @@
#include "base/IEventQueue.h"
//
// CEventQueueTimer
// EventQueueTimer
//
class CEventQueueTimer { };
class EventQueueTimer { };
//
@@ -43,7 +43,7 @@ CMSWindowsEventQueueBuffer::CMSWindowsEventQueueBuffer(IEventQueue* events) :
m_userEvent = RegisterWindowMessage("SYNERGY_USER_EVENT");
// get message type for daemon quit
m_daemonQuit = CArchMiscWindows::getDaemonQuitMessage();
m_daemonQuit = ArchMiscWindows::getDaemonQuitMessage();
// make sure this thread has a message queue
MSG dummy;
@@ -83,7 +83,7 @@ CMSWindowsEventQueueBuffer::waitForEvent(double timeout)
}
IEventQueueBuffer::Type
CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
CMSWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
{
// peek at messages first. waiting for QS_ALLINPUT will return
// if a message has been sent to our window but GetMessage will
@@ -100,11 +100,11 @@ CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
return kNone;
}
else if (result == 0) {
event = CEvent(CEvent::kQuit);
event = Event(Event::kQuit);
return kSystem;
}
else if (m_daemonQuit != 0 && m_event.message == m_daemonQuit) {
event = CEvent(CEvent::kQuit);
event = Event(Event::kQuit);
return kSystem;
}
else if (m_event.message == m_userEvent) {
@@ -112,7 +112,7 @@ CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
return kUser;
}
else {
event = CEvent(CEvent::kSystem,
event = Event(Event::kSystem,
m_events->getSystemTarget(), &m_event);
return kSystem;
}
@@ -131,14 +131,14 @@ CMSWindowsEventQueueBuffer::isEmpty() const
return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0);
}
CEventQueueTimer*
EventQueueTimer*
CMSWindowsEventQueueBuffer::newTimer(double, bool) const
{
return new CEventQueueTimer;
return new EventQueueTimer;
}
void
CMSWindowsEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const
CMSWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
{
delete timer;
}

View File

@@ -34,12 +34,12 @@ public:
// IEventQueueBuffer overrides
virtual void init() { }
virtual void waitForEvent(double timeout);
virtual Type getEvent(CEvent& event, UInt32& dataID);
virtual Type getEvent(Event& event, UInt32& dataID);
virtual bool addEvent(UInt32 dataID);
virtual bool isEmpty() const;
virtual CEventQueueTimer*
virtual EventQueueTimer*
newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(CEventQueueTimer*) const;
virtual void deleteTimer(EventQueueTimer*) const;
private:
DWORD m_thread;

View File

@@ -555,13 +555,13 @@ const KeyID CMSWindowsKeyState::s_virtualKey[] =
/* 0x1ff */ { kKeyNone } // reserved
};
struct CWin32Modifiers {
struct Win32Modifiers {
public:
UINT m_vk;
KeyModifierMask m_mask;
};
static const CWin32Modifiers s_modifiers[] =
static const Win32Modifiers s_modifiers[] =
{
{ VK_SHIFT, KeyModifierShift },
{ VK_LSHIFT, KeyModifierShift },
@@ -578,7 +578,7 @@ static const CWin32Modifiers s_modifiers[] =
CMSWindowsKeyState::CMSWindowsKeyState(
CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events) :
CKeyState(events),
KeyState(events),
m_eventTarget(eventTarget),
m_desks(desks),
m_keyLayout(GetKeyboardLayout(0)),
@@ -593,8 +593,8 @@ CMSWindowsKeyState::CMSWindowsKeyState(
}
CMSWindowsKeyState::CMSWindowsKeyState(
CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, CKeyMap& keyMap) :
CKeyState(events, keyMap),
CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap) :
KeyState(events, keyMap),
m_eventTarget(eventTarget),
m_desks(desks),
m_keyLayout(GetKeyboardLayout(0)),
@@ -625,7 +625,7 @@ void
CMSWindowsKeyState::disable()
{
if (m_fixTimer != NULL) {
m_events->removeHandler(CEvent::kTimer, m_fixTimer);
m_events->removeHandler(Event::kTimer, m_fixTimer);
m_events->deleteTimer(m_fixTimer);
m_fixTimer = NULL;
}
@@ -672,7 +672,7 @@ CMSWindowsKeyState::useSavedModifiers(bool enable)
if (enable != m_useSavedModifiers) {
m_useSavedModifiers = enable;
if (!m_useSavedModifiers) {
// transfer any modifier state changes to CKeyState's state
// transfer any modifier state changes to KeyState's state
KeyModifierMask mask = m_originalSavedModifiers ^ m_savedModifiers;
getActiveModifiersRValue() =
(getActiveModifiers() & ~mask) | (m_savedModifiers & mask);
@@ -759,7 +759,7 @@ CMSWindowsKeyState::mapKeyToVirtualKey(KeyID key) const
void
CMSWindowsKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState)
{
CKeyState::onKey(button, down, newState);
KeyState::onKey(button, down, newState);
}
void
@@ -771,20 +771,20 @@ CMSWindowsKeyState::sendKeyEvent(void* target,
if (press || isAutoRepeat) {
// send key
if (press && !isAutoRepeat) {
CKeyState::sendKeyEvent(target, true, false,
KeyState::sendKeyEvent(target, true, false,
key, mask, 1, button);
if (count > 0) {
--count;
}
}
if (count >= 1) {
CKeyState::sendKeyEvent(target, true, true,
KeyState::sendKeyEvent(target, true, true,
key, mask, count, button);
}
}
else {
// do key up
CKeyState::sendKeyEvent(target, false, false, key, mask, 1, button);
KeyState::sendKeyEvent(target, false, false, key, mask, 1, button);
}
}
@@ -792,14 +792,14 @@ void
CMSWindowsKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask,
KeyButton button)
{
CKeyState::fakeKeyDown(id, mask, button);
KeyState::fakeKeyDown(id, mask, button);
}
bool
CMSWindowsKeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
SInt32 count, KeyButton button)
{
return CKeyState::fakeKeyRepeat(id, mask, count, button);
return KeyState::fakeKeyRepeat(id, mask, count, button);
}
bool
@@ -817,7 +817,7 @@ CMSWindowsKeyState::fakeCtrlAltDel()
CloseHandle( hEvtSendSas );
}
else {
CThread cad(new CFunctionJob(&CMSWindowsKeyState::ctrlAltDelThread));
Thread cad(new FunctionJob(&CMSWindowsKeyState::ctrlAltDelThread));
cad.wait();
}
@@ -918,7 +918,7 @@ CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
}
void
CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap)
CMSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
{
// update keyboard groups
if (getGroups(m_groups)) {
@@ -934,7 +934,7 @@ CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap)
memset(m_virtualKeyToButton, 0, sizeof(m_virtualKeyToButton));
m_keyToVKMap.clear();
CKeyMap::KeyItem item;
synergy::KeyMap::KeyItem item;
SInt32 numGroups = (SInt32)m_groups.size();
for (SInt32 g = 0; g < numGroups; ++g) {
item.m_group = g;
@@ -1118,7 +1118,7 @@ CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap)
item.m_client = m_buttonToVK[i];
// get flags for modifier keys
CKeyMap::initModifierKey(item);
synergy::KeyMap::initModifierKey(item);
if (item.m_id == 0) {
// translate virtual key to a character with and without
@@ -1292,7 +1292,7 @@ CMSWindowsKeyState::getActiveModifiersRValue()
return m_savedModifiers;
}
else {
return CKeyState::getActiveModifiersRValue();
return KeyState::getActiveModifiersRValue();
}
}
@@ -1354,7 +1354,7 @@ CMSWindowsKeyState::mapButtonToVirtualKey(KeyButton button) const
}
KeyID
CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item,
CMSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item,
KeyButton button, UINT virtualKey,
PBYTE keyState, HKL hkl) const
{
@@ -1366,7 +1366,7 @@ CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item,
switch (n) {
case -1:
return CKeyMap::getDeadKey(id);
return synergy::KeyMap::getDeadKey(id);
default:
case 0:
@@ -1385,7 +1385,7 @@ CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item,
}
void
CMSWindowsKeyState::addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item)
CMSWindowsKeyState::addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item)
{
keyMap.addKeyEntry(item);
if (item.m_group == 0) {

View File

@@ -25,8 +25,8 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class CEvent;
class CEventQueueTimer;
class Event;
class EventQueueTimer;
class CMSWindowsDesks;
class IEventQueue;
@@ -34,10 +34,10 @@ class IEventQueue;
/*!
This class maps KeyIDs to keystrokes.
*/
class CMSWindowsKeyState : public CKeyState {
class CMSWindowsKeyState : public KeyState {
public:
CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events);
CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, CKeyMap& keyMap);
CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap);
virtual ~CMSWindowsKeyState();
//! @name manipulators
@@ -145,7 +145,7 @@ public:
virtual SInt32 pollActiveGroup() const;
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
// CKeyState overrides
// KeyState overrides
virtual void onKey(KeyButton button, bool down,
KeyModifierMask newState);
virtual void sendKeyEvent(void* target,
@@ -160,8 +160,8 @@ public:
void setSavedModifiers(KeyModifierMask value) { m_savedModifiers = value; }
protected:
// CKeyState overrides
virtual void getKeyMap(CKeyMap& keyMap);
// KeyState overrides
virtual void getKeyMap(synergy::KeyMap& keyMap);
virtual void fakeKey(const Keystroke& keystroke);
virtual KeyModifierMask&
getActiveModifiersRValue();
@@ -175,11 +175,11 @@ private:
bool getGroups(GroupList&) const;
void setWindowGroup(SInt32 group);
KeyID getIDForKey(CKeyMap::KeyItem& item,
KeyID getIDForKey(synergy::KeyMap::KeyItem& item,
KeyButton button, UINT virtualKey,
PBYTE keyState, HKL hkl) const;
void addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item);
void addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item);
void init();
@@ -202,7 +202,7 @@ private:
IEventQueue* m_events;
// the timer used to check for fixing key state
CEventQueueTimer* m_fixTimer;
EventQueueTimer* m_fixTimer;
// the groups (keyboard layouts)
GroupList m_groups;

View File

@@ -95,7 +95,7 @@ CMSWindowsScreen::CMSWindowsScreen(
bool noHooks,
bool stopOnDeskSwitch,
IEventQueue* events) :
CPlatformScreen(events),
PlatformScreen(events),
m_isPrimary(isPrimary),
m_noHooks(noHooks),
m_isOnScreen(m_isPrimary),
@@ -154,7 +154,7 @@ CMSWindowsScreen::CMSWindowsScreen(
// SHGetFolderPath is deprecated in vista, but use it for xp support.
char desktopPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) {
m_desktopPath = CString(desktopPath);
m_desktopPath = String(desktopPath);
LOG((CLOG_DEBUG "using desktop for drop target: %s", m_desktopPath.c_str()));
}
else {
@@ -177,7 +177,7 @@ CMSWindowsScreen::CMSWindowsScreen(
}
// install event handlers
m_events->adoptHandler(CEvent::kSystem, m_events->getSystemTarget(),
m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(),
new TMethodEventJob<CMSWindowsScreen>(this,
&CMSWindowsScreen::handleSystemEvent));
@@ -191,7 +191,7 @@ CMSWindowsScreen::~CMSWindowsScreen()
disable();
m_events->adoptBuffer(NULL);
m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget());
m_events->removeHandler(Event::kSystem, m_events->getSystemTarget());
delete m_keyState;
delete m_desks;
delete m_screensaver;
@@ -228,7 +228,7 @@ CMSWindowsScreen::enable()
// we need to poll some things to fix them
m_fixTimer = m_events->newTimer(1.0, NULL);
m_events->adoptHandler(CEvent::kTimer, m_fixTimer,
m_events->adoptHandler(Event::kTimer, m_fixTimer,
new TMethodEventJob<CMSWindowsScreen>(this,
&CMSWindowsScreen::handleFixes));
@@ -249,7 +249,7 @@ CMSWindowsScreen::enable()
// prevent the system from entering power saving modes. if
// it did we'd be forced to disconnect from the server and
// the server would not be able to wake us up.
CArchMiscWindows::addBusyState(CArchMiscWindows::kSYSTEM);
ArchMiscWindows::addBusyState(ArchMiscWindows::kSYSTEM);
}
}
@@ -268,8 +268,8 @@ CMSWindowsScreen::disable()
}
else {
// allow the system to enter power saving mode
CArchMiscWindows::removeBusyState(CArchMiscWindows::kSYSTEM |
CArchMiscWindows::kDISPLAY);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kSYSTEM |
ArchMiscWindows::kDISPLAY);
}
// tell key state
@@ -281,7 +281,7 @@ CMSWindowsScreen::disable()
// uninstall fix timer
if (m_fixTimer != NULL) {
m_events->removeHandler(CEvent::kTimer, m_fixTimer);
m_events->removeHandler(Event::kTimer, m_fixTimer);
m_events->deleteTimer(m_fixTimer);
m_fixTimer = NULL;
}
@@ -309,7 +309,7 @@ CMSWindowsScreen::enter()
else {
// Entering a secondary screen. Ensure that no screensaver is active
// and that the screen is not in powersave mode.
CArchMiscWindows::wakeupDisplay();
ArchMiscWindows::wakeupDisplay();
if(m_screensaver != NULL && m_screensaverActive)
{
@@ -370,7 +370,7 @@ CMSWindowsScreen::leave()
forceShowCursor();
if (isDraggingStarted() && !m_isPrimary) {
m_sendDragThread = new CThread(
m_sendDragThread = new Thread(
new TMethodJob<CMSWindowsScreen>(
this,
&CMSWindowsScreen::sendDragThread));
@@ -382,12 +382,12 @@ CMSWindowsScreen::leave()
void
CMSWindowsScreen::sendDragThread(void*)
{
CString& draggingFilename = getDraggingFilename();
String& draggingFilename = getDraggingFilename();
size_t size = draggingFilename.size();
if (draggingFilename.empty() == false) {
CClientApp& app = CClientApp::instance();
CClient* client = app.getClientPtr();
ClientApp& app = ClientApp::instance();
Client* client = app.getClientPtr();
UInt32 fileCount = 1;
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str()));
client->sendDragInfo(fileCount, draggingFilename, size);
@@ -404,7 +404,7 @@ CMSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src)
CMSWindowsClipboard dst(m_window);
if (src != NULL) {
// save clipboard data
return CClipboard::copy(&dst, src);
return Clipboard::copy(&dst, src);
}
else {
// assert clipboard ownership
@@ -488,7 +488,7 @@ CMSWindowsScreen::resetOptions()
}
void
CMSWindowsScreen::setOptions(const COptionsList& options)
CMSWindowsScreen::setOptions(const OptionsList& options)
{
m_desks->setOptions(options);
}
@@ -515,7 +515,7 @@ bool
CMSWindowsScreen::getClipboard(ClipboardID, IClipboard* dst) const
{
CMSWindowsClipboard src(m_window);
CClipboard::copy(dst, &src);
Clipboard::copy(dst, &src);
return true;
}
@@ -625,7 +625,7 @@ CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
bool err;
if (key == kKeyNone) {
// check if already registered
err = (m_hotKeyToIDMap.count(CHotKeyItem(vk, modifiers)) > 0);
err = (m_hotKeyToIDMap.count(HotKeyItem(vk, modifiers)) > 0);
}
else {
// register with OS
@@ -633,17 +633,17 @@ CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
if (!err) {
m_hotKeys.insert(std::make_pair(id, CHotKeyItem(vk, modifiers)));
m_hotKeyToIDMap[CHotKeyItem(vk, modifiers)] = id;
m_hotKeys.insert(std::make_pair(id, HotKeyItem(vk, modifiers)));
m_hotKeyToIDMap[HotKeyItem(vk, modifiers)] = id;
}
else {
m_oldHotKeyIDs.push_back(id);
m_hotKeys.erase(id);
LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", CKeyMap::formatKey(key, mask).c_str(), key, mask));
LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask));
return 0;
}
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id));
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask, id));
return id;
}
@@ -783,7 +783,7 @@ void
CMSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
KeyButton button)
{
CPlatformScreen::fakeKeyDown(id, mask, button);
PlatformScreen::fakeKeyDown(id, mask, button);
updateForceShowCursor();
}
@@ -791,7 +791,7 @@ bool
CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
SInt32 count, KeyButton button)
{
bool result = CPlatformScreen::fakeKeyRepeat(id, mask, count, button);
bool result = PlatformScreen::fakeKeyRepeat(id, mask, count, button);
updateForceShowCursor();
return result;
}
@@ -799,7 +799,7 @@ CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
bool
CMSWindowsScreen::fakeKeyUp(KeyButton button)
{
bool result = CPlatformScreen::fakeKeyUp(button);
bool result = PlatformScreen::fakeKeyUp(button);
updateForceShowCursor();
return result;
}
@@ -807,7 +807,7 @@ CMSWindowsScreen::fakeKeyUp(KeyButton button)
void
CMSWindowsScreen::fakeAllKeysUp()
{
CPlatformScreen::fakeAllKeysUp();
PlatformScreen::fakeAllKeysUp();
updateForceShowCursor();
}
@@ -915,15 +915,15 @@ CMSWindowsScreen::destroyWindow(HWND hwnd) const
}
void
CMSWindowsScreen::sendEvent(CEvent::Type type, void* data)
CMSWindowsScreen::sendEvent(Event::Type type, void* data)
{
m_events->addEvent(CEvent(type, getEventTarget(), data));
m_events->addEvent(Event(type, getEventTarget(), data));
}
void
CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
CMSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
{
CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo));
ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo));
if(info == NULL) {
LOG((CLOG_ERR "malloc failed on %s:%s", __FILE__, __LINE__ ));
return;
@@ -934,12 +934,12 @@ CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
}
void
CMSWindowsScreen::handleSystemEvent(const CEvent& event, void*)
CMSWindowsScreen::handleSystemEvent(const Event& event, void*)
{
MSG* msg = reinterpret_cast<MSG*>(event.getData());
assert(msg != NULL);
if (CArchMiscWindows::processDialog(msg)) {
if (ArchMiscWindows::processDialog(msg)) {
return;
}
if (onPreDispatch(msg->hwnd, msg->message, msg->wParam, msg->lParam)) {
@@ -1080,15 +1080,15 @@ CMSWindowsScreen::onEvent(HWND, UINT msg,
case PBT_APMRESUMEAUTOMATIC:
case PBT_APMRESUMECRITICAL:
case PBT_APMRESUMESUSPEND:
m_events->addEvent(CEvent(m_events->forIScreen().resume(),
m_events->addEvent(Event(m_events->forIScreen().resume(),
getEventTarget(), NULL,
CEvent::kDeliverImmediately));
Event::kDeliverImmediately));
break;
case PBT_APMSUSPEND:
m_events->addEvent(CEvent(m_events->forIScreen().suspend(),
m_events->addEvent(Event(m_events->forIScreen().suspend(),
getEventTarget(), NULL,
CEvent::kDeliverImmediately));
Event::kDeliverImmediately));
break;
}
*result = TRUE;
@@ -1266,13 +1266,13 @@ CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
// find the hot key id
HotKeyToIDMap::const_iterator i =
m_hotKeyToIDMap.find(CHotKeyItem(virtKey, modifiers));
m_hotKeyToIDMap.find(HotKeyItem(virtKey, modifiers));
if (i == m_hotKeyToIDMap.end()) {
return false;
}
// find what kind of event
CEvent::Type type;
Event::Type type;
if ((lParam & 0x80000000u) == 0u) {
if ((lParam & 0x40000000u) != 0u) {
// ignore key repeats but it counts as a hot key
@@ -1285,8 +1285,8 @@ CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
}
// generate event
m_events->addEvent(CEvent(type, getEventTarget(),
CHotKeyInfo::alloc(i->second)));
m_events->addEvent(Event(type, getEventTarget(),
HotKeyInfo::alloc(i->second)));
return true;
}
@@ -1322,14 +1322,14 @@ CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
LOG((CLOG_DEBUG1 "event: button press button=%d", button));
if (button != kButtonNone) {
sendEvent(m_events->forIPrimaryScreen().buttonDown(),
CButtonInfo::alloc(button, mask));
ButtonInfo::alloc(button, mask));
}
}
else {
LOG((CLOG_DEBUG1 "event: button release button=%d", button));
if (button != kButtonNone) {
sendEvent(m_events->forIPrimaryScreen().buttonUp(),
CButtonInfo::alloc(button, mask));
ButtonInfo::alloc(button, mask));
}
}
}
@@ -1371,7 +1371,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
// motion on primary screen
sendEvent(
m_events->forIPrimaryScreen().motionOnPrimary(),
CMotionInfo::alloc(m_xCursor, m_yCursor));
MotionInfo::alloc(m_xCursor, m_yCursor));
if (m_buttons[kButtonLeft] == true && m_draggingStarted == false) {
m_draggingStarted = true;
@@ -1401,7 +1401,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
}
else {
// send motion
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y));
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
}
}
@@ -1414,7 +1414,7 @@ CMSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
// ignore message if posted prior to last mark change
if (!ignore()) {
LOG((CLOG_DEBUG1 "event: button wheel delta=%+d,%+d", xDelta, yDelta));
sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(xDelta, yDelta));
sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(xDelta, yDelta));
}
return true;
}
@@ -1443,7 +1443,7 @@ CMSWindowsScreen::onScreensaver(bool activated)
sendEvent(m_events->forIPrimaryScreen().screensaverActivated());
// enable display power down
CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY);
}
}
else {
@@ -1452,7 +1452,7 @@ CMSWindowsScreen::onScreensaver(bool activated)
sendEvent(m_events->forIPrimaryScreen().screensaverDeactivated());
// disable display power down
CArchMiscWindows::addBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::addBusyState(ArchMiscWindows::kDISPLAY);
}
}
@@ -1602,7 +1602,7 @@ CMSWindowsScreen::updateScreenShape()
}
void
CMSWindowsScreen::handleFixes(const CEvent&, void*)
CMSWindowsScreen::handleFixes(const Event&, void*)
{
// fix clipboard chain
fixClipboardViewer();
@@ -1740,11 +1740,11 @@ CMSWindowsScreen::updateKeysCB(void*)
// update layouts if necessary
if (m_keyState->didGroupsChange()) {
CPlatformScreen::updateKeyMap();
PlatformScreen::updateKeyMap();
}
// now update the keyboard state
CPlatformScreen::updateKeyState();
PlatformScreen::updateKeyState();
// now see which keys we thought were down but now think are up.
// send key releases for these keys to the active client.
@@ -1840,10 +1840,10 @@ CMSWindowsScreen::fakeLocalKey(KeyButton button, bool press) const
}
//
// CMSWindowsScreen::CHotKeyItem
// CMSWindowsScreen::HotKeyItem
//
CMSWindowsScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) :
CMSWindowsScreen::HotKeyItem::HotKeyItem(UINT keycode, UINT mask) :
m_keycode(keycode),
m_mask(mask)
{
@@ -1851,26 +1851,26 @@ CMSWindowsScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) :
}
UINT
CMSWindowsScreen::CHotKeyItem::getVirtualKey() const
CMSWindowsScreen::HotKeyItem::getVirtualKey() const
{
return m_keycode;
}
bool
CMSWindowsScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const
CMSWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
{
return (m_keycode < x.m_keycode ||
(m_keycode == x.m_keycode && m_mask < x.m_mask));
}
void
CMSWindowsScreen::fakeDraggingFiles(CDragFileList fileList)
CMSWindowsScreen::fakeDraggingFiles(DragFileList fileList)
{
// possible design flaw: this function stops a "not implemented"
// exception from being thrown.
}
CString&
String&
CMSWindowsScreen::getDraggingFilename()
{
if (m_draggingStarted) {
@@ -1897,7 +1897,7 @@ CMSWindowsScreen::getDraggingFilename()
fakeKeyUp(1);
fakeMouseButton(kButtonLeft, false);
CString filename;
String filename;
DOUBLE timeout = ARCH->time() + .5f;
while (ARCH->time() < timeout) {
ARCH->sleep(.05f);
@@ -1910,7 +1910,7 @@ CMSWindowsScreen::getDraggingFilename()
ShowWindow(m_dropWindow, SW_HIDE);
if (!filename.empty()) {
if (CDragInformation::isFileValid(filename)) {
if (DragInformation::isFileValid(filename)) {
m_draggingFilename = filename;
}
else {
@@ -1926,7 +1926,7 @@ CMSWindowsScreen::getDraggingFilename()
return m_draggingFilename;
}
const CString&
const String&
CMSWindowsScreen::getDropTarget() const
{
return m_desktopPath;

View File

@@ -29,15 +29,15 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class CEventQueueTimer;
class EventQueueTimer;
class CMSWindowsDesks;
class CMSWindowsKeyState;
class CMSWindowsScreenSaver;
class CThread;
class Thread;
class CMSWindowsDropTarget;
//! Implementation of IPlatformScreen for Microsoft Windows
class CMSWindowsScreen : public CPlatformScreen {
class CMSWindowsScreen : public PlatformScreen {
public:
CMSWindowsScreen(
bool isPrimary,
@@ -113,17 +113,17 @@ public:
virtual void closeScreensaver();
virtual void screensaver(bool activate);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual void setOptions(const OptionsList& options);
virtual void setSequenceNumber(UInt32);
virtual bool isPrimary() const;
virtual void fakeDraggingFiles(CDragFileList fileList);
virtual CString& getDraggingFilename();
virtual const CString&
virtual void fakeDraggingFiles(DragFileList fileList);
virtual String& getDraggingFilename();
virtual const String&
getDropTarget() const;
protected:
// IPlatformScreen overrides
virtual void handleSystemEvent(const CEvent&, void*);
virtual void handleSystemEvent(const Event&, void*);
virtual void updateButtons();
virtual IKeyState* getKeyState() const;
@@ -143,9 +143,9 @@ private:
// convenience function to send events
public: // HACK
void sendEvent(CEvent::Type type, void* = NULL);
void sendEvent(Event::Type type, void* = NULL);
private: // HACK
void sendClipboardEvent(CEvent::Type type, ClipboardID id);
void sendClipboardEvent(Event::Type type, ClipboardID id);
// handle message before it gets dispatched. returns true iff
// the message should not be dispatched.
@@ -183,7 +183,7 @@ private: // HACK
void updateScreenShape();
// fix timer callback
void handleFixes(const CEvent&, void*);
void handleFixes(const Event&, void*);
// fix the clipboard viewer chain
void fixClipboardViewer();
@@ -224,21 +224,21 @@ private: // HACK
void sendDragThread(void*);
private:
struct CHotKeyItem {
struct HotKeyItem {
public:
CHotKeyItem(UINT vk, UINT modifiers);
HotKeyItem(UINT vk, UINT modifiers);
UINT getVirtualKey() const;
bool operator<(const CHotKeyItem&) const;
bool operator<(const HotKeyItem&) const;
private:
UINT m_keycode;
UINT m_mask;
};
typedef std::map<UInt32, CHotKeyItem> HotKeyMap;
typedef std::map<UInt32, HotKeyItem> HotKeyMap;
typedef std::vector<UInt32> HotKeyIDList;
typedef std::map<CHotKeyItem, UInt32> HotKeyToIDMap;
typedef std::map<HotKeyItem, UInt32> HotKeyToIDMap;
typedef std::vector<KeyButton> PrimaryKeyDownList;
static HINSTANCE s_windowInstance;
@@ -277,7 +277,7 @@ private:
DWORD m_threadID;
// timer for periodically checking stuff that requires polling
CEventQueueTimer* m_fixTimer;
EventQueueTimer* m_fixTimer;
// the keyboard layout to use when off primary screen
HKL m_keyLayout;
@@ -331,14 +331,14 @@ private:
IEventQueue* m_events;
CString m_desktopPath;
String m_desktopPath;
CMSWindowsDropTarget*
m_dropTarget;
HWND m_dropWindow;
const int m_dropWindowSize;
CThread* m_sendDragThread;
Thread* m_sendDragThread;
PrimaryKeyDownList m_primaryKeyDownList;
};

View File

@@ -112,7 +112,7 @@ CMSWindowsScreenSaver::enable()
}
// restore display power down
CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY);
}
void
@@ -128,7 +128,7 @@ CMSWindowsScreenSaver::disable()
}
// disable display power down
CArchMiscWindows::addBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::addBusyState(ArchMiscWindows::kDISPLAY);
}
void
@@ -147,7 +147,7 @@ CMSWindowsScreenSaver::activate()
}
// restore power save when screen saver activates
CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY);
}
}
@@ -187,7 +187,7 @@ CMSWindowsScreenSaver::deactivate()
m_wasEnabled, 0, SPIF_SENDWININICHANGE);
// disable display power down
CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY);
}
bool
@@ -220,7 +220,7 @@ CMSWindowsScreenSaver::watchDesktop()
// watch desktop in another thread
LOG((CLOG_DEBUG "watching screen saver desktop"));
m_active = true;
m_watch = new CThread(new TMethodJob<CMSWindowsScreenSaver>(this,
m_watch = new Thread(new TMethodJob<CMSWindowsScreenSaver>(this,
&CMSWindowsScreenSaver::watchDesktopThread));
}
@@ -235,7 +235,7 @@ CMSWindowsScreenSaver::watchProcess(HANDLE process)
LOG((CLOG_DEBUG "watching screen saver process"));
m_process = process;
m_active = true;
m_watch = new CThread(new TMethodJob<CMSWindowsScreenSaver>(this,
m_watch = new Thread(new TMethodJob<CMSWindowsScreenSaver>(this,
&CMSWindowsScreenSaver::watchProcessThread));
}
}
@@ -284,7 +284,7 @@ void
CMSWindowsScreenSaver::watchProcessThread(void*)
{
for (;;) {
CThread::testCancel();
Thread::testCancel();
if (WaitForSingleObject(m_process, 50) == WAIT_OBJECT_0) {
// process terminated
LOG((CLOG_DEBUG "screen saver died"));
@@ -301,19 +301,19 @@ void
CMSWindowsScreenSaver::setSecure(bool secure, bool saveSecureAsInt)
{
HKEY hkey =
CArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
ArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
if (hkey == NULL) {
return;
}
if (saveSecureAsInt) {
CArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? 1 : 0);
ArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? 1 : 0);
}
else {
CArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? "1" : "0");
ArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? "1" : "0");
}
CArchMiscWindows::closeKey(hkey);
ArchMiscWindows::closeKey(hkey);
}
bool
@@ -321,7 +321,7 @@ CMSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const
{
// get the password protection setting key
HKEY hkey =
CArchMiscWindows::openKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
ArchMiscWindows::openKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure);
if (hkey == NULL) {
return false;
}
@@ -329,28 +329,28 @@ CMSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const
// get the value. the value may be an int or a string, depending
// on the version of windows.
bool result;
switch (CArchMiscWindows::typeOfValue(hkey, g_isSecureNT)) {
switch (ArchMiscWindows::typeOfValue(hkey, g_isSecureNT)) {
default:
result = false;
break;
case CArchMiscWindows::kUINT: {
case ArchMiscWindows::kUINT: {
DWORD value =
CArchMiscWindows::readValueInt(hkey, g_isSecureNT);
ArchMiscWindows::readValueInt(hkey, g_isSecureNT);
*wasSecureFlagAnInt = true;
result = (value != 0);
break;
}
case CArchMiscWindows::kSTRING: {
case ArchMiscWindows::kSTRING: {
std::string value =
CArchMiscWindows::readValueString(hkey, g_isSecureNT);
ArchMiscWindows::readValueString(hkey, g_isSecureNT);
*wasSecureFlagAnInt = false;
result = (value != "0");
break;
}
}
CArchMiscWindows::closeKey(hkey);
ArchMiscWindows::closeKey(hkey);
return result;
}

View File

@@ -24,7 +24,7 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class CThread;
class Thread;
//! Microsoft windows screen saver implementation
class CMSWindowsScreenSaver : public IScreenSaver {
@@ -54,7 +54,7 @@ public:
virtual bool isActive() const;
private:
class CFindScreenSaverInfo {
class FindScreenSaverInfo {
public:
HDESK m_desktop;
HWND m_window;
@@ -77,7 +77,7 @@ private:
bool m_wasSecureAnInt;
HANDLE m_process;
CThread* m_watch;
Thread* m_watch;
DWORD m_threadID;
UINT m_msg;
WPARAM m_wParam;

View File

@@ -26,7 +26,7 @@
// CMSWindowsUtil
//
CString
String
CMSWindowsUtil::getString(HINSTANCE instance, DWORD id)
{
char buffer[1024];
@@ -51,12 +51,12 @@ CMSWindowsUtil::getString(HINSTANCE instance, DWORD id)
} while (n == size);
msg[n] = '\0';
CString result(msg);
String result(msg);
delete[] msg;
return result;
}
CString
String
CMSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id)
{
char* buffer;
@@ -69,12 +69,12 @@ CMSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id)
(LPTSTR)&buffer,
0,
NULL) == 0) {
CString errorString = synergy::string::sprintf("%d", error);
String errorString = synergy::string::sprintf("%d", error);
return synergy::string::format(getString(hinstance, id).c_str(),
errorString.c_str());
}
else {
CString result(buffer);
String result(buffer);
LocalFree(buffer);
return result;
}

View File

@@ -29,12 +29,12 @@ public:
/*!
Gets a string for \p id from the string table of \p instance.
*/
static CString getString(HINSTANCE instance, DWORD id);
static String getString(HINSTANCE instance, DWORD id);
//! Get error string
/*!
Gets a system error message for \p error. If the error cannot be
found return the string for \p id, replacing ${1} with \p error.
*/
static CString getErrorString(HINSTANCE, DWORD error, DWORD id);
static String getErrorString(HINSTANCE, DWORD error, DWORD id);
};

View File

@@ -47,8 +47,8 @@ const char g_activeDesktop[] = {"activeDesktop:"};
CMSWindowsWatchdog::CMSWindowsWatchdog(
bool autoDetectCommand,
CIpcServer& ipcServer,
CIpcLogOutputter& ipcLogOutputter) :
IpcServer& ipcServer,
IpcLogOutputter& ipcLogOutputter) :
m_thread(NULL),
m_autoDetectCommand(autoDetectCommand),
m_monitoring(true),
@@ -82,10 +82,10 @@ CMSWindowsWatchdog::~CMSWindowsWatchdog()
void
CMSWindowsWatchdog::startAsync()
{
m_thread = new CThread(new TMethodJob<CMSWindowsWatchdog>(
m_thread = new Thread(new TMethodJob<CMSWindowsWatchdog>(
this, &CMSWindowsWatchdog::mainLoop, nullptr));
m_outputThread = new CThread(new TMethodJob<CMSWindowsWatchdog>(
m_outputThread = new Thread(new TMethodJob<CMSWindowsWatchdog>(
this, &CMSWindowsWatchdog::outputLoop, nullptr));
}
@@ -381,7 +381,7 @@ CMSWindowsWatchdog::getCommand() const
}
// seems like a fairly convoluted way to get the process name
const char* launchName = CApp::instance().argsBase().m_pname;
const char* launchName = App::instance().argsBase().m_pname;
std::string args = ARCH->commandLine();
// build up a full command line
@@ -440,7 +440,7 @@ CMSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout)
return;
}
CIpcShutdownMessage shutdown;
IpcShutdownMessage shutdown;
m_ipcServer.send(shutdown, kIpcClientNode);
// wait for process to exit gracefully.

View File

@@ -27,17 +27,17 @@
#include <string>
#include <list>
class CThread;
class CIpcLogOutputter;
class CIpcServer;
class CFileLogOutputter;
class Thread;
class IpcLogOutputter;
class IpcServer;
class FileLogOutputter;
class CMSWindowsWatchdog {
public:
CMSWindowsWatchdog(
bool autoDetectCommand,
CIpcServer& ipcServer,
CIpcLogOutputter& ipcLogOutputter);
IpcServer& ipcServer,
IpcLogOutputter& ipcLogOutputter);
virtual ~CMSWindowsWatchdog();
void startAsync();
@@ -61,16 +61,16 @@ private:
void testOutput(CString buffer);
private:
CThread* m_thread;
Thread* m_thread;
bool m_autoDetectCommand;
std::string m_command;
bool m_monitoring;
bool m_commandChanged;
HANDLE m_stdOutWrite;
HANDLE m_stdOutRead;
CThread* m_outputThread;
CIpcServer& m_ipcServer;
CIpcLogOutputter& m_ipcLogOutputter;
Thread* m_outputThread;
IpcServer& m_ipcServer;
IpcLogOutputter& m_ipcLogOutputter;
bool m_elevateProcess;
CMSWindowsSession m_session;
PROCESS_INFORMATION m_processInfo;
@@ -89,8 +89,8 @@ An error occured in the process watchdog.
*/
class XMSWindowsWatchdogError : public XSynergy {
public:
XMSWindowsWatchdogError(const CString& msg) : XSynergy(msg) { }
XMSWindowsWatchdogError(const String& msg) : XSynergy(msg) { }
// XBase overrides
virtual CString getWhat() const throw() { return what(); }
virtual String getWhat() const throw() { return what(); }
};

View File

@@ -27,17 +27,17 @@
#include "arch/XArch.h"
//
// COSXClipboard
// OSXClipboard
//
COSXClipboard::COSXClipboard() :
OSXClipboard::OSXClipboard() :
m_time(0),
m_pboard(NULL)
{
m_converters.push_back(new COSXClipboardHTMLConverter);
m_converters.push_back(new COSXClipboardBMPConverter);
m_converters.push_back(new COSXClipboardUTF16Converter);
m_converters.push_back(new COSXClipboardTextConverter);
m_converters.push_back(new OSXClipboardHTMLConverter);
m_converters.push_back(new OSXClipboardBMPConverter);
m_converters.push_back(new OSXClipboardUTF16Converter);
m_converters.push_back(new OSXClipboardTextConverter);
@@ -56,13 +56,13 @@ COSXClipboard::COSXClipboard() :
}
}
COSXClipboard::~COSXClipboard()
OSXClipboard::~OSXClipboard()
{
clearConverters();
}
bool
COSXClipboard::empty()
OSXClipboard::empty()
{
LOG((CLOG_DEBUG "emptying clipboard"));
if (m_pboard == NULL)
@@ -78,7 +78,7 @@ COSXClipboard::empty()
}
bool
COSXClipboard::synchronize()
OSXClipboard::synchronize()
{
if (m_pboard == NULL)
return false;
@@ -93,7 +93,7 @@ COSXClipboard::synchronize()
}
void
COSXClipboard::add(EFormat format, const CString & data)
OSXClipboard::add(EFormat format, const String & data)
{
bool emptied = false;
if (m_pboard == NULL)
@@ -117,7 +117,7 @@ COSXClipboard::add(EFormat format, const CString & data)
// skip converters for other formats
if (converter->getFormat() == format) {
CString osXData = converter->fromIClipboard(data);
String osXData = converter->fromIClipboard(data);
CFStringRef flavorType = converter->getOSXFormat();
CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, (UInt8 *)osXData.data(), osXData.size());
@@ -143,7 +143,7 @@ COSXClipboard::add(EFormat format, const CString & data)
}
bool
COSXClipboard::open(Time time) const
OSXClipboard::open(Time time) const
{
if (m_pboard == NULL)
return false;
@@ -154,20 +154,20 @@ COSXClipboard::open(Time time) const
}
void
COSXClipboard::close() const
OSXClipboard::close() const
{
LOG((CLOG_DEBUG "closing clipboard"));
/* not needed */
}
IClipboard::Time
COSXClipboard::getTime() const
OSXClipboard::getTime() const
{
return m_time;
}
bool
COSXClipboard::has(EFormat format) const
OSXClipboard::has(EFormat format) const
{
if (m_pboard == NULL)
return false;
@@ -193,12 +193,12 @@ COSXClipboard::has(EFormat format) const
return false;
}
CString
COSXClipboard::get(EFormat format) const
String
OSXClipboard::get(EFormat format) const
{
CFStringRef type;
PasteboardItemID item;
CString result;
String result;
if (m_pboard == NULL)
return result;
@@ -237,13 +237,13 @@ COSXClipboard::get(EFormat format) const
throw err;
}
result = CString((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer));
result = String((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer));
}
catch (OSStatus err) {
LOG((CLOG_DEBUG "exception thrown in COSXClipboard::get MacError (%d)", err));
LOG((CLOG_DEBUG "exception thrown in OSXClipboard::get MacError (%d)", err));
}
catch (...) {
LOG((CLOG_DEBUG "unknown exception in COSXClipboard::get"));
LOG((CLOG_DEBUG "unknown exception in OSXClipboard::get"));
RETHROW_XTHREAD
}
@@ -254,7 +254,7 @@ COSXClipboard::get(EFormat format) const
}
void
COSXClipboard::clearConverters()
OSXClipboard::clearConverters()
{
if (m_pboard == NULL)
return;

View File

@@ -26,22 +26,22 @@
class IOSXClipboardConverter;
//! OS X clipboard implementation
class COSXClipboard : public IClipboard {
class OSXClipboard : public IClipboard {
public:
COSXClipboard();
virtual ~COSXClipboard();
OSXClipboard();
virtual ~OSXClipboard();
//! Test if clipboard is owned by synergy
static bool isOwnedBySynergy();
// IClipboard overrides
virtual bool empty();
virtual void add(EFormat, const CString& data);
virtual void add(EFormat, const String& data);
virtual bool open(Time) const;
virtual void close() const;
virtual Time getTime() const;
virtual bool has(EFormat) const;
virtual CString get(EFormat) const;
virtual String get(EFormat) const;
bool synchronize();
private:
@@ -82,14 +82,14 @@ public:
getFormat(). The return data will be in the scrap
format returned by getOSXFormat().
*/
virtual CString fromIClipboard(const CString&) const = 0;
virtual String fromIClipboard(const String&) const = 0;
//! Convert to IClipboard format
/*!
Convert from the carbon scrap format to the IClipboard format
(i.e., the reverse of fromIClipboard()).
*/
virtual CString toIClipboard(const CString&) const = 0;
virtual String toIClipboard(const String&) const = 0;
//@}
};

View File

@@ -19,30 +19,30 @@
#include "platform/OSXClipboardAnyBitmapConverter.h"
#include <algorithm>
COSXClipboardAnyBitmapConverter::COSXClipboardAnyBitmapConverter()
OSXClipboardAnyBitmapConverter::OSXClipboardAnyBitmapConverter()
{
// do nothing
}
COSXClipboardAnyBitmapConverter::~COSXClipboardAnyBitmapConverter()
OSXClipboardAnyBitmapConverter::~OSXClipboardAnyBitmapConverter()
{
// do nothing
}
IClipboard::EFormat
COSXClipboardAnyBitmapConverter::getFormat() const
OSXClipboardAnyBitmapConverter::getFormat() const
{
return IClipboard::kBitmap;
}
CString
COSXClipboardAnyBitmapConverter::fromIClipboard(const CString& data) const
String
OSXClipboardAnyBitmapConverter::fromIClipboard(const String& data) const
{
return doFromIClipboard(data);
}
CString
COSXClipboardAnyBitmapConverter::toIClipboard(const CString& data) const
String
OSXClipboardAnyBitmapConverter::toIClipboard(const String& data) const
{
return doToIClipboard(data);
}

View File

@@ -21,28 +21,28 @@
#include "platform/OSXClipboard.h"
//! Convert to/from some text encoding
class COSXClipboardAnyBitmapConverter : public IOSXClipboardConverter {
class OSXClipboardAnyBitmapConverter : public IOSXClipboardConverter {
public:
COSXClipboardAnyBitmapConverter();
virtual ~COSXClipboardAnyBitmapConverter();
OSXClipboardAnyBitmapConverter();
virtual ~OSXClipboardAnyBitmapConverter();
// IOSXClipboardConverter overrides
virtual IClipboard::EFormat
getFormat() const;
virtual CFStringRef getOSXFormat() const = 0;
virtual CString fromIClipboard(const CString &) const;
virtual CString toIClipboard(const CString &) const;
virtual String fromIClipboard(const String &) const;
virtual String toIClipboard(const String &) const;
protected:
//! Convert from IClipboard format
/*!
Do UTF-8 conversion and linefeed conversion.
*/
virtual CString doFromIClipboard(const CString&) const = 0;
virtual String doFromIClipboard(const String&) const = 0;
//! Convert to IClipboard format
/*!
Do UTF-8 conversion and Linefeed conversion.
*/
virtual CString doToIClipboard(const CString&) const = 0;
virtual String doToIClipboard(const String&) const = 0;
};

View File

@@ -21,34 +21,34 @@
#include <algorithm>
//
// COSXClipboardAnyTextConverter
// OSXClipboardAnyTextConverter
//
COSXClipboardAnyTextConverter::COSXClipboardAnyTextConverter()
OSXClipboardAnyTextConverter::OSXClipboardAnyTextConverter()
{
// do nothing
}
COSXClipboardAnyTextConverter::~COSXClipboardAnyTextConverter()
OSXClipboardAnyTextConverter::~OSXClipboardAnyTextConverter()
{
// do nothing
}
IClipboard::EFormat
COSXClipboardAnyTextConverter::getFormat() const
OSXClipboardAnyTextConverter::getFormat() const
{
return IClipboard::kText;
}
CString
COSXClipboardAnyTextConverter::fromIClipboard(const CString& data) const
String
OSXClipboardAnyTextConverter::fromIClipboard(const String& data) const
{
// convert linefeeds and then convert to desired encoding
return doFromIClipboard(convertLinefeedToMacOS(data));
}
CString
COSXClipboardAnyTextConverter::toIClipboard(const CString& data) const
String
OSXClipboardAnyTextConverter::toIClipboard(const String& data) const
{
// convert text then newlines
return convertLinefeedToUnix(doToIClipboard(data));
@@ -68,21 +68,21 @@ isCR(char ch)
return (ch == '\r');
}
CString
COSXClipboardAnyTextConverter::convertLinefeedToMacOS(const CString& src)
String
OSXClipboardAnyTextConverter::convertLinefeedToMacOS(const String& src)
{
// note -- we assume src is a valid UTF-8 string
CString copy = src;
String copy = src;
std::replace_if(copy.begin(), copy.end(), isLF, '\r');
return copy;
}
CString
COSXClipboardAnyTextConverter::convertLinefeedToUnix(const CString& src)
String
OSXClipboardAnyTextConverter::convertLinefeedToUnix(const String& src)
{
CString copy = src;
String copy = src;
std::replace_if(copy.begin(), copy.end(), isCR, '\n');

View File

@@ -21,33 +21,33 @@
#include "platform/OSXClipboard.h"
//! Convert to/from some text encoding
class COSXClipboardAnyTextConverter : public IOSXClipboardConverter {
class OSXClipboardAnyTextConverter : public IOSXClipboardConverter {
public:
COSXClipboardAnyTextConverter();
virtual ~COSXClipboardAnyTextConverter();
OSXClipboardAnyTextConverter();
virtual ~OSXClipboardAnyTextConverter();
// IOSXClipboardConverter overrides
virtual IClipboard::EFormat
getFormat() const;
virtual CFStringRef
getOSXFormat() const = 0;
virtual CString fromIClipboard(const CString &) const;
virtual CString toIClipboard(const CString &) const;
virtual String fromIClipboard(const String &) const;
virtual String toIClipboard(const String &) const;
protected:
//! Convert from IClipboard format
/*!
Do UTF-8 conversion and linefeed conversion.
*/
virtual CString doFromIClipboard(const CString&) const = 0;
virtual String doFromIClipboard(const String&) const = 0;
//! Convert to IClipboard format
/*!
Do UTF-8 conversion and Linefeed conversion.
*/
virtual CString doToIClipboard(const CString&) const = 0;
virtual String doToIClipboard(const String&) const = 0;
private:
static CString convertLinefeedToMacOS(const CString&);
static CString convertLinefeedToUnix(const CString&);
static String convertLinefeedToMacOS(const String&);
static String convertLinefeedToUnix(const String&);
};

View File

@@ -68,33 +68,33 @@ toLE(UInt8*& dst, UInt32 src)
dst += 4;
}
COSXClipboardBMPConverter::COSXClipboardBMPConverter()
OSXClipboardBMPConverter::OSXClipboardBMPConverter()
{
// do nothing
}
COSXClipboardBMPConverter::~COSXClipboardBMPConverter()
OSXClipboardBMPConverter::~OSXClipboardBMPConverter()
{
// do nothing
}
IClipboard::EFormat
COSXClipboardBMPConverter::getFormat() const
OSXClipboardBMPConverter::getFormat() const
{
return IClipboard::kBitmap;
}
CFStringRef
COSXClipboardBMPConverter::getOSXFormat() const
OSXClipboardBMPConverter::getOSXFormat() const
{
// TODO: does this only work with Windows?
return CFSTR("com.microsoft.bmp");
}
CString
COSXClipboardBMPConverter::fromIClipboard(const CString& bmp) const
String
OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const
{
LOG((CLOG_DEBUG1 "ENTER COSXClipboardBMPConverter::doFromIClipboard()"));
LOG((CLOG_DEBUG1 "ENTER OSXClipboardBMPConverter::doFromIClipboard()"));
// create BMP image
UInt8 header[14];
UInt8* dst = header;
@@ -104,21 +104,21 @@ COSXClipboardBMPConverter::fromIClipboard(const CString& bmp) const
toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt32>(14 + 40));
return CString(reinterpret_cast<const char*>(header), 14) + bmp;
return String(reinterpret_cast<const char*>(header), 14) + bmp;
}
CString
COSXClipboardBMPConverter::toIClipboard(const CString& bmp) const
String
OSXClipboardBMPConverter::toIClipboard(const String& bmp) const
{
// make sure data is big enough for a BMP file
if (bmp.size() <= 14 + 40) {
return CString();
return String();
}
// check BMP file header
const UInt8* rawBMPHeader = reinterpret_cast<const UInt8*>(bmp.data());
if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') {
return CString();
return String();
}
// get offset to image data

View File

@@ -21,10 +21,10 @@
#include "platform/OSXClipboard.h"
//! Convert to/from some text encoding
class COSXClipboardBMPConverter : public IOSXClipboardConverter {
class OSXClipboardBMPConverter : public IOSXClipboardConverter {
public:
COSXClipboardBMPConverter();
virtual ~COSXClipboardBMPConverter();
OSXClipboardBMPConverter();
virtual ~OSXClipboardBMPConverter();
// IMSWindowsClipboardConverter overrides
virtual IClipboard::EFormat
@@ -33,12 +33,12 @@ public:
virtual CFStringRef
getOSXFormat() const;
// COSXClipboardAnyBMPConverter overrides
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
// OSXClipboardAnyBMPConverter overrides
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
// generic encoding converter
static CString convertString(const CString& data,
static String convertString(const String& data,
CFStringEncoding fromEncoding,
CFStringEncoding toEncoding);
};

View File

@@ -20,31 +20,31 @@
#include "base/Unicode.h"
COSXClipboardHTMLConverter::COSXClipboardHTMLConverter()
OSXClipboardHTMLConverter::OSXClipboardHTMLConverter()
{
// do nothing
}
COSXClipboardHTMLConverter::~COSXClipboardHTMLConverter()
OSXClipboardHTMLConverter::~OSXClipboardHTMLConverter()
{
// do nothing
}
IClipboard::EFormat
COSXClipboardHTMLConverter::getFormat() const
OSXClipboardHTMLConverter::getFormat() const
{
return IClipboard::kHTML;
}
CFStringRef
COSXClipboardHTMLConverter::getOSXFormat() const
OSXClipboardHTMLConverter::getOSXFormat() const
{
return CFSTR("public.html");
}
CString
COSXClipboardHTMLConverter::convertString(
const CString& data,
String
OSXClipboardHTMLConverter::convertString(
const String& data,
CFStringEncoding fromEncoding,
CFStringEncoding toEncoding)
{
@@ -53,7 +53,7 @@ COSXClipboardHTMLConverter::convertString(
data.c_str(), fromEncoding);
if (stringRef == NULL) {
return CString();
return String();
}
CFIndex buffSize;
@@ -66,13 +66,13 @@ COSXClipboardHTMLConverter::convertString(
if (buffer == NULL) {
CFRelease(stringRef);
return CString();
return String();
}
CFStringGetBytes(stringRef, entireString, toEncoding,
0, false, (UInt8*)buffer, buffSize, NULL);
CString result(buffer, buffSize);
String result(buffer, buffSize);
delete[] buffer;
CFRelease(stringRef);
@@ -80,15 +80,15 @@ COSXClipboardHTMLConverter::convertString(
return result;
}
CString
COSXClipboardHTMLConverter::doFromIClipboard(const CString& data) const
String
OSXClipboardHTMLConverter::doFromIClipboard(const String& data) const
{
return convertString(data, kCFStringEncodingUTF8,
CFStringGetSystemEncoding());
}
CString
COSXClipboardHTMLConverter::doToIClipboard(const CString& data) const
String
OSXClipboardHTMLConverter::doToIClipboard(const String& data) const
{
return convertString(data, CFStringGetSystemEncoding(),
kCFStringEncodingUTF8);

View File

@@ -21,10 +21,10 @@
#include "OSXClipboardAnyTextConverter.h"
//! Convert to/from HTML encoding
class COSXClipboardHTMLConverter : public COSXClipboardAnyTextConverter {
class OSXClipboardHTMLConverter : public OSXClipboardAnyTextConverter {
public:
COSXClipboardHTMLConverter();
virtual ~COSXClipboardHTMLConverter();
OSXClipboardHTMLConverter();
virtual ~OSXClipboardHTMLConverter();
// IMSWindowsClipboardConverter overrides
virtual IClipboard::EFormat
@@ -33,12 +33,12 @@ public:
virtual CFStringRef getOSXFormat() const;
protected:
// COSXClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
// OSXClipboardAnyTextConverter overrides
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
// generic encoding converter
static CString convertString(const CString& data,
static String convertString(const String& data,
CFStringEncoding fromEncoding,
CFStringEncoding toEncoding);
};

View File

@@ -21,28 +21,28 @@
#include "base/Unicode.h"
//
// COSXClipboardTextConverter
// OSXClipboardTextConverter
//
COSXClipboardTextConverter::COSXClipboardTextConverter()
OSXClipboardTextConverter::OSXClipboardTextConverter()
{
// do nothing
}
COSXClipboardTextConverter::~COSXClipboardTextConverter()
OSXClipboardTextConverter::~OSXClipboardTextConverter()
{
// do nothing
}
CFStringRef
COSXClipboardTextConverter::getOSXFormat() const
OSXClipboardTextConverter::getOSXFormat() const
{
return CFSTR("public.plain-text");
}
CString
COSXClipboardTextConverter::convertString(
const CString& data,
String
OSXClipboardTextConverter::convertString(
const String& data,
CFStringEncoding fromEncoding,
CFStringEncoding toEncoding)
{
@@ -51,7 +51,7 @@ COSXClipboardTextConverter::convertString(
data.c_str(), fromEncoding);
if (stringRef == NULL) {
return CString();
return String();
}
CFIndex buffSize;
@@ -64,13 +64,13 @@ COSXClipboardTextConverter::convertString(
if (buffer == NULL) {
CFRelease(stringRef);
return CString();
return String();
}
CFStringGetBytes(stringRef, entireString, toEncoding,
0, false, (UInt8*)buffer, buffSize, NULL);
CString result(buffer, buffSize);
String result(buffer, buffSize);
delete[] buffer;
CFRelease(stringRef);
@@ -78,15 +78,15 @@ COSXClipboardTextConverter::convertString(
return result;
}
CString
COSXClipboardTextConverter::doFromIClipboard(const CString& data) const
String
OSXClipboardTextConverter::doFromIClipboard(const String& data) const
{
return convertString(data, kCFStringEncodingUTF8,
CFStringGetSystemEncoding());
}
CString
COSXClipboardTextConverter::doToIClipboard(const CString& data) const
String
OSXClipboardTextConverter::doToIClipboard(const String& data) const
{
return convertString(data, CFStringGetSystemEncoding(),
kCFStringEncodingUTF8);

View File

@@ -21,22 +21,22 @@
#include "platform/OSXClipboardAnyTextConverter.h"
//! Convert to/from locale text encoding
class COSXClipboardTextConverter : public COSXClipboardAnyTextConverter {
class OSXClipboardTextConverter : public OSXClipboardAnyTextConverter {
public:
COSXClipboardTextConverter();
virtual ~COSXClipboardTextConverter();
OSXClipboardTextConverter();
virtual ~OSXClipboardTextConverter();
// IOSXClipboardAnyTextConverter overrides
virtual CFStringRef
getOSXFormat() const;
protected:
// COSXClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
// OSXClipboardAnyTextConverter overrides
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
// generic encoding converter
static CString convertString(const CString& data,
static String convertString(const String& data,
CFStringEncoding fromEncoding,
CFStringEncoding toEncoding);
};

View File

@@ -21,35 +21,35 @@
#include "base/Unicode.h"
//
// COSXClipboardUTF16Converter
// OSXClipboardUTF16Converter
//
COSXClipboardUTF16Converter::COSXClipboardUTF16Converter()
OSXClipboardUTF16Converter::OSXClipboardUTF16Converter()
{
// do nothing
}
COSXClipboardUTF16Converter::~COSXClipboardUTF16Converter()
OSXClipboardUTF16Converter::~OSXClipboardUTF16Converter()
{
// do nothing
}
CFStringRef
COSXClipboardUTF16Converter::getOSXFormat() const
OSXClipboardUTF16Converter::getOSXFormat() const
{
return CFSTR("public.utf16-plain-text");
}
CString
COSXClipboardUTF16Converter::doFromIClipboard(const CString& data) const
String
OSXClipboardUTF16Converter::doFromIClipboard(const String& data) const
{
// convert and add nul terminator
return CUnicode::UTF8ToUTF16(data);
return Unicode::UTF8ToUTF16(data);
}
CString
COSXClipboardUTF16Converter::doToIClipboard(const CString& data) const
String
OSXClipboardUTF16Converter::doToIClipboard(const String& data) const
{
// convert and strip nul terminator
return CUnicode::UTF16ToUTF8(data);
return Unicode::UTF16ToUTF8(data);
}

View File

@@ -21,17 +21,17 @@
#include "platform/OSXClipboardAnyTextConverter.h"
//! Convert to/from UTF-16 encoding
class COSXClipboardUTF16Converter : public COSXClipboardAnyTextConverter {
class OSXClipboardUTF16Converter : public OSXClipboardAnyTextConverter {
public:
COSXClipboardUTF16Converter();
virtual ~COSXClipboardUTF16Converter();
OSXClipboardUTF16Converter();
virtual ~OSXClipboardUTF16Converter();
// IOSXClipboardAnyTextConverter overrides
virtual CFStringRef
getOSXFormat() const;
protected:
// COSXClipboardAnyTextConverter overrides
virtual CString doFromIClipboard(const CString&) const;
virtual CString doToIClipboard(const CString&) const;
// OSXClipboardAnyTextConverter overrides
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
};

View File

@@ -23,7 +23,7 @@
#if defined(MAC_OS_X_VERSION_10_7)
NSWindow* g_dragWindow = NULL;
COSXDragView* g_dragView = NULL;
OSXDragView* g_dragView = NULL;
NSString* g_ext = NULL;
void
@@ -42,7 +42,7 @@ runCocoaApp()
[window setAlphaValue:0.1];
[window makeKeyAndOrderFront:nil];
COSXDragView* dragView = [[COSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)];
OSXDragView* dragView = [[OSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)];
g_dragWindow = window;
g_dragView = dragView;

View File

@@ -19,7 +19,7 @@
#ifdef MAC_OS_X_VERSION_10_7
@interface COSXDragView : NSView<NSDraggingSource,NSDraggingInfo>
@interface OSXDragView : NSView<NSDraggingSource,NSDraggingInfo>
{
NSMutableString* m_dropTarget;
NSString* m_dragFileExt;

View File

@@ -19,7 +19,7 @@
#ifdef MAC_OS_X_VERSION_10_7
@implementation COSXDragView
@implementation OSXDragView
@dynamic draggingFormation;
@dynamic animatesToDestination;

View File

@@ -22,16 +22,16 @@
#include "base/IEventQueue.h"
//
// CEventQueueTimer
// EventQueueTimer
//
class CEventQueueTimer { };
class EventQueueTimer { };
//
// COSXEventQueueBuffer
// OSXEventQueueBuffer
//
COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) :
OSXEventQueueBuffer::OSXEventQueueBuffer(IEventQueue* events) :
m_event(NULL),
m_eventQueue(events),
m_carbonEventQueue(NULL)
@@ -39,7 +39,7 @@ COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) :
// do nothing
}
COSXEventQueueBuffer::~COSXEventQueueBuffer()
OSXEventQueueBuffer::~OSXEventQueueBuffer()
{
// release the last event
if (m_event != NULL) {
@@ -48,20 +48,20 @@ COSXEventQueueBuffer::~COSXEventQueueBuffer()
}
void
COSXEventQueueBuffer::init()
OSXEventQueueBuffer::init()
{
m_carbonEventQueue = GetCurrentEventQueue();
}
void
COSXEventQueueBuffer::waitForEvent(double timeout)
OSXEventQueueBuffer::waitForEvent(double timeout)
{
EventRef event;
ReceiveNextEvent(0, NULL, timeout, false, &event);
}
IEventQueueBuffer::Type
COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
OSXEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
{
// release the previous event
if (m_event != NULL) {
@@ -74,7 +74,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
// handle the event
if (error == eventLoopQuitErr) {
event = CEvent(CEvent::kQuit);
event = Event(Event::kQuit);
return kSystem;
}
else if (error != noErr) {
@@ -88,7 +88,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
return kUser;
default:
event = CEvent(CEvent::kSystem,
event = Event(Event::kSystem,
m_eventQueue->getSystemTarget(), &m_event);
return kSystem;
}
@@ -96,7 +96,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
}
bool
COSXEventQueueBuffer::addEvent(UInt32 dataID)
OSXEventQueueBuffer::addEvent(UInt32 dataID)
{
EventRef event;
OSStatus error = CreateEvent(
@@ -123,21 +123,21 @@ COSXEventQueueBuffer::addEvent(UInt32 dataID)
}
bool
COSXEventQueueBuffer::isEmpty() const
OSXEventQueueBuffer::isEmpty() const
{
EventRef event;
OSStatus status = ReceiveNextEvent(0, NULL, 0.0, false, &event);
return (status == eventLoopTimedOutErr);
}
CEventQueueTimer*
COSXEventQueueBuffer::newTimer(double, bool) const
EventQueueTimer*
OSXEventQueueBuffer::newTimer(double, bool) const
{
return new CEventQueueTimer;
return new EventQueueTimer;
}
void
COSXEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const
OSXEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
{
delete timer;
}

View File

@@ -25,20 +25,20 @@
class IEventQueue;
//! Event queue buffer for OS X
class COSXEventQueueBuffer : public IEventQueueBuffer {
class OSXEventQueueBuffer : public IEventQueueBuffer {
public:
COSXEventQueueBuffer(IEventQueue* eventQueue);
virtual ~COSXEventQueueBuffer();
OSXEventQueueBuffer(IEventQueue* eventQueue);
virtual ~OSXEventQueueBuffer();
// IEventQueueBuffer overrides
virtual void init();
virtual void waitForEvent(double timeout);
virtual Type getEvent(CEvent& event, UInt32& dataID);
virtual Type getEvent(Event& event, UInt32& dataID);
virtual bool addEvent(UInt32 dataID);
virtual bool isEmpty() const;
virtual CEventQueueTimer*
virtual EventQueueTimer*
newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(CEventQueueTimer*) const;
virtual void deleteTimer(EventQueueTimer*) const;
private:
EventRef m_event;

View File

@@ -48,12 +48,12 @@ static const UInt32 s_numLockVK = 71;
static const UInt32 s_osxNumLock = 1 << 16;
struct CKeyEntry {
struct KeyEntry {
public:
KeyID m_keyID;
UInt32 m_virtualKey;
};
static const CKeyEntry s_controlKeys[] = {
static const KeyEntry s_controlKeys[] = {
#if defined(MAC_OS_X_VERSION_10_5)
// cursor keys. if we don't do this we'll may still get these from
// the keyboard resource but they may not correspond to the arrow
@@ -177,27 +177,27 @@ static const CKeyEntry s_controlKeys[] = {
//
// COSXKeyState
// OSXKeyState
//
COSXKeyState::COSXKeyState(IEventQueue* events) :
CKeyState(events)
OSXKeyState::OSXKeyState(IEventQueue* events) :
KeyState(events)
{
init();
}
COSXKeyState::COSXKeyState(IEventQueue* events, CKeyMap& keyMap) :
CKeyState(events, keyMap)
OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) :
KeyState(events, keyMap)
{
init();
}
COSXKeyState::~COSXKeyState()
OSXKeyState::~OSXKeyState()
{
}
void
COSXKeyState::init()
OSXKeyState::init()
{
m_deadKeyState = 0;
m_shiftPressed = false;
@@ -216,7 +216,7 @@ COSXKeyState::init()
}
KeyModifierMask
COSXKeyState::mapModifiersFromOSX(UInt32 mask) const
OSXKeyState::mapModifiersFromOSX(UInt32 mask) const
{
KeyModifierMask outMask = 0;
if ((mask & kCGEventFlagMaskShift) != 0) {
@@ -243,7 +243,7 @@ COSXKeyState::mapModifiersFromOSX(UInt32 mask) const
}
KeyModifierMask
COSXKeyState::mapModifiersToCarbon(UInt32 mask) const
OSXKeyState::mapModifiersToCarbon(UInt32 mask) const
{
KeyModifierMask outMask = 0;
if ((mask & kCGEventFlagMaskShift) != 0) {
@@ -269,7 +269,7 @@ COSXKeyState::mapModifiersToCarbon(UInt32 mask) const
}
KeyButton
COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
OSXKeyState::mapKeyFromEvent(KeyIDs& ids,
KeyModifierMask* maskOut, CGEventRef event) const
{
ids.clear();
@@ -295,7 +295,7 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
}
// check for special keys
CVirtualKeyMap::const_iterator i = m_virtualKeyMap.find(vkCode);
VirtualKeyMap::const_iterator i = m_virtualKeyMap.find(vkCode);
if (i != m_virtualKeyMap.end()) {
m_deadKeyState = 0;
ids.push_back(i->second);
@@ -371,7 +371,7 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
if (count != 0 || m_deadKeyState == 0) {
m_deadKeyState = 0;
for (UniCharCount i = 0; i < count; ++i) {
ids.push_back(CKeyResource::unicharToKeyID(chars[i]));
ids.push_back(KeyResource::unicharToKeyID(chars[i]));
}
adjustAltGrModifier(ids, maskOut, isCommand);
return mapVirtualKeyToKeyButton(vkCode);
@@ -384,14 +384,14 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
}
bool
COSXKeyState::fakeCtrlAltDel()
OSXKeyState::fakeCtrlAltDel()
{
// pass keys through unchanged
return false;
}
KeyModifierMask
COSXKeyState::pollActiveModifiers() const
OSXKeyState::pollActiveModifiers() const
{
// falsely assumed that the mask returned by GetCurrentKeyModifiers()
// was the same as a CGEventFlags (which is what mapModifiersFromOSX
@@ -423,7 +423,7 @@ COSXKeyState::pollActiveModifiers() const
}
SInt32
COSXKeyState::pollActiveGroup() const
OSXKeyState::pollActiveGroup() const
{
bool layoutValid = true;
#if defined(MAC_OS_X_VERSION_10_5)
@@ -444,9 +444,9 @@ COSXKeyState::pollActiveGroup() const
}
void
COSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
OSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{
KeyMap km;
::KeyMap km;
GetKeys(km);
const UInt8* m = reinterpret_cast<const UInt8*>(km);
for (UInt32 i = 0; i < 16; ++i) {
@@ -459,7 +459,7 @@ COSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
}
void
COSXKeyState::getKeyMap(CKeyMap& keyMap)
OSXKeyState::getKeyMap(synergy::KeyMap& keyMap)
{
// update keyboard groups
if (getGroups(m_groups)) {
@@ -505,7 +505,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap)
}
void
COSXKeyState::fakeKey(const Keystroke& keystroke)
OSXKeyState::fakeKey(const Keystroke& keystroke)
{
switch (keystroke.m_type) {
case Keystroke::kButton: {
@@ -601,13 +601,13 @@ COSXKeyState::fakeKey(const Keystroke& keystroke)
}
void
COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const
OSXKeyState::getKeyMapForSpecialKeys(synergy::KeyMap& keyMap, SInt32 group) const
{
// special keys are insensitive to modifers and none are dead keys
CKeyMap::KeyItem item;
synergy::KeyMap::KeyItem item;
for (size_t i = 0; i < sizeof(s_controlKeys) /
sizeof(s_controlKeys[0]); ++i) {
const CKeyEntry& entry = s_controlKeys[i];
const KeyEntry& entry = s_controlKeys[i];
item.m_id = entry.m_keyID;
item.m_group = group;
item.m_button = mapVirtualKeyToKeyButton(entry.m_virtualKey);
@@ -615,7 +615,7 @@ COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const
item.m_sensitive = 0;
item.m_dead = false;
item.m_client = 0;
CKeyMap::initModifierKey(item);
synergy::KeyMap::initModifierKey(item);
keyMap.addKeyEntry(item);
if (item.m_lock) {
@@ -626,14 +626,14 @@ COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const
// note: we don't special case the number pad keys. querying the
// mac keyboard returns the non-keypad version of those keys but
// a CKeyState always provides a mapping from keypad keys to
// a KeyState always provides a mapping from keypad keys to
// non-keypad keys so we'll be able to generate the characters
// anyway.
}
bool
COSXKeyState::getKeyMap(CKeyMap& keyMap,
SInt32 group, const CKeyResource& r) const
OSXKeyState::getKeyMap(synergy::KeyMap& keyMap,
SInt32 group, const KeyResource& r) const
{
if (!r.isValid()) {
return false;
@@ -646,7 +646,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
std::vector<std::pair<KeyID, bool> > buttonKeys(r.getNumTables());
// iterate over each button
CKeyMap::KeyItem item;
synergy::KeyMap::KeyItem item;
for (UInt32 i = 0; i < r.getNumButtons(); ++i) {
item.m_button = mapVirtualKeyToKeyButton(i);
@@ -656,7 +656,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
// convert the entry in each table for this button to a KeyID
for (UInt32 j = 0; j < r.getNumTables(); ++j) {
buttonKeys[j].first = r.getKey(j, i);
buttonKeys[j].second = CKeyMap::isDeadKey(buttonKeys[j].first);
buttonKeys[j].second = synergy::KeyMap::isDeadKey(buttonKeys[j].first);
}
// iterate over each character table
@@ -679,7 +679,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
item.m_group = group;
item.m_dead = buttonKeys[j].second;
item.m_client = buttonKeys[j].second ? 1 : 0;
CKeyMap::initModifierKey(item);
synergy::KeyMap::initModifierKey(item);
if (item.m_lock) {
// all locking keys are half duplex on OS X
keyMap.addHalfDuplexButton(i);
@@ -750,7 +750,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
}
bool
COSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask,
OSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask,
UInt32 &macVirtualKey, UInt32 &macModifierMask) const
{
// look up button for key
@@ -785,7 +785,7 @@ COSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask,
}
void
COSXKeyState::handleModifierKeys(void* target,
OSXKeyState::handleModifierKeys(void* target,
KeyModifierMask oldMask, KeyModifierMask newMask)
{
// compute changed modifiers
@@ -819,7 +819,7 @@ COSXKeyState::handleModifierKeys(void* target,
}
void
COSXKeyState::handleModifierKey(void* target,
OSXKeyState::handleModifierKey(void* target,
UInt32 virtualKey, KeyID id,
bool down, KeyModifierMask newMask)
{
@@ -829,7 +829,7 @@ COSXKeyState::handleModifierKey(void* target,
}
bool
COSXKeyState::getGroups(GroupList& groups) const
OSXKeyState::getGroups(GroupList& groups) const
{
CFIndex n;
bool gotLayouts = false;
@@ -871,7 +871,7 @@ COSXKeyState::getGroups(GroupList& groups) const
}
void
COSXKeyState::setGroup(SInt32 group)
OSXKeyState::setGroup(SInt32 group)
{
#if defined(MAC_OS_X_VERSION_10_5)
TISSetInputMethodKeyboardLayoutOverride(m_groups[group]);
@@ -881,7 +881,7 @@ COSXKeyState::setGroup(SInt32 group)
}
void
COSXKeyState::checkKeyboardLayout()
OSXKeyState::checkKeyboardLayout()
{
// XXX -- should call this when notified that groups have changed.
// if no notification for that then we should poll.
@@ -893,11 +893,11 @@ COSXKeyState::checkKeyboardLayout()
}
void
COSXKeyState::adjustAltGrModifier(const CKeyIDs& ids,
OSXKeyState::adjustAltGrModifier(const KeyIDs& ids,
KeyModifierMask* mask, bool isCommand) const
{
if (!isCommand) {
for (CKeyIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) {
for (KeyIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) {
KeyID id = *i;
if (id != kKeyNone &&
((id < 0xe000u || id > 0xefffu) ||
@@ -910,25 +910,25 @@ COSXKeyState::adjustAltGrModifier(const CKeyIDs& ids,
}
KeyButton
COSXKeyState::mapVirtualKeyToKeyButton(UInt32 keyCode)
OSXKeyState::mapVirtualKeyToKeyButton(UInt32 keyCode)
{
// 'A' maps to 0 so shift every id
return static_cast<KeyButton>(keyCode + KeyButtonOffset);
}
UInt32
COSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton)
OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton)
{
return static_cast<UInt32>(keyButton - KeyButtonOffset);
}
//
// COSXKeyState::CKeyResource
// OSXKeyState::KeyResource
//
KeyID
COSXKeyState::CKeyResource::getKeyID(UInt8 c)
OSXKeyState::KeyResource::getKeyID(UInt8 c)
{
if (c == 0) {
return kKeyNone;
@@ -1070,7 +1070,7 @@ COSXKeyState::CKeyResource::getKeyID(UInt8 c)
}
KeyID
COSXKeyState::CKeyResource::unicharToKeyID(UniChar c)
OSXKeyState::KeyResource::unicharToKeyID(UniChar c)
{
switch (c) {
case 3:
@@ -1101,10 +1101,10 @@ COSXKeyState::CKeyResource::unicharToKeyID(UniChar c)
//
// COSXKeyState::CUCHRKeyResource
// OSXKeyState::CUCHRKeyResource
//
COSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource,
OSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource,
UInt32 keyboardType) :
m_m(NULL),
m_cti(NULL),
@@ -1174,32 +1174,32 @@ COSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource,
}
bool
COSXKeyState::CUCHRKeyResource::isValid() const
OSXKeyState::CUCHRKeyResource::isValid() const
{
return (m_m != NULL);
}
UInt32
COSXKeyState::CUCHRKeyResource::getNumModifierCombinations() const
OSXKeyState::CUCHRKeyResource::getNumModifierCombinations() const
{
// only 32 (not 256) because the righthanded modifier bits are ignored
return 32;
}
UInt32
COSXKeyState::CUCHRKeyResource::getNumTables() const
OSXKeyState::CUCHRKeyResource::getNumTables() const
{
return m_cti->keyToCharTableCount;
}
UInt32
COSXKeyState::CUCHRKeyResource::getNumButtons() const
OSXKeyState::CUCHRKeyResource::getNumButtons() const
{
return m_cti->keyToCharTableSize;
}
UInt32
COSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const
OSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const
{
if (mask >= m_m->modifiersCount) {
return m_m->defaultTableNum;
@@ -1210,7 +1210,7 @@ COSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const
}
KeyID
COSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const
OSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const
{
assert(table < getNumTables());
assert(button < getNumButtons());
@@ -1246,7 +1246,7 @@ COSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const
}
bool
COSXKeyState::CUCHRKeyResource::getDeadKey(
OSXKeyState::CUCHRKeyResource::getDeadKey(
KeySequence& keys, UInt16 index) const
{
if (m_sri == NULL || index >= m_sri->keyStateRecordCount) {
@@ -1282,14 +1282,14 @@ COSXKeyState::CUCHRKeyResource::getDeadKey(
// convert keys to their dead counterparts
for (KeySequence::iterator i = keys.begin(); i != keys.end(); ++i) {
*i = CKeyMap::getDeadKey(*i);
*i = synergy::KeyMap::getDeadKey(*i);
}
return true;
}
bool
COSXKeyState::CUCHRKeyResource::getKeyRecord(
OSXKeyState::CUCHRKeyResource::getKeyRecord(
KeySequence& keys, UInt16 index, UInt16& state) const
{
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource);
@@ -1353,7 +1353,7 @@ COSXKeyState::CUCHRKeyResource::getKeyRecord(
}
bool
COSXKeyState::CUCHRKeyResource::addSequence(
OSXKeyState::CUCHRKeyResource::addSequence(
KeySequence& keys, UCKeyCharSeq c) const
{
if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) {

View File

@@ -35,13 +35,13 @@
/*!
A key state for OS X.
*/
class COSXKeyState : public CKeyState {
class OSXKeyState : public KeyState {
public:
typedef std::vector<KeyID> CKeyIDs;
typedef std::vector<KeyID> KeyIDs;
COSXKeyState(IEventQueue* events);
COSXKeyState(IEventQueue* events, CKeyMap& keyMap);
virtual ~COSXKeyState();
OSXKeyState(IEventQueue* events);
OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap);
virtual ~OSXKeyState();
//! @name modifiers
//@{
@@ -79,7 +79,7 @@ public:
that was pressed or released, or 0 if the button doesn't map to a known
KeyID.
*/
KeyButton mapKeyFromEvent(CKeyIDs& ids,
KeyButton mapKeyFromEvent(KeyIDs& ids,
KeyModifierMask* maskOut, CGEventRef event) const;
//! Map key and mask to native values
@@ -101,21 +101,21 @@ public:
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
protected:
// CKeyState overrides
virtual void getKeyMap(CKeyMap& keyMap);
// KeyState overrides
virtual void getKeyMap(synergy::KeyMap& keyMap);
virtual void fakeKey(const Keystroke& keystroke);
private:
class CKeyResource;
class KeyResource;
typedef std::vector<KeyLayout> GroupList;
// Add hard coded special keys to a CKeyMap.
// Add hard coded special keys to a synergy::KeyMap.
void getKeyMapForSpecialKeys(
CKeyMap& keyMap, SInt32 group) const;
synergy::KeyMap& keyMap, SInt32 group) const;
// Convert keyboard resource to a key map
bool getKeyMap(CKeyMap& keyMap,
SInt32 group, const CKeyResource& r) const;
bool getKeyMap(synergy::KeyMap& keyMap,
SInt32 group, const KeyResource& r) const;
// Get the available keyboard groups
bool getGroups(GroupList&) const;
@@ -138,7 +138,7 @@ private:
// option is acting as AltGr (i.e. it generates a glyph and there are
// no command modifiers active) then we don't send the super modifier
// to clients because they'd try to match it as a command modifier.
void adjustAltGrModifier(const CKeyIDs& ids,
void adjustAltGrModifier(const KeyIDs& ids,
KeyModifierMask* mask, bool isCommand) const;
// Maps an OS X virtual key id to a KeyButton. This simply remaps
@@ -152,7 +152,7 @@ private:
void init();
private:
class CKeyResource : public IInterface {
class KeyResource : public IInterface {
public:
virtual bool isValid() const = 0;
virtual UInt32 getNumModifierCombinations() const = 0;
@@ -169,11 +169,11 @@ private:
};
class CUCHRKeyResource : public CKeyResource {
class CUCHRKeyResource : public KeyResource {
public:
CUCHRKeyResource(const void*, UInt32 keyboardType);
// CKeyResource overrides
// KeyResource overrides
virtual bool isValid() const;
virtual UInt32 getNumModifierCombinations() const;
virtual UInt32 getNumTables() const;
@@ -208,9 +208,9 @@ private:
};
typedef std::map<KeyLayout, SInt32> GroupMap;
typedef std::map<UInt32, KeyID> CVirtualKeyMap;
typedef std::map<UInt32, KeyID> VirtualKeyMap;
CVirtualKeyMap m_virtualKeyMap;
VirtualKeyMap m_virtualKeyMap;
mutable UInt32 m_deadKeyState;
GroupList m_groups;
GroupMap m_groupMap;

File diff suppressed because it is too large Load Diff

View File

@@ -41,20 +41,20 @@ extern "C" {
template <class T>
class CCondVar;
class CEventQueueTimer;
class CMutex;
class CThread;
class COSXKeyState;
class COSXScreenSaver;
class CondVar;
class EventQueueTimer;
class Mutex;
class Thread;
class OSXKeyState;
class OSXScreenSaver;
class IEventQueue;
class CMutex;
class Mutex;
//! Implementation of IPlatformScreen for OS X
class COSXScreen : public CPlatformScreen {
class OSXScreen : public PlatformScreen {
public:
COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor=true);
virtual ~COSXScreen();
OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor=true);
virtual ~OSXScreen();
IEventQueue* getEvents() const { return m_events; }
@@ -93,18 +93,18 @@ public:
virtual void closeScreensaver();
virtual void screensaver(bool activate);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual void setOptions(const OptionsList& options);
virtual void setSequenceNumber(UInt32);
virtual bool isPrimary() const;
virtual void fakeDraggingFiles(CDragFileList fileList);
virtual CString& getDraggingFilename();
virtual void fakeDraggingFiles(DragFileList fileList);
virtual String& getDraggingFilename();
const CString& getDropTarget() const { return m_dropTarget; }
const String& getDropTarget() const { return m_dropTarget; }
void waitForCarbonLoop() const;
protected:
// IPlatformScreen overrides
virtual void handleSystemEvent(const CEvent&, void*);
virtual void handleSystemEvent(const Event&, void*);
virtual void updateButtons();
virtual IKeyState* getKeyState() const;
@@ -114,8 +114,8 @@ private:
void postMouseEvent(CGPoint&) const;
// convenience function to send events
void sendEvent(CEvent::Type type, void* = NULL) const;
void sendClipboardEvent(CEvent::Type type, ClipboardID id) const;
void sendEvent(Event::Type type, void* = NULL) const;
void sendClipboardEvent(Event::Type type, ClipboardID id) const;
// message handlers
bool onMouseMove(SInt32 mx, SInt32 my);
@@ -157,10 +157,10 @@ private:
void enableDragTimer(bool enable);
// drag timer handler
void handleDrag(const CEvent&, void*);
void handleDrag(const Event&, void*);
// clipboard check timer handler
void handleClipboardCheck(const CEvent&, void*);
void handleClipboardCheck(const Event&, void*);
#if defined(MAC_OS_X_VERSION_10_5)
// Resolution switch callback
@@ -183,7 +183,7 @@ private:
void handlePowerChangeRequest(natural_t messageType,
void* messageArgument);
void handleConfirmSleep(const CEvent& event, void*);
void handleConfirmSleep(const Event& event, void*);
// global hotkey operating mode
static bool isGlobalHotKeyOperatingModeAvailable();
@@ -206,14 +206,14 @@ private:
void getDropTargetThread(void*);
private:
struct CHotKeyItem {
struct HotKeyItem {
public:
CHotKeyItem(UInt32, UInt32);
CHotKeyItem(EventHotKeyRef, UInt32, UInt32);
HotKeyItem(UInt32, UInt32);
HotKeyItem(EventHotKeyRef, UInt32, UInt32);
EventHotKeyRef getRef() const;
bool operator<(const CHotKeyItem&) const;
bool operator<(const HotKeyItem&) const;
private:
EventHotKeyRef m_ref;
@@ -221,7 +221,7 @@ private:
UInt32 m_mask;
};
enum MouseButtonState {
enum EMouseButtonState {
kMouseButtonUp = 0,
kMouseButtonDragged,
kMouseButtonDown,
@@ -229,9 +229,9 @@ private:
};
class CMouseButtonState {
class MouseButtonState {
public:
void set(UInt32 button, MouseButtonState state);
void set(UInt32 button, EMouseButtonState state);
bool any();
void reset();
void overwrite(UInt32 buttons);
@@ -242,10 +242,10 @@ private:
std::bitset<NumButtonIDs> m_buttons;
};
typedef std::map<UInt32, CHotKeyItem> HotKeyMap;
typedef std::map<UInt32, HotKeyItem> HotKeyMap;
typedef std::vector<UInt32> HotKeyIDList;
typedef std::map<KeyModifierMask, UInt32> ModifierHotKeyMap;
typedef std::map<CHotKeyItem, UInt32> HotKeyToIDMap;
typedef std::map<HotKeyItem, UInt32> HotKeyToIDMap;
// true if screen is being used as a primary screen, false otherwise
bool m_isPrimary;
@@ -271,29 +271,29 @@ private:
fakeMouseButton button method is marked 'const'. This is
Evil, and this should be moved to a place where it need not
be mutable as soon as possible. */
mutable CMouseButtonState m_buttonState;
mutable MouseButtonState m_buttonState;
typedef std::map<UInt16, CGEventType> MouseButtonEventMapType;
std::vector<MouseButtonEventMapType> MouseButtonEventMap;
bool m_cursorHidden;
SInt32 m_dragNumButtonsDown;
Point m_dragLastPoint;
CEventQueueTimer* m_dragTimer;
EventQueueTimer* m_dragTimer;
// keyboard stuff
COSXKeyState* m_keyState;
OSXKeyState* m_keyState;
// clipboards
COSXClipboard m_pasteboard;
OSXClipboard m_pasteboard;
UInt32 m_sequenceNumber;
// screen saver stuff
COSXScreenSaver* m_screensaver;
OSXScreenSaver* m_screensaver;
bool m_screensaverNotify;
// clipboard stuff
bool m_ownClipboard;
CEventQueueTimer* m_clipboardTimer;
EventQueueTimer* m_clipboardTimer;
// window object that gets user input events when the server
// has focus.
@@ -312,9 +312,9 @@ private:
EventHandlerRef m_switchEventHandlerRef;
// sleep / wakeup
CMutex* m_pmMutex;
CThread* m_pmWatchThread;
CCondVar<bool>* m_pmThreadReady;
Mutex* m_pmMutex;
Thread* m_pmWatchThread;
CondVar<bool>* m_pmThreadReady;
CFRunLoopRef m_pmRunloop;
io_connect_t m_pmRootPort;
@@ -345,11 +345,11 @@ private:
IEventQueue* m_events;
CThread* m_getDropTargetThread;
CString m_dropTarget;
Thread* m_getDropTargetThread;
String m_dropTarget;
#if defined(MAC_OS_X_VERSION_10_7)
CMutex* m_carbonLoopMutex;
CCondVar<bool>* m_carbonLoopReady;
Mutex* m_carbonLoopMutex;
CondVar<bool>* m_carbonLoopReady;
#endif
};

View File

@@ -31,10 +31,10 @@ void getProcessSerialNumber(const char* name, ProcessSerialNumber& psn);
bool testProcessName(const char* name, const ProcessSerialNumber& psn);
//
// COSXScreenSaver
// OSXScreenSaver
//
COSXScreenSaver::COSXScreenSaver(IEventQueue* events, void* eventTarget) :
OSXScreenSaver::OSXScreenSaver(IEventQueue* events, void* eventTarget) :
m_eventTarget(eventTarget),
m_enabled(true),
m_events(events)
@@ -64,7 +64,7 @@ COSXScreenSaver::COSXScreenSaver(IEventQueue* events, void* eventTarget) :
}
}
COSXScreenSaver::~COSXScreenSaver()
OSXScreenSaver::~OSXScreenSaver()
{
RemoveEventHandler(m_launchTerminationEventHandlerRef);
// screenSaverUtilReleaseController(m_screenSaverController);
@@ -72,60 +72,60 @@ COSXScreenSaver::~COSXScreenSaver()
}
void
COSXScreenSaver::enable()
OSXScreenSaver::enable()
{
m_enabled = true;
screenSaverUtilEnable(m_screenSaverController);
}
void
COSXScreenSaver::disable()
OSXScreenSaver::disable()
{
m_enabled = false;
screenSaverUtilDisable(m_screenSaverController);
}
void
COSXScreenSaver::activate()
OSXScreenSaver::activate()
{
screenSaverUtilActivate(m_screenSaverController);
}
void
COSXScreenSaver::deactivate()
OSXScreenSaver::deactivate()
{
screenSaverUtilDeactivate(m_screenSaverController, m_enabled);
}
bool
COSXScreenSaver::isActive() const
OSXScreenSaver::isActive() const
{
return (screenSaverUtilIsActive(m_screenSaverController) != 0);
}
void
COSXScreenSaver::processLaunched(ProcessSerialNumber psn)
OSXScreenSaver::processLaunched(ProcessSerialNumber psn)
{
if (testProcessName("ScreenSaverEngine", psn)) {
m_screenSaverPSN = psn;
LOG((CLOG_DEBUG1 "ScreenSaverEngine launched. Enabled=%d", m_enabled));
if (m_enabled) {
m_events->addEvent(
CEvent(m_events->forIPrimaryScreen().screensaverActivated(),
Event(m_events->forIPrimaryScreen().screensaverActivated(),
m_eventTarget));
}
}
}
void
COSXScreenSaver::processTerminated(ProcessSerialNumber psn)
OSXScreenSaver::processTerminated(ProcessSerialNumber psn)
{
if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN &&
m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) {
LOG((CLOG_DEBUG1 "ScreenSaverEngine terminated. Enabled=%d", m_enabled));
if (m_enabled) {
m_events->addEvent(
CEvent(m_events->forIPrimaryScreen().screensaverDeactivated(),
Event(m_events->forIPrimaryScreen().screensaverDeactivated(),
m_eventTarget));
}
@@ -135,7 +135,7 @@ COSXScreenSaver::processTerminated(ProcessSerialNumber psn)
}
pascal OSStatus
COSXScreenSaver::launchTerminationCallback(
OSXScreenSaver::launchTerminationCallback(
EventHandlerCallRef nextHandler,
EventRef theEvent, void* userData)
{
@@ -151,7 +151,7 @@ COSXScreenSaver::launchTerminationCallback(
if ((result == noErr) &&
(actualSize > 0) &&
(actualType == typeProcessSerialNumber)) {
COSXScreenSaver* screenSaver = (COSXScreenSaver*)userData;
OSXScreenSaver* screenSaver = (OSXScreenSaver*)userData;
UInt32 eventKind = GetEventKind(theEvent);
if (eventKind == kEventAppLaunched) {
screenSaver->processLaunched(psn);

View File

@@ -25,10 +25,10 @@
class IEventQueue;
//! OSX screen saver implementation
class COSXScreenSaver : public IScreenSaver {
class OSXScreenSaver : public IScreenSaver {
public:
COSXScreenSaver(IEventQueue* events, void* eventTarget);
virtual ~COSXScreenSaver();
OSXScreenSaver(IEventQueue* events, void* eventTarget);
virtual ~OSXScreenSaver();
// IScreenSaver overrides
virtual void enable();

View File

@@ -145,7 +145,7 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
if (!success) {
// send failure
LOG((CLOG_DEBUG1 "failed"));
insertReply(new CReply(requestor, target, time));
insertReply(new Reply(requestor, target, time));
}
// send notifications that are pending
@@ -164,7 +164,7 @@ CXWindowsClipboard::addSimpleRequest(Window requestor,
}
// handle targets
CString data;
String data;
Atom type = None;
int format = 0;
if (target == m_atomTargets) {
@@ -193,14 +193,14 @@ CXWindowsClipboard::addSimpleRequest(Window requestor,
if (type != None) {
// success
LOG((CLOG_DEBUG1 "success"));
insertReply(new CReply(requestor, target, time,
insertReply(new Reply(requestor, target, time,
property, data, type, format));
return true;
}
else {
// failure
LOG((CLOG_DEBUG1 "failed"));
insertReply(new CReply(requestor, target, time));
insertReply(new Reply(requestor, target, time));
return false;
}
}
@@ -209,7 +209,7 @@ bool
CXWindowsClipboard::processRequest(Window requestor,
::Time /*time*/, Atom property)
{
CReplyMap::iterator index = m_replies.find(requestor);
ReplyMap::iterator index = m_replies.find(requestor);
if (index == m_replies.end()) {
// unknown requestor window
return false;
@@ -218,10 +218,10 @@ CXWindowsClipboard::processRequest(Window requestor,
// find the property in the known requests. it should be the
// first property but we'll check 'em all if we have to.
CReplyList& replies = index->second;
for (CReplyList::iterator index2 = replies.begin();
ReplyList& replies = index->second;
for (ReplyList::iterator index2 = replies.begin();
index2 != replies.end(); ++index2) {
CReply* reply = *index2;
Reply* reply = *index2;
if (reply->m_replied && reply->m_property == property) {
// if reply is complete then remove it and start the
// next one.
@@ -236,7 +236,7 @@ CXWindowsClipboard::processRequest(Window requestor,
bool
CXWindowsClipboard::destroyRequest(Window requestor)
{
CReplyMap::iterator index = m_replies.find(requestor);
ReplyMap::iterator index = m_replies.find(requestor);
if (index == m_replies.end()) {
// unknown requestor window
return false;
@@ -298,7 +298,7 @@ CXWindowsClipboard::empty()
}
void
CXWindowsClipboard::add(EFormat format, const CString& data)
CXWindowsClipboard::add(EFormat format, const String& data)
{
assert(m_open);
assert(m_owner);
@@ -378,7 +378,7 @@ CXWindowsClipboard::has(EFormat format) const
return m_added[format];
}
CString
String
CXWindowsClipboard::get(EFormat format) const
{
assert(m_open);
@@ -504,7 +504,7 @@ CXWindowsClipboard::icccmFillCache()
// instead of the correct type ATOM; allow either.
const Atom atomTargets = m_atomTargets;
Atom target;
CString data;
String data;
if (!icccmGetSelection(atomTargets, &target, &data) ||
(target != m_atomAtom && target != m_atomTargets)) {
LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
@@ -548,7 +548,7 @@ CXWindowsClipboard::icccmFillCache()
// get the data
Atom actualTarget;
CString targetData;
String targetData;
if (!icccmGetSelection(target, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
continue;
@@ -564,7 +564,7 @@ CXWindowsClipboard::icccmFillCache()
bool
CXWindowsClipboard::icccmGetSelection(Atom target,
Atom* actualTarget, CString* data) const
Atom* actualTarget, String* data) const
{
assert(actualTarget != NULL);
assert(data != NULL);
@@ -588,7 +588,7 @@ IClipboard::Time
CXWindowsClipboard::icccmGetTime() const
{
Atom actualTarget;
CString data;
String data;
if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) &&
actualTarget == m_atomInteger) {
Time time = *reinterpret_cast<const Time*>(data.data());
@@ -659,7 +659,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
// get the Motif clipboard header property from the root window
Atom target;
SInt32 format;
CString data;
String data;
Window root = RootWindow(m_display, DefaultScreen(m_display));
if (!CXWindowsUtil::getWindowProperty(m_display, root,
m_atomMotifClipHeader,
@@ -668,9 +668,9 @@ CXWindowsClipboard::motifOwnsClipboard() const
}
// check the owner window against the current clipboard owner
const CMotifClipHeader* header =
reinterpret_cast<const CMotifClipHeader*>(data.data());
if (data.size() >= sizeof(CMotifClipHeader) &&
const MotifClipHeader* header =
reinterpret_cast<const MotifClipHeader*>(data.data());
if (data.size() >= sizeof(MotifClipHeader) &&
header->m_id == kMotifClipHeader) {
if (static_cast<Window>(header->m_selectionOwner) == owner) {
return true;
@@ -688,7 +688,7 @@ CXWindowsClipboard::motifFillCache()
// get the Motif clipboard header property from the root window
Atom target;
SInt32 format;
CString data;
String data;
Window root = RootWindow(m_display, DefaultScreen(m_display));
if (!CXWindowsUtil::getWindowProperty(m_display, root,
m_atomMotifClipHeader,
@@ -697,9 +697,9 @@ CXWindowsClipboard::motifFillCache()
}
// check that the header is okay
const CMotifClipHeader* header =
reinterpret_cast<const CMotifClipHeader*>(data.data());
if (data.size() < sizeof(CMotifClipHeader) ||
const MotifClipHeader* header =
reinterpret_cast<const MotifClipHeader*>(data.data());
if (data.size() < sizeof(MotifClipHeader) ||
header->m_id != kMotifClipHeader ||
header->m_numItems < 1) {
return;
@@ -717,9 +717,9 @@ CXWindowsClipboard::motifFillCache()
}
// check that the item is okay
const CMotifClipItem* item =
reinterpret_cast<const CMotifClipItem*>(data.data());
if (data.size() < sizeof(CMotifClipItem) ||
const MotifClipItem* item =
reinterpret_cast<const MotifClipItem*>(data.data());
if (data.size() < sizeof(MotifClipItem) ||
item->m_id != kMotifClipItem ||
item->m_numFormats - item->m_numDeletedFormats < 1) {
return;
@@ -731,13 +731,13 @@ CXWindowsClipboard::motifFillCache()
reinterpret_cast<const char*>(data.data()));
// get the available formats
typedef std::map<Atom, CString> CMotifFormatMap;
CMotifFormatMap motifFormats;
typedef std::map<Atom, String> MotifFormatMap;
MotifFormatMap motifFormats;
for (SInt32 i = 0; i < numFormats; ++i) {
// get Motif format property from the root window
sprintf(name, "_MOTIF_CLIP_ITEM_%d", formats[i]);
Atom atomFormat = XInternAtom(m_display, name, False);
CString data;
String data;
if (!CXWindowsUtil::getWindowProperty(m_display, root,
atomFormat, &data,
&target, &format, False)) {
@@ -745,9 +745,9 @@ CXWindowsClipboard::motifFillCache()
}
// check that the format is okay
const CMotifClipFormat* motifFormat =
reinterpret_cast<const CMotifClipFormat*>(data.data());
if (data.size() < sizeof(CMotifClipFormat) ||
const MotifClipFormat* motifFormat =
reinterpret_cast<const MotifClipFormat*>(data.data());
if (data.size() < sizeof(MotifClipFormat) ||
motifFormat->m_id != kMotifClipFormat ||
motifFormat->m_length < 0 ||
motifFormat->m_type == None ||
@@ -772,21 +772,21 @@ CXWindowsClipboard::motifFillCache()
}
// see if atom is in target list
CMotifFormatMap::const_iterator index2 =
MotifFormatMap::const_iterator index2 =
motifFormats.find(converter->getAtom());
if (index2 == motifFormats.end()) {
continue;
}
// get format
const CMotifClipFormat* motifFormat =
reinterpret_cast<const CMotifClipFormat*>(
const MotifClipFormat* motifFormat =
reinterpret_cast<const MotifClipFormat*>(
index2->second.data());
const Atom target = motifFormat->m_type;
// get the data (finally)
Atom actualTarget;
CString targetData;
String targetData;
if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
continue;
@@ -801,8 +801,8 @@ CXWindowsClipboard::motifFillCache()
}
bool
CXWindowsClipboard::motifGetSelection(const CMotifClipFormat* format,
Atom* actualTarget, CString* data) const
CXWindowsClipboard::motifGetSelection(const MotifClipFormat* format,
Atom* actualTarget, String* data) const
{
// if the current clipboard owner and the owner indicated by the
// motif clip header are the same then transfer via a property on
@@ -838,7 +838,7 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
// get the requested targets
Atom target;
SInt32 format;
CString data;
String data;
if (!CXWindowsUtil::getWindowProperty(m_display, requestor,
property, &data, &target, &format, False)) {
// can't get the requested targets
@@ -875,14 +875,14 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
}
// add reply for MULTIPLE request
insertReply(new CReply(requestor, m_atomMultiple,
time, property, CString(), None, 32));
insertReply(new Reply(requestor, m_atomMultiple,
time, property, String(), None, 32));
return true;
}
void
CXWindowsClipboard::insertReply(CReply* reply)
CXWindowsClipboard::insertReply(Reply* reply)
{
assert(reply != NULL);
@@ -909,7 +909,7 @@ CXWindowsClipboard::insertReply(CReply* reply)
// note errors while we adjust event masks
bool error = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
// get and save the current event mask
XWindowAttributes attr;
@@ -934,7 +934,7 @@ CXWindowsClipboard::pushReplies()
{
// send the first reply for each window if that reply hasn't
// been sent yet.
for (CReplyMap::iterator index = m_replies.begin();
for (ReplyMap::iterator index = m_replies.begin();
index != m_replies.end(); ) {
assert(!index->second.empty());
CReplyList::iterator listit = index->second.begin();
@@ -953,10 +953,10 @@ CXWindowsClipboard::pushReplies()
}
void
CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex,
CReplyList& replies, CReplyList::iterator index)
CXWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
ReplyList& replies, ReplyList::iterator index)
{
CReply* reply = *index;
Reply* reply = *index;
while (sendReply(reply)) {
// reply is complete. discard it and send the next reply,
// if any.
@@ -971,7 +971,7 @@ CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex,
// if there are no more replies in the list then remove the list
// and stop watching the requestor for events.
if (replies.empty()) {
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
Window requestor = mapIndex->first;
XSelectInput(m_display, requestor, m_eventMasks[requestor]);
m_replies.erase(mapIndex++);
@@ -983,7 +983,7 @@ CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex,
}
bool
CXWindowsClipboard::sendReply(CReply* reply)
CXWindowsClipboard::sendReply(Reply* reply)
{
assert(reply != NULL);
@@ -1048,7 +1048,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
LOG((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
reply->m_done = true;
if (reply->m_property != None) {
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
XDeleteProperty(m_display, reply->m_requestor, reply->m_property);
}
@@ -1083,13 +1083,13 @@ CXWindowsClipboard::sendReply(CReply* reply)
// knowing the properties may help design a workaround, if
// it becomes necessary.
if (CLOG->getFilter() >= kDEBUG2) {
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
int n;
Atom* props = XListProperties(m_display, reply->m_requestor, &n);
LOG((CLOG_DEBUG2 "properties of 0x%08x:", reply->m_requestor));
for (int i = 0; i < n; ++i) {
Atom target;
CString data;
String data;
char* name = XGetAtomName(m_display, props[i]);
if (!CXWindowsUtil::getWindowProperty(m_display,
reply->m_requestor,
@@ -1100,9 +1100,9 @@ CXWindowsClipboard::sendReply(CReply* reply)
// if there are any non-ascii characters in string
// then print the binary data.
static const char* hex = "0123456789abcdef";
for (CString::size_type j = 0; j < data.size(); ++j) {
for (String::size_type j = 0; j < data.size(); ++j) {
if (data[j] < 32 || data[j] > 126) {
CString tmp;
String tmp;
tmp.reserve(data.size() * 3);
for (j = 0; j < data.size(); ++j) {
unsigned char v = (unsigned char)data[j];
@@ -1141,7 +1141,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
void
CXWindowsClipboard::clearReplies()
{
for (CReplyMap::iterator index = m_replies.begin();
for (ReplyMap::iterator index = m_replies.begin();
index != m_replies.end(); ++index) {
clearReplies(index->second);
}
@@ -1150,9 +1150,9 @@ CXWindowsClipboard::clearReplies()
}
void
CXWindowsClipboard::clearReplies(CReplyList& replies)
CXWindowsClipboard::clearReplies(ReplyList& replies)
{
for (CReplyList::iterator index = replies.begin();
for (ReplyList::iterator index = replies.begin();
index != replies.end(); ++index) {
delete *index;
}
@@ -1171,7 +1171,7 @@ CXWindowsClipboard::sendNotify(Window requestor,
event.xselection.target = target;
event.xselection.property = property;
event.xselection.time = time;
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
XSendEvent(m_display, requestor, False, 0, &event);
}
@@ -1210,7 +1210,7 @@ CXWindowsClipboard::wasOwnedAtTime(::Time time) const
}
Atom
CXWindowsClipboard::getTargetsData(CString& data, int* format) const
CXWindowsClipboard::getTargetsData(String& data, int* format) const
{
assert(format != NULL);
@@ -1235,7 +1235,7 @@ CXWindowsClipboard::getTargetsData(CString& data, int* format) const
}
Atom
CXWindowsClipboard::getTimestampData(CString& data, int* format) const
CXWindowsClipboard::getTimestampData(String& data, int* format) const
{
assert(format != NULL);
@@ -1273,7 +1273,7 @@ CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
bool
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
Atom selection, Atom target, Atom* actualTarget, CString* data)
Atom selection, Atom target, Atom* actualTarget, String* data)
{
assert(actualTarget != NULL);
assert(data != NULL);
@@ -1314,7 +1314,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
// by badly behaved selection owners.
XEvent xevent;
std::vector<XEvent> events;
CStopwatch timeout(true);
Stopwatch timeout(true);
static const double s_timeout = 0.25; // FIXME -- is this too short?
bool noWait = false;
while (!m_done && !m_failed) {
@@ -1418,7 +1418,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
// get the data from the property
Atom target;
const CString::size_type oldSize = m_data->size();
const String::size_type oldSize = m_data->size();
if (!CXWindowsUtil::getWindowProperty(display, m_requestor,
m_property, m_data, &target, NULL, True)) {
// unable to read property
@@ -1484,10 +1484,10 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
//
// CXWindowsClipboard::CReply
// CXWindowsClipboard::Reply
//
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) :
CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time) :
m_requestor(requestor),
m_target(target),
m_time(time),
@@ -1502,8 +1502,8 @@ CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) :
// do nothing
}
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time,
Atom property, const CString& data, Atom type, int format) :
CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time,
Atom property, const String& data, Atom type, int format) :
m_requestor(requestor),
m_target(target),
m_time(time),

View File

@@ -88,12 +88,12 @@ public:
// IClipboard overrides
virtual bool empty();
virtual void add(EFormat, const CString& data);
virtual void add(EFormat, const String& data);
virtual bool open(Time) const;
virtual void close() const;
virtual Time getTime() const;
virtual bool has(EFormat) const;
virtual CString get(EFormat) const;
virtual String get(EFormat) const;
private:
// remove all converters from our list
@@ -146,7 +146,7 @@ private:
// cannot be performed (in which case *actualTarget == None).
bool readClipboard(Display* display,
Atom selection, Atom target,
Atom* actualTarget, CString* data);
Atom* actualTarget, String* data);
private:
bool processEvent(Display* display, XEvent* event);
@@ -167,7 +167,7 @@ private:
bool m_reading;
// the converted selection data
CString* m_data;
String* m_data;
// the actual type of the data. if this is None then the
// selection owner cannot convert to the requested type.
@@ -182,7 +182,7 @@ private:
enum { kMotifClipFormat = 1, kMotifClipItem, kMotifClipHeader };
// _MOTIF_CLIP_HEADER structure
class CMotifClipHeader {
class MotifClipHeader {
public:
SInt32 m_id; // kMotifClipHeader
SInt32 m_pad1[3];
@@ -195,7 +195,7 @@ private:
};
// Motif clip item structure
class CMotifClipItem {
class MotifClipItem {
public:
SInt32 m_id; // kMotifClipItem
SInt32 m_pad1[5];
@@ -206,7 +206,7 @@ private:
};
// Motif clip format structure
class CMotifClipFormat {
class MotifClipFormat {
public:
SInt32 m_id; // kMotifClipFormat
SInt32 m_pad1[6];
@@ -219,11 +219,11 @@ private:
};
// stores data needed to respond to a selection request
class CReply {
class Reply {
public:
CReply(Window, Atom target, ::Time);
CReply(Window, Atom target, ::Time, Atom property,
const CString& data, Atom type, int format);
Reply(Window, Atom target, ::Time);
Reply(Window, Atom target, ::Time, Atom property,
const String& data, Atom type, int format);
public:
// information about the request
@@ -239,21 +239,21 @@ private:
bool m_done;
// the data to send and its type and format
CString m_data;
String m_data;
Atom m_type;
int m_format;
// index of next byte in m_data to send
UInt32 m_ptr;
};
typedef std::list<CReply*> CReplyList;
typedef std::map<Window, CReplyList> CReplyMap;
typedef std::map<Window, long> CReplyEventMask;
typedef std::list<Reply*> ReplyList;
typedef std::map<Window, ReplyList> ReplyMap;
typedef std::map<Window, long> ReplyEventMask;
// ICCCM interoperability methods
void icccmFillCache();
bool icccmGetSelection(Atom target,
Atom* actualTarget, CString* data) const;
Atom* actualTarget, String* data) const;
Time icccmGetTime() const;
// motif interoperability methods
@@ -261,26 +261,26 @@ private:
void motifUnlockClipboard() const;
bool motifOwnsClipboard() const;
void motifFillCache();
bool motifGetSelection(const CMotifClipFormat*,
Atom* actualTarget, CString* data) const;
bool motifGetSelection(const MotifClipFormat*,
Atom* actualTarget, String* data) const;
Time motifGetTime() const;
// reply methods
bool insertMultipleReply(Window, ::Time, Atom);
void insertReply(CReply*);
void insertReply(Reply*);
void pushReplies();
void pushReplies(CReplyMap::iterator&,
CReplyList&, CReplyList::iterator);
bool sendReply(CReply*);
void pushReplies(ReplyMap::iterator&,
ReplyList&, ReplyList::iterator);
bool sendReply(Reply*);
void clearReplies();
void clearReplies(CReplyList&);
void clearReplies(ReplyList&);
void sendNotify(Window requestor, Atom selection,
Atom target, Atom property, Time time);
bool wasOwnedAtTime(::Time) const;
// data conversion methods
Atom getTargetsData(CString&, int* format) const;
Atom getTimestampData(CString&, int* format) const;
Atom getTargetsData(String&, int* format) const;
Atom getTimestampData(String&, int* format) const;
private:
typedef std::vector<IXWindowsClipboardConverter*> ConverterList;
@@ -303,11 +303,11 @@ private:
bool m_cached;
Time m_cacheTime;
bool m_added[kNumFormats];
CString m_data[kNumFormats];
String m_data[kNumFormats];
// conversion request replies
CReplyMap m_replies;
CReplyEventMask m_eventMasks;
ReplyMap m_replies;
ReplyEventMask m_eventMasks;
// clipboard format converters
ConverterList m_converters;
@@ -365,14 +365,14 @@ public:
getFormat(). The return data will be in the X selection
format returned by getAtom().
*/
virtual CString fromIClipboard(const CString&) const = 0;
virtual String fromIClipboard(const String&) const = 0;
//! Convert to IClipboard format
/*!
Convert from the X selection format to the IClipboard format
(i.e., the reverse of fromIClipboard()).
*/
virtual CString toIClipboard(const CString&) const = 0;
virtual String toIClipboard(const String&) const = 0;
//@}
};

View File

@@ -122,8 +122,8 @@ CXWindowsClipboardAnyBitmapConverter::getDataSize() const
return 8;
}
CString
CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const
String
CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const
{
// fill BMP info header with native-endian data
CBMPInfoHeader infoHeader;
@@ -145,7 +145,7 @@ CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const
infoHeader.biWidth == 0 || infoHeader.biHeight == 0 ||
infoHeader.biPlanes != 0 || infoHeader.biCompression != 0 ||
(infoHeader.biBitCount != 24 && infoHeader.biBitCount != 32)) {
return CString();
return String();
}
// convert to image format
@@ -160,14 +160,14 @@ CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const
}
}
CString
CXWindowsClipboardAnyBitmapConverter::toIClipboard(const CString& image) const
String
CXWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const
{
// convert to raw BMP data
UInt32 w, h, depth;
CString rawBMP = doToIClipboard(image, w, h, depth);
String rawBMP = doToIClipboard(image, w, h, depth);
if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) {
return CString();
return String();
}
// fill BMP info header with little-endian data
@@ -186,6 +186,6 @@ CXWindowsClipboardAnyBitmapConverter::toIClipboard(const CString& image) const
toLE(dst, static_cast<UInt32>(0));
// construct image
return CString(reinterpret_cast<const char*>(infoHeader),
return String(reinterpret_cast<const char*>(infoHeader),
sizeof(infoHeader)) + rawBMP;
}

View File

@@ -32,22 +32,22 @@ public:
getFormat() const;
virtual Atom getAtom() const = 0;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
protected:
//! Convert from IClipboard format
/*!
Convert raw BGR pixel data to another image format.
*/
virtual CString doBGRFromIClipboard(const UInt8* bgrData,
virtual String doBGRFromIClipboard(const UInt8* bgrData,
UInt32 w, UInt32 h) const = 0;
//! Convert from IClipboard format
/*!
Convert raw BGRA pixel data to another image format.
*/
virtual CString doBGRAFromIClipboard(const UInt8* bgrData,
virtual String doBGRAFromIClipboard(const UInt8* bgrData,
UInt32 w, UInt32 h) const = 0;
//! Convert to IClipboard format
@@ -55,6 +55,6 @@ protected:
Convert an image into raw BGR or BGRA image data and store the
width, height, and image depth (24 or 32).
*/
virtual CString doToIClipboard(const CString&,
virtual String doToIClipboard(const String&,
UInt32& w, UInt32& h, UInt32& depth) const = 0;
};

View File

@@ -101,8 +101,8 @@ CXWindowsClipboardBMPConverter::getDataSize() const
return 8;
}
CString
CXWindowsClipboardBMPConverter::fromIClipboard(const CString& bmp) const
String
CXWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const
{
// create BMP image
UInt8 header[14];
@@ -113,21 +113,21 @@ CXWindowsClipboardBMPConverter::fromIClipboard(const CString& bmp) const
toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt32>(14 + 40));
return CString(reinterpret_cast<const char*>(header), 14) + bmp;
return String(reinterpret_cast<const char*>(header), 14) + bmp;
}
CString
CXWindowsClipboardBMPConverter::toIClipboard(const CString& bmp) const
String
CXWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const
{
// make sure data is big enough for a BMP file
if (bmp.size() <= 14 + 40) {
return CString();
return String();
}
// check BMP file header
const UInt8* rawBMPHeader = reinterpret_cast<const UInt8*>(bmp.data());
if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') {
return CString();
return String();
}
// get offset to image data

View File

@@ -32,8 +32,8 @@ public:
getFormat() const;
virtual Atom getAtom() const;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
private:
Atom m_atom;

View File

@@ -54,14 +54,14 @@ CXWindowsClipboardHTMLConverter::getDataSize() const
return 8;
}
CString
CXWindowsClipboardHTMLConverter::fromIClipboard(const CString& data) const
String
CXWindowsClipboardHTMLConverter::fromIClipboard(const String& data) const
{
return CUnicode::UTF8ToUTF16(data);
return Unicode::UTF8ToUTF16(data);
}
CString
CXWindowsClipboardHTMLConverter::toIClipboard(const CString& data) const
String
CXWindowsClipboardHTMLConverter::toIClipboard(const String& data) const
{
return CUnicode::UTF16ToUTF8(data);
return Unicode::UTF16ToUTF8(data);
}

View File

@@ -34,8 +34,8 @@ public:
getFormat() const;
virtual Atom getAtom() const;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
private:
Atom m_atom;

View File

@@ -54,24 +54,24 @@ CXWindowsClipboardTextConverter::getDataSize() const
return 8;
}
CString
CXWindowsClipboardTextConverter::fromIClipboard(const CString& data) const
String
CXWindowsClipboardTextConverter::fromIClipboard(const String& data) const
{
return CUnicode::UTF8ToText(data);
return Unicode::UTF8ToText(data);
}
CString
CXWindowsClipboardTextConverter::toIClipboard(const CString& data) const
String
CXWindowsClipboardTextConverter::toIClipboard(const String& data) const
{
// convert to UTF-8
bool errors;
CString utf8 = CUnicode::textToUTF8(data, &errors);
String utf8 = Unicode::textToUTF8(data, &errors);
// if there were decoding errors then, to support old applications
// that don't understand UTF-8 but can report the exact binary
// UTF-8 representation, see if the data appears to be UTF-8. if
// so then use it as is.
if (errors && CUnicode::isUTF8(data)) {
if (errors && Unicode::isUTF8(data)) {
return data;
}

View File

@@ -34,8 +34,8 @@ public:
getFormat() const;
virtual Atom getAtom() const;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
private:
Atom m_atom;

View File

@@ -54,14 +54,14 @@ CXWindowsClipboardUCS2Converter::getDataSize() const
return 16;
}
CString
CXWindowsClipboardUCS2Converter::fromIClipboard(const CString& data) const
String
CXWindowsClipboardUCS2Converter::fromIClipboard(const String& data) const
{
return CUnicode::UTF8ToUCS2(data);
return Unicode::UTF8ToUCS2(data);
}
CString
CXWindowsClipboardUCS2Converter::toIClipboard(const CString& data) const
String
CXWindowsClipboardUCS2Converter::toIClipboard(const String& data) const
{
return CUnicode::UCS2ToUTF8(data);
return Unicode::UCS2ToUTF8(data);
}

View File

@@ -34,8 +34,8 @@ public:
getFormat() const;
virtual Atom getAtom() const;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
private:
Atom m_atom;

View File

@@ -52,14 +52,14 @@ CXWindowsClipboardUTF8Converter::getDataSize() const
return 8;
}
CString
CXWindowsClipboardUTF8Converter::fromIClipboard(const CString& data) const
String
CXWindowsClipboardUTF8Converter::fromIClipboard(const String& data) const
{
return data;
}
CString
CXWindowsClipboardUTF8Converter::toIClipboard(const CString& data) const
String
CXWindowsClipboardUTF8Converter::toIClipboard(const String& data) const
{
return data;
}

View File

@@ -34,8 +34,8 @@ public:
getFormat() const;
virtual Atom getAtom() const;
virtual int getDataSize() const;
virtual CString fromIClipboard(const CString&) const;
virtual CString toIClipboard(const CString&) const;
virtual String fromIClipboard(const String&) const;
virtual String toIClipboard(const String&) const;
private:
Atom m_atom;

View File

@@ -42,10 +42,10 @@
#endif
//
// CEventQueueTimer
// EventQueueTimer
//
class CEventQueueTimer { };
class EventQueueTimer { };
//
@@ -84,7 +84,7 @@ CXWindowsEventQueueBuffer::~CXWindowsEventQueueBuffer()
void
CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
{
CThread::testCancel();
Thread::testCancel();
// clear out the pipe in preparation for waiting.
@@ -98,7 +98,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
}
{
CLock lock(&m_mutex);
Lock lock(&m_mutex);
// we're now waiting for events
m_waiting = true;
@@ -107,7 +107,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
}
// calling flush may have queued up a new event.
if (!CXWindowsEventQueueBuffer::isEmpty()) {
CThread::testCancel();
Thread::testCancel();
return;
}
@@ -190,17 +190,17 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
{
// we're no longer waiting for events
CLock lock(&m_mutex);
Lock lock(&m_mutex);
m_waiting = false;
}
CThread::testCancel();
Thread::testCancel();
}
IEventQueueBuffer::Type
CXWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
CXWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
{
CLock lock(&m_mutex);
Lock lock(&m_mutex);
// push out pending events
flush();
@@ -215,7 +215,7 @@ CXWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
return kUser;
}
else {
event = CEvent(CEvent::kSystem,
event = Event(Event::kSystem,
m_events->getSystemTarget(), &m_event);
return kSystem;
}
@@ -233,7 +233,7 @@ CXWindowsEventQueueBuffer::addEvent(UInt32 dataID)
xevent.xclient.data.l[0] = static_cast<long>(dataID);
// save the message
CLock lock(&m_mutex);
Lock lock(&m_mutex);
m_postedEvents.push_back(xevent);
// if we're currently waiting for an event then send saved events to
@@ -261,18 +261,18 @@ CXWindowsEventQueueBuffer::addEvent(UInt32 dataID)
bool
CXWindowsEventQueueBuffer::isEmpty() const
{
CLock lock(&m_mutex);
Lock lock(&m_mutex);
return (XPending(m_display) == 0 );
}
CEventQueueTimer*
EventQueueTimer*
CXWindowsEventQueueBuffer::newTimer(double, bool) const
{
return new CEventQueueTimer;
return new EventQueueTimer;
}
void
CXWindowsEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const
CXWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
{
delete timer;
}

View File

@@ -39,25 +39,25 @@ public:
// IEventQueueBuffer overrides
virtual void init() { }
virtual void waitForEvent(double timeout);
virtual Type getEvent(CEvent& event, UInt32& dataID);
virtual Type getEvent(Event& event, UInt32& dataID);
virtual bool addEvent(UInt32 dataID);
virtual bool isEmpty() const;
virtual CEventQueueTimer*
virtual EventQueueTimer*
newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(CEventQueueTimer*) const;
virtual void deleteTimer(EventQueueTimer*) const;
private:
void flush();
private:
typedef std::vector<XEvent> CEventList;
typedef std::vector<XEvent> EventList;
CMutex m_mutex;
Mutex m_mutex;
Display* m_display;
Window m_window;
Atom m_userEvent;
XEvent m_event;
CEventList m_postedEvents;
EventList m_postedEvents;
bool m_waiting;
int m_pipefd[2];
IEventQueue* m_events;

View File

@@ -43,7 +43,7 @@ static const size_t ModifiersFromXDefaultSize = 32;
CXWindowsKeyState::CXWindowsKeyState(
Display* display, bool useXKB,
IEventQueue* events) :
CKeyState(events),
KeyState(events),
m_display(display),
m_modifierFromX(ModifiersFromXDefaultSize)
{
@@ -52,8 +52,8 @@ CXWindowsKeyState::CXWindowsKeyState(
CXWindowsKeyState::CXWindowsKeyState(
Display* display, bool useXKB,
IEventQueue* events, CKeyMap& keyMap) :
CKeyState(events, keyMap),
IEventQueue* events, synergy::KeyMap& keyMap) :
KeyState(events, keyMap),
m_display(display),
m_modifierFromX(ModifiersFromXDefaultSize)
{
@@ -152,7 +152,7 @@ CXWindowsKeyState::mapModifiersToX(KeyModifierMask mask,
}
void
CXWindowsKeyState::mapKeyToKeycodes(KeyID key, CKeycodeList& keycodes) const
CXWindowsKeyState::mapKeyToKeycodes(KeyID key, KeycodeList& keycodes) const
{
keycodes.clear();
std::pair<KeyToKeyCodeMap::const_iterator,
@@ -218,7 +218,7 @@ CXWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
}
void
CXWindowsKeyState::getKeyMap(CKeyMap& keyMap)
CXWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
{
// get autorepeat info. we must use the global_auto_repeat told to
// us because it may have modified by synergy.
@@ -297,7 +297,7 @@ CXWindowsKeyState::fakeKey(const Keystroke& keystroke)
}
void
CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap)
CXWindowsKeyState::updateKeysymMap(synergy::KeyMap& keyMap)
{
// there are up to 4 keysyms per keycode
static const int maxKeysyms = 4;
@@ -391,7 +391,7 @@ CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap)
}
// add entries for each keycode
CKeyMap::KeyItem item;
synergy::KeyMap::KeyItem item;
for (int i = 0; i < numKeycodes; ++i) {
KeySym* keysyms = allKeysyms + maxKeysyms * i;
KeyCode keycode = static_cast<KeyCode>(i + minKeycode);
@@ -495,7 +495,7 @@ CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap)
item.m_lock = false;
if (modifierButtons.count(keycode) > 0) {
// get flags for modifier keys
CKeyMap::initModifierKey(item);
synergy::KeyMap::initModifierKey(item);
// add mapping from X (unless we already have)
if (item.m_generates != 0) {
@@ -543,7 +543,7 @@ CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap)
#if HAVE_XKB_EXTENSION
void
CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap)
CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
{
static const XkbKTMapEntryRec defMapEntry = {
True, // active
@@ -589,7 +589,7 @@ CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap)
// check every button. on this pass we save all modifiers as native
// X modifier masks.
CKeyMap::KeyItem item;
synergy::KeyMap::KeyItem item;
for (int i = m_xkb->min_key_code; i <= m_xkb->max_key_code; ++i) {
KeyCode keycode = static_cast<KeyCode>(i);
item.m_button = static_cast<KeyButton>(keycode);
@@ -783,7 +783,7 @@ CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap)
void
CXWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
CKeyMap::KeyItem& item, void* vself)
synergy::KeyMap::KeyItem& item, void* vself)
{
CXWindowsKeyState* self = reinterpret_cast<CXWindowsKeyState*>(vself);
item.m_required =

View File

@@ -42,9 +42,9 @@ class IEventQueue;
/*!
A key state for X Windows.
*/
class CXWindowsKeyState : public CKeyState {
class CXWindowsKeyState : public KeyState {
public:
typedef std::vector<int> CKeycodeList;
typedef std::vector<int> KeycodeList;
enum {
kGroupPoll = -1,
kGroupPollAndSet = -2
@@ -52,7 +52,7 @@ public:
CXWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
CXWindowsKeyState(Display*, bool useXKB,
IEventQueue* events, CKeyMap& keyMap);
IEventQueue* events, synergy::KeyMap& keyMap);
~CXWindowsKeyState();
//! @name modifiers
@@ -99,7 +99,7 @@ public:
that key.
*/
void mapKeyToKeycodes(KeyID key,
CKeycodeList& keycodes) const;
KeycodeList& keycodes) const;
//@}
@@ -111,20 +111,20 @@ public:
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
protected:
// CKeyState overrides
virtual void getKeyMap(CKeyMap& keyMap);
// KeyState overrides
virtual void getKeyMap(synergy::KeyMap& keyMap);
virtual void fakeKey(const Keystroke& keystroke);
private:
void init(Display* display, bool useXKB);
void updateKeysymMap(CKeyMap&);
void updateKeysymMapXKB(CKeyMap&);
void updateKeysymMap(synergy::KeyMap&);
void updateKeysymMapXKB(synergy::KeyMap&);
bool hasModifiersXKB() const;
int getEffectiveGroup(KeyCode, int group) const;
UInt32 getGroupFromState(unsigned int state) const;
static void remapKeyModifiers(KeyID, SInt32,
CKeyMap::KeyItem&, void*);
synergy::KeyMap::KeyItem&, void*);
private:
struct XKBModifierInfo {

View File

@@ -121,7 +121,7 @@ CXWindowsScreen::CXWindowsScreen(
m_xi2detected(false),
m_xrandr(false),
m_events(events),
CPlatformScreen(events)
PlatformScreen(events)
{
assert(s_screen == NULL);
@@ -187,7 +187,7 @@ CXWindowsScreen::CXWindowsScreen(
}
// install event handlers
m_events->adoptHandler(CEvent::kSystem, m_events->getSystemTarget(),
m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(),
new TMethodEventJob<CXWindowsScreen>(this,
&CXWindowsScreen::handleSystemEvent));
@@ -202,7 +202,7 @@ CXWindowsScreen::~CXWindowsScreen()
assert(m_display != NULL);
m_events->adoptBuffer(NULL);
m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget());
m_events->removeHandler(Event::kSystem, m_events->getSystemTarget());
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
delete m_clipboard[id];
}
@@ -279,7 +279,7 @@ CXWindowsScreen::enter()
// set the input focus to what it had been when we took it
if (m_lastFocus != None) {
// the window may not exist anymore so ignore errors
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
XSetInputFocus(m_display, m_lastFocus, m_lastFocusRevert, CurrentTime);
}
@@ -396,7 +396,7 @@ CXWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard)
if (clipboard != NULL) {
// save clipboard data
return CClipboard::copy(m_clipboard[id], clipboard, timestamp);
return Clipboard::copy(m_clipboard[id], clipboard, timestamp);
}
else {
// assert clipboard ownership
@@ -451,7 +451,7 @@ CXWindowsScreen::resetOptions()
}
void
CXWindowsScreen::setOptions(const COptionsList& options)
CXWindowsScreen::setOptions(const OptionsList& options)
{
for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
if (options[i] == kOptionXTestXineramaUnaware) {
@@ -498,7 +498,7 @@ CXWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const
m_display, m_clipboard[id]->getWindow());
// copy the clipboard
return CClipboard::copy(clipboard, m_clipboard[id], timestamp);
return Clipboard::copy(clipboard, m_clipboard[id], timestamp);
}
void
@@ -576,7 +576,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
return 0;
}
CXWindowsKeyState::CKeycodeList keycodes;
CXWindowsKeyState::KeycodeList keycodes;
m_keyState->mapKeyToKeycodes(key, keycodes);
if (key != kKeyNone && keycodes.empty()) {
// can't map key
@@ -600,7 +600,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
// requested modifiers.
bool err = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &err);
CXWindowsUtil::ErrorLock lock(m_display, &err);
if (key == kKeyNone) {
static const KeyModifierMask s_hotKeyModifiers[] = {
KeyModifierShift,
@@ -677,7 +677,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
False, GrabModeAsync, GrabModeAsync);
if (!err) {
hotKeys.push_back(std::make_pair(code, modifiers2));
m_hotKeyToIDMap[CHotKeyItem(code, modifiers2)] = id;
m_hotKeyToIDMap[HotKeyItem(code, modifiers2)] = id;
}
}
}
@@ -704,7 +704,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
for (CXWindowsKeyState::CKeycodeList::iterator j = keycodes.begin();
for (CXWindowsKeyState::KeycodeList::iterator j = keycodes.begin();
j != keycodes.end() && !err; ++j) {
for (size_t i = 0; i < (1u << numToggleModifiers); ++i) {
// add toggle modifiers for index i
@@ -724,7 +724,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
False, GrabModeAsync, GrabModeAsync);
if (!err) {
hotKeys.push_back(std::make_pair(*j, tmpModifiers));
m_hotKeyToIDMap[CHotKeyItem(*j, tmpModifiers)] = id;
m_hotKeyToIDMap[HotKeyItem(*j, tmpModifiers)] = id;
}
}
}
@@ -736,16 +736,16 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
for (HotKeyList::iterator j = hotKeys.begin();
j != hotKeys.end(); ++j) {
XUngrabKey(m_display, j->first, j->second, m_root);
m_hotKeyToIDMap.erase(CHotKeyItem(j->first, j->second));
m_hotKeyToIDMap.erase(HotKeyItem(j->first, j->second));
}
m_oldHotKeyIDs.push_back(id);
m_hotKeys.erase(id);
LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", CKeyMap::formatKey(key, mask).c_str(), key, mask));
LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask));
return 0;
}
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id));
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask, id));
return id;
}
@@ -761,12 +761,12 @@ CXWindowsScreen::unregisterHotKey(UInt32 id)
// unregister with OS
bool err = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &err);
CXWindowsUtil::ErrorLock lock(m_display, &err);
HotKeyList& hotKeys = i->second;
for (HotKeyList::iterator j = hotKeys.begin();
j != hotKeys.end(); ++j) {
XUngrabKey(m_display, j->first, j->second, m_root);
m_hotKeyToIDMap.erase(CHotKeyItem(j->first, j->second));
m_hotKeyToIDMap.erase(HotKeyItem(j->first, j->second));
}
}
if (err) {
@@ -1145,15 +1145,15 @@ CXWindowsScreen::openIM()
}
void
CXWindowsScreen::sendEvent(CEvent::Type type, void* data)
CXWindowsScreen::sendEvent(Event::Type type, void* data)
{
m_events->addEvent(CEvent(type, getEventTarget(), data));
m_events->addEvent(Event(type, getEventTarget(), data));
}
void
CXWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
CXWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
{
CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo));
ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo));
info->m_id = id;
info->m_sequenceNumber = m_sequenceNumber;
sendEvent(type, info);
@@ -1168,7 +1168,7 @@ CXWindowsScreen::getKeyState() const
Bool
CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
{
CKeyEventFilter* filter = reinterpret_cast<CKeyEventFilter*>(arg);
KeyEventFilter* filter = reinterpret_cast<KeyEventFilter*>(arg);
return (xevent->type == filter->m_event &&
xevent->xkey.window == filter->m_window &&
xevent->xkey.time == filter->m_time &&
@@ -1176,7 +1176,7 @@ CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
}
void
CXWindowsScreen::handleSystemEvent(const CEvent& event, void*)
CXWindowsScreen::handleSystemEvent(const Event& event, void*)
{
XEvent* xevent = reinterpret_cast<XEvent*>(event.getData());
assert(xevent != NULL);
@@ -1189,7 +1189,7 @@ CXWindowsScreen::handleSystemEvent(const CEvent& event, void*)
// KeyPress event that has the same key and time as
// this release event, if any. first prepare the
// filter info.
CKeyEventFilter filter;
KeyEventFilter filter;
filter.m_event = KeyPress;
filter.m_window = xevent->xkey.window;
filter.m_time = xevent->xkey.time;
@@ -1531,13 +1531,13 @@ CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat)
{
// find the hot key id
HotKeyToIDMap::const_iterator i =
m_hotKeyToIDMap.find(CHotKeyItem(xkey.keycode, xkey.state));
m_hotKeyToIDMap.find(HotKeyItem(xkey.keycode, xkey.state));
if (i == m_hotKeyToIDMap.end()) {
return false;
}
// find what kind of event
CEvent::Type type;
Event::Type type;
if (xkey.type == KeyPress) {
type = m_events->forIPrimaryScreen().hotKeyDown();
}
@@ -1550,8 +1550,8 @@ CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat)
// generate event (ignore key repeats)
if (!isRepeat) {
m_events->addEvent(CEvent(type, getEventTarget(),
CHotKeyInfo::alloc(i->second)));
m_events->addEvent(Event(type, getEventTarget(),
HotKeyInfo::alloc(i->second)));
}
return true;
}
@@ -1563,7 +1563,7 @@ CXWindowsScreen::onMousePress(const XButtonEvent& xbutton)
ButtonID button = mapButtonFromX(&xbutton);
KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state);
if (button != kButtonNone) {
sendEvent(m_events->forIPrimaryScreen().buttonDown(), CButtonInfo::alloc(button, mask));
sendEvent(m_events->forIPrimaryScreen().buttonDown(), ButtonInfo::alloc(button, mask));
}
}
@@ -1574,15 +1574,15 @@ CXWindowsScreen::onMouseRelease(const XButtonEvent& xbutton)
ButtonID button = mapButtonFromX(&xbutton);
KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state);
if (button != kButtonNone) {
sendEvent(m_events->forIPrimaryScreen().buttonUp(), CButtonInfo::alloc(button, mask));
sendEvent(m_events->forIPrimaryScreen().buttonUp(), ButtonInfo::alloc(button, mask));
}
else if (xbutton.button == 4) {
// wheel forward (away from user)
sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(0, 120));
sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(0, 120));
}
else if (xbutton.button == 5) {
// wheel backward (toward user)
sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(0, -120));
sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(0, -120));
}
// XXX -- support x-axis scrolling
}
@@ -1621,7 +1621,7 @@ CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
else if (m_isOnScreen) {
// motion on primary screen
sendEvent(m_events->forIPrimaryScreen().motionOnPrimary(),
CMotionInfo::alloc(m_xCursor, m_yCursor));
MotionInfo::alloc(m_xCursor, m_yCursor));
}
else {
// motion on secondary screen. warp mouse back to
@@ -1651,7 +1651,7 @@ CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
// warping to the primary screen's enter position,
// effectively overriding it.
if (x != 0 || y != 0) {
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y));
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
}
}
}
@@ -1769,7 +1769,7 @@ CXWindowsScreen::selectEvents(Window w) const
// ignore errors while we adjust event masks. windows could be
// destroyed at any time after the XQueryTree() in doSelectEvents()
// so we must ignore BadWindow errors.
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
// adjust event masks
doSelectEvents(w);
@@ -1990,7 +1990,7 @@ CXWindowsScreen::grabMouseAndKeyboard()
// and wait before retrying. give up after s_timeout seconds.
static const double s_timeout = 1.0;
int result;
CStopwatch timer;
Stopwatch timer;
do {
// keyboard first
do {
@@ -2059,10 +2059,10 @@ CXWindowsScreen::refreshKeyboard(XEvent* event)
//
// CXWindowsScreen::CHotKeyItem
// CXWindowsScreen::HotKeyItem
//
CXWindowsScreen::CHotKeyItem::CHotKeyItem(int keycode, unsigned int mask) :
CXWindowsScreen::HotKeyItem::HotKeyItem(int keycode, unsigned int mask) :
m_keycode(keycode),
m_mask(mask)
{
@@ -2070,7 +2070,7 @@ CXWindowsScreen::CHotKeyItem::CHotKeyItem(int keycode, unsigned int mask) :
}
bool
CXWindowsScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const
CXWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
{
return (m_keycode < x.m_keycode ||
(m_keycode == x.m_keycode && m_mask < x.m_mask));

View File

@@ -34,7 +34,7 @@ class CXWindowsKeyState;
class CXWindowsScreenSaver;
//! Implementation of IPlatformScreen for X11
class CXWindowsScreen : public CPlatformScreen {
class CXWindowsScreen : public PlatformScreen {
public:
CXWindowsScreen(const char* displayName, bool isPrimary,
bool disableXInitThreads, int mouseScrollDelta,
@@ -81,20 +81,20 @@ public:
virtual void closeScreensaver();
virtual void screensaver(bool activate);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual void setOptions(const OptionsList& options);
virtual void setSequenceNumber(UInt32);
virtual bool isPrimary() const;
protected:
// IPlatformScreen overrides
virtual void handleSystemEvent(const CEvent&, void*);
virtual void handleSystemEvent(const Event&, void*);
virtual void updateButtons();
virtual IKeyState* getKeyState() const;
private:
// event sending
void sendEvent(CEvent::Type, void* = NULL);
void sendClipboardEvent(CEvent::Type, ClipboardID);
void sendEvent(Event::Type, void* = NULL);
void sendClipboardEvent(Event::Type, ClipboardID);
// create the transparent cursor
Cursor createBlankCursor() const;
@@ -115,7 +115,7 @@ private:
static int ioErrorHandler(Display*);
private:
class CKeyEventFilter {
class KeyEventFilter {
public:
int m_event;
Window m_window;
@@ -154,21 +154,21 @@ private:
static Bool findKeyEvent(Display*, XEvent* xevent, XPointer arg);
private:
struct CHotKeyItem {
struct HotKeyItem {
public:
CHotKeyItem(int, unsigned int);
HotKeyItem(int, unsigned int);
bool operator<(const CHotKeyItem&) const;
bool operator<(const HotKeyItem&) const;
private:
int m_keycode;
unsigned int m_mask;
};
typedef std::set<bool> CFilteredKeycodes;
typedef std::set<bool> FilteredKeycodes;
typedef std::vector<std::pair<int, unsigned int> > HotKeyList;
typedef std::map<UInt32, HotKeyList> HotKeyMap;
typedef std::vector<UInt32> HotKeyIDList;
typedef std::map<CHotKeyItem, UInt32> HotKeyToIDMap;
typedef std::map<HotKeyItem, UInt32> HotKeyToIDMap;
// true if screen is being used as a primary screen, false otherwise
bool m_isPrimary;
@@ -205,7 +205,7 @@ private:
XIM m_im;
XIC m_ic;
KeyCode m_lastKeycode;
CFilteredKeycodes m_filtered;
FilteredKeycodes m_filtered;
// clipboards
CXWindowsClipboard* m_clipboard[kClipboardEnd];
@@ -244,7 +244,7 @@ private:
int m_xrandrEventBase;
IEventQueue* m_events;
CKeyMap m_keyMap;
synergy::KeyMap m_keyMap;
// pointer to (singleton) screen. this is only needed by
// ioErrorHandler().

View File

@@ -97,7 +97,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
// watch top-level windows for changes
bool error = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
Window root = DefaultRootWindow(m_display);
XWindowAttributes attr;
XGetWindowAttributes(m_display, root, &attr);
@@ -122,7 +122,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
}
// install disable timer event handler
m_events->adoptHandler(CEvent::kTimer, this,
m_events->adoptHandler(Event::kTimer, this,
new TMethodEventJob<CXWindowsScreenSaver>(this,
&CXWindowsScreenSaver::handleDisableTimer));
}
@@ -133,14 +133,14 @@ CXWindowsScreenSaver::~CXWindowsScreenSaver()
if (m_disableTimer != NULL) {
m_events->deleteTimer(m_disableTimer);
}
m_events->removeHandler(CEvent::kTimer, this);
m_events->removeHandler(Event::kTimer, this);
if (m_display != NULL) {
enableDPMS(m_dpmsEnabled);
XSetScreenSaver(m_display, m_timeout, m_interval,
m_preferBlanking, m_allowExposures);
clearWatchForXScreenSaver();
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
XSelectInput(m_display, DefaultRootWindow(m_display), m_rootEventMask);
}
}
@@ -356,7 +356,7 @@ CXWindowsScreenSaver::setXScreenSaver(Window window)
bool error = false;
XWindowAttributes attr;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
XGetWindowAttributes(m_display, m_xscreensaver, &attr);
}
setXScreenSaverActive(!error && attr.map_state != IsUnmapped);
@@ -399,12 +399,12 @@ CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
updateDisableTimer();
if (activated) {
m_events->addEvent(CEvent(
m_events->addEvent(Event(
m_events->forIPrimaryScreen().screensaverActivated(),
m_eventTarget));
}
else {
m_events->addEvent(CEvent(
m_events->addEvent(Event(
m_events->forIPrimaryScreen().screensaverDeactivated(),
m_eventTarget));
}
@@ -429,7 +429,7 @@ CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
LOG((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
bool error = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
}
if (error) {
@@ -466,8 +466,8 @@ void
CXWindowsScreenSaver::clearWatchForXScreenSaver()
{
// stop watching all windows
CXWindowsUtil::CErrorLock lock(m_display);
for (CWatchList::iterator index = m_watchWindows.begin();
CXWindowsUtil::ErrorLock lock(m_display);
for (WatchList::iterator index = m_watchWindows.begin();
index != m_watchWindows.end(); ++index) {
XSelectInput(m_display, index->first, index->second);
}
@@ -481,7 +481,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window)
bool error = false;
XWindowAttributes attr;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
XGetWindowAttributes(m_display, window, &attr);
}
@@ -490,7 +490,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window)
if (!error && attr.override_redirect == True) {
error = false;
{
CXWindowsUtil::CErrorLock lock(m_display, &error);
CXWindowsUtil::ErrorLock lock(m_display, &error);
XSelectInput(m_display, window,
attr.your_event_mask | PropertyChangeMask);
}
@@ -515,7 +515,7 @@ CXWindowsScreenSaver::updateDisableTimer()
}
void
CXWindowsScreenSaver::handleDisableTimer(const CEvent&, void*)
CXWindowsScreenSaver::handleDisableTimer(const Event&, void*)
{
// send fake mouse motion directly to xscreensaver
if (m_xscreensaver != None) {
@@ -534,7 +534,7 @@ CXWindowsScreenSaver::handleDisableTimer(const CEvent&, void*)
event.xmotion.is_hint = NotifyNormal;
event.xmotion.same_screen = True;
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
m_disablePos = 20 - m_disablePos;
@@ -547,7 +547,7 @@ CXWindowsScreenSaver::activateDPMS(bool activate)
#if HAVE_X11_EXTENSIONS_DPMS_H
if (m_dpms) {
// DPMSForceLevel will generate a BadMatch if DPMS is disabled
CXWindowsUtil::CErrorLock lock(m_display);
CXWindowsUtil::ErrorLock lock(m_display);
DPMSForceLevel(m_display, activate ? DPMSModeStandby : DPMSModeOn);
}
#endif

View File

@@ -28,8 +28,8 @@
# include <X11/Xlib.h>
#endif
class CEvent;
class CEventQueueTimer;
class Event;
class EventQueueTimer;
//! X11 screen saver implementation
class CXWindowsScreenSaver : public IScreenSaver {
@@ -95,7 +95,7 @@ private:
void updateDisableTimer();
// called periodically to prevent the screen saver from starting
void handleDisableTimer(const CEvent&, void*);
void handleDisableTimer(const Event&, void*);
// force DPMS to activate or deactivate
void activateDPMS(bool activate);
@@ -110,7 +110,7 @@ private:
bool isDPMSActivated() const;
private:
typedef std::map<Window, long> CWatchList;
typedef std::map<Window, long> WatchList;
// the X display
Display* m_display;
@@ -131,7 +131,7 @@ private:
long m_rootEventMask;
// potential xscreensaver windows being watched
CWatchList m_watchWindows;
WatchList m_watchWindows;
// atoms used to communicate with xscreensaver's window
Atom m_atomScreenSaver;
@@ -158,7 +158,7 @@ private:
bool m_suppressDisable;
// the disable timer (NULL if not installed)
CEventQueueTimer* m_disableTimer;
EventQueueTimer* m_disableTimer;
// fake mouse motion position for suppressing the screen saver.
// xscreensaver since 2.21 requires the mouse to move more than 10

View File

@@ -1290,11 +1290,11 @@ static const KeySym s_map1008FF[] =
// CXWindowsUtil
//
CXWindowsUtil::CKeySymMap CXWindowsUtil::s_keySymToUCS4;
CXWindowsUtil::KeySymMap CXWindowsUtil::s_keySymToUCS4;
bool
CXWindowsUtil::getWindowProperty(Display* display, Window window,
Atom property, CString* data, Atom* type,
Atom property, String* data, Atom* type,
SInt32* format, bool deleteProperty)
{
assert(display != NULL);
@@ -1303,7 +1303,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
int actualDatumSize;
// ignore errors. XGetWindowProperty() will report failure.
CXWindowsUtil::CErrorLock lock(display);
CXWindowsUtil::ErrorLock lock(display);
// read the property
bool okay = true;
@@ -1395,7 +1395,7 @@ CXWindowsUtil::setWindowProperty(Display* display, Window window,
// save errors
bool error = false;
CXWindowsUtil::CErrorLock lock(display, &error);
CXWindowsUtil::ErrorLock lock(display, &error);
// how much data to send in first chunk?
UInt32 chunkSize = size;
@@ -1445,7 +1445,7 @@ CXWindowsUtil::getCurrentTime(Display* display, Window window)
&dummy, 0);
// look for property notify events with the following
CPropertyNotifyPredicateInfo filter;
PropertyNotifyPredicateInfo filter;
filter.m_window = window;
filter.m_property = atom;
@@ -1546,7 +1546,7 @@ CXWindowsUtil::mapKeySymToKeyID(KeySym k)
default: {
// lookup character in table
CKeySymMap::const_iterator index = s_keySymToUCS4.find(k);
KeySymMap::const_iterator index = s_keySymToUCS4.find(k);
if (index != s_keySymToUCS4.end()) {
return static_cast<KeyID>(index->second);
}
@@ -1606,7 +1606,7 @@ CXWindowsUtil::getModifierBitForKeySym(KeySym keysym)
}
}
CString
String
CXWindowsUtil::atomToString(Display* display, Atom atom)
{
if (atom == 0) {
@@ -1614,26 +1614,26 @@ CXWindowsUtil::atomToString(Display* display, Atom atom)
}
bool error = false;
CXWindowsUtil::CErrorLock lock(display, &error);
CXWindowsUtil::ErrorLock lock(display, &error);
char* name = XGetAtomName(display, atom);
if (error) {
return synergy::string::sprintf("<UNKNOWN> (%d)", (int)atom);
}
else {
CString msg = synergy::string::sprintf("%s (%d)", name, (int)atom);
String msg = synergy::string::sprintf("%s (%d)", name, (int)atom);
XFree(name);
return msg;
}
}
CString
String
CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
{
char** names = new char*[num];
bool error = false;
CXWindowsUtil::CErrorLock lock(display, &error);
CXWindowsUtil::ErrorLock lock(display, &error);
XGetAtomNames(display, const_cast<Atom*>(atom), (int)num, names);
CString msg;
String msg;
if (error) {
for (UInt32 i = 0; i < num; ++i) {
msg += synergy::string::sprintf("<UNKNOWN> (%d), ", (int)atom[i]);
@@ -1653,7 +1653,7 @@ CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
}
void
CXWindowsUtil::convertAtomProperty(CString& data)
CXWindowsUtil::convertAtomProperty(String& data)
{
// as best i can tell, 64-bit systems don't pack Atoms into properties
// as 32-bit numbers but rather as the 64-bit numbers they are. that
@@ -1668,13 +1668,13 @@ CXWindowsUtil::convertAtomProperty(CString& data)
}
void
CXWindowsUtil::appendAtomData(CString& data, Atom atom)
CXWindowsUtil::appendAtomData(String& data, Atom atom)
{
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
}
void
CXWindowsUtil::replaceAtomData(CString& data, UInt32 index, Atom atom)
CXWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
{
data.replace(index * sizeof(Atom), sizeof(Atom),
reinterpret_cast<const char*>(&atom),
@@ -1682,7 +1682,7 @@ CXWindowsUtil::replaceAtomData(CString& data, UInt32 index, Atom atom)
}
void
CXWindowsUtil::appendTimeData(CString& data, Time time)
CXWindowsUtil::appendTimeData(String& data, Time time)
{
data.append(reinterpret_cast<char*>(&time), sizeof(Time));
}
@@ -1690,8 +1690,8 @@ CXWindowsUtil::appendTimeData(CString& data, Time time)
Bool
CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
{
CPropertyNotifyPredicateInfo* filter =
reinterpret_cast<CPropertyNotifyPredicateInfo*>(arg);
PropertyNotifyPredicateInfo* filter =
reinterpret_cast<PropertyNotifyPredicateInfo*>(arg);
return (xevent->type == PropertyNotify &&
xevent->xproperty.window == filter->m_window &&
xevent->xproperty.atom == filter->m_property &&
@@ -1710,31 +1710,31 @@ CXWindowsUtil::initKeyMaps()
//
// CXWindowsUtil::CErrorLock
// CXWindowsUtil::ErrorLock
//
CXWindowsUtil::CErrorLock* CXWindowsUtil::CErrorLock::s_top = NULL;
CXWindowsUtil::ErrorLock* CXWindowsUtil::ErrorLock::s_top = NULL;
CXWindowsUtil::CErrorLock::CErrorLock(Display* display) :
CXWindowsUtil::ErrorLock::ErrorLock(Display* display) :
m_display(display)
{
install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL);
install(&CXWindowsUtil::ErrorLock::ignoreHandler, NULL);
}
CXWindowsUtil::CErrorLock::CErrorLock(Display* display, bool* flag) :
CXWindowsUtil::ErrorLock::ErrorLock(Display* display, bool* flag) :
m_display(display)
{
install(&CXWindowsUtil::CErrorLock::saveHandler, flag);
install(&CXWindowsUtil::ErrorLock::saveHandler, flag);
}
CXWindowsUtil::CErrorLock::CErrorLock(Display* display,
CXWindowsUtil::ErrorLock::ErrorLock(Display* display,
ErrorHandler handler, void* data) :
m_display(display)
{
install(handler, data);
}
CXWindowsUtil::CErrorLock::~CErrorLock()
CXWindowsUtil::ErrorLock::~ErrorLock()
{
// make sure everything finishes before uninstalling handler
if (m_display != NULL) {
@@ -1747,7 +1747,7 @@ CXWindowsUtil::CErrorLock::~CErrorLock()
}
void
CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data)
CXWindowsUtil::ErrorLock::install(ErrorHandler handler, void* data)
{
// make sure everything finishes before installing handler
if (m_display != NULL) {
@@ -1758,13 +1758,13 @@ CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data)
m_handler = handler;
m_userData = data;
m_oldXHandler = XSetErrorHandler(
&CXWindowsUtil::CErrorLock::internalHandler);
&CXWindowsUtil::ErrorLock::internalHandler);
m_next = s_top;
s_top = this;
}
int
CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
CXWindowsUtil::ErrorLock::internalHandler(Display* display, XErrorEvent* event)
{
if (s_top != NULL && s_top->m_handler != NULL) {
s_top->m_handler(display, event, s_top->m_userData);
@@ -1773,13 +1773,13 @@ CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
}
void
CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
CXWindowsUtil::ErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
{
LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
}
void
CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
CXWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
{
LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
*reinterpret_cast<bool*>(flag) = true;

View File

@@ -44,7 +44,7 @@ public:
*/
static bool getWindowProperty(Display*,
Window window, Atom property,
CString* data, Atom* type,
String* data, Atom* type,
SInt32* format, bool deleteProperty);
//! Set property
@@ -81,14 +81,14 @@ public:
/*!
Converts \p atom to its string representation.
*/
static CString atomToString(Display*, Atom atom);
static String atomToString(Display*, Atom atom);
//! Convert several Atoms to a string
/*!
Converts each atom in \p atoms to its string representation and
concatenates the results.
*/
static CString atomsToString(Display* display,
static String atomsToString(Display* display,
const Atom* atom, UInt32 num);
//! Prepare a property of atoms for use
@@ -96,21 +96,21 @@ public:
64-bit systems may need to modify a property's data if it's a
list of Atoms before using it.
*/
static void convertAtomProperty(CString& data);
static void convertAtomProperty(String& data);
//! Append an Atom to property data
/*!
Converts \p atom to a 32-bit on-the-wire format and appends it to
\p data.
*/
static void appendAtomData(CString& data, Atom atom);
static void appendAtomData(String& data, Atom atom);
//! Replace an Atom in property data
/*!
Converts \p atom to a 32-bit on-the-wire format and replaces the atom
at index \p index in \p data.
*/
static void replaceAtomData(CString& data,
static void replaceAtomData(String& data,
UInt32 index, Atom atom);
//! Append an Time to property data
@@ -118,7 +118,7 @@ public:
Converts \p time to a 32-bit on-the-wire format and appends it to
\p data.
*/
static void appendTimeData(CString& data, Time time);
static void appendTimeData(String& data, Time time);
//! X11 error handler
/*!
@@ -126,10 +126,10 @@ public:
previous error handler in the d'tor. A lock should only be
installed while the display is locked by the thread.
CErrorLock() ignores errors
CErrorLock(bool* flag) sets *flag to true if any error occurs
ErrorLock() ignores errors
ErrorLock(bool* flag) sets *flag to true if any error occurs
*/
class CErrorLock {
class ErrorLock {
public:
//! Error handler type
typedef void (*ErrorHandler)(Display*, XErrorEvent*, void* userData);
@@ -137,19 +137,19 @@ public:
/*!
Ignore X11 errors.
*/
CErrorLock(Display*);
ErrorLock(Display*);
/*!
Set \c *errorFlag if any error occurs.
*/
CErrorLock(Display*, bool* errorFlag);
ErrorLock(Display*, bool* errorFlag);
/*!
Call \c handler on each error.
*/
CErrorLock(Display*, ErrorHandler handler, void* userData);
ErrorLock(Display*, ErrorHandler handler, void* userData);
~CErrorLock();
~ErrorLock();
private:
void install(ErrorHandler, void*);
@@ -164,12 +164,12 @@ public:
ErrorHandler m_handler;
void* m_userData;
XErrorHandler m_oldXHandler;
CErrorLock* m_next;
static CErrorLock* s_top;
ErrorLock* m_next;
static ErrorLock* s_top;
};
private:
class CPropertyNotifyPredicateInfo {
class PropertyNotifyPredicateInfo {
public:
Window m_window;
Atom m_property;
@@ -181,7 +181,7 @@ private:
static void initKeyMaps();
private:
typedef std::map<KeySym, UInt32> CKeySymMap;
typedef std::map<KeySym, UInt32> KeySymMap;
static CKeySymMap s_keySymToUCS4;
static KeySymMap s_keySymToUCS4;
};