[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
numlock sync patch (including capslock)
hello,
sorry forgot to sync caps too ...
here the new patch, again based on unified 18-9
problems remaining - as ben correctly stated:
> ... will do the exact opposite of what you want if you
> happen to be reconnecting to a disconnected session in which you had
> numlock turned on! And it doesn't help when programs toggle the status
regards,
norbert
diff -u rdesktop-patched-old/Makefile rdesktop-patched/Makefile
--- rdesktop-patched-old/Makefile Tue Jan 9 16:50:25 2001
+++ rdesktop-patched/Makefile Wed Jan 10 11:39:42 2001
@@ -12,7 +12,7 @@
CC = gcc
CFLAGS = -O2 -Wall $(DEBUG) -I/usr/X11R6/include
-LIBS = -L/usr/X11R6/lib -lX11
+LIBS = -L/usr/X11R6/lib -lX11 -lXext
RDPOBJ = rdesktop.o tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o xwin.o
CRYPTOBJ = crypto/rc4_enc.o crypto/rc4_skey.o crypto/md5_dgst.o crypto/sha1dgst.o crypto/arith.o
Only in rdesktop-patched: bitmap.o
Only in rdesktop-patched: cache.o
Common subdirectories: rdesktop-patched-old/crypto and rdesktop-patched/crypto
Only in rdesktop-patched: iso.o
Only in rdesktop-patched: licence.o
Only in rdesktop-patched: mcs.o
Only in rdesktop-patched: orders.o
Only in rdesktop-patched: rdesktop
Common subdirectories: rdesktop-patched-old/rdesktop-patched and rdesktop-patched/rdesktop-patched
Only in rdesktop-patched: rdesktop.o
Only in rdesktop-patched: rdp.o
Only in rdesktop-patched: secure.o
Only in rdesktop-patched: tcp.o
diff -u rdesktop-patched-old/xwin.c rdesktop-patched/xwin.c
--- rdesktop-patched-old/xwin.c Tue Jan 9 16:50:25 2001
+++ rdesktop-patched/xwin.c Wed Jan 10 14:18:32 2001
@@ -20,6 +20,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/XKBlib.h>
#include <sys/time.h>
#include "rdesktop.h"
#include <stdlib.h>
@@ -40,6 +41,7 @@
static XIM IM;
static uint32 *colmap;
static Pixmap back_pixmap;
+static BOOL lockkeys_synced=False;
#ifdef XDEBUG
#define WASHERE() {fprintf(stderr,"file %s line %d\n",__FILE__,__LINE__);}
@@ -269,6 +271,22 @@
}
void
+sync_lockkeys ()
+{
+ unsigned int stats;
+
+ if (XkbGetIndicatorState( display, XkbUseCoreKbd, &stats)!=Success) return;
+ if (stats & 0x01) { /* caps lock (bit 0) */
+ rdp_send_input (time(NULL), RDP_INPUT_SCANCODE, KBD_FLAG_DOWN | KBD_FLAG_UP, 0x3A, 0);
+ rdp_send_input (time(NULL), RDP_INPUT_SCANCODE, 0, 0x3A, 0);
+ }
+ if (stats & 0x02) { /* num lock (bit 1) */
+ rdp_send_input (time(NULL), RDP_INPUT_SCANCODE, KBD_FLAG_DOWN | KBD_FLAG_UP, 0x45, 0);
+ rdp_send_input (time(NULL), RDP_INPUT_SCANCODE, 0, 0x45, 0);
+ }
+}
+
+void
ui_process_events ()
{
XEvent event;
@@ -278,6 +296,11 @@
if (display == NULL)
return;
+
+ if(!lockkeys_synced) {
+ sync_lockkeys();
+ lockkeys_synced=True;
+ }
while (XCheckWindowEvent (display, wnd, ~0, &event))
{
Only in rdesktop-patched: xwin.o