blob: 79ba5b1ea605ee22940bef3873a7a895dfc5dc2d (
plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
Index: g_editor.c
===================================================================
--- g_editor.c (revision 9725)
+++ g_editor.c (working copy)
@@ -1469,8 +1469,18 @@
else if (av[1].a_type == A_FLOAT)
{
char buf[3];
- sprintf(buf, "%c", (int)(av[1].a_w.w_float));
- gotkeysym = gensym(buf);
+ switch((int)(av[1].a_w.w_float))
+ {
+ case 8: gotkeysym = gensym("BackSpace"); break;
+ case 9: gotkeysym = gensym("Tab"); break;
+ case 10: gotkeysym = gensym("Return"); break;
+ case 27: gotkeysym = gensym("Escape"); break;
+ case 32: gotkeysym = gensym("Space"); break;
+ case 127:gotkeysym = gensym("Delete"); break;
+ default:
+ sprintf(buf, "%c", (int)(av[1].a_w.w_float));
+ gotkeysym = gensym(buf);
+ }
}
else gotkeysym = gensym("?");
fflag = (av[0].a_type == A_FLOAT ? av[0].a_w.w_float : 0);
Index: u_main.tk
===================================================================
--- u_main.tk (revision 9725)
+++ u_main.tk (working copy)
@@ -1254,9 +1254,9 @@
bind $name.c <Mod1-Key> {pdtk_canvas_ctrlkey %W %K 0}
bind $name.c <Mod1-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
}
- bind $name.c <Key> {pdtk_canvas_key %W %K %A 0}
- bind $name.c <Shift-Key> {pdtk_canvas_key %W %K %A 1}
- bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
+ bind $name.c <Key> {pdtk_canvas_sendkey %W 1 %K %A 0}
+ bind $name.c <Shift-Key> {pdtk_canvas_sendkey %W 1 %K %A 1}
+ bind $name.c <KeyRelease> {pdtk_canvas_sendkey %W 0 %K %A 0}
bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0}
bind $name.c <Control-Motion> {pdtk_canvas_motion %W %x %y 2}
if {$pd_nt == 2} {
@@ -1603,44 +1603,33 @@
pdtk_canvas_checkgeometry [canvastosym $name]
}
-proc pdtk_canvas_key {name key iso shift} {
-# puts stderr [concat down key= $key iso= $iso]
-# .controls.switches.meterbutton configure -text $key
-# HACK for MAC OSX -- backspace seems different; I don't understand why.
-# invesigate this LATER...
+proc pdtk_canvas_sendkey {name state key iso shift} {
global pd_nt
- if {$pd_nt == 2} {
- if {$key == "BackSpace"} {
- set key 8
- set keynum 8
- }
- if {$key == "Delete"} {
- set key 8
- set keynum 8
- }
+ if {$key == "BackSpace"} {
+ set iso ""
+ set key 8
+ } elseif {$key == "Tab"} {
+ set iso ""
+ set key 9
+ } elseif {$key == "Return"} {
+ set iso ""
+ set key 10
+ } elseif {$key == "Escape"} {
+ set iso ""
+ set key 27
+ } elseif {$key == "Space"} {
+ set iso ""
+ set key 32
+ } elseif {$key == "Delete" || $key == "KP_Delete"} {
+ set iso ""
+ set key 127
}
- if {$key == "KP_Delete"} {
- set key 127
- set keynum 127
- }
if {$iso != ""} {
- scan $iso %c keynum
- pd [canvastosym $name] key 1 $keynum $shift\;
- } else {
- pd [canvastosym $name] key 1 $key $shift\;
+ scan $iso %c key
}
+ pd [canvastosym $name] key $state $key $shift \;
}
-proc pdtk_canvas_keyup {name key iso} {
-# puts stderr [concat up key= $key iso= $iso]
- if {$iso != ""} {
- scan $iso %c keynum
- pd [canvastosym $name] key 0 $keynum 0 \;
- } else {
- pd [canvastosym $name] key 0 $key 0 \;
- }
-}
-
proc pdtk_canvas_ctrlkey {name key shift} {
# first get rid of ".c" suffix; we'll refer to the toplevel instead
set topname [string trimright $name .c]
|