[MPlayer-cvslog] CVS: main/libvo vo_ggi.c,1.34,1.35

Diego Biurrun CVS syncmail at mplayerhq.hu
Wed May 11 10:04:15 CEST 2005


CVS change done by Diego Biurrun CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv18291/libvo

Modified Files:
	vo_ggi.c 
Log Message:
- 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>


Index: vo_ggi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_ggi.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- vo_ggi.c	27 Apr 2005 12:15:37 -0000	1.34
+++ vo_ggi.c	11 May 2005 08:04:13 -0000	1.35
@@ -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 @@
     
     ggi_visual_t parentvis;
     ggi_visual_t vis;
-    ggi_mode gmode;
     
     /* source image format */
     int srcwidth;
@@ -78,6 +85,16 @@
 } 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 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 @@
     printf("[ggi] mode: ");
     ggiPrintMode(&parentmode);
     printf("\n");
+
+    printf("[ggi] submode: ");
+    ggiPrintMode(&mode);
+    printf("\n");
 #endif
 
     ggiCheckMode(ggi_conf.parentvis, &parentmode);
@@ -166,13 +184,19 @@
 	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 @@
 	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 @@
     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 @@
 	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 @@
     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 @@
 {
     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 @@
 	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 @@
 	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 @@
 {
     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 @@
 	    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;
 }




More information about the MPlayer-cvslog mailing list