@@ -273,6 +273,11 @@ static void vncKeyboardBell(int percent, DeviceIntPtr device, | |||
vncBell(); | |||
} | |||
static void vncKeyboardCtrl(DeviceIntPtr pDevice, KeybdCtrl *ctrl) | |||
{ | |||
vncSetLEDState(ctrl->leds); | |||
} | |||
static int vncKeyboardProc(DeviceIntPtr pDevice, int onoff) | |||
{ | |||
DevicePtr pDev = (DevicePtr)pDevice; | |||
@@ -280,7 +285,7 @@ static int vncKeyboardProc(DeviceIntPtr pDevice, int onoff) | |||
switch (onoff) { | |||
case DEVICE_INIT: | |||
InitKeyboardDeviceStruct(pDevice, NULL, vncKeyboardBell, | |||
(KbdCtrlProcPtr)NoopDDA); | |||
vncKeyboardCtrl); | |||
break; | |||
case DEVICE_ON: | |||
pDev->on = TRUE; |
@@ -322,6 +322,11 @@ void XserverDesktop::bell() | |||
server->bell(); | |||
} | |||
void XserverDesktop::setLEDState(unsigned int state) | |||
{ | |||
server->setLEDState(state); | |||
} | |||
void XserverDesktop::serverCutText(const char* str, int len) | |||
{ | |||
try { |
@@ -63,6 +63,7 @@ public: | |||
void setFramebuffer(int w, int h, void* fbptr, int stride); | |||
void refreshScreenLayout(); | |||
void bell(); | |||
void setLEDState(unsigned int state); | |||
void serverCutText(const char* str, int len); | |||
void setDesktopName(const char* name); | |||
void setCursor(int width, int height, int hotX, int hotY, |
@@ -32,6 +32,7 @@ | |||
#include <rfb/LogWriter.h> | |||
#include <rfb/Hostname.h> | |||
#include <rfb/Region.h> | |||
#include <rfb/ledStates.h> | |||
#include <network/TcpSocket.h> | |||
#include "XserverDesktop.h" | |||
@@ -358,6 +359,25 @@ void vncBell() | |||
} | |||
} | |||
void vncSetLEDState(unsigned long leds) | |||
{ | |||
unsigned int state; | |||
state = 0; | |||
if (leds & (1 << 0)) | |||
state |= ledCapsLock; | |||
if (leds & (1 << 1)) | |||
state |= ledNumLock; | |||
if (leds & (1 << 2)) | |||
state |= ledScrollLock; | |||
for (int scr = 0; scr < vncGetScreenCount(); scr++) { | |||
if (desktop[scr] == NULL) | |||
continue; | |||
desktop[scr]->setLEDState(state); | |||
} | |||
} | |||
void vncAddChanged(int scrIdx, const struct UpdateRect *extents, | |||
int nRects, const struct UpdateRect *rects) | |||
{ |
@@ -70,6 +70,8 @@ void vncApproveConnection(uint32_t opaqueId, int approve); | |||
void vncBell(void); | |||
void vncSetLEDState(unsigned long leds); | |||
// Must match rfb::ShortRect in common/rfb/Region.h, and BoxRec in the | |||
// Xorg source. | |||
struct UpdateRect { |