diff options
author | kraxel <kraxel> | 2006-10-25 15:43:29 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2006-10-25 15:43:29 +0000 |
commit | 1278b2c2ffa8f353cb9ba7241d3f63464caa8e90 (patch) | |
tree | e35be07e19c78828fd12155aff3574bff1889b0a | |
parent | a44b0df427a3a6a1f1be834d0631a3e8dde8143b (diff) | |
download | xenwatch-1278b2c2ffa8f353cb9ba7241d3f63464caa8e90.tar.gz |
fix crash
-rw-r--r-- | vnc.c | 31 | ||||
-rw-r--r-- | x11.c | 2 |
2 files changed, 24 insertions, 9 deletions
@@ -16,6 +16,8 @@ #ifdef HAVE_VNC +static int debug = 0; + /* ------------------------------------------------------------------ */ /* data tables */ @@ -139,10 +141,9 @@ static void vnc_blit(char *reason, struct vnc_window *vnc, int x, int y, int w, Window win = gdk_x11_drawable_get_xid(vnc->draw->window); XGCValues values; -#if 0 - fprintf(stderr, "%s [%s]: %dx%d+%d+%d\n", - __FUNCTION__, reason, w, h, x, y); -#endif + if (debug) + fprintf(stderr, "%s [%s]: %dx%d+%d+%d\n", + __FUNCTION__, reason, w, h, x, y); if (x > vnc->ximage->width) return; if (y > vnc->ximage->height) @@ -176,8 +177,9 @@ static rfbBool vnc_resize(rfbClient* client) { struct vnc_window *vnc = rfbClientGetClientData(client, vnc_open); - fprintf(stderr, "%s: %dx%d\n", - __FUNCTION__, client->width, client->height); + if (debug) + fprintf(stderr, "%s: %dx%d\n", + __FUNCTION__, client->width, client->height); if (vnc->ximage) { x11_destroy_ximage(vnc->dpy, vnc->ximage, vnc->shm); @@ -242,6 +244,8 @@ static gboolean vnc_data_cb(GIOChannel *source, GIOCondition condition, { struct vnc_window *vnc = data; + if (debug) + fprintf(stderr,"%s: called\n", __FUNCTION__); if (!HandleRFBServerMessage(vnc->client)) { /* server closed connection */ g_source_destroy(g_main_context_find_source_by_id @@ -256,6 +260,8 @@ static void destroy_cb(GtkWidget *widget, gpointer data) { struct vnc_window *vnc = data; + if (debug) + fprintf(stderr,"%s: called\n", __FUNCTION__); if (vnc->standalone) gtk_main_quit(); vnc_release(vnc); @@ -277,6 +283,8 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, { struct vnc_window *vnc = data; + if (debug) + fprintf(stderr,"%s: called\n", __FUNCTION__); SendPointerEvent(vnc->client, event->x, event->y, event->state); return TRUE; } @@ -288,6 +296,9 @@ static gboolean key_cb(GtkWidget *widget, GdkEventKey *event, rfbKeySym keysym = 0; int keydown; + if (debug) + fprintf(stderr,"%s[%d]: called: sym %d, code %d\n", __FUNCTION__, + event->type, event->keyval, event->hardware_keycode); keydown = (8 == event->type); if (vnc->keysyms) keysym = event->keyval; @@ -324,12 +335,16 @@ struct vnc_window* vnc_open(char *hostname, int displayno, /* x11 */ vnc->dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default()); if (NULL == x11_info) - x11_color_init(vnc->dpy); + if (0 != x11_color_init(vnc->dpy)) + goto err; /* rfb client */ snprintf(display, sizeof(display), "%s:%d", hostname, displayno); fprintf(stderr, "%s: connecting to %s:%d\n", __FUNCTION__, hostname, displayno); - vnc->client = rfbGetClient(8,3,3); + if (8 == x11_red_bits) + vnc->client = rfbGetClient(8,3,4); + else + vnc->client = rfbGetClient(5,3,2); if (NULL == vnc->client) goto err; rfbClientSetClientData(vnc->client, vnc_open, vnc); @@ -52,7 +52,7 @@ x11_find_bits(unsigned long red_mask, x11_blue_shift++; } -#if 1 +#if 0 printf("color: bits shift\n"); printf("red : %04i %05i\n", x11_red_bits, x11_red_shift); printf("green: %04i %05i\n", x11_green_bits, x11_green_shift); |