summaryrefslogtreecommitdiff
path: root/x11-toolkits/xview/files/patch-lib+libxview+win+win_input.c
blob: d95c305c823cce99be6b0c26f01ac18bff160632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- lib/libxview/win/win_input.c.orig	Thu Oct  5 19:18:09 2006
+++ lib/libxview/win/win_input.c	Thu Oct  5 20:10:42 2006
@@ -87,6 +87,8 @@
 static int      process_wm_pushpin_state();
 Pkg_private int win_handle_compose();
 
+static int xevent_to_event();
+
 struct _XKeytrans {
         struct _XKeytrans *next;/* next on list */
         char *string;           /* string to return when the time comes */
@@ -853,7 +855,9 @@
 #ifdef X11R6
 	/* lumpi@dobag.in-berlin.de */
 		int ksym_pcc;
-		XGetKeyboardMapping(display,NoSymbol,0,&ksym_pcc);
+		int tc_min_keycode, tc_max_keycode;
+		XDisplayKeycodes(display, &tc_min_keycode, &tc_max_keycode);
+		XGetKeyboardMapping(display,tc_min_keycode,tc_max_keycode-tc_min_keycode-1,&ksym_pcc);
 		for (index = 0; index < ksym_pcc; index++) {
 #else
 		for (index = 0; index < display->keysyms_per_keycode; index++) {
@@ -861,7 +865,7 @@
 		    if ((ksym = XLookupKeysym(ek, index)) != NoSymbol)
 			if (IsKeypadKey(ksym)) {
 			    /* See if key has been rebound. */
-			    if (!translate_key(display, ksym, ek->state,
+			    if (translate_key(display, ksym, ek->state,
 					       buffer, BUFFERSIZE)) {
 			        (void)win_translate_KP_keysym(ksym, buffer);
 			    }
@@ -2311,7 +2315,7 @@
     XButtonEvent   *bEvent;
     int             timeout;
 {
-    XEvent          xevent;
+    XEvent         *xevent;
 
     /* XView does a passive grab on the SELECT button! */
     window_x_allow_events(display);
@@ -2720,8 +2724,10 @@
  * Xlib's.
  */
 
-#ifdef X11R6
-/* lumpi@dobag.in-berlin.de */
+#ifdef X11R6 
+/* lumpi@dobag.in-berlin.de  
+   tom@sees.bangor.ac.uk this replacement for X11R6 doesn't work. At least 
+   it should now return sensible values though. */
 static int
 translate_key(dpy, symbol, modifiers, buffer, nbytes)
     Display 		*dpy;
@@ -2731,11 +2737,18 @@
     int 		 nbytes;
 {
 	/* This is _very_ rude ! */
-	strcpy(buffer,XKeysymToString(symbol));
+	char *string;
+	string = XKeysymToString(symbol);
+     	if (string) {
+		strncpy(buffer,XKeysymToString(symbol),nbytes);
+		return(strlen(buffer));
+	}
+	else
+		return 0;
 }
 
-#else
 
+#else
 static int
 translate_key(dpy, symbol, modifiers, buffer, nbytes)
     Display 		*dpy;