mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-12 03:16:07 +08:00
formatting changes.
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
// CMSWindowsClipboard
|
||||
//
|
||||
|
||||
CMSWindowsClipboard::CMSWindowsClipboard(
|
||||
HWND window) :
|
||||
CMSWindowsClipboard::CMSWindowsClipboard(HWND window) :
|
||||
m_window(window),
|
||||
m_time(0)
|
||||
{
|
||||
@@ -32,9 +31,7 @@ CMSWindowsClipboard::empty()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsClipboard::add(
|
||||
EFormat format,
|
||||
const CString& data)
|
||||
CMSWindowsClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
log((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
||||
|
||||
@@ -58,8 +55,7 @@ CMSWindowsClipboard::add(
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsClipboard::open(
|
||||
Time time) const
|
||||
CMSWindowsClipboard::open(Time time) const
|
||||
{
|
||||
log((CLOG_DEBUG "open clipboard"));
|
||||
|
||||
@@ -87,16 +83,14 @@ CMSWindowsClipboard::getTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsClipboard::has(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::has(EFormat format) const
|
||||
{
|
||||
const UINT win32Format = convertFormatToWin32(format);
|
||||
return (win32Format != 0 && IsClipboardFormatAvailable(win32Format) != 0);
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsClipboard::get(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::get(EFormat format) const
|
||||
{
|
||||
// get the win32 format. return empty data if unknown format.
|
||||
const UINT win32Format = convertFormatToWin32(format);
|
||||
@@ -119,8 +113,7 @@ CMSWindowsClipboard::get(
|
||||
}
|
||||
|
||||
UINT
|
||||
CMSWindowsClipboard::convertFormatToWin32(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::convertFormatToWin32(EFormat format) const
|
||||
{
|
||||
switch (format) {
|
||||
case kText:
|
||||
@@ -132,8 +125,7 @@ CMSWindowsClipboard::convertFormatToWin32(
|
||||
}
|
||||
|
||||
HANDLE
|
||||
CMSWindowsClipboard::convertTextToWin32(
|
||||
const CString& data) const
|
||||
CMSWindowsClipboard::convertTextToWin32(const CString& data) const
|
||||
{
|
||||
// compute size of converted text
|
||||
UInt32 dstSize = 1;
|
||||
@@ -172,8 +164,7 @@ CMSWindowsClipboard::convertTextToWin32(
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsClipboard::convertTextFromWin32(
|
||||
HANDLE handle) const
|
||||
CMSWindowsClipboard::convertTextFromWin32(HANDLE handle) const
|
||||
{
|
||||
// get source data and it's size
|
||||
const char* src = (const char*)GlobalLock(handle);
|
||||
|
||||
@@ -30,8 +30,7 @@ CMSWindowsScreen::~CMSWindowsScreen()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::init(
|
||||
HINSTANCE instance)
|
||||
CMSWindowsScreen::init(HINSTANCE instance)
|
||||
{
|
||||
s_instance = instance;
|
||||
}
|
||||
@@ -151,9 +150,7 @@ CMSWindowsScreen::updateScreenSize()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::getScreenSize(
|
||||
SInt32* w,
|
||||
SInt32* h) const
|
||||
CMSWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
||||
{
|
||||
assert(m_class != 0);
|
||||
assert(w != NULL && h != NULL);
|
||||
@@ -172,8 +169,7 @@ CMSWindowsScreen::openInputDesktop() const
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsScreen::getDesktopName(
|
||||
HDESK desk) const
|
||||
CMSWindowsScreen::getDesktopName(HDESK desk) const
|
||||
{
|
||||
if (desk == NULL) {
|
||||
return CString();
|
||||
@@ -190,16 +186,14 @@ CMSWindowsScreen::getDesktopName(
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsScreen::isCurrentDesktop(
|
||||
HDESK desk) const
|
||||
CMSWindowsScreen::isCurrentDesktop(HDESK desk) const
|
||||
{
|
||||
return CStringUtil::CaselessCmp::equal(getDesktopName(desk),
|
||||
getCurrentDesktopName());
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::getEvent(
|
||||
MSG* msg) const
|
||||
CMSWindowsScreen::getEvent(MSG* msg) const
|
||||
{
|
||||
// wait for an event in a cancellable way
|
||||
CThread::waitForEvent();
|
||||
@@ -207,11 +201,7 @@ CMSWindowsScreen::getEvent(
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
CMSWindowsScreen::wndProc(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
assert(s_screen != NULL);
|
||||
return s_screen->onEvent(hwnd, msg, wParam, lParam);
|
||||
|
||||
@@ -25,28 +25,21 @@ CUnixPlatform::~CUnixPlatform()
|
||||
}
|
||||
|
||||
bool
|
||||
CUnixPlatform::installDaemon(
|
||||
const char*,
|
||||
const char*,
|
||||
const char*,
|
||||
const char*)
|
||||
CUnixPlatform::installDaemon(const char*, const char*, const char*, const char*)
|
||||
{
|
||||
// daemons don't require special installation
|
||||
return true;
|
||||
}
|
||||
|
||||
CUnixPlatform::EResult
|
||||
CUnixPlatform::uninstallDaemon(
|
||||
const char*)
|
||||
CUnixPlatform::uninstallDaemon(const char*)
|
||||
{
|
||||
// daemons don't require special installation
|
||||
return kSuccess;
|
||||
}
|
||||
|
||||
int
|
||||
CUnixPlatform::daemonize(
|
||||
const char* name,
|
||||
DaemonFunc func)
|
||||
CUnixPlatform::daemonize(const char* name, DaemonFunc func)
|
||||
{
|
||||
// fork so shell thinks we're done and so we're not a process
|
||||
// group leader
|
||||
@@ -92,17 +85,14 @@ CUnixPlatform::daemonize(
|
||||
}
|
||||
|
||||
void
|
||||
CUnixPlatform::installDaemonLogger(
|
||||
const char* name)
|
||||
CUnixPlatform::installDaemonLogger(const char* name)
|
||||
{
|
||||
openlog(name, 0, LOG_DAEMON);
|
||||
CLog::setOutputter(&CUnixPlatform::deamonLogger);
|
||||
}
|
||||
|
||||
int
|
||||
CUnixPlatform::restart(
|
||||
RestartFunc func,
|
||||
int minErrorCode)
|
||||
CUnixPlatform::restart(RestartFunc func, int minErrorCode)
|
||||
{
|
||||
for (;;) {
|
||||
switch (fork()) {
|
||||
@@ -153,8 +143,7 @@ CUnixPlatform::restart(
|
||||
}
|
||||
|
||||
const char*
|
||||
CUnixPlatform::getBasename(
|
||||
const char* pathname) const
|
||||
CUnixPlatform::getBasename(const char* pathname) const
|
||||
{
|
||||
if (pathname == NULL) {
|
||||
return NULL;
|
||||
@@ -189,9 +178,8 @@ CUnixPlatform::getSystemDirectory() const
|
||||
}
|
||||
|
||||
CString
|
||||
CUnixPlatform::addPathComponent(
|
||||
const CString& prefix,
|
||||
const CString& suffix) const
|
||||
CUnixPlatform::addPathComponent(const CString& prefix,
|
||||
const CString& suffix) const
|
||||
{
|
||||
CString path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
@@ -204,9 +192,7 @@ CUnixPlatform::addPathComponent(
|
||||
}
|
||||
|
||||
bool
|
||||
CUnixPlatform::deamonLogger(
|
||||
int priority,
|
||||
const char* msg)
|
||||
CUnixPlatform::deamonLogger(int priority, const char* msg)
|
||||
{
|
||||
// convert priority
|
||||
switch (priority) {
|
||||
|
||||
@@ -37,19 +37,14 @@ CWin32Platform::isWindows95Family()
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatus(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state)
|
||||
CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle, DWORD state)
|
||||
{
|
||||
setStatus(handle, state, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatus(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state,
|
||||
DWORD step,
|
||||
DWORD waitHint)
|
||||
CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state, DWORD step, DWORD waitHint)
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
|
||||
@@ -66,9 +61,7 @@ CWin32Platform::setStatus(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatusError(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD error)
|
||||
CWin32Platform::setStatusError(SERVICE_STATUS_HANDLE handle, DWORD error)
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
|
||||
@@ -85,11 +78,8 @@ CWin32Platform::setStatusError(
|
||||
}
|
||||
|
||||
bool
|
||||
CWin32Platform::installDaemon(
|
||||
const char* name,
|
||||
const char* description,
|
||||
const char* pathname,
|
||||
const char* commandLine)
|
||||
CWin32Platform::installDaemon(const char* name, const char* description,
|
||||
const char* pathname, const char* commandLine)
|
||||
{
|
||||
// windows 95 family services
|
||||
if (isWindows95Family()) {
|
||||
@@ -181,8 +171,7 @@ CWin32Platform::installDaemon(
|
||||
}
|
||||
|
||||
IPlatform::EResult
|
||||
CWin32Platform::uninstallDaemon(
|
||||
const char* name)
|
||||
CWin32Platform::uninstallDaemon(const char* name)
|
||||
{
|
||||
// windows 95 family services
|
||||
if (isWindows95Family()) {
|
||||
@@ -255,9 +244,7 @@ CWin32Platform::uninstallDaemon(
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::daemonize(
|
||||
const char* name,
|
||||
DaemonFunc func)
|
||||
CWin32Platform::daemonize(const char* name, DaemonFunc func)
|
||||
{
|
||||
assert(name != NULL);
|
||||
assert(func != NULL);
|
||||
@@ -319,8 +306,7 @@ CWin32Platform::daemonize(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::installDaemonLogger(
|
||||
const char* name)
|
||||
CWin32Platform::installDaemonLogger(const char* name)
|
||||
{
|
||||
if (!CWin32Platform::isWindows95Family()) {
|
||||
// open event log and direct log messages to it
|
||||
@@ -334,9 +320,7 @@ CWin32Platform::installDaemonLogger(
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::restart(
|
||||
RestartFunc func,
|
||||
int /*minErrorCode*/)
|
||||
CWin32Platform::restart(RestartFunc func, int /*minErrorCode*/)
|
||||
{
|
||||
// FIXME -- start in separate process or thread. note that this
|
||||
// isn't too critical as win32 doesn't force us to terminate for
|
||||
@@ -345,8 +329,7 @@ CWin32Platform::restart(
|
||||
}
|
||||
|
||||
const char*
|
||||
CWin32Platform::getBasename(
|
||||
const char* pathname) const
|
||||
CWin32Platform::getBasename(const char* pathname) const
|
||||
{
|
||||
if (pathname == NULL) {
|
||||
return NULL;
|
||||
@@ -429,9 +412,8 @@ CWin32Platform::getSystemDirectory() const
|
||||
}
|
||||
|
||||
CString
|
||||
CWin32Platform::addPathComponent(
|
||||
const CString& prefix,
|
||||
const CString& suffix) const
|
||||
CWin32Platform::addPathComponent(const CString& prefix,
|
||||
const CString& suffix) const
|
||||
{
|
||||
CString path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
@@ -446,9 +428,7 @@ CWin32Platform::addPathComponent(
|
||||
}
|
||||
|
||||
HKEY
|
||||
CWin32Platform::openKey(
|
||||
HKEY key,
|
||||
const char* keyName)
|
||||
CWin32Platform::openKey(HKEY key, const char* keyName)
|
||||
{
|
||||
// open next key
|
||||
HKEY newKey;
|
||||
@@ -471,9 +451,7 @@ CWin32Platform::openKey(
|
||||
}
|
||||
|
||||
HKEY
|
||||
CWin32Platform::openKey(
|
||||
HKEY key,
|
||||
const char** keyNames)
|
||||
CWin32Platform::openKey(HKEY key, const char** keyNames)
|
||||
{
|
||||
for (UInt32 i = 0; key != NULL && keyNames[i] != NULL; ++i) {
|
||||
// open next key
|
||||
@@ -483,17 +461,14 @@ CWin32Platform::openKey(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::closeKey(
|
||||
HKEY key)
|
||||
CWin32Platform::closeKey(HKEY key)
|
||||
{
|
||||
assert(key != NULL);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::deleteKey(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::deleteKey(HKEY key, const char* name)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@@ -501,9 +476,7 @@ CWin32Platform::deleteKey(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::deleteValue(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::deleteValue(HKEY key, const char* name)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@@ -511,10 +484,7 @@ CWin32Platform::deleteValue(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setValue(
|
||||
HKEY key,
|
||||
const char* name,
|
||||
const CString& value)
|
||||
CWin32Platform::setValue(HKEY key, const char* name, const CString& value)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@@ -524,9 +494,7 @@ CWin32Platform::setValue(
|
||||
}
|
||||
|
||||
CString
|
||||
CWin32Platform::readValueString(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::readValueString(HKEY key, const char* name)
|
||||
{
|
||||
// get the size of the string
|
||||
DWORD type;
|
||||
@@ -582,9 +550,7 @@ CWin32Platform::open95ServicesKey()
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::runDaemon(
|
||||
RunFunc run,
|
||||
StopFunc stop)
|
||||
CWin32Platform::runDaemon(RunFunc run, StopFunc stop)
|
||||
{
|
||||
// should only be called from DaemonFunc
|
||||
assert(m_serviceMutex != NULL);
|
||||
@@ -664,9 +630,7 @@ CWin32Platform::runDaemon(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::serviceMain(
|
||||
DWORD argc,
|
||||
LPTSTR* argvIn)
|
||||
CWin32Platform::serviceMain(DWORD argc, LPTSTR* argvIn)
|
||||
{
|
||||
typedef std::vector<LPCTSTR> ArgList;
|
||||
typedef std::vector<CString> Arguments;
|
||||
@@ -784,16 +748,13 @@ CWin32Platform::serviceMain(
|
||||
}
|
||||
|
||||
void WINAPI
|
||||
CWin32Platform::serviceMainEntry(
|
||||
DWORD argc,
|
||||
LPTSTR* argv)
|
||||
CWin32Platform::serviceMainEntry(DWORD argc, LPTSTR* argv)
|
||||
{
|
||||
s_daemonPlatform->serviceMain(argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::serviceHandler(
|
||||
DWORD ctrl)
|
||||
CWin32Platform::serviceHandler(DWORD ctrl)
|
||||
{
|
||||
assert(m_serviceMutex != NULL);
|
||||
assert(m_serviceState != NULL);
|
||||
@@ -866,16 +827,13 @@ CWin32Platform::serviceHandler(
|
||||
}
|
||||
|
||||
void WINAPI
|
||||
CWin32Platform::serviceHandlerEntry(
|
||||
DWORD ctrl)
|
||||
CWin32Platform::serviceHandlerEntry(DWORD ctrl)
|
||||
{
|
||||
s_daemonPlatform->serviceHandler(ctrl);
|
||||
}
|
||||
|
||||
bool
|
||||
CWin32Platform::serviceLogger(
|
||||
int priority,
|
||||
const char* msg)
|
||||
CWin32Platform::serviceLogger(int priority, const char* msg)
|
||||
{
|
||||
if (s_eventLog == NULL) {
|
||||
return false;
|
||||
|
||||
@@ -10,10 +10,8 @@
|
||||
// CXWindowsClipboard
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CXWindowsClipboard(
|
||||
Display* display,
|
||||
Window window,
|
||||
ClipboardID id) :
|
||||
CXWindowsClipboard::CXWindowsClipboard(Display* display,
|
||||
Window window, ClipboardID id) :
|
||||
m_display(display),
|
||||
m_window(window),
|
||||
m_id(id),
|
||||
@@ -63,8 +61,7 @@ CXWindowsClipboard::~CXWindowsClipboard()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::lost(
|
||||
Time time)
|
||||
CXWindowsClipboard::lost(Time time)
|
||||
{
|
||||
log((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
|
||||
if (m_owner) {
|
||||
@@ -75,12 +72,8 @@ CXWindowsClipboard::lost(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::addRequest(
|
||||
Window owner,
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::addRequest(Window owner, Window requestor,
|
||||
Atom target, ::Time time, Atom property)
|
||||
{
|
||||
// must be for our window and we must have owned the selection
|
||||
// at the given time.
|
||||
@@ -118,11 +111,8 @@ CXWindowsClipboard::addRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::addSimpleRequest(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::addSimpleRequest(Window requestor,
|
||||
Atom target, ::Time time, Atom property)
|
||||
{
|
||||
// obsolete requestors may supply a None property. in
|
||||
// that case we use the target as the property to store
|
||||
@@ -162,10 +152,8 @@ CXWindowsClipboard::addSimpleRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::processRequest(
|
||||
Window requestor,
|
||||
::Time /*time*/,
|
||||
Atom property)
|
||||
CXWindowsClipboard::processRequest(Window requestor,
|
||||
::Time /*time*/, Atom property)
|
||||
{
|
||||
CReplyMap::iterator index = m_replies.find(requestor);
|
||||
if (index == m_replies.end()) {
|
||||
@@ -192,8 +180,7 @@ CXWindowsClipboard::processRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::destroyRequest(
|
||||
Window requestor)
|
||||
CXWindowsClipboard::destroyRequest(Window requestor)
|
||||
{
|
||||
CReplyMap::iterator index = m_replies.find(requestor);
|
||||
if (index == m_replies.end()) {
|
||||
@@ -257,9 +244,7 @@ CXWindowsClipboard::empty()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::add(
|
||||
EFormat format,
|
||||
const CString& data)
|
||||
CXWindowsClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
assert(m_open);
|
||||
assert(m_owner);
|
||||
@@ -273,8 +258,7 @@ CXWindowsClipboard::add(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::open(
|
||||
Time time) const
|
||||
CXWindowsClipboard::open(Time time) const
|
||||
{
|
||||
assert(!m_open);
|
||||
|
||||
@@ -347,8 +331,7 @@ CXWindowsClipboard::getTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::has(
|
||||
EFormat format) const
|
||||
CXWindowsClipboard::has(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
@@ -357,8 +340,7 @@ CXWindowsClipboard::has(
|
||||
}
|
||||
|
||||
CString
|
||||
CXWindowsClipboard::get(
|
||||
EFormat format) const
|
||||
CXWindowsClipboard::get(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
@@ -367,8 +349,7 @@ CXWindowsClipboard::get(
|
||||
}
|
||||
|
||||
IClipboard::EFormat
|
||||
CXWindowsClipboard::getFormat(
|
||||
Atom src) const
|
||||
CXWindowsClipboard::getFormat(Atom src) const
|
||||
{
|
||||
// FIXME -- handle more formats (especially mime-type-like formats
|
||||
// and various character encodings like unicode).
|
||||
@@ -482,10 +463,8 @@ CXWindowsClipboard::icccmFillCache()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::icccmGetSelection(
|
||||
Atom target,
|
||||
Atom* actualTarget,
|
||||
CString* data) const
|
||||
CXWindowsClipboard::icccmGetSelection(Atom target,
|
||||
Atom* actualTarget, CString* data) const
|
||||
{
|
||||
assert(actualTarget != NULL);
|
||||
assert(data != NULL);
|
||||
@@ -725,10 +704,8 @@ CXWindowsClipboard::motifGetTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::insertMultipleReply(
|
||||
Window requestor,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::insertMultipleReply(Window requestor,
|
||||
::Time time, Atom property)
|
||||
{
|
||||
// get the requested targets
|
||||
Atom target;
|
||||
@@ -780,8 +757,7 @@ CXWindowsClipboard::insertMultipleReply(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::insertReply(
|
||||
CReply* reply)
|
||||
CXWindowsClipboard::insertReply(CReply* reply)
|
||||
{
|
||||
assert(reply != NULL);
|
||||
|
||||
@@ -841,10 +817,8 @@ CXWindowsClipboard::pushReplies()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::pushReplies(
|
||||
CReplyMap::iterator mapIndex,
|
||||
CReplyList& replies,
|
||||
CReplyList::iterator index)
|
||||
CXWindowsClipboard::pushReplies(CReplyMap::iterator mapIndex,
|
||||
CReplyList& replies, CReplyList::iterator index)
|
||||
{
|
||||
CReply* reply = *index;
|
||||
while (sendReply(reply)) {
|
||||
@@ -870,8 +844,7 @@ CXWindowsClipboard::pushReplies(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::sendReply(
|
||||
CReply* reply)
|
||||
CXWindowsClipboard::sendReply(CReply* reply)
|
||||
{
|
||||
assert(reply != NULL);
|
||||
|
||||
@@ -1005,8 +978,7 @@ CXWindowsClipboard::clearReplies()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::clearReplies(
|
||||
CReplyList& replies)
|
||||
CXWindowsClipboard::clearReplies(CReplyList& replies)
|
||||
{
|
||||
for (CReplyList::iterator index = replies.begin();
|
||||
index != replies.end(); ++index) {
|
||||
@@ -1016,12 +988,8 @@ CXWindowsClipboard::clearReplies(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::sendNotify(
|
||||
Window requestor,
|
||||
Atom selection,
|
||||
Atom target,
|
||||
Atom property,
|
||||
Time time)
|
||||
CXWindowsClipboard::sendNotify(Window requestor,
|
||||
Atom selection, Atom target, Atom property, Time time)
|
||||
{
|
||||
XEvent event;
|
||||
event.xselection.type = SelectionNotify;
|
||||
@@ -1036,8 +1004,7 @@ CXWindowsClipboard::sendNotify(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::wasOwnedAtTime(
|
||||
::Time time) const
|
||||
CXWindowsClipboard::wasOwnedAtTime(::Time time) const
|
||||
{
|
||||
// not owned if we've never owned the selection
|
||||
if (m_timeOwned == 0) {
|
||||
@@ -1070,9 +1037,7 @@ CXWindowsClipboard::wasOwnedAtTime(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getTargetsData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getTargetsData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@@ -1096,9 +1061,7 @@ CXWindowsClipboard::getTargetsData(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getTimestampData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getTimestampData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@@ -1109,9 +1072,7 @@ CXWindowsClipboard::getTimestampData(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getStringData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getStringData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@@ -1131,9 +1092,7 @@ CXWindowsClipboard::getStringData(
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
|
||||
Window requestor,
|
||||
Time time,
|
||||
Atom property) :
|
||||
Window requestor, Time time, Atom property) :
|
||||
m_requestor(requestor),
|
||||
m_time(time),
|
||||
m_property(property),
|
||||
@@ -1154,12 +1113,8 @@ CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(
|
||||
Display* display,
|
||||
Atom selection,
|
||||
Atom target,
|
||||
Atom* actualTarget,
|
||||
CString* data)
|
||||
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
|
||||
Atom selection, Atom target, Atom* actualTarget, CString* data)
|
||||
{
|
||||
assert(actualTarget != NULL);
|
||||
assert(data != NULL);
|
||||
@@ -1216,8 +1171,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::doEventPredicate(
|
||||
Display* display,
|
||||
XEvent* xevent)
|
||||
Display* display, XEvent* xevent)
|
||||
{
|
||||
// process event
|
||||
switch (xevent->type) {
|
||||
@@ -1354,17 +1308,14 @@ log((CLOG_INFO " INCR secondary chunk")); // FIXME
|
||||
|
||||
Bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::eventPredicate(
|
||||
Display* display,
|
||||
XEvent* xevent,
|
||||
XPointer arg)
|
||||
Display* display, XEvent* xevent, XPointer arg)
|
||||
{
|
||||
CICCCMGetClipboard* self = reinterpret_cast<CICCCMGetClipboard*>(arg);
|
||||
return self->doEventPredicate(display, xevent) ? True : False;
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::CICCCMGetClipboard::timeout(
|
||||
void* vdisplay)
|
||||
CXWindowsClipboard::CICCCMGetClipboard::timeout(void* vdisplay)
|
||||
{
|
||||
// wait
|
||||
CThread::sleep(0.2); // FIXME -- is this too short?
|
||||
@@ -1386,10 +1337,7 @@ CXWindowsClipboard::CICCCMGetClipboard::timeout(
|
||||
// CXWindowsClipboard::CReply
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CReply::CReply(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time) :
|
||||
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) :
|
||||
m_requestor(requestor),
|
||||
m_target(target),
|
||||
m_time(time),
|
||||
@@ -1404,14 +1352,8 @@ CXWindowsClipboard::CReply::CReply(
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CXWindowsClipboard::CReply::CReply(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property,
|
||||
const CString& data,
|
||||
Atom type,
|
||||
int format) :
|
||||
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time,
|
||||
Atom property, const CString& data, Atom type, int format) :
|
||||
m_requestor(requestor),
|
||||
m_target(target),
|
||||
m_time(time),
|
||||
|
||||
@@ -113,9 +113,7 @@ CXWindowsScreen::getRoot() const
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::getScreenSize(
|
||||
SInt32* w,
|
||||
SInt32* h) const
|
||||
CXWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
||||
{
|
||||
assert(m_display != NULL);
|
||||
assert(w != NULL && h != NULL);
|
||||
@@ -161,8 +159,7 @@ CXWindowsScreen::createBlankCursor() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::getEvent(
|
||||
XEvent* xevent) const
|
||||
CXWindowsScreen::getEvent(XEvent* xevent) const
|
||||
{
|
||||
// wait for an event in a cancellable way and don't lock the
|
||||
// display while we're waiting.
|
||||
@@ -217,8 +214,7 @@ CXWindowsScreen::onUnexpectedClose()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::processEvent(
|
||||
XEvent* xevent)
|
||||
CXWindowsScreen::processEvent(XEvent* xevent)
|
||||
{
|
||||
switch (xevent->type) {
|
||||
case SelectionClear:
|
||||
@@ -288,9 +284,8 @@ CXWindowsScreen::processEvent(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::setDisplayClipboard(
|
||||
ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
CXWindowsScreen::setDisplayClipboard(ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@@ -319,9 +314,8 @@ CXWindowsScreen::setDisplayClipboard(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::getDisplayClipboard(
|
||||
ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
CXWindowsScreen::getDisplayClipboard(ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
{
|
||||
assert(clipboard != NULL);
|
||||
|
||||
@@ -342,10 +336,8 @@ CXWindowsScreen::getDisplayClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::processClipboardRequest(
|
||||
Window requestor,
|
||||
Time time,
|
||||
Atom property)
|
||||
CXWindowsScreen::processClipboardRequest(Window requestor,
|
||||
Time time, Atom property)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@@ -359,8 +351,7 @@ CXWindowsScreen::processClipboardRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::destroyClipboardRequest(
|
||||
Window requestor)
|
||||
CXWindowsScreen::destroyClipboardRequest(Window requestor)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@@ -374,8 +365,7 @@ CXWindowsScreen::destroyClipboardRequest(
|
||||
}
|
||||
|
||||
int
|
||||
CXWindowsScreen::ioErrorHandler(
|
||||
Display*)
|
||||
CXWindowsScreen::ioErrorHandler(Display*)
|
||||
{
|
||||
// the display has disconnected, probably because X is shutting
|
||||
// down. X forces us to exit at this point. that's arguably
|
||||
@@ -395,8 +385,7 @@ CXWindowsScreen::ioErrorHandler(
|
||||
// CXWindowsScreen::CDisplayLock
|
||||
//
|
||||
|
||||
CXWindowsScreen::CDisplayLock::CDisplayLock(
|
||||
const CXWindowsScreen* screen) :
|
||||
CXWindowsScreen::CDisplayLock::CDisplayLock(const CXWindowsScreen* screen) :
|
||||
m_mutex(&screen->m_mutex),
|
||||
m_display(screen->m_display)
|
||||
{
|
||||
|
||||
@@ -8,14 +8,9 @@
|
||||
//
|
||||
|
||||
bool
|
||||
CXWindowsUtil::getWindowProperty(
|
||||
Display* display,
|
||||
Window window,
|
||||
Atom property,
|
||||
CString* data,
|
||||
Atom* type,
|
||||
int* format,
|
||||
bool deleteProperty)
|
||||
CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||
Atom property, CString* data, Atom* type,
|
||||
int* format, bool deleteProperty)
|
||||
{
|
||||
assert(display != NULL);
|
||||
assert(data != NULL);
|
||||
@@ -88,14 +83,9 @@ CXWindowsUtil::getWindowProperty(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsUtil::setWindowProperty(
|
||||
Display* display,
|
||||
Window window,
|
||||
Atom property,
|
||||
const void* vdata,
|
||||
UInt32 size,
|
||||
Atom type,
|
||||
SInt32 format)
|
||||
CXWindowsUtil::setWindowProperty(Display* display, Window window,
|
||||
Atom property, const void* vdata, UInt32 size,
|
||||
Atom type, SInt32 format)
|
||||
{
|
||||
const UInt32 length = 4 * XMaxRequestSize(display);
|
||||
const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata);
|
||||
@@ -135,9 +125,7 @@ CXWindowsUtil::setWindowProperty(
|
||||
}
|
||||
|
||||
Time
|
||||
CXWindowsUtil::getCurrentTime(
|
||||
Display* display,
|
||||
Window window)
|
||||
CXWindowsUtil::getCurrentTime(Display* display, Window window)
|
||||
{
|
||||
// select property events on window
|
||||
XWindowAttributes attr;
|
||||
@@ -174,10 +162,7 @@ CXWindowsUtil::getCurrentTime(
|
||||
}
|
||||
|
||||
Bool
|
||||
CXWindowsUtil::propertyNotifyPredicate(
|
||||
Display*,
|
||||
XEvent* xevent,
|
||||
XPointer arg)
|
||||
CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
|
||||
{
|
||||
CPropertyNotifyPredicateInfo* filter =
|
||||
reinterpret_cast<CPropertyNotifyPredicateInfo*>(arg);
|
||||
@@ -199,15 +184,12 @@ CXWindowsUtil::CErrorLock::CErrorLock()
|
||||
install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL);
|
||||
}
|
||||
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(
|
||||
bool* flag)
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(bool* flag)
|
||||
{
|
||||
install(&CXWindowsUtil::CErrorLock::saveHandler, flag);
|
||||
}
|
||||
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(
|
||||
ErrorHandler handler,
|
||||
void* data)
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(ErrorHandler handler, void* data)
|
||||
{
|
||||
install(handler, data);
|
||||
}
|
||||
@@ -219,9 +201,7 @@ CXWindowsUtil::CErrorLock::~CErrorLock()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::install(
|
||||
ErrorHandler handler,
|
||||
void* data)
|
||||
CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data)
|
||||
{
|
||||
m_handler = handler;
|
||||
m_userData = data;
|
||||
@@ -232,9 +212,7 @@ CXWindowsUtil::CErrorLock::install(
|
||||
}
|
||||
|
||||
int
|
||||
CXWindowsUtil::CErrorLock::internalHandler(
|
||||
Display* display,
|
||||
XErrorEvent* event)
|
||||
CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
|
||||
{
|
||||
if (s_top != NULL && s_top->m_handler != NULL) {
|
||||
s_top->m_handler(display, event, s_top->m_userData);
|
||||
@@ -243,19 +221,13 @@ CXWindowsUtil::CErrorLock::internalHandler(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::ignoreHandler(
|
||||
Display*,
|
||||
XErrorEvent*,
|
||||
void*)
|
||||
CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent*, void*)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::saveHandler(
|
||||
Display*,
|
||||
XErrorEvent*,
|
||||
void* flag)
|
||||
CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent*, void* flag)
|
||||
{
|
||||
*reinterpret_cast<bool*>(flag) = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user