Author: rshortt
Date: Thu Jan 18 18:08:13 2007
New Revision: 2419

Modified:
   trunk/display/src/dfb.c
   trunk/display/src/dfb.py

Log:
Add kwargs for layer_id and window_id, and impliment setting the layer_id.  
Also set the pixel format (maybe allow setting that too later on).  So far so 
good.


Modified: trunk/display/src/dfb.c
==============================================================================
--- trunk/display/src/dfb.c     (original)
+++ trunk/display/src/dfb.c     Thu Jan 18 18:08:13 2007
@@ -10,6 +10,7 @@
  *
  * First Edition: Dirk Meyer <[EMAIL PROTECTED]>
  * Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
+ * Maintainer:    Rob Shortt <[EMAIL PROTECTED]>
  *
  * Please see the file AUTHORS for a complete list of authors.
  *
@@ -59,11 +60,16 @@
 
 
 /* open dfb and create base surface */
-PyObject *dfb_open(PyObject *self, PyObject *args)
+PyObject *dfb_open(PyObject *self, PyObject *args, PyObject *keywds)
 {
     int width, height;
+    int layer_id = DLID_PRIMARY;
+    int window_id = -1;
 
-    if (!PyArg_ParseTuple(args, "(ii)", &width, &height))
+    static char *kwlist[] = { "width", "height", "layer_id", "window_id", NULL 
};
+
+    if (!PyArg_ParseTupleAndKeywords(args, keywds, "ii|ii", kwlist, 
+                                     &width, &height, &layer_id, &window_id))
         return NULL;
 
     /* create the super interface */
@@ -72,20 +78,25 @@
     DFBCHECK(DirectFBCreate(&dfb), "DirectFBCreate");
     dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
 
-    DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer), 
+    DFBCHECK(dfb->GetDisplayLayer(dfb, layer_id, &layer), 
              "GetDisplayLayer");
     layer->GetConfiguration(layer, &layer_config);
 
     /* get the primary surface, i.e. the surface of the primary layer we have
      * exclusive access to */
     memset(&dsc, 0, sizeof(DFBSurfaceDescription));
-    dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT;
+    dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | 
DSDESC_PIXELFORMAT;
     layer_config.width = width;
     layer_config.height = height;
 
     dsc.width = layer_config.width;
     dsc.height = layer_config.height;
-    dsc.caps = DSCAPS_PRIMARY;
+    dsc.pixelformat = DSPF_ARGB;
+
+    if(layer_id == DLID_PRIMARY)
+        dsc.caps = DSCAPS_PRIMARY;
+    else
+        dsc.caps = DSCAPS_NONE;
 
     DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary), "CreateSurface");
 
@@ -154,7 +165,7 @@
 #endif  // ENABLE_ENGINE_DIRECTFB
 
 PyMethodDef dfb_methods[] = {
-    { "open", (PyCFunction) dfb_open, METH_VARARGS },
+    { "open", (PyCFunction) dfb_open, METH_VARARGS | METH_KEYWORDS },
     { "close", (PyCFunction) dfb_close, METH_VARARGS },
     { "size", (PyCFunction) dfb_size, METH_VARARGS },
 #ifdef ENABLE_ENGINE_DIRECTFB

Modified: trunk/display/src/dfb.py
==============================================================================
--- trunk/display/src/dfb.py    (original)
+++ trunk/display/src/dfb.py    Thu Jan 18 18:08:13 2007
@@ -13,6 +13,7 @@
 #
 # First Edition: Dirk Meyer <[EMAIL PROTECTED]>
 # Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
+# Maintainer:    Rob Shortt <[EMAIL PROTECTED]>
 #
 # Please see the file AUTHORS for a complete list of authors.
 #
@@ -40,8 +41,10 @@
     """
     Base class for DirectFB framebuffer.
     """
-    def __init__(self, size):
-        dfb.open(size)
+    def __init__(self, size, **kwargs):
+        # check size, it comes in as a tupple
+        # we can't parse tupples with kwargs in the C extention
+        dfb.open(size[0], size[1], **kwargs)
 
 
     def size(self):
@@ -78,8 +81,8 @@
     the specified framebuffer resolutions, a list for fbset or None. If set to
     None, the current framebuffer size will be used.
     """
-    def __init__(self, size):
-        _DirectFB.__init__(self, size)
+    def __init__(self, size, **kwargs):
+        _DirectFB.__init__(self, size, **kwargs)
         import kaa.evas
         self._evas = kaa.evas.Evas()
         dfb.new_evas_dfb(self._evas._evas)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to