diff options
author | runge <runge> | 2006-11-13 15:33:00 +0000 |
---|---|---|
committer | runge <runge> | 2006-11-13 15:33:00 +0000 |
commit | 4a83f87609b9d53b2983806be58ccd02498a5cd3 (patch) | |
tree | a79c96930a97fb162edd1765adece43425f8db8a /x11vnc/screen.c | |
parent | 5f9693d4a2c511f8f2ea069373807c5f36ac1459 (diff) | |
download | libtdevnc-4a83f876.tar.gz libtdevnc-4a83f876.zip |
x11vnc: Native Mac OS X support.
Diffstat (limited to 'x11vnc/screen.c')
-rw-r--r-- | x11vnc/screen.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/x11vnc/screen.c b/x11vnc/screen.c index f87ae09..fd18a5c 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -21,6 +21,7 @@ #include "sslhelper.h" #include "v4l.h" #include "linuxfb.h" +#include "macosx.h" void set_greyscale_colormap(void); void set_hi240_colormap(void); @@ -618,7 +619,9 @@ void set_raw_fb_params(int restore) { "use_solid_bg\n"); use_solid_bg = 0; } +#ifndef MACOSX multiple_cursors_mode = strdup("arrow"); +#endif } if (using_shm) { if (verbose) rfbLog(" rawfb: turning off using_shm\n"); @@ -650,8 +653,14 @@ static void nofb_hook(rfbClientPtr cl) { rfbLog("framebuffer requested in -nofb mode by client %s\n", cl->host); /* ignore xrandr */ - RAWFB_RET_VOID - fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + + if (raw_fb && ! dpy) { + XImage raw; + fb = &raw; + fb->data = (char *)malloc(32); + } else { + fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + } main_fb = fb->data; rfb_fb = main_fb; screen->frameBuffer = rfb_fb; @@ -809,6 +818,7 @@ XImage *initialize_raw_fb(int reset) { static XImage ximage_struct; /* n.b.: not (XImage *) */ static XImage ximage_struct_snap; int closedpy = 1, i, m, db = 0; + int do_macosx = 0; static char *last_file = NULL; static int last_mode = 0; @@ -855,6 +865,12 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); } return NULL; } + +#ifdef MACOSX + if (raw_fb_addr != NULL && raw_fb_addr == macosx_get_fb_addr()) { + raw_fb_addr = NULL; + } +#endif if (raw_fb_addr || raw_fb_seek) { if (raw_fb_shm) { @@ -1129,6 +1145,13 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); q = strchr(str, ':'); q++; + if (strstr(q, "macosx:") == q) { + /* mmap:macosx:/dev/null@... */ + q += strlen("macosx:"); + do_macosx = 1; + do_mmap = 0; + } + last_file = strdup(q); fd = raw_fb_fd; @@ -1159,7 +1182,15 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); } } - if (do_mmap) { + if (do_macosx) { + raw_fb_addr = macosx_get_fb_addr(); + raw_fb_mmap = size; + rfbLog("rawfb: macosx fb: %s\n", q); + rfbLog(" w: %d h: %d b: %d addr: %p sz: %d\n", w, h, + b, raw_fb_addr, size); + last_mode = 0; + + } else if (do_mmap) { #if LIBVNCSERVER_HAVE_MMAP raw_fb_addr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0); @@ -1211,6 +1242,12 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); raw_fb_image->bytes_per_line = dpy_x*b/8; raw_fb_image->bitmap_unit = -1; +#ifdef MACOSX + if (do_macosx) { + raw_fb_image->bytes_per_line = macosxCG_CGDisplayBytesPerRow(); + } +#endif + if (use_snapfb && (raw_fb_seek || raw_fb_mmap)) { int b_use = b; if (snap_fb) { @@ -1556,7 +1593,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ vinfo->bits_per_rgb); fprintf(stderr, "\n"); } - XFree(vinfo); + XFree_wr(vinfo); } if (! quiet) { |