mirror of https://github.com/mpv-player/mpv
- 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:
parent
2045d25ceb
commit
467ab2516e
|
@ -35,6 +35,14 @@
|
||||||
|
|
||||||
#include <ggi/ggi.h>
|
#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 */
|
/* maximum buffers */
|
||||||
#undef GGI_FLIP
|
#undef GGI_FLIP
|
||||||
|
|
||||||
|
@ -53,7 +61,6 @@ static struct ggi_conf_s {
|
||||||
|
|
||||||
ggi_visual_t parentvis;
|
ggi_visual_t parentvis;
|
||||||
ggi_visual_t vis;
|
ggi_visual_t vis;
|
||||||
ggi_mode gmode;
|
|
||||||
|
|
||||||
/* source image format */
|
/* source image format */
|
||||||
int srcwidth;
|
int srcwidth;
|
||||||
|
@ -78,6 +85,16 @@ static struct ggi_conf_s {
|
||||||
} ggi_conf;
|
} 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)
|
static void set_graphtype(uint32_t format, ggi_mode *mode)
|
||||||
{
|
{
|
||||||
switch(format)
|
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,
|
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)
|
uint32_t d_height, uint32_t flags, char *title, uint32_t format)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
ggi_mode mode = {
|
ggi_mode mode = {
|
||||||
1, /* frames */
|
1, /* frames */
|
||||||
{ 0, 0 }, /* top, left corner */
|
{ 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: ");
|
printf("[ggi] mode: ");
|
||||||
ggiPrintMode(&parentmode);
|
ggiPrintMode(&parentmode);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
printf("[ggi] submode: ");
|
||||||
|
ggiPrintMode(&mode);
|
||||||
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ggiCheckMode(ggi_conf.parentvis, &parentmode);
|
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);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printf("[ggi] mode: ");
|
||||||
|
ggiPrintMode(&parentmode);
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* calculate top, left corner */
|
/* calculate top, left corner */
|
||||||
mode.visible.x = (parentmode.virt.x - width) / 2;
|
mode.visible.x = (parentmode.virt.x - width) / 2;
|
||||||
mode.visible.y = (parentmode.virt.y - height) / 2;
|
mode.visible.y = (parentmode.virt.y - height) / 2;
|
||||||
|
|
||||||
/* calculate bottom, right corner */
|
/* calculate bottom, right corner */
|
||||||
mode.virt.x = mode.visible.x + width;
|
mode.virt.x = width;
|
||||||
mode.virt.y = mode.visible.y + height;
|
mode.virt.y = height;
|
||||||
|
|
||||||
ggiCheckMode(ggi_conf.vis, &mode);
|
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);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GGIWMH
|
||||||
ggi_conf.gmode = mode;
|
ggiWmhSetTitle(ggi_conf.parentvis, title);
|
||||||
|
if (vo_ontop) window_ontop();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("[ggi] mode: ");
|
printf("[ggi] submode: ");
|
||||||
ggiPrintMode(&mode);
|
ggiPrintMode(&mode);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -210,6 +236,9 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||||
ggi_conf.srcheight = height;
|
ggi_conf.srcheight = height;
|
||||||
ggi_conf.srcformat = format;
|
ggi_conf.srcformat = format;
|
||||||
|
|
||||||
|
ggi_conf.dstwidth = mode.virt.x;
|
||||||
|
ggi_conf.dstheight = mode.virt.y;
|
||||||
|
|
||||||
ggi_conf.voflags = flags;
|
ggi_conf.voflags = flags;
|
||||||
|
|
||||||
if (IMGFMT_IS_RGB(ggi_conf.srcformat))
|
if (IMGFMT_IS_RGB(ggi_conf.srcformat))
|
||||||
|
@ -228,9 +257,6 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||||
return(-1);
|
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);
|
ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
|
||||||
|
|
||||||
if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
|
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,
|
ggiFlushRegion(ggi_conf.vis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
|
||||||
ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
|
ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
|
||||||
ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
|
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,
|
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]);
|
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;
|
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;
|
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;
|
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;
|
ggi_conf.flushregion.y2 = y + h;
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
|
@ -380,6 +407,14 @@ static uint32_t preinit(const char *arg)
|
||||||
return(-1);
|
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)
|
if ((char *)arg)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -410,6 +445,10 @@ static uint32_t preinit(const char *arg)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GGIWMH
|
||||||
|
ggiWmhAttach(ggi_conf.parentvis);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
|
mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
|
||||||
(ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
|
(ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
|
||||||
|
@ -421,6 +460,12 @@ static void uninit(void)
|
||||||
{
|
{
|
||||||
if (ggi_conf.driver)
|
if (ggi_conf.driver)
|
||||||
free(ggi_conf.driver);
|
free(ggi_conf.driver);
|
||||||
|
|
||||||
|
#ifdef HAVE_GGIWMH
|
||||||
|
ggiWmhDetach(ggi_conf.parentvis);
|
||||||
|
ggiWmhExit();
|
||||||
|
#endif
|
||||||
|
|
||||||
ggiClose(ggi_conf.vis);
|
ggiClose(ggi_conf.vis);
|
||||||
ggiClose(ggi_conf.parentvis);
|
ggiClose(ggi_conf.parentvis);
|
||||||
ggiExit();
|
ggiExit();
|
||||||
|
@ -434,6 +479,12 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||||
return query_format(*((uint32_t*)data));
|
return query_format(*((uint32_t*)data));
|
||||||
case VOCTRL_GET_IMAGE:
|
case VOCTRL_GET_IMAGE:
|
||||||
return get_image(data);
|
return get_image(data);
|
||||||
|
#ifdef HAVE_GGIWMH
|
||||||
|
case VOCTRL_ONTOP:
|
||||||
|
vo_ontop = (!(vo_ontop));
|
||||||
|
window_ontop();
|
||||||
|
return VO_TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return VO_NOTIMPL;
|
return VO_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue