diff options
author | kraxel <kraxel> | 2006-10-26 14:57:40 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2006-10-26 14:57:40 +0000 |
commit | 16928d0f1b55cd0adb39450f1fbd122e6aac3f5e (patch) | |
tree | 34ae5733f8a79c8cbd447a11aa49846fa1f03f2f | |
parent | a528dd2172edb6fc4a152c2cd5f2b1f1b64a5531 (diff) | |
download | xenwatch-16928d0f1b55cd0adb39450f1fbd122e6aac3f5e.tar.gz |
cvs passwd fixup
-rw-r--r-- | vnc-client.c | 19 | ||||
-rw-r--r-- | vnc.c | 31 | ||||
-rw-r--r-- | vnc.h | 2 | ||||
-rw-r--r-- | xd_view.c | 5 |
4 files changed, 36 insertions, 21 deletions
diff --git a/vnc-client.c b/vnc-client.c index 9dc221c..da2ca20 100644 --- a/vnc-client.c +++ b/vnc-client.c @@ -23,8 +23,8 @@ static void usage(FILE *fp) "usage: vnc-client [options] hostname displayno\n" "options:\n" " -h Print this text.\n" - " -k Send locally translated keysyms. Default is to send\n" - " us-layout keysyms no matter what the local kbd layout is.\n" + " -u Send us kbd layout keysyms.\n" + " -d Enable debug output.\n" "\n" "-- \n" "(c) 2006 Gerd Hoffmann <kraxel@suse.de>\n"); @@ -33,16 +33,20 @@ static void usage(FILE *fp) int main(int argc, char *argv[]) { - int keysyms = 0; + int debug = 0; + int uskbd = 0; int c; gtk_init(&argc, &argv); for (;;) { - if (-1 == (c = getopt(argc, argv, "hk"))) + if (-1 == (c = getopt(argc, argv, "hdu"))) break; switch (c) { - case 'k': - keysyms = 1; + case 'd': + debug = 1; + break; + case 'u': + uskbd = 1; break; case 'h': usage(stdout); @@ -58,7 +62,8 @@ main(int argc, char *argv[]) exit(1); } - if (NULL == vnc_open(argv[optind], atoi(argv[optind+1]), 1, keysyms)) + if (NULL == vnc_open(argv[optind], atoi(argv[optind+1]), + 1 /* standalone */, uskbd, debug)) exit(1); gtk_main(); @@ -18,6 +18,8 @@ #include <rfb/rfbclient.h> +static int debug_libvnc; + /* ------------------------------------------------------------------ */ struct vnc_window { @@ -189,7 +191,8 @@ static char *vnc_passwd(rfbClient* cl) { struct vnc_window *vnc = rfbClientGetClientData(cl, vnc_open); GtkWidget *dialog, *label, *entry; - const char *passwd = ""; + char *passwd = NULL; + const char *txt; char message[256]; if (vnc->debug) @@ -221,25 +224,27 @@ static char *vnc_passwd(rfbClient* cl) gtk_widget_show_all(dialog); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: - passwd = gtk_entry_get_text(GTK_ENTRY(entry)); + txt = gtk_entry_get_text(GTK_ENTRY(entry)); + passwd = strdup(txt); if (vnc->debug) - fprintf(stderr,"%s: OK\n", __FUNCTION__); + fprintf(stderr,"%s: OK: \"%s\"\n", __FUNCTION__, passwd); break; default: if (vnc->debug) fprintf(stderr,"%s: canceled\n", __FUNCTION__); + passwd = strdup(""); break; } gtk_widget_destroy(dialog); - return strdup(passwd); + return passwd; } static void vnc_log(const char *format, ...) { va_list args; - if (1) + if (!debug_libvnc) return; va_start(args, format); vfprintf(stderr, format, args); @@ -361,7 +366,7 @@ static gboolean key_cb_uskbd(GtkWidget *widget, GdkEventKey *event, /* public API functions */ GtkWidget *vnc_open(char *hostname, int displayno, - int standalone, int keysyms) + int standalone, int uskbd, int debug) { char display[128]; char *argv[] = { "vnc-client", display, NULL }; @@ -374,6 +379,8 @@ GtkWidget *vnc_open(char *hostname, int displayno, goto err; memset(vnc,0,sizeof(*vnc)); vnc->standalone = standalone; + vnc->debug = debug; + debug_libvnc = debug; /* x11 */ vnc->dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default()); @@ -433,16 +440,16 @@ GtkWidget *vnc_open(char *hostname, int displayno, G_CALLBACK(button_cb), vnc); g_signal_connect(G_OBJECT(vnc->draw), "motion-notify-event", G_CALLBACK(motion_cb), vnc); - if (keysyms) { + if (uskbd) { g_signal_connect(G_OBJECT(vnc->draw), "key-press-event", - G_CALLBACK(key_cb_local), vnc); + G_CALLBACK(key_cb_uskbd), vnc); g_signal_connect(G_OBJECT(vnc->draw), "key-release-event", - G_CALLBACK(key_cb_local), vnc); + G_CALLBACK(key_cb_uskbd), vnc); } else { g_signal_connect(G_OBJECT(vnc->draw), "key-press-event", - G_CALLBACK(key_cb_uskbd), vnc); + G_CALLBACK(key_cb_local), vnc); g_signal_connect(G_OBJECT(vnc->draw), "key-release-event", - G_CALLBACK(key_cb_uskbd), vnc); + G_CALLBACK(key_cb_local), vnc); } /* show window */ @@ -458,7 +465,7 @@ GtkWidget *vnc_open(char *hostname, int displayno, #else /* HAVE_VNCCLIENT */ GtkWidget *vnc_open(char *hostname, int displayno, - int standalone, int keysyms) + int standalone, int uskbd, int debug) { fprintf(stderr, "compiled without VNC support, sorry\n"); return NULL; @@ -1,2 +1,2 @@ GtkWidget *vnc_open(char *hostname, int displayno, - int standalone, int keysyms); + int standalone, int uskbd, int debug); @@ -136,7 +136,10 @@ static void open_vnc(gint id, char *hostname, gint displayno) { #ifdef HAVE_VNCCLIENT if (1) { - vnc_open(hostname, displayno, 0, 0); + vnc_open(hostname, displayno, + 0, /* standalone */ + 1, /* uskbd */ + 0); /* debug */ return; } #endif |