Browse Source

Add support for lock LED state to Xvnc/libvnc.so

tags/v1.8.90
Pierre Ossman 7 years ago
parent
commit
ac94b50e63

+ 6
- 1
unix/xserver/hw/vnc/Input.c View File

@@ -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;

+ 5
- 0
unix/xserver/hw/vnc/XserverDesktop.cc View File

@@ -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 {

+ 1
- 0
unix/xserver/hw/vnc/XserverDesktop.h View File

@@ -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,

+ 20
- 0
unix/xserver/hw/vnc/vncExtInit.cc View File

@@ -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)
{

+ 2
- 0
unix/xserver/hw/vnc/vncExtInit.h View File

@@ -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 {

Loading…
Cancel
Save