Ignore:
Timestamp:
Jul 29, 2006, 6:43:07 AM (19 years ago)
Author:
bird
Message:

Two classes (CPMScreen and CPMKeyState) + the hook dll left (and debugging of course).

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/synergy/lib/platform/CPMScreen.cpp

    r2751 r2752  
    22 * synergy -- mouse and keyboard sharing utility
    33 * Copyright (C) 2002 Chris Schoeneman
     4 * Copyright (C) 2006 Knut St. Osmundsen
    45 *
    56 * This package is free software; you can redistribute it and/or
     
    1314 */
    1415
    15 #include "CMSWindowsScreen.h"
    16 #include "CMSWindowsClipboard.h"
    17 #include "CMSWindowsDesks.h"
    18 #include "CMSWindowsEventQueueBuffer.h"
    19 #include "CMSWindowsKeyState.h"
    20 #include "CMSWindowsScreenSaver.h"
     16#include "CPMScreen.h"
     17#include "CPMClipboard.h"
     18#include "CPMEventQueueBuffer.h"
     19#include "CPMKeyState.h"
     20#include "CPMScreenSaver.h"
    2121#include "CClipboard.h"
    2222#include "CKeyMap.h"
     
    3232#include "TMethodJob.h"
    3333#include "CArch.h"
    34 #include "CArchMiscWindows.h"
     34#include "CPMUtil.h"
    3535#include <string.h>
    36 #include <pbt.h>
    3736
    3837//
    39 // add backwards compatible multihead support (and suppress bogus warning).
    40 // this isn't supported on MinGW yet AFAICT.
     38// CPMScreen
    4139//
    42 #if defined(_MSC_VER)
    43 #pragma warning(push)
    44 #pragma warning(disable: 4706) // assignment within conditional
    45 #define COMPILE_MULTIMON_STUBS
    46 #include <multimon.h>
    47 #pragma warning(pop)
    48 #endif
    49 
    50 // X button stuff
    51 #if !defined(WM_XBUTTONDOWN)
    52 #define WM_XBUTTONDOWN          0x020B
    53 #define WM_XBUTTONUP            0x020C
    54 #define WM_XBUTTONDBLCLK        0x020D
    55 #define WM_NCXBUTTONDOWN        0x00AB
    56 #define WM_NCXBUTTONUP          0x00AC
    57 #define WM_NCXBUTTONDBLCLK      0x00AD
    58 #define MOUSEEVENTF_XDOWN       0x0080
    59 #define MOUSEEVENTF_XUP         0x0100
    60 #define XBUTTON1                        0x0001
    61 #define XBUTTON2                        0x0002
    62 #endif
    63 #if !defined(VK_XBUTTON1)
    64 #define VK_XBUTTON1                     0x05
    65 #define VK_XBUTTON2                     0x06
    66 #endif
    67 
    68 // WM_POWERBROADCAST stuff
    69 #if !defined(PBT_APMRESUMEAUTOMATIC)
    70 #define PBT_APMRESUMEAUTOMATIC  0x0012
    71 #endif
    72 
    73 //
    74 // CMSWindowsScreen
    75 //
    76 
    77 HINSTANCE                               CMSWindowsScreen::s_instance = NULL;
    78 CMSWindowsScreen*               CMSWindowsScreen::s_screen   = NULL;
    79 
    80 CMSWindowsScreen::CMSWindowsScreen(bool isPrimary) :
     40
     41CPMScreen*              CPMScreen::s_screen   = NULL;
     42
     43CPMScreen::CPMScreen(bool isPrimary) :
    8144        m_isPrimary(isPrimary),
    82         m_is95Family(CArchMiscWindows::isWindows95Family()),
    8345        m_isOnScreen(m_isPrimary),
    8446        m_class(0),
    8547        m_x(0), m_y(0),
    86         m_w(0), m_h(0),
     48        m_cx(0), m_cy(0),
    8749        m_xCenter(0), m_yCenter(0),
    8850        m_multimon(false),
     
    9254        m_markReceived(0),
    9355        m_fixTimer(NULL),
    94         m_keyLayout(NULL),
    9556        m_screensaver(NULL),
    9657        m_screensaverNotify(false),
    9758        m_screensaverActive(false),
    98         m_window(NULL),
    99         m_nextClipboardWindow(NULL),
     59        m_window(NULLHANDLE),
     60        m_nextClipboardWindow(NULLHANDLE),
    10061        m_ownClipboard(false),
    101         m_desks(NULL),
    102         m_hookLibrary(NULL),
     62        m_hmodHook(NULLHANDLE),
    10363        m_init(NULL),
    10464        m_cleanup(NULL),
     
    10767        m_setMode(NULL),
    10868        m_keyState(NULL),
    109         m_hasMouse(GetSystemMetrics(SM_MOUSEPRESENT) != 0),
     69        m_hasMouse(WinQuerySysValue(HWND_DESKTOP, SV_MOUSEPRESENT) != FALSE),
    11070        m_showingMouse(false)
    11171{
    112         assert(s_instance != NULL);
    113         assert(s_screen   == NULL);
     72        assert(s_screen == NULL);
    11473
    11574        s_screen = this;
    11675        try {
    11776                if (m_isPrimary) {
    118                         m_hookLibrary = openHookLibrary("synrgyhk");
    119                 }
    120                 m_screensaver = new CMSWindowsScreenSaver();
    121                 m_desks       = new CMSWindowsDesks(m_isPrimary,
    122                                                         m_hookLibrary, m_screensaver,
    123                                                         new TMethodJob<CMSWindowsScreen>(this,
    124                                                                 &CMSWindowsScreen::updateKeysCB));
    125                 m_keyState    = new CMSWindowsKeyState(m_desks, getEventTarget());
     77                        m_hmodHook = openHookLibrary("synrgyhk");
     78                }
     79                m_screensaver = new CPMScreenSaver();
     80                m_keyState    = new CPMKeyState(getEventTarget());
    12681                updateScreenShape();
    12782                m_class       = createWindowClass();
    12883                m_window      = createWindow(m_class, "Synergy");
    12984                forceShowCursor();
    130                 LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
     85                LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_cx, m_cy, m_multimon ? "(multi-monitor)" : ""));
    13186                LOG((CLOG_DEBUG "window is 0x%08x", m_window));
    13287        }
    13388        catch (...) {
    13489                delete m_keyState;
    135                 delete m_desks;
    13690                delete m_screensaver;
    13791                destroyWindow(m_window);
    13892                destroyClass(m_class);
    139                 closeHookLibrary(m_hookLibrary);
     93                closeHookLibrary(m_hmodHook);
    14094                s_screen = NULL;
    14195                throw;
     
    14498        // install event handlers
    14599        EVENTQUEUE->adoptHandler(CEvent::kSystem, IEventQueue::getSystemTarget(),
    146                                                         new TMethodEventJob<CMSWindowsScreen>(this,
    147                                                                 &CMSWindowsScreen::handleSystemEvent));
     100                                                        new TMethodEventJob<CPMScreen>(this,
     101                                                                &CPMScreen::handleSystemEvent));
    148102
    149103        // install the platform event queue
    150         EVENTQUEUE->adoptBuffer(new CMSWindowsEventQueueBuffer);
    151 }
    152 
    153 CMSWindowsScreen::~CMSWindowsScreen()
     104        EVENTQUEUE->adoptBuffer(new CPMEventQueueBuffer);
     105}
     106
     107CPMScreen::~CPMScreen()
    154108{
    155109        assert(s_screen != NULL);
     
    159113        EVENTQUEUE->removeHandler(CEvent::kSystem, IEventQueue::getSystemTarget());
    160114        delete m_keyState;
    161         delete m_desks;
    162115        delete m_screensaver;
    163116        destroyWindow(m_window);
    164117        destroyClass(m_class);
    165         closeHookLibrary(m_hookLibrary);
     118        closeHookLibrary(m_hmodHook);
    166119        s_screen = NULL;
    167120}
    168121
    169122void
    170 CMSWindowsScreen::init(HINSTANCE instance)
    171 {
    172         assert(s_instance == NULL);
    173         assert(instance   != NULL);
    174 
    175         s_instance = instance;
    176 }
    177 
    178 HINSTANCE
    179 CMSWindowsScreen::getInstance()
    180 {
    181         return s_instance;
    182 }
    183 
    184 void
    185 CMSWindowsScreen::enable()
     123CPMScreen::enable()
    186124{
    187125        assert(m_isOnScreen == m_isPrimary);
     
    190128        m_fixTimer = EVENTQUEUE->newTimer(1.0, NULL);
    191129        EVENTQUEUE->adoptHandler(CEvent::kTimer, m_fixTimer,
    192                                                         new TMethodEventJob<CMSWindowsScreen>(this,
    193                                                                 &CMSWindowsScreen::handleFixes));
     130                                                         new TMethodEventJob<CPMScreen>(this, &CPMScreen::handleFixes));
    194131
    195132        // install our clipboard snooper
    196         m_nextClipboardWindow = SetClipboardViewer(m_window);
    197 
     133    HAB hab = CPMUtil::getHAB();
     134        m_nextClipboardWindow = WinQueryClipbrdViewer(hab);
     135    WinSetClipbrdViewer(hab, m_window);
     136
     137/// @todo start here!
    198138        // track the active desk and (re)install the hooks
    199139        m_desks->enable();
     
    201141        if (m_isPrimary) {
    202142                // set jump zones
    203                 m_setZone(m_x, m_y, m_w, m_h, getJumpZoneSize());
     143                m_setZone(m_x, m_y, m_cx, m_cy, getJumpZoneSize());
    204144
    205145                // watch jump zones
    206146                m_setMode(kHOOK_WATCH_JUMP_ZONE);
    207147        }
    208         else {
    209                 // prevent the system from entering power saving modes.  if
    210                 // it did we'd be forced to disconnect from the server and
    211                 // the server would not be able to wake us up.
    212                 CArchMiscWindows::addBusyState(CArchMiscWindows::kSYSTEM);
    213         }
    214 }
    215 
    216 void
    217 CMSWindowsScreen::disable()
     148}
     149
     150void
     151CPMScreen::disable()
    218152{
    219153        // stop tracking the active desk
     
    223157                // disable hooks
    224158                m_setMode(kHOOK_DISABLE);
    225 
    226                 // enable special key sequences on win95 family
    227                 enableSpecialKeys(true);
    228         }
    229         else {
    230                 // allow the system to enter power saving mode
    231                 CArchMiscWindows::removeBusyState(CArchMiscWindows::kSYSTEM |
    232                                                         CArchMiscWindows::kDISPLAY);
    233159        }
    234160
     
    237163
    238164        // stop snooping the clipboard
    239         ChangeClipboardChain(m_window, m_nextClipboardWindow);
     165        WinSetClipbrdViewer(m_window, m_nextClipboardWindow);
    240166        m_nextClipboardWindow = NULL;
    241167
     
    252178
    253179void
    254 CMSWindowsScreen::enter()
     180CPMScreen::enter()
    255181{
    256182        m_desks->enter();
    257183        if (m_isPrimary) {
    258                 // enable special key sequences on win95 family
    259                 enableSpecialKeys(true);
    260 
    261184                // watch jump zones
    262185                m_setMode(kHOOK_WATCH_JUMP_ZONE);
     
    272195
    273196bool
    274 CMSWindowsScreen::leave()
    275 {
    276         // get keyboard layout of foreground window.  we'll use this
    277         // keyboard layout for translating keys sent to clients.
    278         HWND window  = GetForegroundWindow();
    279         DWORD thread = GetWindowThreadProcessId(window, NULL);
    280         m_keyLayout  = GetKeyboardLayout(thread);
    281 
    282         // tell the key mapper about the keyboard layout
    283         m_keyState->setKeyLayout(m_keyLayout);
    284 
    285         // tell desk that we're leaving and tell it the keyboard layout
    286         m_desks->leave(m_keyLayout);
    287 
     197CPMScreen::leave()
     198{
    288199        if (m_isPrimary) {
    289200                // warp to center
    290201                warpCursor(m_xCenter, m_yCenter);
    291202
    292                 // disable special key sequences on win95 family
    293                 enableSpecialKeys(false);
    294 
    295203                // all messages prior to now are invalid
    296204                nextMark();
     
    312220
    313221bool
    314 CMSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src)
    315 {
    316         CMSWindowsClipboard dst(m_window);
     222CPMScreen::setClipboard(ClipboardID, const IClipboard* src)
     223{
     224        CPMClipboard dst(m_window);
    317225        if (src != NULL) {
    318226                // save clipboard data
    319227                return CClipboard::copy(&dst, src);
    320228        }
    321         else {
    322                 // assert clipboard ownership
    323                 if (!dst.open(0)) {
    324                         return false;
    325                 }
    326                 dst.empty();
    327                 dst.close();
    328                 return true;
    329         }
    330 }
    331 
    332 void
    333 CMSWindowsScreen::checkClipboards()
    334 {
    335         // if we think we own the clipboard but we don't then somebody
    336         // grabbed the clipboard on this screen without us knowing.
    337         // tell the server that this screen grabbed the clipboard.
    338         //
    339         // this works around bugs in the clipboard viewer chain.
    340         // sometimes NT will simply never send WM_DRAWCLIPBOARD
    341         // messages for no apparent reason and rebooting fixes the
    342         // problem.  since we don't want a broken clipboard until the
    343         // next reboot we do this double check.  clipboard ownership
    344         // won't be reflected on other screens until we leave but at
    345         // least the clipboard itself will work.
    346         if (m_ownClipboard && !CMSWindowsClipboard::isOwnedBySynergy()) {
     229    // assert clipboard ownership
     230    if (!dst.open(0)) {
     231        return false;
     232    }
     233    dst.empty();
     234    dst.close();
     235    return true;
     236}
     237
     238void
     239CPMScreen::checkClipboards()
     240{
     241    // be careful, even if we don't have the NT bugs.
     242        if (m_ownClipboard && !CPMClipboard::isOwnedBySynergy()) {
    347243                LOG((CLOG_DEBUG "clipboard changed: lost ownership and no notification received"));
    348244                m_ownClipboard = false;
     
    353249
    354250void
    355 CMSWindowsScreen::openScreensaver(bool notify)
    356 {
    357         assert(m_screensaver != NULL);
    358 
     251CPMScreen::openScreensaver(bool notify)
     252{
    359253        m_screensaverNotify = notify;
    360         if (m_screensaverNotify) {
    361                 m_desks->installScreensaverHooks(true);
    362         }
    363         else {
     254        if (!m_screensaverNotify) {
    364255                m_screensaver->disable();
    365256        }
     
    367258
    368259void
    369 CMSWindowsScreen::closeScreensaver()
    370 {
    371         if (m_screensaver != NULL) {
    372                 if (m_screensaverNotify) {
    373                         m_desks->installScreensaverHooks(false);
    374                 }
    375                 else {
    376                         m_screensaver->enable();
    377                 }
    378         }
    379         m_screensaverNotify = false;
    380 }
    381 
    382 void
    383 CMSWindowsScreen::screensaver(bool activate)
    384 {
    385         assert(m_screensaver != NULL);
    386 
    387         if (activate) {
    388                 m_screensaver->activate();
    389         }
    390         else {
    391                 m_screensaver->deactivate();
    392         }
    393 }
    394 
    395 void
    396 CMSWindowsScreen::resetOptions()
    397 {
    398         m_desks->resetOptions();
    399 }
    400 
    401 void
    402 CMSWindowsScreen::setOptions(const COptionsList& options)
    403 {
    404         m_desks->setOptions(options);
    405 }
    406 
    407 void
    408 CMSWindowsScreen::setSequenceNumber(UInt32 seqNum)
     260CPMScreen::closeScreensaver()
     261{
     262        if (!m_screensaverNotify) {
     263                m_screensaver->enable();
     264        }
     265}
     266
     267void
     268CPMScreen::screensaver(bool activate)
     269{
     270    if (activate) {
     271        m_screensaver->activate();
     272    }
     273    else {
     274        m_screensaver->deactivate();
     275    }
     276}
     277
     278void
     279CPMScreen::resetOptions()
     280{
     281//example    m_xtestIsXineramaUnaware = true;
     282}
     283
     284void
     285CPMScreen::setOptions(const COptionsList& options)
     286{
     287    for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
     288//example        if (options[i] == kOptionXTestXineramaUnaware) {
     289//example            m_xtestIsXineramaUnaware = (options[i + 1] != 0);
     290//example            LOG((CLOG_DEBUG1 "XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false"));
     291//example        }
     292    }
     293}
     294
     295void
     296CPMScreen::setSequenceNumber(UInt32 seqNum)
    409297{
    410298        m_sequenceNumber = seqNum;
     
    412300
    413301bool
    414 CMSWindowsScreen::isPrimary() const
     302CPMScreen::isPrimary() const
    415303{
    416304        return m_isPrimary;
     
    418306
    419307void*
    420 CMSWindowsScreen::getEventTarget() const
    421 {
    422         return const_cast<CMSWindowsScreen*>(this);
    423 }
    424 
    425 bool
    426 CMSWindowsScreen::getClipboard(ClipboardID, IClipboard* dst) const
    427 {
    428         CMSWindowsClipboard src(m_window);
    429         CClipboard::copy(dst, &src);
    430         return true;
    431 }
    432 
    433 void
    434 CMSWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
     308CPMScreen::getEventTarget() const
     309{
     310        return const_cast<CPMScreen*>(this);
     311}
     312
     313bool
     314CPMScreen::getClipboard(ClipboardID, IClipboard* dst) const
     315{
     316        CPMClipboard src(m_window);
     317        return CClipboard::copy(dst, &src);
     318}
     319
     320void
     321CPMScreen::getShape(SInt32& x, SInt32& y, SInt32& cx, SInt32& cy) const
    435322{
    436323        assert(m_class != 0);
     
    438325        x = m_x;
    439326        y = m_y;
    440         w = m_w;
    441         h = m_h;
    442 }
    443 
    444 void
    445 CMSWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
    446 {
    447         m_desks->getCursorPos(x, y);
    448 }
    449 
    450 void
    451 CMSWindowsScreen::reconfigure(UInt32 activeSides)
    452 {
    453         assert(m_isPrimary);
    454 
    455         LOG((CLOG_DEBUG "active sides: %x", activeSides));
    456         m_setSides(activeSides);
    457 }
    458 
    459 void
    460 CMSWindowsScreen::warpCursor(SInt32 x, SInt32 y)
     327        cx= m_cx;
     328        cy = m_cy;
     329}
     330
     331void
     332CPMScreen::getCursorPos(SInt32& x, SInt32& y) const
     333{
     334    CURSORINFO Info;
     335    if (WinQueryCursorInfo(HWND_DESKTOP, &Info)) {
     336        x = Info.x;
     337        y = m_cy - Info.y;
     338    } else {
     339        x = 0;
     340        y = 0;
     341    }
     342}
     343
     344void
     345CPMScreen::reconfigure(UInt32 activeSides)
     346{
     347    // do nothing.
     348}
     349
     350void
     351CPMScreen::warpCursor(SInt32 x, SInt32 y)
    461352{
    462353        // warp mouse
     
    464355
    465356        // remove all input events before and including warp
    466         MSG msg;
    467         while (PeekMessage(&msg, NULL, SYNERGY_MSG_INPUT_FIRST,
    468                                                                 SYNERGY_MSG_INPUT_LAST, PM_REMOVE)) {
     357        QMSG qmsg;
     358        while (WinPeekMsg(m_hab, &qmsg, NULLHANDLE, SYNERGY_MSG_INPUT_FIRST, SYNERGY_MSG_INPUT_LAST, PM_REMOVE)) {
    469359                // do nothing
    470360        }
     
    476366
    477367UInt32
    478 CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
     368CPMScreen::registerHotKey(KeyID key, KeyModifierMask mask)
    479369{
    480370        // only allow certain modifiers
     
    490380        }
    491381
     382#if 1
     383    LOG((CLOG_WARN "not implemented id=%04x mask=%04x", key, mask));
     384    return 0;
     385#else
    492386        // convert to win32
    493387        UINT modifiers = 0;
     
    545439        LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id));
    546440        return id;
    547 }
    548 
    549 void
    550 CMSWindowsScreen::unregisterHotKey(UInt32 id)
     441#endif
     442}
     443
     444void
     445CPMScreen::unregisterHotKey(UInt32 id)
    551446{
    552447        // look up hotkey
     
    558453        // unregister with OS
    559454        bool err;
     455#if 1
     456    err = true;
     457#else
    560458        if (i->second.getVirtualKey() != 0) {
    561459                err = !UnregisterHotKey(NULL, id);
    562         }
    563         else {
     460        } else {
    564461                err = false;
    565462        }
     463#endif
    566464        if (err) {
    567465                LOG((CLOG_WARN "failed to unregister hotkey id=%d", id));
     
    578476
    579477void
    580 CMSWindowsScreen::fakeInputBegin()
     478CPMScreen::fakeInputBegin()
    581479{
    582480        assert(m_isPrimary);
     
    589487
    590488void
    591 CMSWindowsScreen::fakeInputEnd()
     489CPMScreen::fakeInputEnd()
    592490{
    593491        assert(m_isPrimary);
     
    600498
    601499SInt32
    602 CMSWindowsScreen::getJumpZoneSize() const
     500CPMScreen::getJumpZoneSize() const
    603501{
    604502        return 1;
     
    606504
    607505bool
    608 CMSWindowsScreen::isAnyMouseButtonDown() const
     506CPMScreen::isAnyMouseButtonDown() const
    609507{
    610508        static const char* buttonToName[] = {
     
    628526
    629527void
    630 CMSWindowsScreen::getCursorCenter(SInt32& x, SInt32& y) const
     528CPMScreen::getCursorCenter(SInt32& x, SInt32& y) const
    631529{
    632530        x = m_xCenter;
     
    635533
    636534void
    637 CMSWindowsScreen::fakeMouseButton(ButtonID id, bool press) const
     535CPMScreen::fakeMouseButton(ButtonID id, bool press) const
    638536{
    639537        m_desks->fakeMouseButton(id, press);
     
    641539
    642540void
    643 CMSWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y) const
     541CPMScreen::fakeMouseMove(SInt32 x, SInt32 y) const
    644542{
    645543        m_desks->fakeMouseMove(x, y);
     
    647545
    648546void
    649 CMSWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
     547CPMScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
    650548{
    651549        m_desks->fakeMouseRelativeMove(dx, dy);
     
    653551
    654552void
    655 CMSWindowsScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
     553CPMScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
    656554{
    657555        m_desks->fakeMouseWheel(xDelta, yDelta);
     
    659557
    660558void
    661 CMSWindowsScreen::updateKeys()
     559CPMScreen::updateKeys()
    662560{
    663561        m_desks->updateKeys();
     
    665563
    666564void
    667 CMSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
     565CPMScreen::fakeKeyDown(KeyID id, KeyModifierMask mask,
    668566                                KeyButton button)
    669567{
     
    673571
    674572void
    675 CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
     573CPMScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask,
    676574                                SInt32 count, KeyButton button)
    677575{
     
    681579
    682580void
    683 CMSWindowsScreen::fakeKeyUp(KeyButton button)
     581CPMScreen::fakeKeyUp(KeyButton button)
    684582{
    685583        CPlatformScreen::fakeKeyUp(button);
     
    688586
    689587void
    690 CMSWindowsScreen::fakeAllKeysUp()
     588CPMScreen::fakeAllKeysUp()
    691589{
    692590        CPlatformScreen::fakeAllKeysUp();
     
    695593
    696594HINSTANCE
    697 CMSWindowsScreen::openHookLibrary(const char* name)
     595CPMScreen::openHookLibrary(const char* name)
    698596{
    699597        // load the hook library
     
    729627
    730628void
    731 CMSWindowsScreen::closeHookLibrary(HINSTANCE hookLibrary) const
     629CPMScreen::closeHookLibrary(HINSTANCE hookLibrary) const
    732630{
    733631        if (hookLibrary != NULL) {
     
    737635}
    738636
    739 HCURSOR
    740 CMSWindowsScreen::createBlankCursor() const
    741 {
    742         // create a transparent cursor
    743         int cw = GetSystemMetrics(SM_CXCURSOR);
    744         int ch = GetSystemMetrics(SM_CYCURSOR);
    745         UInt8* cursorAND = new UInt8[ch * ((cw + 31) >> 2)];
    746         UInt8* cursorXOR = new UInt8[ch * ((cw + 31) >> 2)];
    747         memset(cursorAND, 0xff, ch * ((cw + 31) >> 2));
    748         memset(cursorXOR, 0x00, ch * ((cw + 31) >> 2));
    749         HCURSOR c = CreateCursor(s_instance, 0, 0, cw, ch, cursorAND, cursorXOR);
    750         delete[] cursorXOR;
    751         delete[] cursorAND;
    752         return c;
    753 }
    754 
    755 void
    756 CMSWindowsScreen::destroyCursor(HCURSOR cursor) const
    757 {
    758         if (cursor != NULL) {
    759                 DestroyCursor(cursor);
    760         }
    761 }
    762 
    763637ATOM
    764 CMSWindowsScreen::createWindowClass() const
     638CPMScreen::createWindowClass() const
    765639{
    766640        WNDCLASSEX classInfo;
    767641        classInfo.cbSize        = sizeof(classInfo);
    768642        classInfo.style         = CS_DBLCLKS | CS_NOCLOSE;
    769         classInfo.lpfnWndProc   = &CMSWindowsScreen::wndProc;
     643        classInfo.lpfnWndProc   = &CPMScreen::wndProc;
    770644        classInfo.cbClsExtra    = 0;
    771645        classInfo.cbWndExtra    = 0;
     
    781655
    782656void
    783 CMSWindowsScreen::destroyClass(ATOM windowClass) const
     657CPMScreen::destroyClass(ATOM windowClass) const
    784658{
    785659        if (windowClass != 0) {
     
    789663
    790664HWND
    791 CMSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
     665CPMScreen::createWindow(ATOM windowClass, const char* name) const
    792666{
    793667        HWND window = CreateWindowEx(WS_EX_TOPMOST |
     
    809683
    810684void
    811 CMSWindowsScreen::destroyWindow(HWND hwnd) const
     685CPMScreen::destroyWindow(HWND hwnd) const
    812686{
    813687        if (hwnd != NULL) {
     
    817691
    818692void
    819 CMSWindowsScreen::sendEvent(CEvent::Type type, void* data)
     693CPMScreen::sendEvent(CEvent::Type type, void* data)
    820694{
    821695        EVENTQUEUE->addEvent(CEvent(type, getEventTarget(), data));
     
    823697
    824698void
    825 CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
     699CPMScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id)
    826700{
    827701        CClipboardInfo* info   = (CClipboardInfo*)malloc(sizeof(CClipboardInfo));
     
    832706
    833707void
    834 CMSWindowsScreen::handleSystemEvent(const CEvent& event, void*)
     708CPMScreen::handleSystemEvent(const CEvent& event, void*)
    835709{
    836710        MSG* msg = reinterpret_cast<MSG*>(event.getData());
     
    848722
    849723void
    850 CMSWindowsScreen::updateButtons()
     724CPMScreen::updateButtons()
    851725{
    852726        int numButtons               = GetSystemMetrics(SM_CMOUSEBUTTONS);
     
    862736
    863737IKeyState*
    864 CMSWindowsScreen::getKeyState() const
     738CPMScreen::getKeyState() const
    865739{
    866740        return m_keyState;
     
    868742
    869743bool
    870 CMSWindowsScreen::onPreDispatch(HWND hwnd,
     744CPMScreen::onPreDispatch(HWND hwnd,
    871745                                UINT message, WPARAM wParam, LPARAM lParam)
    872746{
     
    889763
    890764bool
    891 CMSWindowsScreen::onPreDispatchPrimary(HWND,
     765CPMScreen::onPreDispatchPrimary(HWND,
    892766                                UINT message, WPARAM wParam, LPARAM lParam)
    893767{
     
    946820
    947821bool
    948 CMSWindowsScreen::onEvent(HWND, UINT msg,
     822CPMScreen::onEvent(HWND, UINT msg,
    949823                                WPARAM wParam, LPARAM lParam, LRESULT* result)
    950824{
     
    1006880                *result = TRUE;
    1007881                return true;
    1008 
    1009         case WM_DEVICECHANGE:
    1010                 forceShowCursor();
    1011                 break;
    1012 
    1013         case WM_SETTINGCHANGE:
    1014                 if (wParam == SPI_SETMOUSEKEYS) {
    1015                         forceShowCursor();
    1016                 }
    1017                 break;
    1018882        }
    1019883
     
    1022886
    1023887bool
    1024 CMSWindowsScreen::onMark(UInt32 mark)
     888CPMScreen::onMark(UInt32 mark)
    1025889{
    1026890        m_markReceived = mark;
     
    1029893
    1030894bool
    1031 CMSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
     895CPMScreen::onKey(WPARAM wParam, LPARAM lParam)
    1032896{
    1033897        static const KeyModifierMask s_ctrlAlt =
     
    11721036
    11731037bool
    1174 CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
     1038CPMScreen::onHotKey(WPARAM wParam, LPARAM lParam)
    11751039{
    11761040        // get the key info
     
    12191083
    12201084bool
    1221 CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
     1085CPMScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
    12221086{
    12231087        // get which button
    1224         bool pressed    = mapPressFromEvent(wParam, lParam);
    1225         ButtonID button = mapButtonFromEvent(wParam, lParam);
     1088        bool pressed    = mapPressFromEvent((ULONG)wParam, lParam);
     1089        ButtonID button = mapButtonFromEvent((ULONG)wParam, lParam);
    12261090
    12271091        // keep our shadow key state up to date
     
    12581122
    12591123bool
    1260 CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
     1124CPMScreen::onMouseMove(SInt32 mx, SInt32 my)
    12611125{
    12621126        // compute motion delta (relative to the last known
     
    12921156                static SInt32 bogusZoneSize = 10;
    12931157                if (-x + bogusZoneSize > m_xCenter - m_x ||
    1294                          x + bogusZoneSize > m_x + m_w - m_xCenter ||
     1158                         x + bogusZoneSize > m_x + m_cx - m_xCenter ||
    12951159                        -y + bogusZoneSize > m_yCenter - m_y ||
    1296                          y + bogusZoneSize > m_y + m_h - m_yCenter) {
     1160                         y + bogusZoneSize > m_y + m_cy - m_yCenter) {
    12971161                        LOG((CLOG_DEBUG "dropped bogus motion %+d,%+d", x, y));
    12981162                }
     
    13071171
    13081172bool
    1309 CMSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
     1173CPMScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
    13101174{
    13111175        // ignore message if posted prior to last mark change
     
    13181182
    13191183bool
    1320 CMSWindowsScreen::onScreensaver(bool activated)
     1184CPMScreen::onScreensaver(bool activated)
    13211185{
    13221186        // ignore this message if there are any other screen saver
     
    13581222
    13591223bool
    1360 CMSWindowsScreen::onDisplayChange()
     1224CPMScreen::onDisplayChange()
    13611225{
    13621226        // screen resolution may have changed.  save old shape.
    1363         SInt32 xOld = m_x, yOld = m_y, wOld = m_w, hOld = m_h;
     1227        SInt32 xOld = m_x, yOld = m_y, wOld = m_cx, hOld = m_cy;
    13641228
    13651229        // update shape
     
    13671231
    13681232        // do nothing if resolution hasn't changed
    1369         if (xOld != m_x || yOld != m_y || wOld != m_w || hOld != m_h) {
     1233        if (xOld != m_x || yOld != m_y || wOld != m_cx || hOld != m_cy) {
    13701234                if (m_isPrimary) {
    13711235                        // warp mouse to center if off screen
     
    13761240                        // tell hook about resize if on screen
    13771241                        else {
    1378                                 m_setZone(m_x, m_y, m_w, m_h, getJumpZoneSize());
     1242                                m_setZone(m_x, m_y, m_cx, m_cy, getJumpZoneSize());
    13791243                        }
    13801244                }
     
    13831247                sendEvent(getShapeChangedEvent());
    13841248
    1385                 LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
     1249                LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_cx, m_cy, m_multimon ? "(multi-monitor)" : ""));
    13861250        }
    13871251
     
    13901254
    13911255bool
    1392 CMSWindowsScreen::onClipboardChange()
     1256CPMScreen::onClipboardChange()
    13931257{
    13941258        // now notify client that somebody changed the clipboard (unless
    13951259        // we're the owner).
    1396         if (!CMSWindowsClipboard::isOwnedBySynergy()) {
     1260        if (!CPMClipboard::isOwnedBySynergy()) {
    13971261                if (m_ownClipboard) {
    13981262                        LOG((CLOG_DEBUG "clipboard changed: lost ownership"));
     
    14111275
    14121276void
    1413 CMSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
     1277CPMScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
    14141278{
    14151279        // send an event that we can recognize before the mouse warp
    1416         PostThreadMessage(GetCurrentThreadId(), SYNERGY_MSG_PRE_WARP, x, y);
     1280    WinPostQueueMsg(m_hmq, SYNERGY_MSG_PRE_WARP, (MPARAM)x, (MPARAM)y);
    14171281
    14181282        // warp mouse.  hopefully this inserts a mouse motion event
    14191283        // between the previous message and the following message.
    1420         SetCursorPos(x, y);
     1284    WinSetPointerPos(HWND_DESKTOP, x, y);
    14211285
    14221286        // yield the CPU.  there's a race condition when warping:
     
    14391303
    14401304        // send an event that we can recognize after the mouse warp
    1441         PostThreadMessage(GetCurrentThreadId(), SYNERGY_MSG_POST_WARP, 0, 0);
    1442 }
    1443 
    1444 void
    1445 CMSWindowsScreen::nextMark()
     1305    WinPostQueueMsg(m_hmq, SYNERGY_MSG_POST_WARP, 0, 0);
     1306}
     1307
     1308void
     1309CPMScreen::nextMark()
    14461310{
    14471311        // next mark
     
    14491313
    14501314        // mark point in message queue where the mark was changed
    1451         PostThreadMessage(GetCurrentThreadId(), SYNERGY_MSG_MARK, m_mark, 0);
    1452 }
    1453 
    1454 bool
    1455 CMSWindowsScreen::ignore() const
     1315    WinPostQueueMsg(m_hmq, SYNERGY_MSG_MARK, (MPARAM)m_mark, 0);
     1316}
     1317
     1318bool
     1319CPMScreen::ignore() const
    14561320{
    14571321        return (m_mark != m_markReceived);
     
    14591323
    14601324void
    1461 CMSWindowsScreen::updateScreenShape()
     1325CPMScreen::updateScreenShape()
    14621326{
    14631327        // get shape
    1464         m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
    1465         m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
    1466         m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
    1467         m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
     1328        m_x = 0;
     1329        m_y = 0;
     1330        m_cx = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
     1331        m_cy = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
    14681332
    14691333        // get center for cursor
    1470         m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
    1471         m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
     1334        m_xCenter = m_cx / 2;
     1335        m_yCenter = m_cy / 2;
    14721336
    14731337        // check for multiple monitors
    1474         m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
    1475                                   m_h != GetSystemMetrics(SM_CYSCREEN));
    1476 
    1477         // tell the desks
    1478         m_desks->setShape(m_x, m_y, m_w, m_h, m_xCenter, m_yCenter, m_multimon);
    1479 }
    1480 
    1481 void
    1482 CMSWindowsScreen::handleFixes(const CEvent&, void*)
    1483 {
    1484         // fix clipboard chain
    1485         fixClipboardViewer();
    1486 
     1338        m_multimon = false;
     1339}
     1340
     1341void
     1342CPMScreen::handleFixes(const CEvent&, void*)
     1343{
    14871344        // update keys if keyboard layouts have changed
    14881345        if (m_keyState->didGroupsChange()) {
     
    14911348}
    14921349
    1493 void
    1494 CMSWindowsScreen::fixClipboardViewer()
    1495 {
    1496         // XXX -- disable this code for now.  somehow it can cause an infinite
    1497         // recursion in the WM_DRAWCLIPBOARD handler.  either we're sending
    1498         // the message to our own window or some window farther down the chain
    1499         // forwards the message to our window or a window farther up the chain.
    1500         // i'm not sure how that could happen.  the m_nextClipboardWindow = NULL
    1501         // was not in the code that infinite loops and may fix the bug but i
    1502         // doubt it.
    1503         return;
    1504         ChangeClipboardChain(m_window, m_nextClipboardWindow);
    1505         m_nextClipboardWindow = NULL;
    1506         m_nextClipboardWindow = SetClipboardViewer(m_window);
    1507 }
    1508 
    1509 void
    1510 CMSWindowsScreen::enableSpecialKeys(bool enable) const
    1511 {
    1512         // enable/disable ctrl+alt+del, alt+tab, etc on win95 family.
    1513         // since the win95 family doesn't support low-level hooks, we
    1514         // use this undocumented feature to suppress normal handling
    1515         // of certain key combinations.
    1516         if (m_is95Family) {
    1517                 DWORD dummy = 0;
    1518                 SystemParametersInfo(SPI_SETSCREENSAVERRUNNING,
    1519                                                         enable ? FALSE : TRUE, &dummy, 0);
    1520         }
    1521 }
    1522 
    15231350ButtonID
    1524 CMSWindowsScreen::mapButtonFromEvent(WPARAM msg, LPARAM button) const
    1525 {
     1351CPMScreen::mapButtonFromEvent(ULONG msg, MPARAM button) const
     1352{
     1353    /** @todo query which is left and which is right. */
     1354
    15261355        switch (msg) {
    1527         case WM_LBUTTONDOWN:
    1528         case WM_LBUTTONDBLCLK:
    1529         case WM_LBUTTONUP:
    1530         case WM_NCLBUTTONDOWN:
    1531         case WM_NCLBUTTONDBLCLK:
    1532         case WM_NCLBUTTONUP:
    1533                 return kButtonLeft;
    1534 
    1535         case WM_MBUTTONDOWN:
    1536         case WM_MBUTTONDBLCLK:
    1537         case WM_MBUTTONUP:
    1538         case WM_NCMBUTTONDOWN:
    1539         case WM_NCMBUTTONDBLCLK:
    1540         case WM_NCMBUTTONUP:
    1541                 return kButtonMiddle;
    1542 
    1543         case WM_RBUTTONDOWN:
    1544         case WM_RBUTTONDBLCLK:
    1545         case WM_RBUTTONUP:
    1546         case WM_NCRBUTTONDOWN:
    1547         case WM_NCRBUTTONDBLCLK:
    1548         case WM_NCRBUTTONUP:
    1549                 return kButtonRight;
    1550 
    1551         case WM_XBUTTONDOWN:
    1552         case WM_XBUTTONDBLCLK:
    1553         case WM_XBUTTONUP:
    1554         case WM_NCXBUTTONDOWN:
    1555         case WM_NCXBUTTONDBLCLK:
    1556         case WM_NCXBUTTONUP:
    1557                 switch (button) {
    1558                 case XBUTTON1:
    1559                         if (GetSystemMetrics(SM_CMOUSEBUTTONS) >= 4) {
    1560                                 return kButtonExtra0 + 0;
    1561                         }
    1562                         break;
    1563 
    1564                 case XBUTTON2:
    1565                         if (GetSystemMetrics(SM_CMOUSEBUTTONS) >= 5) {
    1566                                 return kButtonExtra0 + 1;
    1567                         }
    1568                         break;
    1569                 }
    1570                 return kButtonNone;
    1571 
    1572         default:
    1573                 return kButtonNone;
    1574         }
    1575 }
    1576 
    1577 bool
    1578 CMSWindowsScreen::mapPressFromEvent(WPARAM msg, LPARAM) const
     1356        case WM_BUTTON1DOWN:
     1357        case WM_BUTTON1UP:
     1358        case WM_BUTTON1DBLCLK:
     1359        case WM_BUTTON1CLICK: //??
     1360                    return kButtonLeft;
     1361
     1362        case WM_BUTTON2DOWN:
     1363        case WM_BUTTON2UP:
     1364        case WM_BUTTON2DBLCLK:
     1365        case WM_BUTTON2CLICK: //??
     1366            return kButtonLeft;
     1367
     1368        case WM_BUTTON3DOWN:
     1369        case WM_BUTTON3UP:
     1370        case WM_BUTTON3DBLCLK:
     1371        case WM_BUTTON3CLICK: //??
     1372            return kButtonMiddle;
     1373        default:
     1374                return kButtonNone;
     1375        }
     1376}
     1377
     1378bool
     1379CPMScreen::mapPressFromEvent(ULONG msg, LPARAM) const
    15791380{
    15801381        switch (msg) {
    1581         case WM_LBUTTONDOWN:
    1582         case WM_MBUTTONDOWN:
    1583         case WM_RBUTTONDOWN:
    1584         case WM_XBUTTONDOWN:
    1585         case WM_LBUTTONDBLCLK:
    1586         case WM_MBUTTONDBLCLK:
    1587         case WM_RBUTTONDBLCLK:
    1588         case WM_XBUTTONDBLCLK:
    1589         case WM_NCLBUTTONDOWN:
    1590         case WM_NCMBUTTONDOWN:
    1591         case WM_NCRBUTTONDOWN:
    1592         case WM_NCXBUTTONDOWN:
    1593         case WM_NCLBUTTONDBLCLK:
    1594         case WM_NCMBUTTONDBLCLK:
    1595         case WM_NCRBUTTONDBLCLK:
    1596         case WM_NCXBUTTONDBLCLK:
    1597                 return true;
    1598 
    1599         case WM_LBUTTONUP:
    1600         case WM_MBUTTONUP:
    1601         case WM_RBUTTONUP:
    1602         case WM_XBUTTONUP:
    1603         case WM_NCLBUTTONUP:
    1604         case WM_NCMBUTTONUP:
    1605         case WM_NCRBUTTONUP:
    1606         case WM_NCXBUTTONUP:
    1607                 return false;
    1608 
    1609         default:
    1610                 return false;
    1611         }
    1612 }
    1613 
    1614 void
    1615 CMSWindowsScreen::updateKeysCB(void*)
     1382        case WM_BUTTON1DOWN:
     1383        case WM_BUTTON1CLICK: //??
     1384        case WM_BUTTON1DBLCLK:
     1385        case WM_BUTTON2DOWN:
     1386        case WM_BUTTON2DBLCLK:
     1387        case WM_BUTTON2CLICK: //??
     1388        case WM_BUTTON3DOWN:
     1389        case WM_BUTTON3DBLCLK:
     1390        case WM_BUTTON3CLICK: //??
     1391            return true;
     1392        case WM_BUTTON1UP:
     1393        case WM_BUTTON2UP:
     1394        case WM_BUTTON3UP:
     1395            return false;
     1396        default:
     1397            return false;
     1398        }
     1399}
     1400
     1401void
     1402CPMScreen::updateKeysCB(void*)
    16161403{
    16171404        // record which keys we think are down
     
    16461433
    16471434void
    1648 CMSWindowsScreen::forceShowCursor()
    1649 {
    1650         // check for mouse
    1651         m_hasMouse = (GetSystemMetrics(SM_MOUSEPRESENT) != 0);
     1435CPMScreen::forceShowCursor()
     1436{
     1437        // check for mouse - probably not required.
     1438        m_hasMouse = WinQuerySysValue(HWND_DESKTOP, SV_MOUSEPRESENT) != FALSE;
    16521439
    16531440        // decide if we should show the mouse
     
    16561443        // show/hide the mouse
    16571444        if (showMouse != m_showingMouse) {
    1658                 if (showMouse) {
    1659                         m_oldMouseKeys.cbSize = sizeof(m_oldMouseKeys);
    1660                         m_gotOldMouseKeys =
    1661                                 (SystemParametersInfo(SPI_GETMOUSEKEYS,
    1662                                                         m_oldMouseKeys.cbSize,  &m_oldMouseKeys, 0) != 0);
    1663                         if (m_gotOldMouseKeys) {
    1664                                 m_mouseKeys    = m_oldMouseKeys;
    1665                                 m_showingMouse = true;
    1666                                 updateForceShowCursor();
    1667                         }
    1668                 }
    1669                 else {
    1670                         if (m_gotOldMouseKeys) {
    1671                                 SystemParametersInfo(SPI_SETMOUSEKEYS,
    1672                                                         m_oldMouseKeys.cbSize,
    1673                                                         &m_oldMouseKeys, SPIF_SENDCHANGE);
    1674                                 m_showingMouse = false;
    1675                         }
    1676                 }
    1677         }
    1678 }
    1679 
    1680 void
    1681 CMSWindowsScreen::updateForceShowCursor()
    1682 {
    1683         DWORD oldFlags = m_mouseKeys.dwFlags;
    1684 
    1685         // turn on MouseKeys
    1686         m_mouseKeys.dwFlags = MKF_AVAILABLE | MKF_MOUSEKEYSON;
    1687 
    1688         // make sure MouseKeys is active in whatever state the NumLock is
    1689         // not currently in.
    1690         if ((m_keyState->getActiveModifiers() & KeyModifierNumLock) != 0) {
    1691                 m_mouseKeys.dwFlags |= MKF_REPLACENUMBERS;
    1692         }
    1693 
    1694         // update MouseKeys
    1695         if (oldFlags != m_mouseKeys.dwFlags) {
    1696                 SystemParametersInfo(SPI_SETMOUSEKEYS,
    1697                                                         m_mouseKeys.cbSize, &m_mouseKeys, SPIF_SENDCHANGE);
    1698         }
    1699 }
    1700 
    1701 LRESULT CALLBACK
    1702 CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     1445        WinShowPointer(HWND_DESKTOP, showMouse);
     1446        m_showingMouse = WinQuerySysValue(HWND_DESKTOP, SV_POINTERLEVEL) != 0;
     1447        }
     1448}
     1449
     1450void
     1451CPMScreen::updateForceShowCursor()
     1452{
     1453    //???
     1454}
     1455
     1456HRESULT EXPENTRY
     1457CPMScreen::wndProc(HWND hwnd, UINT msg, MPARAM mp1, MPARAM mp2)
    17031458{
    17041459        assert(s_screen != NULL);
    17051460
    1706         LRESULT result = 0;
    1707         if (!s_screen->onEvent(hwnd, msg, wParam, lParam, &result)) {
    1708                 result = DefWindowProc(hwnd, msg, wParam, lParam);
    1709         }
    1710 
    1711         return result;
     1461        HRESULT mr = 0;
     1462        if (!s_screen->onEvent(hwnd, msg, mp1, mp2, &result)) {
     1463                mr = WinDefWindowProc(hwnd, msg, mp1, mp2);
     1464        }
     1465
     1466        return mr;
    17121467}
    17131468
    17141469
    17151470//
    1716 // CMSWindowsScreen::CHotKeyItem
     1471// CPMScreen::CHotKeyItem
    17171472//
    17181473
    1719 CMSWindowsScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) :
     1474CPMScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) :
    17201475        m_keycode(keycode),
    17211476        m_mask(mask)
     
    17251480
    17261481UINT
    1727 CMSWindowsScreen::CHotKeyItem::getVirtualKey() const
     1482CPMScreen::CHotKeyItem::getVirtualKey() const
    17281483{
    17291484        return m_keycode;
     
    17311486
    17321487bool
    1733 CMSWindowsScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const
     1488CPMScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const
    17341489{
    17351490        return (m_keycode < x.m_keycode ||
Note: See TracChangeset for help on using the changeset viewer.