[gtk+/gtk-2-22] directfb: rework backend initialization a little bit



commit 737f035959ad4807aa81ef8397f771513c99b4be
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Fri May 14 15:30:50 2010 +0200

    directfb: rework backend initialization a little bit
    
    Make it look more like the x11 backend. Also some people reported
    crash early in the backend initialization about some colormap stuff,
    this should avoid the problem.
    
    Signed-off-by: Lionel Landwerlin <llandwerlin gmail com>

 gdk/directfb/gdkdisplay-directfb.c |    4 +-
 gdk/directfb/gdkwindow-directfb.c  |   62 +++++++++++++++++++----------------
 2 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/gdk/directfb/gdkdisplay-directfb.c b/gdk/directfb/gdkdisplay-directfb.c
index 39f7983..4db63e9 100644
--- a/gdk/directfb/gdkdisplay-directfb.c
+++ b/gdk/directfb/gdkdisplay-directfb.c
@@ -39,7 +39,7 @@ extern void _gdk_visual_init            (void);
 extern void _gdk_events_init            (void);
 extern void _gdk_input_init             (void);
 extern void _gdk_dnd_init               (void);
-extern void _gdk_windowing_window_init  (void);
+extern void _gdk_windowing_window_init  (GdkScreen *screen);
 extern void _gdk_windowing_image_init   (void);
 extern void _gdk_directfb_keyboard_init (void);
 
@@ -116,7 +116,7 @@ gdk_display_open (const gchar *display_name)
   _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL);
 
   _gdk_visual_init ();
-  _gdk_windowing_window_init ();
+  _gdk_windowing_window_init (_gdk_screen);
 
   gdk_screen_set_default_colormap (_gdk_screen,
                                    gdk_screen_get_system_colormap (_gdk_screen));
diff --git a/gdk/directfb/gdkwindow-directfb.c b/gdk/directfb/gdkwindow-directfb.c
index 5b67a27..8b72fe9 100644
--- a/gdk/directfb/gdkwindow-directfb.c
+++ b/gdk/directfb/gdkwindow-directfb.c
@@ -258,11 +258,11 @@ create_directfb_window (GdkWindowImplDirectFB *impl,
 }
 
 void
-_gdk_windowing_window_init (void)
+_gdk_windowing_window_init (GdkScreen *screen)
 {
-  GdkWindowObject       *private;
-  GdkWindowImplDirectFB *impl;
-  DFBDisplayLayerConfig  dlc;
+  GdkWindowObject         *private;
+  GdkDrawableImplDirectFB *draw_impl;
+  DFBDisplayLayerConfig    dlc;
 
   g_assert (_gdk_parent_root == NULL);
 
@@ -274,19 +274,8 @@ _gdk_windowing_window_init (void)
   private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
   private->impl_window = private;
 
-  impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
+  draw_impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
 
-  private->window_type            = GDK_WINDOW_ROOT;
-  private->state                  = 0;
-  private->children               = NULL;
-  private->viewable               = TRUE;
-  //  impl->drawable.paint_region = NULL;
-  impl->window                    = NULL;
-  impl->drawable.abs_x            = 0;
-  impl->drawable.abs_y            = 0;
-  impl->drawable.width            = dlc.width;
-  impl->drawable.height           = dlc.height;
-  impl->drawable.wrapper          = GDK_DRAWABLE (private);
   /* custom root window init */
   {
     DFBWindowDescription   desc;
@@ -303,21 +292,38 @@ _gdk_windowing_window_init (void)
     desc.posy    = 0;
     desc.width   = dlc.width;
     desc.height  = dlc.height;
-    create_directfb_window (impl, &desc, 0);
-    g_assert (impl->window != NULL);
-    g_assert (impl->drawable.surface != NULL );
+
+    create_directfb_window (GDK_WINDOW_IMPL_DIRECTFB (private->impl),
+                            &desc, 0);
+
+    g_assert (GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window != NULL);
+    g_assert (draw_impl->surface != NULL);
   }
-  impl->drawable.surface->GetPixelFormat (impl->drawable.surface,
-                                          &impl->drawable.format);
-  private->depth = DFB_BITS_PER_PIXEL (impl->drawable.format);
 
-  _gdk_window_update_size (_gdk_parent_root);
+  private->window_type = GDK_WINDOW_ROOT;
+  private->viewable    = TRUE;
+  private->x           = 0;
+  private->y           = 0;
+  private->abs_x       = 0;
+  private->abs_y       = 0;
+  private->width       = dlc.width;
+  private->height      = dlc.height;
 
-  /*
-    Now we can set up the system colormap
-  */
-  gdk_drawable_set_colormap (GDK_DRAWABLE (_gdk_parent_root),
-                             gdk_colormap_get_system ());
+  //  impl->drawable.paint_region = NULL;
+  /* impl->window                    = NULL; */
+  draw_impl->abs_x    = 0;
+  draw_impl->abs_y    = 0;
+  draw_impl->width    = dlc.width;
+  draw_impl->height   = dlc.height;
+  draw_impl->wrapper  = GDK_DRAWABLE (private);
+  draw_impl->colormap = gdk_screen_get_system_colormap (screen);
+  g_object_ref (draw_impl->colormap);
+
+  draw_impl->surface->GetPixelFormat (draw_impl->surface,
+                                      &draw_impl->format);
+  private->depth = DFB_BITS_PER_PIXEL (draw_impl->format);
+
+  _gdk_window_update_size (_gdk_parent_root);
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]