diff -uNr xawdecode/src/main.c xawdecode-new/src/main.c --- xawdecode/src/main.c 2007-09-10 01:12:43 +0400 +++ xawdecode-new/src/main.c 2007-09-10 01:08:34 +0400 @@ -238,6 +238,8 @@ int fs = 0; int temp_colorkey = 0; int fullscreen = 0; +int left_shift = 5; +int window_shift = 5; int fsstate = 0; int de = 1; int fs_width, fs_height, fs_xoff, fs_yoff; @@ -5155,6 +5157,17 @@ switch_method=2; } } + else if (strcmp (arg, "-s") == 0) + { + left_shift = 0; + window_shift = 0; + } + else if (strcmp (arg, "-left_shift") == 0) + { + INCRARG(i); + left_shift = atoi(arg); + window_shift = 3; + } else if (strcmp (arg, "-nowd") == 0) { decoration = 0; diff -uNr xawdecode/src/x11.c xawdecode-new/src/x11.c --- xawdecode/src/x11.c 2007-09-10 01:12:43 +0400 +++ xawdecode-new/src/x11.c 2007-09-10 01:08:34 +0400 @@ -107,6 +107,9 @@ /* ------------------------------------------------------------------------ */ //extern int decode; extern int cur_capture; +extern int fullscreen, tv_debug; +extern int left_shift; +extern int window_shift; extern XtAppContext app_context; @@ -187,7 +190,7 @@ int wx, wy, wwidth, wheight, wmap; /* window */ int ox, oy, owidth, oheight; /* overlay */ int width_capture = 0, height_capture = 0; -int width_capture_max = 768, height_capture_max = 576; +int width_capture_max = 2560, height_capture_max = 2048; static set_overlay overlay_cb; static XtIntervalId overlay_refresh; @@ -1334,19 +1337,26 @@ void video_set_size(int w, int h) { - XtVaSetValues (video_parent, XtNwidth, w, XtNheight, h, NULL); + + XtVaSetValues (video_parent, XtNwidth , w, XtNheight, h, NULL); video_new_size(); } void video_new_size (void) { - Dimension x, y, w, h; - + Dimension x, y, w, h, d; + float buf; XtVaGetValues (video_parent, XtNx, &x, XtNy, &y, XtNwidth, &w, XtNheight, &h, NULL); - - wx = x; +// if (if window_shift!=0) +// { +// buf = w /40.; d= (Dimension) buf; + d=window_shift; +// fprintf(stderr, "window_shift = %d", window_shift); +// } else +// d=0; + wx = x - d; if (wx > 32768) wx -= 65536; @@ -1354,7 +1364,7 @@ if (wy > 32768) wy -= 65536; - wwidth = w; + wwidth = w + 2*d; if (wwidth > 32768) wwidth -= 65536; @@ -1363,8 +1373,11 @@ wheight -= 65536; if (tv_debug > 1) + { fprintf (stderr, "video: shell: size %dx%d+%d+%d\n", wwidth, wheight, wx, wy); + fprintf(stderr, "delta=%d\n", d); + } if (force_ratio) { @@ -1414,14 +1427,14 @@ if(cur_capture == CAPTURE_GRABDISPLAY) if(oheight>height_capture_max) oheight = height_capture_max; - owidth &= ~(WPAD-1); + owidth &= ~(WPAD-1); oheight &= ~(HPAD-1); ox = wx + (wwidth - owidth) / 2; oy = wy + (wheight - oheight) / 2; ox &= ~(XPAD-1); - if (ox < wx) - ox += XPAD; + if (ox < wx ) + ox = wx + XPAD; if (ox + owidth > wx + wwidth) owidth -= WPAD; @@ -1440,6 +1453,12 @@ oheight = height_capture2; if(oheight>cur_maxheight) oheight = cur_maxheight; oy = wy + (wheight - oheight) / 2; + + // fprintf (stderr, "video: shell: size %dx%d+%d+%d\n", + // wwidth, wheight, wx, wy); + // fprintf(stderr, "delta=%d\n", d); + // fprintf(stderr, "wx=%d ox=%d \n", wx, ox); + } } diff -uNr xawdecode/src/xosd.c xawdecode-new/src/xosd.c --- xawdecode/src/xosd.c 2004-11-22 01:21:16 +0300 +++ xawdecode-new/src/xosd.c 2007-09-10 01:11:21 +0400 @@ -33,10 +33,14 @@ #define XOFFSET 10 const char *osd_default_font = - "-misc-fixed-medium-r-semicondensed--*-*-*-*-c-*-*-*"; + "-misc-fixed-medium-r-*-*-*-*-*-*-c-*-*-*"; #if 0 "-adobe-helvetica-bold-r-*-*-10-*"; #endif + +extern int left_shift; +extern int tv_debug; + const char *osd_default_colour = "green"; /** Global error string. */ @@ -77,19 +81,22 @@ * The number of characters in the pipe is an indication for the number of * threads waiting for the X11-MUTEX. */ -static /*inline */ void +static inline +void _xosd_lock(xosd * osd) { - char c = 0; + unsigned char c = 0; FUNCTION_START(Dlocking); write(osd->pipefd[1], &c, sizeof(c)); pthread_mutex_lock(&osd->mutex); FUNCTION_END(Dlocking); } -static /*inline */ void + +static inline +void _xosd_unlock(xosd * osd) { - char c; + unsigned char c; int generation = osd->generation, update = osd->update; FUNCTION_START(Dlocking); read(osd->pipefd[0], &c, sizeof(c)); @@ -103,19 +110,22 @@ /* }}} */ /* Draw percentage/slider bar. {{{ */ -static void /*inline */ +static void inline _draw_bar(xosd * osd, int nbars, int on, XRectangle * p, XRectangle * mod, int is_slider) { + float buf; int i; XRectangle rs[2]; FUNCTION_START(Dfunction); rs[0].x = rs[1].x = mod->x + p->x; - rs[0].y = (rs[1].y = mod->y + p->y) + p->height / 3; - rs[0].width = mod->width + p->width * SLIDER_SCALE; - rs[0].height = mod->height + p->height / 3; - rs[1].width = mod->width + p->width * SLIDER_SCALE_ON; + buf = (rs[1].y = mod->y + p->y) + p->height / 3 +0.5; + rs[0].y = buf; + rs[0].width = mod->width + p->width; + buf = mod->height + p->height / 3 + 0.5; + rs[0].height = buf; + rs[1].width = mod->width + p->width; rs[1].height = mod->height + p->height; for (i = 0; i < nbars; i++, rs[0].x = rs[1].x += p->width) { XRectangle *r = &(rs[is_slider ? (i == on) : (i < on)]); @@ -124,48 +134,76 @@ } FUNCTION_END(Dfunction); } -static void + +static void inline draw_bar(xosd * osd, int line) { + float buf; + float delta; + float xtvixers; struct xosd_bar *l = &osd->lines[line].bar; int is_slider = l->type == LINE_slider, nbars, on; XRectangle p, m; + + fprintf (stderr, "osd->bar_length ==%d", osd->bar_length); + p.x = XOFFSET; p.y = osd->line_height * line; - p.width = -osd->extent->y / 2; + buf=-osd->extent->y+0.5 / 2; + if (p.width>-1 || p.width<1) + p.width=1; p.height = -osd->extent->y; - assert(osd); FUNCTION_START(Dfunction); /* Calculate number of bars in automatic mode */ if (osd->bar_length == -1) { - nbars = (osd->screen_width * SLIDER_SCALE) / p.width; + xtvixers= osd->screen_width / p.width; + delta = xtvixers / 40.; + buf = xtvixers - 2 * delta; + nbars = buf; switch (osd->align) { case XOSD_center: - p.x = osd->screen_width * ((1 - SLIDER_SCALE) / 2); + buf = (float) osd->screen_width/ 2. - 0.5; + p.x = (size_t) (buf - left_shift); break; case XOSD_right: - p.x = osd->screen_width * (1 - SLIDER_SCALE); + buf = (float) osd->screen_width - 0.5; + p.x = (size_t) ( buf - left_shift); + break; case XOSD_left: + buf = (float) 0.5; + p.x = (size_t) (buf - left_shift) ; break; } } else { - nbars = osd->bar_length; - switch (osd->align) { + xtvixers= nbars * p.width; + delta = xtvixers / 40.; + nbars = osd->bar_length - 2 * delta; + switch (osd->align) { case XOSD_center: - p.x = (osd->screen_width - (nbars * p.width)) / 2; + buf = xtvixers / 2 + 0.5; + p.x = (size_t) (buf - left_shift); break; case XOSD_right: - p.x = osd->screen_width - (nbars * p.width) - p.x; + buf = xtvixers + 0.5; + p.x = (size_t) (buf - left_shift); + break; case XOSD_left: + buf = (float) 0.5; + p.x = (size_t) (buf - left_shift); break; } } - on = ((nbars - is_slider) * l->value) / 100; - + if (tv_debug) + { + buf= ((nbars - is_slider) * l->value) / 100. + 0.5; + on = buf; + DEBUG(Dvalue, "xtvixers=%f , nbars=%d, ", xtvixers, nbars); + DEBUG(Dvalue, "p.x=%d\n", p.x); + DEBUG(Dvalue, "left_shift=%d, delta=%f\n", left_shift, delta); DEBUG(Dvalue, "percent=%d, nbars=%d, on=%d", l->value, nbars, on); - + } /* Outline */ if (osd->outline_offset) { m.x = m.y = -osd->outline_offset; @@ -191,8 +229,8 @@ /* }}} */ /* Draw text. {{{ */ -static void /*inline */ -_draw_text(xosd * osd, char *string, int x, int y) +static void inline +_draw_text(xosd * osd, wchar_t *string, int x, int y) { int len = strlen(string); FUNCTION_START(Dfunction); @@ -268,6 +306,7 @@ { xosd *osd = osdv; int xfd, max; + float buf; FUNCTION_START(Dfunction); DEBUG(Dtrace, "event thread started"); @@ -338,7 +377,8 @@ y = osd->screen_height - osd->height - osd->voffset; break; case XOSD_middle: - y = (osd->screen_height - osd->height) / 2 - osd->voffset; + buf = (osd->screen_height - osd->height) / 2. - osd->voffset + 0.5; + y = buf; break; case XOSD_top: y = osd->voffset; @@ -676,9 +716,9 @@ return NULL; } - // to slove problem with specific characters!!!!!!!!!!!!!!!!!! - DEBUG(Dtrace, "setting locale"); - setlocale(LC_ALL, ""); +// // to slove problem with specific characters!!!!!!!!!!!!!!!!!! +// DEBUG(Dtrace, "setting locale"); +// setlocale(LC_ALL, ""); DEBUG(Dtrace, "Mallocing osd"); osd = malloc(sizeof(xosd));