aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Quessy <alexandrequessy@users.sourceforge.net>2007-03-23 05:17:04 +0000
committerAlexandre Quessy <alexandrequessy@users.sourceforge.net>2007-03-23 05:17:04 +0000
commit9412a059b39ee839d08da01e2ad99a94d400997e (patch)
tree2116d1bf6b40d58e21a47aa63fcccb987f2b3643
parentd62cbe2146c78d071b11b44f11f78228595239f8 (diff)
help file improvements
svn path=/trunk/externals/aalex/; revision=7513
-rw-r--r--x11key-help.pd120
-rw-r--r--x11key.c33
2 files changed, 103 insertions, 50 deletions
diff --git a/x11key-help.pd b/x11key-help.pd
index 616c91b..5fb957a 100644
--- a/x11key-help.pd
+++ b/x11key-help.pd
@@ -1,43 +1,83 @@
-#N canvas 466 121 703 480 10;
-#X obj 89 21 cnv 15 150 140 empty empty empty 20 12 0 14 -258699 -66577
+#N canvas 90 105 743 591 10;
+#X obj 73 -42 cnv 15 150 140 empty empty empty 20 12 0 14 -258699 -66577
0;
-#X obj 334 26 cnv 15 200 140 empty empty empty 20 12 0 14 -258699 -66577
-0;
-#X obj 230 191 cnv 15 420 230 empty empty x11key_object 20 12 0 14 -258699
+#X obj 265 -43 cnv 15 200 140 empty empty empty 20 12 0 14 -258699
-66577 0;
-#X obj 166 365 x11key;
-#X msg 22 61 help;
-#X msg 104 106 letter a;
-#X msg 103 40 bang;
-#X msg 348 50 bang;
-#X msg 29 305 display :0.0;
-#X obj 347 114 delay 1000;
-#X obj 105 84 delay 1000;
-#X obj 446 116 delay 2000;
-#X msg 344 139 keysym A 1;
-#X msg 448 136 keysym A 0;
-#X obj 349 92 t b b;
-#X text 341 34 2 triggers on and of a key;
-#X text 109 25 1 types a key;
-#X text 25 273 Not yet implemented;
-#X text 243 231 [x11key] simulates X11 keyboard events.;
-#X text 240 262 Try examples 1 and 2 They generate keys as if you typed
-it on your keyboard. Give the focus to an other application than PD
-\, in order to see that you really fake letters typing.;
-#X text 240 322 Comments are welcome. The API (the messages for every
+#X obj 157 301 x11key;
+#X msg 83 221 help;
+#X msg 95 42 letter a;
+#X msg 94 -24 bang;
+#X msg 279 -19 bang;
+#X obj 278 45 delay 1000;
+#X obj 96 20 delay 1000;
+#X obj 377 47 delay 2000;
+#X msg 275 70 keysym A 1;
+#X msg 379 67 keysym A 0;
+#X obj 280 23 t b b;
+#X text 300 219 [x11key] simulates X11 keyboard events.;
+#X text 304 292 Comments are welcome. The API (the messages for every
is likely to change.;
-#X text 242 384 )c( Copyleft 2006 Alexandre Quessy;
-#X text 245 399 Released under the GNU Public License;
-#X text 245 368 pureX11;
-#X connect 4 0 3 0;
-#X connect 5 0 3 0;
-#X connect 6 0 10 0;
-#X connect 7 0 14 0;
-#X connect 8 0 3 0;
-#X connect 9 0 12 0;
-#X connect 10 0 5 0;
-#X connect 11 0 13 0;
-#X connect 12 0 3 0;
-#X connect 13 0 3 0;
-#X connect 14 0 9 0;
-#X connect 14 1 11 0;
+#X text 669 458 pureX11;
+#N canvas 0 0 410 183 todo 0;
+#X msg 35 78 display :0.0;
+#X text 31 46 Not yet implemented;
+#X restore 28 402 pd todo;
+#X obj 518 41 t b b b;
+#X obj 519 -32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1
+-1;
+#X text 546 -35 control-A;
+#X msg 498 92 keysym Control_L \$1;
+#X msg 563 67 1;
+#X msg 489 67 0;
+#X msg 499 115 keysym A 1 \, keysym A 0;
+#X text 272 -35 triggers on and off a key;
+#X text 301 242 The examples above generate keys as if you typed it
+on your keyboard. Give the focus to an other application than PD \,
+in order to see that you really fake letters typing.;
+#X text 83 -42 types a key;
+#X text 420 485 Released under the GNU Public License v2.0;
+#X text 224 428 <-- see a bigger list of the keynames you can generate
+;
+#N canvas 0 0 500 345 more_keynames_possibles 0;
+#X text 19 116 BackSpace \, Tab \, Linefeed \, Clear \, Return \, Pause
+\, Scroll_Lock \, Sys_Req \, Escape \, Delete \, Home \, Left \, Up
+\, Right \, Down \, Prior \, Page_Up \, Next \, Page_Down \, End \,
+Begin \, Shift_L \, Shift_R \, Control_L \, Control_R \, Caps_Lock
+\, Shift_Lock \, Meta_L \, Meta_R \, Alt_L \, Alt_R \, space \, exclam
+\, quotedbl \, numbersign \, dollar \, percent \, ampersand \, apostrophe
+\, quoteright \, parenleft \, parenright \, asterisk \, plus \, comma
+\, minus \, period \, slash \, 0 \, 1 \, 2 \, 3 \, 4 \, 5 \, 6 \, 7
+\, 8 \, 9 \, colon \, semicolon \, less \, equal \, greater \, question
+\, at \, A \, B \, C \, D \, E \, F \, G \, H \, I \, J \, K \, L \,
+M \, N \, O \, P \, Q \, R \, S \, T \, U \, V \, W \, X \, Y \, Z
+\, bracketleft;
+#X text 19 54 Here are some ideas you can send using [keysym Tab 1<
+and [keysym Tab 0< \, for instance.;
+#X text 86 279 ...and much more. See /usr/include/X11/keysymdef.h;
+#X restore 28 425 pd more_keynames_possibles;
+#X text 302 325 [letter X< generate a letter (simple version);
+#X text 304 346 [keysym X 1|0< triggers a keystroke on or off \, depending
+on the second argument value.;
+#X obj 498 146 s to_x11key;
+#X obj 191 275 r to_x11key;
+#X text 443 469 )c( Copyleft 2006-2007 Alexandre Quessy;
+#X connect 3 0 2 0;
+#X connect 4 0 2 0;
+#X connect 5 0 8 0;
+#X connect 6 0 12 0;
+#X connect 7 0 10 0;
+#X connect 8 0 4 0;
+#X connect 9 0 11 0;
+#X connect 10 0 2 0;
+#X connect 11 0 2 0;
+#X connect 12 0 7 0;
+#X connect 12 1 9 0;
+#X connect 17 0 22 0;
+#X connect 17 1 23 0;
+#X connect 17 2 21 0;
+#X connect 18 0 17 0;
+#X connect 20 0 32 0;
+#X connect 21 0 20 0;
+#X connect 22 0 20 0;
+#X connect 23 0 32 0;
+#X connect 33 0 2 0;
diff --git a/x11key.c b/x11key.c
index 2134019..eb2ac91 100644
--- a/x11key.c
+++ b/x11key.c
@@ -31,7 +31,7 @@ void x11key_letter(t_x11key *x, t_symbol *s, int argc, t_atom *argv) {
KeyCode keycode;
int result;
- if (argc == 1) {
+ if (argc >= 1) {
if (argv[0].a_type == A_SYMBOL) {
t_symbol *sym = atom_getsymbolarg(0, argc, argv);
char *theChars = sym->s_name;
@@ -47,15 +47,28 @@ void x11key_letter(t_x11key *x, t_symbol *s, int argc, t_atom *argv) {
//post("letter = %s", theChars);
//post("keycode = %d", (int) keycode);
/** Pushes on and off the letter */
- result = XTestFakeKeyEvent(display, keycode, True, 0);
- //post("result = %d", result);
- if (result == 0) {
- post("Error : could not simulate typing the letter.");
- }
- result = XTestFakeKeyEvent(display, keycode, False, 0);
- if (result == 0) {
- post("Error : could not simulate typing the letter.");
- }
+ /*
+ if (argc >= 2) {
+ if (argv[1].a_type == A_FLOAT) {
+ int isPressed = (atom_getfloatarg(0, argc, argv) == 0) ? true: false;
+ result = XTestFakeKeyEvent(display, keycode, isPressed, 0);
+ //post("result = %d", result);
+ if (result == 0) {
+ post("Error : could not simulate typing the letter.");
+ }
+ }
+ } else { */
+ // defaults to press and release
+ result = XTestFakeKeyEvent(display, keycode, True, 0);
+ //post("result = %d", result);
+ if (result == 0) {
+ post("Error : could not simulate typing the letter.");
+ }
+ result = XTestFakeKeyEvent(display, keycode, False, 0);
+ if (result == 0) {
+ post("Error : could not simulate typing the letter.");
+ }
+ /* } //endif argc >= 2 */
XCloseDisplay(display);
}
} else {