- Timestamp:
- Aug 20, 2006, 9:50:11 AM (19 years ago)
- Location:
- trunk/synergy
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/synergy/Makefile.kmk
r2764 r2774 243 243 synrgyhk_ASTOOL.os2 = NASM 244 244 synrgyhk_ASFLAGS.os2 = -f obj 245 synrgyhk_CXXFLAGS.os2 = -fno-exceptions 245 synrgyhk_CXXFLAGS.os2 = -fno-exceptions 246 246 synrgyhk_LDFLAGS.os2 = -nostdlib -los2 -v -lend 247 247 synrgyhk_SOURCES.nt = \ … … 252 252 lib/platform/CPMSynergyHook.def 253 253 254 255 # 256 # A debugging testcase. 257 # 258 PROGRAMS += syntest 259 syntest_SOURCES = syntest.cpp 260 syntest_LIBS = \ 261 $(TARGET_platform) \ 262 $(TARGET_synergy) \ 263 $(TARGET_net) \ 264 $(TARGET_base) \ 265 $(TARGET_io) \ 266 $(TARGET_mt) \ 267 $(TARGET_arch) \ 268 $(TARGET_common) 269 270 254 271 include $(PATH_KBUILD)/footer.kmk -
trunk/synergy/lib/platform/CPMClipboard.cpp
r2770 r2774 43 43 44 44 bool 45 CPMClipboard::empty Unowned()45 CPMClipboard::empty() 46 46 { 47 47 LOG((CLOG_DEBUG "empty clipboard")); 48 49 // empty the clipboard (and take ownership)50 48 if (!WinEmptyClipbrd(CPMUtil::getHAB())) { 51 LOG((CLOG_DEBUG "failed to grab clipboard")); 52 return false; 53 } 54 55 return true; 56 } 57 58 bool 59 CPMClipboard::empty() 60 { 61 if (!emptyUnowned()) { 49 LOG((CLOG_ERR "failed to empty the clipboard")); 62 50 return false; 63 51 } … … 70 58 return false; 71 59 } 72 return !!WinSetClipbrdData(CPMUtil::getHAB(), (ULONG)pv, getOwnershipFormat(), CFI_POINTER); 60 if (!WinSetClipbrdData(CPMUtil::getHAB(), (ULONG)pv, getOwnershipFormat(), CFI_POINTER)) { 61 LOG((CLOG_ERR "failed to set dummy clipboard data. %#x", WinGetLastError(CPMUtil::getHAB()))); 62 DosFreeMem(pv); 63 return false; 64 } 65 return true; 73 66 } 74 67 … … 92 85 if (!WinSetClipbrdData(CPMUtil::getHAB(), ulPMData, ulPMFormat, ulPMFormatInfo)) { 93 86 // free converted data if we couldn't put it on the clipboard 87 LOG((CLOG_ERR "failed to set clipboard data ulPMData=%#lx ulPMFormat=%#lx ulPMFormatInfo=%#lx. %#x", 88 ulPMData, ulPMFormat, ulPMFormatInfo, WinGetLastError(CPMUtil::getHAB()))); 94 89 converter->freePMData(ulPMData); 95 90 } … … 108 103 return false; 109 104 } 110 111 105 m_time = time; 112 113 106 return true; 114 107 } … … 118 111 { 119 112 LOG((CLOG_DEBUG "close clipboard")); 120 WinCloseClipbrd(CPMUtil::getHAB()); 113 if (!WinCloseClipbrd(CPMUtil::getHAB())) { 114 LOG((CLOG_WARN "failed to close the clipboard. %#x", WinGetLastError(CPMUtil::getHAB()))); 115 } 121 116 } 122 117 … … 130 125 CPMClipboard::has(EFormat format) const 131 126 { 127 LOG((CLOG_DEBUG "has clipboard format=%d?", format)); 132 128 for (ConverterList::const_iterator index = m_converters.begin(); 133 129 index != m_converters.end(); 134 130 ++index) { 135 131 IPMClipboardConverter* converter = *index; 132 LOG((CLOG_DEBUG2 "CPMClipboard::has: format=%d convert->getFormat()->%d (pmformat=%d)", format, converter->getFormat(), converter->getPMFormat())); 136 133 if (converter->getFormat() == format) { 137 134 ULONG fFmtInfo; 138 if (WinQueryClipbrdFmtInfo(CPMUtil::getHAB(), getOwnershipFormat(), &fFmtInfo)) { 135 if (WinQueryClipbrdFmtInfo(CPMUtil::getHAB(), converter->getPMFormat(), &fFmtInfo)) { 136 LOG((CLOG_DEBUG "yes, we have format %d!", format)); 139 137 return true; 140 138 } 141 139 } 142 140 } 141 LOG((CLOG_DEBUG "sorry, no we haven't.")); 143 142 return false; 144 143 } … … 147 146 CPMClipboard::get(EFormat format) const 148 147 { 148 LOG((CLOG_DEBUG "get clipboard format=%d?", format)); 149 149 150 // find the converter for the first clipboard format we can handle 150 151 IPMClipboardConverter* converter = NULL; … … 155 156 ++index) { 156 157 converter = *index; 158 LOG((CLOG_DEBUG2 "CPMClipboard::get: pmFormat=%d format=%d ?=? %d:%d", pmFormat, format, converter->getPMFormat(), converter->getFormat())); 157 159 if (converter->getPMFormat() == pmFormat && 158 160 converter->getFormat() == format) { … … 172 174 ULONG ulData = WinQueryClipbrdData(CPMUtil::getHAB(), converter->getPMFormat()); 173 175 if (ulData == 0) { 176 LOG((CLOG_DEBUG "CPMClipboard::get: ulData=%#x\n", ulData)); 174 177 return CString(); 175 178 } 176 179 177 180 // convert 178 return converter->toIClipboard(ulData); 181 CString str = converter->toIClipboard(ulData); 182 LOG((CLOG_DEBUG2 "CPMClipboard::get: converted ulData=%lx to '%s'\n", ulData, str.c_str())); 183 return str; 179 184 } 180 185 … … 194 199 { 195 200 ULONG fFmtInfo; 196 return (!!WinQueryClipbrdFmtInfo(CPMUtil::getHAB(), getOwnershipFormat(), &fFmtInfo)); 201 if (WinQueryClipbrdFmtInfo(CPMUtil::getHAB(), getOwnershipFormat(), &fFmtInfo)) { 202 LOG((CLOG_DEBUG "isOwnedBySynergy: yes")); 203 return true; 204 } 205 LOG((CLOG_DEBUG "isOwnedBySynergy: no")); 206 return false; 197 207 } 198 208 -
trunk/synergy/lib/platform/CPMClipboard.h
r2770 r2774 31 31 CPMClipboard(HWND window); 32 32 virtual ~CPMClipboard(); 33 34 //! Empty clipboard without ownership35 /*!36 Take ownership of the clipboard and clear all data from it.37 This must be called between a successful open() and close().38 Return false if the clipboard ownership could not be taken;39 the clipboard should not be emptied in this case. Unlike40 empty(), isOwnedBySynergy() will return false when emptied41 this way. This is useful when synergy wants to put data on42 clipboard but pretend (to itself) that some other app did it.43 When using empty(), synergy assumes the data came from the44 server and doesn't need to be sent back. emptyUnowned()45 makes synergy send the data to the server.46 */47 bool emptyUnowned();48 33 49 34 //! Test if clipboard is owned by synergy -
trunk/synergy/lib/platform/CPMClipboardAnyTextConverter.cpp
r2752 r2774 3 3 * Copyright (C) 2002 Chris Schoeneman 4 4 * Copyright (C) 2006 Knut St. Osmundsen 5 * 5 * 6 6 * This package is free software; you can redistribute it and/or 7 7 * modify it under the terms of the GNU General Public License 8 8 * found in the file COPYING that should have accompanied this file. 9 * 9 * 10 10 * This package is distributed in the hope that it will be useful, 11 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of … … 15 15 16 16 #include "CPMClipboardAnyTextConverter.h" 17 #include "CLog.h" 17 18 18 19 // … … 50 51 // copy to memory handle 51 52 PVOID pv = NULL; 52 APIRET rc = DosAllocSharedMem(&pv, NULL, cb , PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GETTABLE | OBJ_GIVEABLE);53 APIRET rc = DosAllocSharedMem(&pv, NULL, cb + 1, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GETTABLE | OBJ_GIVEABLE); 53 54 if (rc == NO_ERROR) { 54 return (ULONG)memcpy(pv, text.data(), cb); 55 const char *psz = text.c_str(); 56 LOG((CLOG_DEBUG "fromIClipboard: psz='%s' cb=%d strlen=%d\n", psz, cb, strlen(psz))); 57 return (ULONG)memcpy(pv, psz, cb); 55 58 } 56 59 return 0; 57 60 } 58 61 59 void 62 void 60 63 CPMClipboardAnyTextConverter::freePMData(ULONG ulPMData) const 61 64 { … … 68 71 // convert text 69 72 const char *psz = (const char *)data; 70 CString text = doToIClipboard(CString(psz)); 73 LOG((CLOG_DEBUG "toIClipboard: psz='%s' strlen=%d\n", psz, strlen(psz))); 74 CString raw = CString(psz); 75 LOG((CLOG_DEBUG "toIClipboard: raw='%s'\n", raw.c_str())); 76 CString text = doToIClipboard(raw); 77 LOG((CLOG_DEBUG "toIClipboard: text='%s'\n", text.c_str())); 71 78 72 79 // convert newlines … … 77 84 CPMClipboardAnyTextConverter::convertLinefeedToPM(const CString& src) const 78 85 { 79 // note -- we assume src is a valid UTF-8 string 86 // note -- we assume src is a valid UTF-8 string L 80 87 81 88 // count newlines in string -
trunk/synergy/lib/platform/CPMScreen.cpp
r2771 r2774 547 547 qmsg.ptl.y = 0; 548 548 qmsg.reserved = 0; 549 LOG((CLOG_DEBUG "fakeMessage: msg=%#lx mp1=%#lx mp2=%#lx...", msg, mp1, mp2));549 LOG((CLOG_DEBUG "fakeMessage: msg=%#lx mp1=%#lx mp2=%#lx...", msg, mp1, mp2)); 550 550 const char *pszError = m_fakeMsg(m_hab, &qmsg); 551 551 if (pszError) { 552 552 LOG((CLOG_CRIT "fakeMessage: msg=%#lx mp1=%#lx mp2=%#lx failed: %s", msg, mp1, mp2, pszError)); 553 553 } 554 else LOG((CLOG_DEBUG "fakeMessage: done"));555 554 } 556 555 … … 624 623 POINTL ptl; 625 624 if (WinQueryPointerPos(HWND_DESKTOP, &ptl)) { 626 LOG((CLOG_DEBUG "fakeMouseRelativeMove: %d,%d (%d,%d +/- %d,%d)", ptl.x + dx, ptl.y - dy, ptl.y, ptl.x, dx, dy));625 LOG((CLOG_DEBUG1 "fakeMouseRelativeMove: %d,%d (%d,%d +/- %d,%d)", ptl.x + dx, ptl.y - dy, ptl.y, ptl.x, dx, dy)); 627 626 fakeMouseMove(ptl.x + dx, ptl.y - dy - m_cy); 628 627 return; … … 762 761 throw XScreenOpenFailure(); 763 762 } 764 LOG((CLOG_DEBUG 1"openHookLibrary: hmod=%#lx '%s'", hmod, name));763 LOG((CLOG_DEBUG2 "openHookLibrary: hmod=%#lx '%s'", hmod, name)); 765 764 return hmod; 766 765 } … … 769 768 CPMScreen::closeHookLibrary(HMODULE hmod) const 770 769 { 771 LOG((CLOG_DEBUG 1"closeHookLibrary: hmod=%#lx\n", hmod));770 LOG((CLOG_DEBUG2 "closeHookLibrary: hmod=%#lx\n", hmod)); 772 771 if (hmod != NULL) { 773 772 m_cleanup(m_hab); … … 911 910 { 912 911 switch (msg) { 913 case WM_DRAWCLIPBOARD: 912 913 // 914 // Just freak out and close the clipboard if we get any of these. 915 // 916 case WM_RENDERFMT: 917 case WM_RENDERALLFMTS: 918 case WM_PAINTCLIPBOARD: 919 case WM_SIZECLIPBOARD: 920 case WM_HSCROLLCLIPBOARD: 921 case WM_VSCROLLCLIPBOARD: 922 LOG((CLOG_DEBUG "msg=%#x -> closing clipboard.\n", msg)); 923 WinCloseClipbrd(m_hab); 924 break; 925 926 // 927 // The content has changed. 928 // 929 //case WM_DESTROYCLIPBOARD: 930 case WM_DRAWCLIPBOARD: 914 931 //// first pass on the message 915 932 //if (m_nextClipboardWindow != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.