#include <rfb_win32/SDisplayCoreWMHooks.h>
#include <rfb/Exception.h>
#include <rfb/LogWriter.h>
+#include <rfb/ledStates.h>
using namespace rdr;
: server(0), pb(0), device(0),
core(0), ptr(0), kbd(0), clipboard(0),
inputs(0), monitor(0), cleanDesktop(0), cursor(0),
- statusLocation(0)
+ statusLocation(0), ledState(0)
{
updateEvent.h = CreateEvent(0, TRUE, FALSE, 0);
}
cleanDesktop->disableEffects();
isWallpaperRemoved = removeWallpaper;
areEffectsDisabled = disableEffects;
+
+ checkLedState();
+ if (server)
+ server->setLEDState(ledState);
}
void SDisplay::stopCore() {
kbd->keyEvent(key, down);
}
+bool SDisplay::checkLedState() {
+ unsigned state = 0;
+
+ if (GetKeyState(VK_SCROLL) & 0x0001)
+ state |= ledScrollLock;
+ if (GetKeyState(VK_NUMLOCK) & 0x0001)
+ state |= ledNumLock;
+ if (GetKeyState(VK_CAPITAL) & 0x0001)
+ state |= ledCapsLock;
+
+ if (ledState != state) {
+ ledState = state;
+ return true;
+ }
+
+ return false;
+}
+
void SDisplay::clientCutText(const char* text, int len) {
CharArray clip_sz(len+1);
memcpy(clip_sz.buf, text, len);
// Flush any changes to the server
flushChangeTracker();
+
+ // Forward current LED state to the server
+ if (checkLedState())
+ server->setLEDState(ledState);
}
return;
}