wok-undigest rev 511
Move to wok: sdcc fbvnc novnc
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Nov 03 16:34:05 2011 +0100 (2011-11-03) |
parents | ecdb180fd054 |
children | cdafb3f6afbb |
files | fbpanel/receipt fbvnc/receipt fbvnc/stuff/fbvnc.u novnc/receipt sdcc/receipt |
line diff
1.1 --- a/fbpanel/receipt Thu Nov 03 11:29:23 2011 +0100 1.2 +++ b/fbpanel/receipt Thu Nov 03 16:34:05 2011 +0100 1.3 @@ -10,7 +10,6 @@ 1.4 TARBALL="$PACKAGE-$VERSION.tbz2" 1.5 WEB_SITE="http://fbpanel.sourceforge.net/" 1.6 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 1.7 -#http://sunet.dl.sourceforge.net/project/fbpanel/fbpanel/6.1/fbpanel-6.1.tbz2 1.8 1.9 # Rules to configure and make the package. 1.10 compile_rules()
2.1 --- a/fbvnc/receipt Thu Nov 03 11:29:23 2011 +0100 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,32 +0,0 @@ 2.4 -# SliTaz package receipt. 2.5 - 2.6 -PACKAGE="fbvnc" 2.7 -VERSION="20110416" 2.8 -CATEGORY="network" 2.9 -SHORT_DESC="VNC client in frame buffer." 2.10 -MAINTAINER="pascal.bellard@slitaz.org" 2.11 -WEB_SITE="http://repo.or.cz/w/fbvnc.git" 2.12 -_TARBALL="$PACKAGE-$VERSION.tar.gz" 2.13 - 2.14 -# Rules to configure and make the package. 2.15 -compile_rules() 2.16 -{ 2.17 - [ -s $SOURCES_REPOSITORY/$_TARBALL ] || 2.18 - wget -O $SOURCES_REPOSITORY/$_TARBALL \ 2.19 - $WEB_SITE/snapshot/e42bc02b14b3331e7c7f45c6b42179d0af99ed7b.tar.gz 2.20 - mkdir -p $src 2.21 - cd $src 2.22 - tar xzf $SOURCES_REPOSITORY/$_TARBALL 2.23 - mkdir $DESTDIR 2.24 - cd fbvnc 2.25 - patch -p0 < $stuff/fbvnc.u && 2.26 - make && cp fbvnc $DESTDIR 2.27 -} 2.28 - 2.29 - 2.30 -# Rules to gen a SliTaz package suitable for Tazpkg. 2.31 -genpkg_rules() 2.32 -{ 2.33 - mkdir -p $fs/usr/bin 2.34 - cp $_pkg/fbvnc $fs/usr/bin 2.35 -}
3.1 --- a/fbvnc/stuff/fbvnc.u Thu Nov 03 11:29:23 2011 +0100 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,612 +0,0 @@ 3.4 ---- draw.h 3.5 -+++ draw.h 3.6 -@@ -15,5 +15,11 @@ 3.7 - void fb_cmap(void); 3.8 - 3.9 - /* helper functions */ 3.10 -+struct rgb_conv { 3.11 -+ int rshl, gshl; 3.12 -+ int rskp, gskp, bskp; 3.13 -+ int rmax, gmax, bmax; 3.14 -+}; 3.15 -+void fill_rgb_conv(int mode, struct rgb_conv *s); 3.16 - void fb_set(int r, int c, void *mem, int len); 3.17 - unsigned fb_val(int r, int g, int b); 3.18 ---- draw.c 3.19 -+++ draw.c 3.20 -@@ -10,14 +10,13 @@ 3.21 - 3.22 - #define MIN(a, b) ((a) < (b) ? (a) : (b)) 3.23 - #define MAX(a, b) ((a) > (b) ? (a) : (b)) 3.24 --#define NLEVELS (1 << 8) 3.25 -+#define NLEVELS (1 << 16) 3.26 - 3.27 - static int fd; 3.28 - static void *fb; 3.29 - static struct fb_var_screeninfo vinfo; 3.30 - static struct fb_fix_screeninfo finfo; 3.31 --static int bpp; 3.32 --static int nr, ng, nb; 3.33 -+static int bytes_per_pixel; 3.34 - 3.35 - static int fb_len(void) 3.36 - { 3.37 -@@ -28,10 +27,12 @@ 3.38 - { 3.39 - static unsigned short red[NLEVELS], green[NLEVELS], blue[NLEVELS]; 3.40 - struct fb_cmap cmap; 3.41 -+ 3.42 - if (finfo.visual == FB_VISUAL_TRUECOLOR) 3.43 - return; 3.44 -+ 3.45 - cmap.start = 0; 3.46 -- cmap.len = MAX(nr, MAX(ng, nb)); 3.47 -+ cmap.len = NLEVELS; 3.48 - cmap.red = red; 3.49 - cmap.green = green; 3.50 - cmap.blue = blue; 3.51 -@@ -41,24 +42,39 @@ 3.52 - 3.53 - void fb_cmap(void) 3.54 - { 3.55 -- unsigned short red[NLEVELS], green[NLEVELS], blue[NLEVELS]; 3.56 -+ struct fb_bitfield *color[3] = { 3.57 -+ &vinfo.blue, &vinfo.green, &vinfo.red 3.58 -+ }; 3.59 -+ int eye_sensibility[3] = { 2, 0, 1 }; // higher=red, blue, lower=green 3.60 - struct fb_cmap cmap; 3.61 -- int i; 3.62 -+ unsigned short map[3][NLEVELS]; 3.63 -+ int i, j, n, offset; 3.64 -+ 3.65 - if (finfo.visual == FB_VISUAL_TRUECOLOR) 3.66 - return; 3.67 - 3.68 -- for (i = 0; i < nr; i++) 3.69 -- red[i] = (65535 / (nr - 1)) * i; 3.70 -- for (i = 0; i < ng; i++) 3.71 -- green[i] = (65535 / (ng - 1)) * i; 3.72 -- for (i = 0; i < nb; i++) 3.73 -- blue[i] = (65535 / (nb - 1)) * i; 3.74 -- 3.75 -+ for (i = 0, n = vinfo.bits_per_pixel; i < 3; i++) { 3.76 -+ n -= color[eye_sensibility[i]]->length = n / (3 - i); 3.77 -+ } 3.78 -+ n = (1 << vinfo.bits_per_pixel); 3.79 -+ if (n > NLEVELS) 3.80 -+ n = NLEVELS; 3.81 -+ for (i = offset = 0; i < 3; i++) { 3.82 -+ int length = color[i]->length; 3.83 -+ color[i]->offset = offset; 3.84 -+ for (j = 0; j < n; j++) { 3.85 -+ int k = (j >> offset) << (16 - length); 3.86 -+ if (k == (0xFFFF << (16 - length))) 3.87 -+ k = 0xFFFF; 3.88 -+ map[i][j] = k; 3.89 -+ } 3.90 -+ offset += length; 3.91 -+ } 3.92 - cmap.start = 0; 3.93 -- cmap.len = MAX(nr, MAX(ng, nb)); 3.94 -- cmap.red = red; 3.95 -- cmap.green = green; 3.96 -- cmap.blue = blue; 3.97 -+ cmap.len = n; 3.98 -+ cmap.red = map[2]; 3.99 -+ cmap.green = map[1]; 3.100 -+ cmap.blue = map[0]; 3.101 - cmap.transp = NULL; 3.102 - 3.103 - ioctl(fd, FBIOPUTCMAP, &cmap); 3.104 -@@ -66,25 +82,26 @@ 3.105 - 3.106 - unsigned fb_mode(void) 3.107 - { 3.108 -- return (bpp << 16) | (vinfo.red.length << 8) | 3.109 -+ return (bytes_per_pixel << 16) | (vinfo.red.length << 8) | 3.110 - (vinfo.green.length << 4) | (vinfo.blue.length); 3.111 - } 3.112 - 3.113 - int fb_init(void) 3.114 - { 3.115 -+ int err = 1; 3.116 - fd = open(FBDEV_PATH, O_RDWR); 3.117 - if (fd == -1) 3.118 - goto failed; 3.119 -+ err++; 3.120 - if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) 3.121 - goto failed; 3.122 -+ err++; 3.123 - if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) 3.124 - goto failed; 3.125 - fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); 3.126 -- bpp = (vinfo.bits_per_pixel + 7) >> 3; 3.127 -- nr = 1 << vinfo.red.length; 3.128 -- ng = 1 << vinfo.blue.length; 3.129 -- nb = 1 << vinfo.green.length; 3.130 -+ bytes_per_pixel = (vinfo.bits_per_pixel + 7) >> 3; 3.131 - fb = mmap(NULL, fb_len(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 3.132 -+ err++; 3.133 - if (fb == MAP_FAILED) 3.134 - goto failed; 3.135 - fb_cmap_save(1); 3.136 -@@ -93,7 +110,7 @@ 3.137 - failed: 3.138 - perror("fb_init()"); 3.139 - close(fd); 3.140 -- return 1; 3.141 -+ return err; 3.142 - } 3.143 - 3.144 - void fb_free(void) 3.145 -@@ -120,19 +137,30 @@ 3.146 - 3.147 - void fb_set(int r, int c, void *mem, int len) 3.148 - { 3.149 -- memcpy(fb_mem(r) + (c + vinfo.xoffset) * bpp, mem, len * bpp); 3.150 -+ memcpy(fb_mem(r) + (c + vinfo.xoffset) * bytes_per_pixel, 3.151 -+ mem, len * bytes_per_pixel); 3.152 - } 3.153 - 3.154 -+void fill_rgb_conv(int mode, struct rgb_conv *s) 3.155 -+{ 3.156 -+ int bits; 3.157 -+ 3.158 -+ bits = mode & 0xF; mode >>= 4; 3.159 -+ s->rshl = s->gshl = bits; 3.160 -+ s->bskp = 8 - bits; s->bmax = (1 << bits) -1; 3.161 -+ bits = mode & 0xF; mode >>= 4; 3.162 -+ s->rshl += bits; 3.163 -+ s->gskp = 8 - bits; s->gmax = (1 << bits) -1; 3.164 -+ bits = mode & 0xF; 3.165 -+ s->rskp = 8 - bits; s->rmax = (1 << bits) -1; 3.166 -+} 3.167 -+ 3.168 - unsigned fb_val(int r, int g, int b) 3.169 - { 3.170 -- switch (fb_mode() & 0x0fff) { 3.171 -- default: 3.172 -- fprintf(stderr, "fb_val: unknown fb_mode()\n"); 3.173 -- case 0x0888: 3.174 -- return (r << 16) | (g << 8) | b; 3.175 -- case 0x0565: 3.176 -- return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); 3.177 -- case 0x0233: 3.178 -- return ((r >> 6) << 6) | ((g >> 5) << 3) | (b >> 5); 3.179 -- } 3.180 -+ static struct rgb_conv c; 3.181 -+ 3.182 -+ if (c.rshl == 0) 3.183 -+ fill_rgb_conv(fb_mode(), &c); 3.184 -+ return ((r >> c.rskp) << c.rshl) | ((g >> c.gskp) << c.gshl) 3.185 -+ | (b >> c.bskp); 3.186 - } 3.187 ---- fbvnc.c 3.188 -+++ fbvnc.c 3.189 -@@ -36,13 +36,15 @@ 3.190 - 3.191 - #define VNC_PORT "5900" 3.192 - 3.193 --#define MAXRES (1 << 21) 3.194 --#define MIN(a, b) ((a) < (b) ? (a) : (b)) 3.195 -+#define MAXRES (1 << 12) 3.196 - 3.197 - static int cols, rows; 3.198 -+static int srv_cols, srv_rows; 3.199 -+static int or, oc; 3.200 - static int mr, mc; /* mouse position */ 3.201 - 3.202 - static char buf[MAXRES]; 3.203 -+#define MAXPIX (MAXRES/sizeof(fbval_t)) 3.204 - 3.205 - static int vnc_connect(char *addr, char *port) 3.206 - { 3.207 -@@ -61,22 +63,26 @@ 3.208 - 3.209 - if (connect(fd, addrinfo->ai_addr, addrinfo->ai_addrlen) == -1) { 3.210 - close(fd); 3.211 -- freeaddrinfo(addrinfo); 3.212 -- return -1; 3.213 -+ fd = -2; 3.214 - } 3.215 - freeaddrinfo(addrinfo); 3.216 - return fd; 3.217 - } 3.218 - 3.219 -+static int bpp, vnc_mode; 3.220 -+static struct rgb_conv format; 3.221 - static int vnc_init(int fd) 3.222 - { 3.223 -- char vncver[] = "RFB 003.003\n"; 3.224 -+ static int vncfmt[] = { 0x40888, 0x20565, 0x10233, 0 }; 3.225 -+ char vncver[12]; 3.226 -+ int i; 3.227 -+ 3.228 - struct vnc_client_init clientinit; 3.229 - struct vnc_server_init serverinit; 3.230 - struct vnc_client_pixelfmt pixfmt_cmd; 3.231 - int connstat = VNC_CONN_FAILED; 3.232 - 3.233 -- write(fd, vncver, 12); 3.234 -+ write(fd, "RFB 003.003\n", 12); 3.235 - read(fd, vncver, 12); 3.236 - 3.237 - read(fd, &connstat, sizeof(connstat)); 3.238 -@@ -88,68 +94,78 @@ 3.239 - write(fd, &clientinit, sizeof(clientinit)); 3.240 - read(fd, &serverinit, sizeof(serverinit)); 3.241 - 3.242 -- if (fb_init()) 3.243 -- return -1; 3.244 -- if (FBM_BPP(fb_mode()) != sizeof(fbval_t)) { 3.245 -- fprintf(stderr, "fbvnc: fbval_t doesn't match fb depth\n"); 3.246 -- exit(1); 3.247 -- } 3.248 -- cols = MIN(ntohs(serverinit.w), fb_cols()); 3.249 -- rows = MIN(ntohs(serverinit.h), fb_rows()); 3.250 -+ i = fb_init(); 3.251 -+ if (i) 3.252 -+ return -1 - i; 3.253 -+ srv_cols = ntohs(serverinit.w); 3.254 -+ srv_rows = ntohs(serverinit.h); 3.255 -+ cols = MIN(srv_cols, fb_cols()); 3.256 -+ rows = MIN(srv_rows, fb_rows()); 3.257 - mr = rows / 2; 3.258 - mc = cols / 2; 3.259 -+ or = oc = 0; 3.260 - 3.261 - read(fd, buf, ntohl(serverinit.len)); 3.262 - pixfmt_cmd.type = VNC_CLIENT_PIXFMT; 3.263 -- pixfmt_cmd.format.bpp = 8; 3.264 -- pixfmt_cmd.format.depth = 8; 3.265 - pixfmt_cmd.format.bigendian = 0; 3.266 - pixfmt_cmd.format.truecolor = 1; 3.267 - 3.268 -- pixfmt_cmd.format.rmax = htons(3); 3.269 -- pixfmt_cmd.format.gmax = htons(7); 3.270 -- pixfmt_cmd.format.bmax = htons(7); 3.271 -- pixfmt_cmd.format.rshl = 0; 3.272 -- pixfmt_cmd.format.gshl = 2; 3.273 -- pixfmt_cmd.format.bshl = 5; 3.274 -+ if (bpp < 1) 3.275 -+ bpp = FBM_BPP(fb_mode()); 3.276 -+ if (bpp >= 3) 3.277 -+ bpp = 4; 3.278 -+ for (i = 0; bpp <= FBM_BPP(vncfmt[i]); i++) 3.279 -+ vnc_mode = vncfmt[i]; 3.280 -+ bpp = FBM_BPP(vnc_mode); 3.281 -+ pixfmt_cmd.format.bpp = 3.282 -+ pixfmt_cmd.format.depth = bpp << 3; 3.283 - 3.284 -+ fill_rgb_conv(FBM_COLORS(vnc_mode), &format); 3.285 -+ pixfmt_cmd.format.rmax = htons(format.rmax); 3.286 -+ pixfmt_cmd.format.gmax = htons(format.gmax); 3.287 -+ pixfmt_cmd.format.bmax = htons(format.bmax); 3.288 -+ pixfmt_cmd.format.rshl = format.rshl; 3.289 -+ pixfmt_cmd.format.gshl = format.gshl; 3.290 -+ pixfmt_cmd.format.bshl = 0; 3.291 - write(fd, &pixfmt_cmd, sizeof(pixfmt_cmd)); 3.292 - return fd; 3.293 - } 3.294 - 3.295 --static int vnc_free(void) 3.296 -+static void vnc_free(void) 3.297 - { 3.298 - fb_free(); 3.299 -- return 0; 3.300 - } 3.301 - 3.302 --static int vnc_refresh(int fd, int inc) 3.303 -+static void vnc_refresh(int fd, int inc) 3.304 - { 3.305 - struct vnc_client_fbup fbup_req; 3.306 - fbup_req.type = VNC_CLIENT_FBUP; 3.307 - fbup_req.inc = inc; 3.308 -- fbup_req.x = htons(0); 3.309 -- fbup_req.y = htons(0); 3.310 -- fbup_req.w = htons(cols); 3.311 -- fbup_req.h = htons(rows); 3.312 -+ fbup_req.x = htons(oc); 3.313 -+ fbup_req.y = htons(or); 3.314 -+ fbup_req.w = htons(oc + cols); 3.315 -+ fbup_req.h = htons(or + rows); 3.316 - write(fd, &fbup_req, sizeof(fbup_req)); 3.317 -- return 0; 3.318 - } 3.319 - 3.320 --static void drawfb(char *s, int x, int y, int w, int h) 3.321 -+static void drawfb(char *s, int x, int y, int w) 3.322 - { 3.323 -- fbval_t slice[1 << 14]; 3.324 -- int i, j; 3.325 -- for (i = 0; i < h; i++) { 3.326 -- for (j = 0; j < w; j++) { 3.327 -- int c = *(unsigned char *) &s[i * w + j]; 3.328 -- int r = (c & 0x3) << 6; 3.329 -- int g = ((c >> 2) & 0x7) << 5; 3.330 -- int b = ((c >> 5) & 0x7) << 5; 3.331 -- slice[j] = FB_VAL(r, g, b); 3.332 -+ int mode = fb_mode(); 3.333 -+ if (mode != vnc_mode) { 3.334 -+ fbval_t slice[MAXRES]; 3.335 -+ unsigned char *byte = (unsigned char *) slice; 3.336 -+ int j; 3.337 -+ int fb_bpp = FBM_BPP(mode); 3.338 -+ for (j = 0; j < w; j++, byte += fb_bpp, s += bpp) { 3.339 -+ fbval_t c = * (fbval_t *) s; 3.340 -+ int r = ((c >> format.rshl) & format.rmax) << format.rskp; 3.341 -+ int g = ((c >> format.gshl) & format.gmax) << format.gskp; 3.342 -+ int b = (c & format.bmax) << format.bskp; 3.343 -+ * (fbval_t *) byte = FB_VAL(r, g, b); 3.344 - } 3.345 -- fb_set(y + i, x, slice, w); 3.346 -+ s = (void *) slice; 3.347 - } 3.348 -+ fb_set(y, x, s, w); 3.349 - } 3.350 - 3.351 - static void xread(int fd, void *buf, int len) 3.352 -@@ -159,54 +175,84 @@ 3.353 - while (nr < len && (n = read(fd, buf + nr, len - nr)) > 0) 3.354 - nr += n; 3.355 - if (nr < len) { 3.356 -- printf("partial vnc read!\n"); 3.357 -- exit(1); 3.358 -+ fprintf(stderr,"partial vnc read!\n"); 3.359 -+ exit(99); 3.360 - } 3.361 - } 3.362 - 3.363 -+static void skip(int fd, int len) 3.364 -+{ 3.365 -+ int n; 3.366 -+ while (len > 0 && (n = read(fd, buf, MIN(len, sizeof(buf)))) > 0) 3.367 -+ len -= n; 3.368 -+} 3.369 -+ 3.370 - static int vnc_event(int fd) 3.371 - { 3.372 - struct vnc_rect uprect; 3.373 -- char msg[1 << 12]; 3.374 -- struct vnc_server_fbup *fbup = (void *) msg; 3.375 -- struct vnc_server_cuttext *cuttext = (void *) msg; 3.376 -- struct vnc_server_colormap *colormap = (void *) msg; 3.377 -- int j; 3.378 -- int n; 3.379 -+ union { 3.380 -+ struct vnc_server_fbup fbup; 3.381 -+ struct vnc_server_cuttext cuttext; 3.382 -+ struct vnc_server_colormap colormap; 3.383 -+ } msg; 3.384 -+ int j, n; 3.385 - 3.386 -- if (read(fd, msg, 1) != 1) 3.387 -+ if (read(fd, &msg.fbup.type, 1) != 1) 3.388 - return -1; 3.389 -- switch (msg[0]) { 3.390 -+ switch (msg.fbup.type) { 3.391 - case VNC_SERVER_FBUP: 3.392 -- xread(fd, msg + 1, sizeof(*fbup) - 1); 3.393 -- n = ntohs(fbup->n); 3.394 -+ xread(fd, &msg.fbup.pad, sizeof(msg.fbup) - 1); 3.395 -+ n = ntohs(msg.fbup.n); 3.396 - for (j = 0; j < n; j++) { 3.397 -- int x, y, w, h; 3.398 -+ int x, y, w, h, l, i; 3.399 - xread(fd, &uprect, sizeof(uprect)); 3.400 -+ if (uprect.enc != 0) { 3.401 -+ fprintf(stderr,"Encoding not RAW: %d\n", 3.402 -+ ntohl(uprect.enc)); 3.403 -+ return -1; 3.404 -+ } 3.405 - x = ntohs(uprect.x); 3.406 - y = ntohs(uprect.y); 3.407 - w = ntohs(uprect.w); 3.408 - h = ntohs(uprect.h); 3.409 -- if (x >= cols || x + w > cols) 3.410 -- return -1; 3.411 -- if (y >= rows || y + h > rows) 3.412 -- return -1; 3.413 -- xread(fd, buf, w * h); 3.414 -- drawfb(buf, x, y, w, h); 3.415 -+ x -= oc; 3.416 -+ y -= or; 3.417 -+ i = 0; 3.418 -+ l = MIN(w, cols - x); 3.419 -+ if (x < 0) { 3.420 -+ l = MIN(w + x, cols); 3.421 -+ i = MIN(w, -x); 3.422 -+ x = 0; 3.423 -+ } 3.424 -+ if (l < 0) 3.425 -+ l = 0; 3.426 -+ for (; h--; y++) { 3.427 -+ int n = l; 3.428 -+ int xj = x; 3.429 -+ skip(fd, i * bpp); 3.430 -+ while (n > 0) { 3.431 -+ int j = MIN(n, MAXPIX); 3.432 -+ xread(fd, buf, j * bpp); 3.433 -+ if (y >= 0 && y < rows) 3.434 -+ drawfb(buf, xj, y, j); 3.435 -+ xj += j; n -= j; 3.436 -+ } 3.437 -+ skip(fd, (w - l - i) * bpp); 3.438 -+ } 3.439 - } 3.440 - break; 3.441 - case VNC_SERVER_BELL: 3.442 - break; 3.443 - case VNC_SERVER_CUTTEXT: 3.444 -- xread(fd, msg + 1, sizeof(*cuttext) - 1); 3.445 -- xread(fd, buf, ntohl(cuttext->len)); 3.446 -+ xread(fd, &msg.cuttext.pad1, sizeof(msg.cuttext) - 1); 3.447 -+ skip(fd, ntohl(msg.cuttext.len)); 3.448 - break; 3.449 - case VNC_SERVER_COLORMAP: 3.450 -- xread(fd, msg + 1, sizeof(*colormap) - 1); 3.451 -- xread(fd, buf, ntohs(colormap->n) * 3 * 2); 3.452 -+ xread(fd, &msg.colormap.pad, sizeof(msg.colormap) - 1); 3.453 -+ skip(fd, ntohs(msg.colormap.n) * 3 * 2); 3.454 - break; 3.455 - default: 3.456 -- fprintf(stderr, "unknown vnc msg: %d\n", msg[0]); 3.457 -+ fprintf(stderr, "unknown vnc msg: %d\n", msg.fbup.type); 3.458 - return -1; 3.459 - } 3.460 - return 0; 3.461 -@@ -217,12 +263,31 @@ 3.462 - char ie[3]; 3.463 - struct vnc_client_ratevent me = {VNC_CLIENT_RATEVENT}; 3.464 - int mask = 0; 3.465 -+ int refresh = 2; 3.466 - if (read(ratfd, &ie, sizeof(ie)) != 3) 3.467 - return -1; 3.468 - mc += ie[1]; 3.469 - mr -= ie[2]; 3.470 -- mc = MAX(0, MIN(cols - 1, mc)); 3.471 -- mr = MAX(0, MIN(rows - 1, mr)); 3.472 -+ if (mc < oc) { 3.473 -+ if ((oc -= cols / 5) < 0) 3.474 -+ oc = 0; 3.475 -+ } 3.476 -+ else if (mc >= oc + cols && oc + cols < srv_cols) { 3.477 -+ if ((oc += cols / 5) > srv_cols - cols) 3.478 -+ oc = srv_cols - cols; 3.479 -+ } 3.480 -+ else refresh--; 3.481 -+ if (mr < or) { 3.482 -+ if ((or -= rows / 5) < 0) 3.483 -+ or = 0; 3.484 -+ } 3.485 -+ else if (mr >= or + rows && or + rows < srv_rows) { 3.486 -+ if ((or += rows / 5) > srv_rows - rows) 3.487 -+ or = srv_rows - rows; 3.488 -+ } 3.489 -+ else refresh--; 3.490 -+ mc = MAX(oc, MIN(oc + cols - 1, mc)); 3.491 -+ mr = MAX(or, MIN(or + rows - 1, mr)); 3.492 - if (ie[0] & 0x01) 3.493 - mask |= VNC_BUTTON1_MASK; 3.494 - if (ie[0] & 0x04) 3.495 -@@ -233,6 +298,8 @@ 3.496 - me.x = htons(mc); 3.497 - me.mask = mask; 3.498 - write(fd, &me, sizeof(me)); 3.499 -+ if (refresh) 3.500 -+ vnc_refresh(fd, 0); 3.501 - return 0; 3.502 - } 3.503 - 3.504 -@@ -292,12 +359,11 @@ 3.505 - k = 0xff0d; 3.506 - break; 3.507 - case 0x0c: /* ^L: redraw */ 3.508 -- if (vnc_refresh(fd, 0)) 3.509 -- return -1; 3.510 -+ vnc_refresh(fd, 0); 3.511 - default: 3.512 - k = (unsigned char) key[i]; 3.513 - } 3.514 -- if (k >= 'A' && k <= 'Z' || strchr(":\"<>?{}|+_()*&^%$#@!~", k)) 3.515 -+ if ((k >= 'A' && k <= 'Z') || strchr(":\"<>?{}|+_()*&^%$#@!~", k)) 3.516 - mod[nmod++] = 0xffe1; 3.517 - if (k >= 1 && k <= 26) { 3.518 - k = 'a' + k - 1; 3.519 -@@ -339,40 +405,42 @@ 3.520 - write(STDIN_FILENO, show, strlen(show)); 3.521 - } 3.522 - 3.523 --static void mainloop(int vnc_fd, int kbd_fd, int rat_fd) 3.524 -+static int mainloop(int vnc_fd, int kbd_fd, int rat_fd) 3.525 - { 3.526 - struct pollfd ufds[3]; 3.527 - int pending = 0; 3.528 - int err; 3.529 - ufds[0].fd = kbd_fd; 3.530 -- ufds[0].events = POLLIN; 3.531 - ufds[1].fd = vnc_fd; 3.532 -- ufds[1].events = POLLIN; 3.533 - ufds[2].fd = rat_fd; 3.534 -+ ufds[0].events = 3.535 -+ ufds[1].events = 3.536 - ufds[2].events = POLLIN; 3.537 -- if (vnc_refresh(vnc_fd, 0)) 3.538 -- return; 3.539 -+ vnc_refresh(vnc_fd, 0); 3.540 - while (1) { 3.541 - err = poll(ufds, 3, 500); 3.542 - if (err == -1 && errno != EINTR) 3.543 - break; 3.544 - if (!err) 3.545 - continue; 3.546 -+ err = -2; 3.547 - if (ufds[0].revents & POLLIN) 3.548 - if (kbd_event(vnc_fd, kbd_fd) == -1) 3.549 - break; 3.550 -+ err--; 3.551 - if (ufds[1].revents & POLLIN) { 3.552 - if (vnc_event(vnc_fd) == -1) 3.553 - break; 3.554 - pending = 0; 3.555 - } 3.556 -+ err--; 3.557 - if (ufds[2].revents & POLLIN) 3.558 - if (rat_event(vnc_fd, rat_fd) == -1) 3.559 - break; 3.560 - if (!pending++) 3.561 -- if (vnc_refresh(vnc_fd, 1)) 3.562 -- break; 3.563 -+ vnc_refresh(vnc_fd, 1); 3.564 - } 3.565 -+ return err; 3.566 - } 3.567 - 3.568 - int main(int argc, char * argv[]) 3.569 -@@ -380,27 +448,38 @@ 3.570 - char *port = VNC_PORT; 3.571 - char *host = "127.0.0.1"; 3.572 - struct termios ti; 3.573 -- int vnc_fd, rat_fd; 3.574 -+ int vnc_fd, rat_fd, status; 3.575 -+ 3.576 -+ if (argc < 2) { 3.577 -+ fprintf(stderr, "Usage : fbvnc [-bpp bits] server [port]\n"); 3.578 -+ return 0; 3.579 -+ } 3.580 -+ if (*argv[1] == '-' && argc >= 3) { 3.581 -+ argc -= 2; argv += 2; 3.582 -+ bpp = atoi(argv[0]) >> 3; 3.583 -+ } 3.584 - if (argc >= 2) 3.585 - host = argv[1]; 3.586 - if (argc >= 3) 3.587 - port = argv[2]; 3.588 -- if ((vnc_fd = vnc_connect(host, port)) == -1) { 3.589 -- fprintf(stderr, "could not connect!\n"); 3.590 -+ if ((vnc_fd = vnc_connect(host, port)) < 0) { 3.591 -+ fprintf(stderr, "could not connect! %s %s : %d\n", 3.592 -+ host,port,vnc_fd); 3.593 - return 1; 3.594 - } 3.595 -- if (vnc_init(vnc_fd) == -1) { 3.596 -- fprintf(stderr, "vnc init failed!\n"); 3.597 -- return 1; 3.598 -+ status = vnc_init(vnc_fd); 3.599 -+ if (status < 0) { 3.600 -+ fprintf(stderr, "vnc init failed! %d\n", status); 3.601 -+ return 2; 3.602 - } 3.603 - term_setup(&ti); 3.604 - rat_fd = open("/dev/input/mice", O_RDONLY); 3.605 - 3.606 -- mainloop(vnc_fd, 0, rat_fd); 3.607 -+ status = mainloop(vnc_fd, 0, rat_fd); 3.608 - 3.609 - term_cleanup(&ti); 3.610 - vnc_free(); 3.611 - close(vnc_fd); 3.612 - close(rat_fd); 3.613 -- return 0; 3.614 -+ return 2 - status; 3.615 - }
4.1 --- a/novnc/receipt Thu Nov 03 11:29:23 2011 +0100 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,52 +0,0 @@ 4.4 -# SliTaz package receipt. 4.5 - 4.6 -PACKAGE="novnc" 4.7 -VERSION="20110901" 4.8 -CATEGORY="network" 4.9 -SHORT_DESC="VNC client in javascript." 4.10 -MAINTAINER="pascal.bellard@slitaz.org" 4.11 -WEB_SITE="http://github.com/kanaka/noVNC" 4.12 -_TARBALL="$PACKAGE-$VERSION.tgz" 4.13 - 4.14 -DEPENDS="python python-numpy" 4.15 -BUILD_DEPENDS="wget python python-pil openssl" 4.16 -SUGGESTED="pyopenssl openssl" 4.17 - 4.18 -# Rules to configure and make the package. 4.19 -compile_rules() 4.20 -{ 4.21 - [ -s $SOURCES_REPOSITORY/$_TARBALL ] || 4.22 - wget -O $SOURCES_REPOSITORY/$_TARBALL \ 4.23 - $WEB_SITE/tarball/7b10dc8a485079fdc34847140fb0c993265e3a1e 4.24 - mkdir -p $src 4.25 - cd $src 4.26 - tar xzf $SOURCES_REPOSITORY/$_TARBALL 4.27 - mkdir -p $DESTDIR 4.28 - cd kanaka* 4.29 - sed -i 's/bash/sh/;s/ps -p \([^ ]*\)/ps | grep "^ *\1 "/' utils/launch.sh 4.30 - IMAGE=/usr/share/images/slitaz-background.jpg 4.31 - [ -s $IMAGE ] && utils/img2js.py $IMAGE noVNC_logo > include/logo.js 4.32 - cp -a *.html images/favicon.ico utils include $DESTDIR 4.33 -} 4.34 - 4.35 -# Rules to gen a SliTaz package suitable for Tazpkg. 4.36 -genpkg_rules() 4.37 -{ 4.38 - mkdir -p $fs/usr/share/novnc 4.39 - cp -a $_pkg/* $fs/usr/share/novnc 4.40 -} 4.41 - 4.42 -port_install() 4.43 -{ 4.44 - which openssl > /dev/null && 4.45 - openssl req -new -x509 -keyout $1/usr/share/novnc/self.pem \ 4.46 - -out $1/usr/share/novnc/self.pem -days 3650 -nodes <<EOT 4.47 -$(. /etc/locale.conf ; echo ${LANG#*_}) 4.48 -$(cat /etc/TZ) 4.49 - 4.50 -$(cat /etc/hostname) 4.51 - 4.52 - 4.53 - 4.54 -EOT 4.55 -}
5.1 --- a/sdcc/receipt Thu Nov 03 11:29:23 2011 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,33 +0,0 @@ 5.4 -# SliTaz package receipt. 5.5 - 5.6 -PACKAGE="sdcc" 5.7 -VERSION="2.9.0" 5.8 -CATEGORY="development" 5.9 -SHORT_DESC="Retargettable C compiler for 8051, Z80 and 68HC08." 5.10 -MAINTAINER="pascal.bellard@slitaz.org" 5.11 -TARBALL="$PACKAGE-src-$VERSION.tar.bz2" 5.12 -WEB_SITE="http://sdcc.sourceforge.net/" 5.13 -WGET_URL="$SF_MIRROR/$PACKAGE/$PACKAGE/$VERSION/$TARBALL" 5.14 -TAGS="cross compiler" 5.15 - 5.16 -# Rules to configure and make the package. 5.17 -compile_rules() 5.18 -{ 5.19 - mv $PACKAGE $src 2> /dev/null 5.20 - cd $src 5.21 - sed -i 's/all %/%/' device/lib/pic/Makefile.in 5.22 - find -name getline.h | xargs sed -i \ 5.23 - 's/char.*getline/#define getline sdcc_getline\nchar *sdcc_getline/' 5.24 - ./configure --prefix=/usr --infodir=/usr/share/info \ 5.25 - --mandir=/usr/share/man \ 5.26 - $CONFIGURE_ARGS && 5.27 - make && 5.28 - make DESTDIR=$PWD/_pkg install 5.29 -} 5.30 - 5.31 -# Rules to gen a SliTaz package suitable for Tazpkg. 5.32 -genpkg_rules() 5.33 -{ 5.34 - cp -a $_pkg/usr $fs 5.35 -} 5.36 -