summaryrefslogtreecommitdiffstats
path: root/VisualNaCro
diff options
context:
space:
mode:
authordscho <dscho>2006-10-12 22:59:39 +0000
committerdscho <dscho>2006-10-12 22:59:39 +0000
commit5738e33f859563a566b059e15a517120c4c215b8 (patch)
treef412e9ebe5e438a04c546a47e885f8d45aa3910b /VisualNaCro
parenta5baf57ba627ca8e85b1156a0ea09ca376d0b8e4 (diff)
downloadlibvncserver-5738e33f859563a566b059e15a517120c4c215b8.zip
libvncserver-5738e33f859563a566b059e15a517120c4c215b8.tar.gz
VisualNaCro: add sendascii
Diffstat (limited to 'VisualNaCro')
-rw-r--r--VisualNaCro/nacro.c41
-rw-r--r--VisualNaCro/nacro.h1
2 files changed, 42 insertions, 0 deletions
diff --git a/VisualNaCro/nacro.c b/VisualNaCro/nacro.c
index 7cdc5b4..2fc9e36 100644
--- a/VisualNaCro/nacro.c
+++ b/VisualNaCro/nacro.c
@@ -717,6 +717,47 @@ bool_t sendkey(resource_t res,keysym_t keysym,bool_t keydown)
return SendKeyEvent(r->client,keysym,keydown);
}
+bool_t sendascii(resource_t res,const char *string)
+{
+ timeout_t delay = 0.1;
+ private_resource_t* r=get_resource(res);
+ int i;
+ if(r==NULL)
+ return 0;
+ while (*string) {
+ int keysym = *string;
+ int need_shift = 0;
+
+ if (keysym >= 8 && keysym < ' ')
+ keysym += 0xff00;
+ else if (keysym >= 'A' && keysym <= 'Z')
+ need_shift = 1;
+ else if (keysym > '~') {
+ fprintf(stderr, "String contains non-ASCII "
+ "character 0x%02x\n", *string);
+ return FALSE;
+ }
+
+ if (need_shift) {
+ if (!SendKeyEvent(r->client,0xffe1,1))
+ return FALSE;
+ waitforinput(r,delay);
+ }
+ for (i = 1; i >= 0; i--) {
+ if (!SendKeyEvent(r->client,keysym,i))
+ return FALSE;
+ waitforinput(r,delay);
+ }
+ if (need_shift) {
+ if (!SendKeyEvent(r->client,0xffe1,0))
+ return FALSE;
+ waitforinput(r,delay);
+ }
+ string++;
+ }
+ return TRUE;
+}
+
bool_t sendmouse(resource_t res,coordinate_t x,coordinate_t y,buttons_t buttons)
{
private_resource_t* r=get_resource(res);
diff --git a/VisualNaCro/nacro.h b/VisualNaCro/nacro.h
index 8bb2f60..abd0067 100644
--- a/VisualNaCro/nacro.h
+++ b/VisualNaCro/nacro.h
@@ -94,6 +94,7 @@ const char *gettext_server(resource_t res);
/* send events to the server */
bool_t sendkey(resource_t res,keysym_t keysym,bool_t keydown);
+bool_t sendascii(resource_t res,const char *string);
bool_t sendmouse(resource_t res,coordinate_t x,coordinate_t y,buttons_t buttons);
bool_t sendtext(resource_t res, const char *string);
bool_t sendtext_to_server(resource_t res, const char *string);
OpenPOWER on IntegriCloud