Attached are the changes to add Get/SetProperty to window.

Plus I added  passing in  a desc for create subsurface

--- directfb.h  17 Jul 2006 13:12:21 -0000      1.304
+++ directfb.h  22 Jul 2006 23:33:45 -0000
@@ -3457,6 +3457,7 @@
      */
     DFBResult (*GetSubSurface) (
          IDirectFBSurface         *thiz,
+          const DFBSurfaceDescription   *desc,
          const DFBRectangle       *rect,
          IDirectFBSurface        **ret_interface
     );


I'm working now on figuring out how to add double buffering to subsurfaces
but this gets the api right for allowing subsurfaces to be equal to
"real" surfaces.
? src/windows/idirectfbwindow.loT
Index: src/core/fonts.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/fonts.c,v
retrieving revision 1.58
diff -u -r1.58 fonts.c
--- src/core/fonts.c	22 Jul 2006 18:46:29 -0000	1.58
+++ src/core/fonts.c	22 Jul 2006 23:32:47 -0000
@@ -43,11 +43,11 @@
 #include <core/surfaces.h>
 
 #include <direct/debug.h>
-#include <direct/hash.h>
 #include <direct/mem.h>
 #include <direct/messages.h>
 #include <direct/utf8.h>
 #include <direct/util.h>
+#include <fusion/hash.h>
 
 #include <gfx/convert.h>
 
@@ -75,7 +75,7 @@
      if (!font)
           return D_OOM();
 
-     ret = direct_hash_create( 163, &font->glyph_hash );
+     ret = fusion_hash_create_local(HASH_INT,HASH_PTR,163, &font->glyph_hash );
      if (ret) {
           D_FREE( font );
           return ret;
@@ -121,7 +121,7 @@
 
      dfb_state_destroy( &font->state );
 
-     direct_hash_destroy( font->glyph_hash );
+     fusion_hash_destroy( font->glyph_hash );
 
      if (font->rows) {
           for (i = 0; i < font->num_rows; i++) {
@@ -204,7 +204,7 @@
           D_ASSERT( font->active_row < font->num_rows );
      }
 
-     data = direct_hash_lookup( font->glyph_hash, index );
+     data = fusion_hash_lookup( font->glyph_hash, (const void *)index );
      if (data) {
           D_MAGIC_ASSERT( data, CoreGlyphData );
           D_ASSERT( data->row >= 0 );
@@ -333,7 +333,7 @@
                     direct_list_foreach_safe (d, n, row->glyphs) {
                          D_MAGIC_ASSERT( d, CoreGlyphData );
 
-                         /*ret =*/ direct_hash_remove( font->glyph_hash, d->index );
+                         /*ret =*/ fusion_hash_remove( font->glyph_hash, (const void *)d->index,NULL,(void **)&d);
                          //FIXME: use D_ASSERT( ret == DFB_OK );
 
                          D_MAGIC_CLEAR( d );
@@ -416,7 +416,7 @@
      if (row)
           direct_list_append( &row->glyphs, &data->link );
 
-     direct_hash_insert( font->glyph_hash, index, data );
+     fusion_hash_insert( font->glyph_hash, (const void *)index, data );
 
      *ret_data = data;
 
Index: src/core/fonts.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/fonts.h,v
retrieving revision 1.25
diff -u -r1.25 fonts.h
--- src/core/fonts.h	22 Jul 2006 18:46:29 -0000	1.25
+++ src/core/fonts.h	22 Jul 2006 23:32:47 -0000
@@ -109,7 +109,7 @@
      int                           active_row;
      unsigned int                  row_stamp;
 
-     DirectHash                   *glyph_hash;    /* infos about loaded glyphs        */
+     FusionHash                   *glyph_hash;    /* infos about loaded glyphs        */
 
      int                           height;        /* font height                      */
 
Index: src/core/gfxcard.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/gfxcard.c,v
retrieving revision 1.185
diff -u -r1.185 gfxcard.c
--- src/core/gfxcard.c	22 Jul 2006 11:19:09 -0000	1.185
+++ src/core/gfxcard.c	22 Jul 2006 23:32:48 -0000
@@ -54,12 +54,12 @@
 #include <gfx/clip.h>
 #include <gfx/util.h>
 
-#include <direct/hash.h>
 #include <direct/mem.h>
 #include <direct/messages.h>
 #include <direct/modules.h>
 #include <direct/utf8.h>
 #include <direct/util.h>
+#include <fusion/hash.h>
 
 #include <misc/conf.h>
 #include <misc/util.h>
@@ -1532,7 +1532,7 @@
           CoreGlyphData *glyph;
           unsigned int   current = indices[i];
 
-          glyph = direct_hash_lookup( font->glyph_hash, current );
+          glyph = fusion_hash_lookup( font->glyph_hash,(const void *) current );
           if (!glyph) {
                switch (blit) {
                     case 1:
Index: src/core/wm.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/wm.c,v
retrieving revision 1.12
diff -u -r1.12 wm.c
--- src/core/wm.c	16 Jul 2006 10:15:29 -0000	1.12
+++ src/core/wm.c	22 Jul 2006 23:32:48 -0000
@@ -563,6 +563,7 @@
 
      return wm_local->funcs->GetInsets(stack,window,insets);
 }
+
 /**
  Give the wm a chance to override the windows configuration 
 **/
@@ -652,6 +653,65 @@
      return ret;
 }
 
+/**
+ * Let the wm set a property on a window 
+ */
+DFBResult
+dfb_wm_set_window_property( CoreWindowStack  *stack,
+					 CoreWindow       *window,
+                     char             *key,
+                     void             *value,
+                     void             **old_value)
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->SetWindowProperty != NULL );
+
+     D_ASSERT( stack != NULL );
+
+     return wm_local->funcs->SetWindowProperty(stack,wm_local->data,stack->stack_data,
+                                                    window,window->window_data,
+                                                    key,value,old_value);
+}
+
+/**
+ * get the wm  property on a window 
+ */
+DFBResult
+dfb_wm_get_window_property( CoreWindowStack  *stack,
+					 CoreWindow       *window,
+                     char             *key,
+                     void             **value)
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->GetWindowProperty != NULL );
+
+     D_ASSERT( stack != NULL );
+
+     return wm_local->funcs->GetWindowProperty(stack,wm_local->data,stack->stack_data,
+                                                window,window->window_data,key,value);
+}
+
+/**
+ * remove th wm  property on a window 
+ */
+DFBResult
+dfb_wm_remove_window_property( CoreWindowStack  *stack,
+					 CoreWindow       *window,
+                     char             *key,
+                     void             **value)
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RemoveWindowProperty != NULL );
+
+     D_ASSERT( stack != NULL );
+
+     return wm_local->funcs->RemoveWindowProperty(stack,wm_local->data,stack->stack_data,
+                                                    window,window->window_data,key,value);
+}
+
 DFBResult
 dfb_wm_set_window_config( CoreWindow             *window,
                           const CoreWindowConfig *config,
Index: src/core/wm.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/wm.h,v
retrieving revision 1.11
diff -u -r1.11 wm.h
--- src/core/wm.h	16 Jul 2006 10:15:29 -0000	1.11
+++ src/core/wm.h	22 Jul 2006 23:32:48 -0000
@@ -185,6 +185,30 @@
 
 
    /** Window **/
+    DFBResult (*SetWindowProperty)( CoreWindowStack  *stack,
+                                    void             *wm_data,
+                                    void             *stack_data,
+					                CoreWindow       *window,
+                                    void             *window_data,
+                                    char             *key,
+                                    void             *value,
+                                    void             **old_value);
+
+    DFBResult (*GetWindowProperty)( CoreWindowStack  *stack,
+                                    void             *wm_data,
+                                    void             *stack_data,
+					                CoreWindow       *window,
+                                    void             *window_data,
+                                    char             *key,
+                                    void             **value);
+
+    DFBResult (*RemoveWindowProperty)( CoreWindowStack  *stack,
+                                       void             *wm_data,
+                                       void             *stack_data,
+					                   CoreWindow       *window,
+                                       void             *window_data,
+                                       char             *key,
+                                       void             **value);
 
      DFBResult (*GetInsets)         ( CoreWindowStack        *stack,
                                       CoreWindow             *window,
@@ -296,7 +320,23 @@
                                       CoreWindow             *window,
                                       DFBInsets              *insets );
 
-DFBResult dfb_wm_preconfigure_window( CoreWindowStack        *stack,
+DFBResult dfb_wm_set_window_property ( CoreWindowStack  *stack,
+					                  CoreWindow       *window,
+                                      char             *key,
+                                      void             *value,
+                                      void             **old_value);
+
+DFBResult dfb_wm_get_window_property ( CoreWindowStack  *stack,
+					                  CoreWindow       *window,
+                                      char             *key,
+                                      void             **value);
+
+DFBResult dfb_wm_remove_window_property ( CoreWindowStack  *stack,
+					                  CoreWindow       *window,
+                                      char             *key,
+                                      void             **value);
+
+DFBResult dfb_wm_preconfigure_window ( CoreWindowStack        *stack,
                                       CoreWindow             *window );
 
 
Index: src/core/wm_module.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/wm_module.h,v
retrieving revision 1.9
diff -u -r1.9 wm_module.h
--- src/core/wm_module.h	16 Jul 2006 10:15:29 -0000	1.9
+++ src/core/wm_module.h	22 Jul 2006 23:32:49 -0000
@@ -120,6 +120,31 @@
                                      CoreWindow             *window,
                                      void                   *window_data );
 
+static DFBResult wm_set_window_property( CoreWindowStack        *stack,
+                                       void                   *wm_data,
+                                       void                   *stack_data,
+                                       CoreWindow             *window,
+                                       void                   *window_data,
+                                       char                   *key,
+                                       void                   *value, 
+                                       void                   **old_value );
+
+static DFBResult wm_get_window_property( CoreWindowStack        *stack,
+                                       void                   *wm_data,
+                                       void                   *stack_data,
+                                       CoreWindow             *window,
+                                       void                   *window_data,
+                                       char                   *key,
+                                       void                   **ret_value );
+
+static DFBResult wm_remove_window_property( CoreWindowStack        *stack,
+                                       void                   *wm_data,
+                                       void                   *stack_data,
+                                       CoreWindow             *window,
+                                       void                   *window_data,
+                                       char                   *key,
+                                       void                   **ret_value );
+
 static DFBResult wm_add_window     ( CoreWindowStack        *stack,
                                      void                   *wm_data,
                                      void                   *stack_data,
@@ -201,7 +226,10 @@
 
      StartDesktop:     	  wm_start_desktop,
      GetInsets:     	  wm_get_insets,
-     PreConfigureWindow:     wm_preconfigure_window,
+     PreConfigureWindow:  wm_preconfigure_window,
+     SetWindowProperty:   wm_set_window_property,
+     GetWindowProperty:   wm_get_window_property,
+     RemoveWindowProperty:wm_remove_window_property,
      AddWindow:           wm_add_window,
      RemoveWindow:        wm_remove_window,
      SetWindowConfig:     wm_set_window_config,
Index: src/display/idirectfbsurface.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/display/idirectfbsurface.c,v
retrieving revision 1.117
diff -u -r1.117 idirectfbsurface.c
--- src/display/idirectfbsurface.c	23 Jun 2006 06:01:37 -0000	1.117
+++ src/display/idirectfbsurface.c	22 Jul 2006 23:32:50 -0000
@@ -1920,6 +1920,7 @@
 
 static DFBResult
 IDirectFBSurface_GetSubSurface( IDirectFBSurface    *thiz,
+                                const DFBSurfaceDescription  *desc,
                                 const DFBRectangle  *rect,
                                 IDirectFBSurface   **surface )
 {
@@ -1936,6 +1937,9 @@
      if (!surface)
           return DFB_INVARG;
 
+     if (desc && desc->flags & DSDESC_CAPS)
+        data->caps = desc->caps;
+
      /* Compute wanted rectangle */
      if (rect) {
           wanted = *rect;
Index: src/windows/idirectfbwindow.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/windows/idirectfbwindow.c,v
retrieving revision 1.86
diff -u -r1.86 idirectfbwindow.c
--- src/windows/idirectfbwindow.c	11 Jun 2006 16:33:00 -0000	1.86
+++ src/windows/idirectfbwindow.c	22 Jul 2006 23:32:50 -0000
@@ -344,6 +344,55 @@
 }
 
 static DFBResult
+IDirectFBWindow_SetProperty( IDirectFBWindow  *thiz,
+                            char *key, void *value, void **old_value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     /* Check arguments */
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     return dfb_wm_set_property(data->window->stack,data->window,key,value,old_value);
+}
+
+static DFBResult
+IDirectFBWindow_GetProperty( IDirectFBWindow  *thiz,char *key,
+                            void **ret_value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     if (!ret_value)
+          return DFB_INVARG;
+
+     return dfb_wm_get_property(data->window->stack,data->window,key,ret_value);
+}
+
+static DFBResult
+IDirectFBWindow_RemoveProperty( IDirectFBWindow  *thiz,char *key,
+                            void **ret_value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     return dfb_wm_remove_property(data->window->stack,data->window,key,ret_value);
+}
+
+static DFBResult
 IDirectFBWindow_SetOptions( IDirectFBWindow  *thiz,
                             DFBWindowOptions  options )
 {
@@ -832,6 +881,9 @@
      thiz->GetPosition = IDirectFBWindow_GetPosition;
      thiz->GetSize = IDirectFBWindow_GetSize;
      thiz->GetSurface = IDirectFBWindow_GetSurface;
+     thiz->SetProperty = IDirectFBWindow_SetProperty;
+     thiz->GetProperty = IDirectFBWindow_GetProperty;
+     thiz->RemoveProperty = IDirectFBWindow_RemoveProperty;
      thiz->SetOptions = IDirectFBWindow_SetOptions;
      thiz->GetOptions = IDirectFBWindow_GetOptions;
      thiz->SetColorKey = IDirectFBWindow_SetColorKey;
Index: wm/default/default.c
===================================================================
RCS file: /cvs/directfb/DirectFB/wm/default/default.c,v
retrieving revision 1.31
diff -u -r1.31 default.c
--- wm/default/default.c	16 Jul 2006 10:15:29 -0000	1.31
+++ wm/default/default.c	22 Jul 2006 23:32:52 -0000
@@ -2795,6 +2795,7 @@
 	return DFB_OK;
 }
 
+
 static DFBResult
 wm_preconfigure_window( CoreWindowStack *stack,
                void            *wm_data,
@@ -2806,6 +2807,44 @@
 }
 
 static DFBResult
+wm_set_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            *value,
+               void            **old_value)
+{
+	return DFB_OK;
+}
+
+static DFBResult
+wm_get_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            **value)
+{
+	return DFB_OK;
+}
+
+
+static DFBResult
+wm_remove_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            **value)
+{
+	return DFB_OK;
+}
+
+static DFBResult
 wm_add_window( CoreWindowStack *stack,
                void            *wm_data,
                void            *stack_data,
Index: wm/unique/unique.c
===================================================================
RCS file: /cvs/directfb/DirectFB/wm/unique/unique.c,v
retrieving revision 1.14
diff -u -r1.14 unique.c
--- wm/unique/unique.c	16 Jul 2006 10:15:29 -0000	1.14
+++ wm/unique/unique.c	22 Jul 2006 23:32:52 -0000
@@ -564,6 +564,44 @@
 }
 
 static DFBResult
+wm_set_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            *value,
+               void            **old_value)
+{
+	return DFB_OK;
+}
+
+static DFBResult
+wm_get_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            **value)
+{
+	return DFB_OK;
+}
+
+
+static DFBResult
+wm_remove_window_property( CoreWindowStack *stack,
+               void            *wm_data,
+               void            *stack_data,
+               CoreWindow      *window,
+               void            *window_data,
+               char            *key,
+               void            **value)
+{
+	return DFB_OK;
+}
+
+static DFBResult
 wm_add_window( CoreWindowStack *stack,
                void            *wm_data,
                void            *stack_data,
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to