- make use of libggiwmh if found by configure

* For now use it to set the window title
  * Implement "Window-On-Top" (experimental)
- Improved dirty region handling introduced in rev 1.33.
- other minor fixes
patch by Christoph Egger <Christoph_Egger at gmx dot de>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15407 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2005-05-11 08:04:13 +00:00
parent 2045d25ceb
commit 467ab2516e
1 changed files with 69 additions and 18 deletions

View File

@ -35,6 +35,14 @@
#include <ggi/ggi.h>
#ifdef HAVE_GGIWMH
#include <ggi/wmh.h>
#endif
#ifdef HAVE_GGIWMH
extern int vo_ontop; /* Window on top */
#endif
/* maximum buffers */
#undef GGI_FLIP
@ -53,7 +61,6 @@ static struct ggi_conf_s {
ggi_visual_t parentvis;
ggi_visual_t vis;
ggi_mode gmode;
/* source image format */
int srcwidth;
@ -78,6 +85,16 @@ static struct ggi_conf_s {
} ggi_conf;
#ifdef HAVE_GGIWMH
static void window_ontop(void)
{
mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n");
ggiWmhZOrder(ggi_conf.parentvis, ZO_TOP);
return;
}
#endif
static void set_graphtype(uint32_t format, ggi_mode *mode)
{
switch(format)
@ -117,9 +134,6 @@ static void set_graphtype(uint32_t format, ggi_mode *mode)
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t flags, char *title, uint32_t format)
{
int i;
int rc;
ggi_mode mode = {
1, /* frames */
{ 0, 0 }, /* top, left corner */
@ -144,6 +158,10 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
printf("[ggi] mode: ");
ggiPrintMode(&parentmode);
printf("\n");
printf("[ggi] submode: ");
ggiPrintMode(&mode);
printf("\n");
#endif
ggiCheckMode(ggi_conf.parentvis, &parentmode);
@ -166,13 +184,19 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
return(-1);
}
#if 0
printf("[ggi] mode: ");
ggiPrintMode(&parentmode);
printf("\n");
#endif
/* calculate top, left corner */
mode.visible.x = (parentmode.virt.x - width) / 2;
mode.visible.y = (parentmode.virt.y - height) / 2;
/* calculate bottom, right corner */
mode.virt.x = mode.visible.x + width;
mode.virt.y = mode.visible.y + height;
mode.virt.x = width;
mode.virt.y = height;
ggiCheckMode(ggi_conf.vis, &mode);
@ -188,11 +212,13 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
return(-1);
}
ggi_conf.gmode = mode;
#ifdef HAVE_GGIWMH
ggiWmhSetTitle(ggi_conf.parentvis, title);
if (vo_ontop) window_ontop();
#endif
#if 0
printf("[ggi] mode: ");
printf("[ggi] submode: ");
ggiPrintMode(&mode);
printf("\n");
#endif
@ -209,6 +235,9 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
ggi_conf.srcwidth = width;
ggi_conf.srcheight = height;
ggi_conf.srcformat = format;
ggi_conf.dstwidth = mode.virt.x;
ggi_conf.dstheight = mode.virt.y;
ggi_conf.voflags = flags;
@ -228,9 +257,6 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
return(-1);
}
vo_dwidth = ggi_conf.dstwidth = ggi_conf.gmode.virt.x;
vo_dheight = ggi_conf.dstheight = ggi_conf.gmode.virt.y;
ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
@ -315,8 +341,9 @@ static void flip_page(void)
ggiFlushRegion(ggi_conf.vis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = ggi_conf.dstwidth / 2;
ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = ggi_conf.dstheight / 2;
ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1;
ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1;
}
static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h,
@ -324,13 +351,13 @@ static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h,
{
ggiPutBox(ggi_conf.vis, x, y, w, h, src[0]);
if (x < ggi_conf.flushregion.x1)
if ((ggi_conf.flushregion.x1 == -1) || (x < ggi_conf.flushregion.x1))
ggi_conf.flushregion.x1 = x;
if (y < ggi_conf.flushregion.y1)
if ((ggi_conf.flushregion.y1 == -1) || (y < ggi_conf.flushregion.y1))
ggi_conf.flushregion.y1 = y;
if ((x + w) > ggi_conf.flushregion.x2)
if ((ggi_conf.flushregion.x2 == -1) || ((x + w) > ggi_conf.flushregion.x2))
ggi_conf.flushregion.x2 = x + w;
if ((y + h) > ggi_conf.flushregion.y2)
if ((ggi_conf.flushregion.y2 == -1) || ((y + h) > ggi_conf.flushregion.y2))
ggi_conf.flushregion.y2 = y + h;
return(1);
@ -380,6 +407,14 @@ static uint32_t preinit(const char *arg)
return(-1);
}
#ifdef HAVE_GGIWMH
if (ggiWmhInit() < 0)
{
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n");
return(-1);
}
#endif
if ((char *)arg)
{
int i = 0;
@ -410,6 +445,10 @@ static uint32_t preinit(const char *arg)
return(-1);
}
#ifdef HAVE_GGIWMH
ggiWmhAttach(ggi_conf.parentvis);
#endif
mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
(ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
@ -421,6 +460,12 @@ static void uninit(void)
{
if (ggi_conf.driver)
free(ggi_conf.driver);
#ifdef HAVE_GGIWMH
ggiWmhDetach(ggi_conf.parentvis);
ggiWmhExit();
#endif
ggiClose(ggi_conf.vis);
ggiClose(ggi_conf.parentvis);
ggiExit();
@ -434,6 +479,12 @@ static uint32_t control(uint32_t request, void *data, ...)
return query_format(*((uint32_t*)data));
case VOCTRL_GET_IMAGE:
return get_image(data);
#ifdef HAVE_GGIWMH
case VOCTRL_ONTOP:
vo_ontop = (!(vo_ontop));
window_ontop();
return VO_TRUE;
#endif
}
return VO_NOTIMPL;
}