gtk+ r19432 - in trunk: . gdk/directfb



Author: neo
Date: Wed Jan 30 19:43:16 2008
New Revision: 19432
URL: http://svn.gnome.org/viewvc/gtk+?rev=19432&view=rev

Log:
2008-01-30  Sven Neumann  <sven gimp org>

	* gdk/directfb/gdkdirectfb.h
	* gdk/directfb/gdkdisplay-directfb.c
	* gdk/directfb/gdkdrawable-directfb.c
	* gdk/directfb/gdkim-directfb.c
	* gdk/directfb/gdkimage-directfb.c
	* gdk/directfb/gdkinput-directfb.c
	* gdk/directfb/gdkmain-directfb.c
	* gdk/directfb/gdkpixmap-directfb.c
	* gdk/directfb/gdktestutils-directfb.c
	* gdk/directfb/gdkvisual-directfb.c
	* gdk/directfb/gdkwindow-directfb.c: applied patch from Denis
	Oliver Kropp <dok directfb org>. Fixes various warnings, some
	errors and has some cleanups.



Modified:
   trunk/ChangeLog
   trunk/gdk/directfb/gdkdirectfb.h
   trunk/gdk/directfb/gdkdisplay-directfb.c
   trunk/gdk/directfb/gdkdrawable-directfb.c
   trunk/gdk/directfb/gdkim-directfb.c
   trunk/gdk/directfb/gdkimage-directfb.c
   trunk/gdk/directfb/gdkinput-directfb.c
   trunk/gdk/directfb/gdkmain-directfb.c
   trunk/gdk/directfb/gdkpixmap-directfb.c
   trunk/gdk/directfb/gdktestutils-directfb.c
   trunk/gdk/directfb/gdkvisual-directfb.c
   trunk/gdk/directfb/gdkwindow-directfb.c

Modified: trunk/gdk/directfb/gdkdirectfb.h
==============================================================================
--- trunk/gdk/directfb/gdkdirectfb.h	(original)
+++ trunk/gdk/directfb/gdkdirectfb.h	Wed Jan 30 19:43:16 2008
@@ -41,16 +41,6 @@
 #include <directfb.h>
 #include "gdk/gdkprivate.h"
 
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
-     {                                                                \
-          int err = x;                                                    \
-          if (err != DFB_OK) {                                        \
-               fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
-               DirectFBErrorFatal( #x, err );                         \
-          }                                                           \
-     }
-
 
 extern GdkWindow * _gdk_parent_root;
 

Modified: trunk/gdk/directfb/gdkdisplay-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkdisplay-directfb.c	(original)
+++ trunk/gdk/directfb/gdkdisplay-directfb.c	Wed Jan 30 19:43:16 2008
@@ -195,6 +195,9 @@
 }
 
 
+/*************************************************************************************************
+ * Displays and Screens
+ */
 
 void
 _gdk_windowing_set_default_display (GdkDisplay *display)
@@ -228,6 +231,30 @@
 }
 
 gboolean
+gdk_display_supports_shapes (GdkDisplay *display)
+{
+       return FALSE;
+}
+
+gboolean
+gdk_display_supports_input_shapes (GdkDisplay *display)
+{
+       return FALSE;
+}
+
+
+GdkWindow *gdk_display_get_default_group (GdkDisplay *display)
+{
+  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+  return  _gdk_parent_root;
+}
+
+
+/*************************************************************************************************
+ * Selection and Clipboard
+ */
+
+gboolean
 gdk_display_supports_selection_notification (GdkDisplay *display)
 {
 	return FALSE;
@@ -262,28 +289,9 @@
 }
 
 
-gboolean
-gdk_display_supports_shapes (GdkDisplay *display)
-{
-       return FALSE;
-}
-
-
-gboolean
-gdk_display_supports_input_shapes (GdkDisplay *display)
-{
-       return FALSE;
-}
-
-
-GdkWindow *gdk_display_get_default_group (GdkDisplay *display)
-{
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-  return  _gdk_parent_root;
-}
-
-
-
+/*************************************************************************************************
+ * Pointer
+ */
 
 static gboolean _gdk_directfb_pointer_implicit_grab = FALSE;
 
@@ -338,9 +346,6 @@
   return GDK_GRAB_SUCCESS;
 }
 
-
-
-
 void
 gdk_directfb_pointer_ungrab (guint32  time,
                              gboolean implicit_grab)
@@ -387,8 +392,69 @@
   g_object_unref (old_grab_window);
 }
 
+gint
+gdk_display_pointer_is_grabbed (GdkDisplay *display)
+{
+  return _gdk_directfb_pointer_grab_window != NULL;
+}
+
+void
+gdk_display_pointer_ungrab (GdkDisplay *display,guint32 time)
+{
+  gdk_directfb_pointer_ungrab (time, _gdk_directfb_pointer_implicit_grab);
+}
+
+
+/*************************************************************************************************
+ * Keyboard
+ */
+
+GdkGrabStatus
+gdk_directfb_keyboard_grab (GdkDisplay *display,GdkWindow *window,
+                            gint       owner_events,
+                            guint32    time)
+{
+  GdkWindow             *toplevel;
+  GdkWindowImplDirectFB *impl;
+
+  g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+
+  if (_gdk_directfb_keyboard_grab_window)
+    gdk_keyboard_ungrab (time);
+
+  toplevel = gdk_directfb_window_find_toplevel (window);
+  impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl);
+
+  if (impl->window)
+    {
+      if (impl->window->GrabKeyboard (impl->window) == DFB_LOCKED)
+        return GDK_GRAB_ALREADY_GRABBED;
+    }
+
+  _gdk_directfb_keyboard_grab_window = g_object_ref (window);
+  _gdk_directfb_keyboard_grab_owner_events = owner_events;
+  return GDK_GRAB_SUCCESS;
+}
+
+void
+gdk_directfb_keyboard_ungrab (GdkDisplay *display,guint32 time)
+{
+  GdkWindow             *toplevel;
+  GdkWindowImplDirectFB *impl;
+
+  if (!_gdk_directfb_keyboard_grab_window)
+    return;
 
+  toplevel =
+    gdk_directfb_window_find_toplevel (_gdk_directfb_keyboard_grab_window);
+  impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl);
 
+  if (impl->window)
+    impl->window->UngrabKeyboard (impl->window);
+
+  g_object_unref (_gdk_directfb_keyboard_grab_window);
+  _gdk_directfb_keyboard_grab_window = NULL;
+}
 
 /*
  *--------------------------------------------------------------
@@ -457,17 +523,10 @@
   _gdk_directfb_keyboard_grab_window = NULL;
 }
 
-gint
-gdk_display_pointer_is_grabbed (GdkDisplay *display)
-{
-  return _gdk_directfb_pointer_grab_window != NULL;
-}
 
-void
-gdk_display_pointer_ungrab (GdkDisplay *display,guint32 time)
-{
-  gdk_directfb_pointer_ungrab (time, _gdk_directfb_pointer_implicit_grab);
-}
+/*************************************************************************************************
+ * Misc Stuff
+ */
 
 void
 gdk_display_beep (GdkDisplay *display)
@@ -486,6 +545,10 @@
 
 
 
+/*************************************************************************************************
+ * Notifications
+ */
+
 void
 gdk_notify_startup_complete (void)
 {
@@ -512,12 +575,17 @@
 }
 
 
+/*************************************************************************************************
+ * Compositing
+ */
+
 gboolean
 gdk_display_supports_composite (GdkDisplay *display)
 {
     return FALSE;
 }
 
+
 #define __GDK_DISPLAY_X11_C__
 #include "gdkaliasdef.c"
 

Modified: trunk/gdk/directfb/gdkdrawable-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkdrawable-directfb.c	(original)
+++ trunk/gdk/directfb/gdkdrawable-directfb.c	Wed Jan 30 19:43:16 2008
@@ -49,16 +49,6 @@
 
 #include "cairo-directfb.h"
 
-#define WARN_UNIMPLEMENTED(func)\
-{\
-  static gboolean first_call = TRUE;\
-  if (first_call)\
-    {\
-                        g_message ("unimplemented " func);\
-      first_call = FALSE;\
-    }\
-}
-
 
 /* From DirectFB's <gfx/generix/duffs_device.h> */
 #define DUFF_1() \
@@ -556,7 +546,7 @@
                        gint         angle1,
                        gint         angle2)
 {
-  WARN_UNIMPLEMENTED (G_GNUC_FUNCTION);
+  D_UNIMPLEMENTED();
 }
 
 static void
@@ -640,7 +630,7 @@
                         const gchar *text,
                         gint         text_length)
 {
-  WARN_UNIMPLEMENTED (G_GNUC_FUNCTION);
+  D_UNIMPLEMENTED();
 }
 
 static void
@@ -652,7 +642,7 @@
                            const GdkWChar *text,
                            gint            text_length)
 {
-  WARN_UNIMPLEMENTED (G_GNUC_FUNCTION);
+  D_UNIMPLEMENTED();
 }
 
 static void

Modified: trunk/gdk/directfb/gdkim-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkim-directfb.c	(original)
+++ trunk/gdk/directfb/gdkim-directfb.c	Wed Jan 30 19:43:16 2008
@@ -151,7 +151,7 @@
 
   *bp = 0;
 
-  return mbstr;
+  return (gchar*)mbstr;
 }
 
 

Modified: trunk/gdk/directfb/gdkimage-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkimage-directfb.c	(original)
+++ trunk/gdk/directfb/gdkimage-directfb.c	Wed Jan 30 19:43:16 2008
@@ -151,7 +151,7 @@
 
   GDK_NOTE (MISC, g_print ("gdk_image_new_bitmap: %dx%d\n", w, h));
 
-  g_message ("not fully implemented %s", G_GNUC_FUNCTION);
+  g_message ("not fully implemented %s", __FUNCTION__);
 
   image->bpl = (w + 7) / 8;
   image->mem = g_malloc (image->bpl * h);
@@ -209,7 +209,7 @@
       format = DSPF_ARGB;
       break;
     default:
-      g_message ("unimplemented %s for depth %d", G_GNUC_FUNCTION, depth);
+      g_message ("unimplemented %s for depth %d", __FUNCTION__, depth);
       return NULL;
     }
 
@@ -225,7 +225,13 @@
 
   private->surface = surface;
 
-  surface->Lock( surface, DSLF_WRITE, &image->mem, &pitch );
+  ret = surface->Lock( surface, DSLF_WRITE, &image->mem, &pitch );
+  if (ret)
+    {
+      DirectFBError( "IDirectFBSurface::Lock() for writing failed!\n", ret );
+      gdk_image_unref( image );
+      return NULL;
+    }
 
   image->type           = type;
   image->visual         = visual;
@@ -403,8 +409,8 @@
   if (!private)
     return;
 
-  GDK_NOTE (MISC, g_print ("gdk_directfb_image_destroy: %#x\n",
-                           (guint) private->surface));
+  GDK_NOTE (MISC, g_print ("gdk_directfb_image_destroy: %#lx\n",
+                           (gulong) private->surface));
 
   private->surface->Unlock( private->surface );
   private->surface->Release( private->surface );

Modified: trunk/gdk/directfb/gdkinput-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkinput-directfb.c	(original)
+++ trunk/gdk/directfb/gdkinput-directfb.c	Wed Jan 30 19:43:16 2008
@@ -228,7 +228,7 @@
 gdk_device_set_mode (GdkDevice    *device,
                      GdkInputMode  mode)
 {
-  g_message ("unimplemented %s", G_GNUC_FUNCTION);
+  g_message ("unimplemented %s", __FUNCTION__);
 
   return FALSE;
 }
@@ -303,7 +303,7 @@
                                 gint              mask,
                                 GdkExtensionMode  mode)
 {
-  g_message ("unimplemented %s", G_GNUC_FUNCTION);
+  g_message ("unimplemented %s", __FUNCTION__);
 }
 
 GList *

Modified: trunk/gdk/directfb/gdkmain-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkmain-directfb.c	(original)
+++ trunk/gdk/directfb/gdkmain-directfb.c	Wed Jan 30 19:43:16 2008
@@ -435,7 +435,7 @@
                    gint       owner_events,
                    guint32    time) 
 {
-	return gdk_display_keyboard_grab(gdk_display_get_default(),
+	return gdk_directfb_keyboard_grab(gdk_display_get_default(),
 			window,
 			owner_events,
 			time);

Modified: trunk/gdk/directfb/gdkpixmap-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkpixmap-directfb.c	(original)
+++ trunk/gdk/directfb/gdkpixmap-directfb.c	Wed Jan 30 19:43:16 2008
@@ -109,8 +109,6 @@
 static void
 gdk_pixmap_impl_directfb_finalize (GObject *object)
 {
-  GdkDrawableImplDirectFB *impl = GDK_DRAWABLE_IMPL_DIRECTFB (object);
-
   if (G_OBJECT_CLASS (parent_class)->finalize)
     G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -172,7 +170,7 @@
           format = DSPF_RGB32;
           break;
         default:
-          g_message ("unimplemented %s for depth %d", G_GNUC_FUNCTION, depth);
+          g_message ("unimplemented %s for depth %d", __FUNCTION__, depth);
           return NULL;
         }
     }

Modified: trunk/gdk/directfb/gdktestutils-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdktestutils-directfb.c	(original)
+++ trunk/gdk/directfb/gdktestutils-directfb.c	Wed Jan 30 19:43:16 2008
@@ -83,7 +83,7 @@
     case GDK_Cancel:
       return DIKS_CANCEL;
       /* TODO: handle them all */
-    defualt:
+    default:
       break;
   }
 

Modified: trunk/gdk/directfb/gdkvisual-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkvisual-directfb.c	(original)
+++ trunk/gdk/directfb/gdkvisual-directfb.c	Wed Jan 30 19:43:16 2008
@@ -112,7 +112,6 @@
 void
 _gdk_visual_init ()
 {
-  DFBResult              ret;
   DFBDisplayLayerConfig  dlc;
   DFBSurfaceDescription  desc;
   IDirectFBSurface      *dest;

Modified: trunk/gdk/directfb/gdkwindow-directfb.c
==============================================================================
--- trunk/gdk/directfb/gdkwindow-directfb.c	(original)
+++ trunk/gdk/directfb/gdkwindow-directfb.c	Wed Jan 30 19:43:16 2008
@@ -2453,7 +2453,7 @@
     return;
 
   /* N/A */
-  g_message("unimplemented %s", G_GNUC_FUNCTION);
+  g_message("unimplemented %s", __FUNCTION__);
 }
 
 void
@@ -2486,7 +2486,7 @@
     return FALSE;
 
   /* N/A */
-  g_message("unimplemented %s", G_GNUC_FUNCTION);
+  g_message("unimplemented %s", __FUNCTION__);
 
   return FALSE;
 }
@@ -2504,7 +2504,7 @@
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  g_message("unimplemented %s", G_GNUC_FUNCTION);
+  g_message("unimplemented %s", __FUNCTION__);
 }
 
 void
@@ -2519,7 +2519,7 @@
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  g_message("unimplemented %s", G_GNUC_FUNCTION);
+  g_message("unimplemented %s", __FUNCTION__);
 }
 
 /**
@@ -2818,10 +2818,10 @@
 }
 
 static void
-gdk_window_impl_directfb_invalidate_maybe_recurse (GdkPaintable *paintable,
-                                                   GdkRegion    *region,
-                                                   gboolean    (*child_func) (GdkWindow *, gpointer),
-                                                   gpointer      user_data)
+gdk_window_impl_directfb_invalidate_maybe_recurse (GdkPaintable    *paintable,
+                                                   const GdkRegion *region,
+                                                   gboolean       (*child_func) (GdkWindow *, gpointer),
+                                                   gpointer         user_data)
 {
   GdkWindow *window;
   GdkWindowObject *private;
@@ -2866,14 +2866,11 @@
           
           if (child_func && (*child_func) ((GdkWindow *)child, user_data))
             {
-              gdk_region_offset (region, - child->x, - child->y);
-              gdk_region_offset (&child_region, - child->x, - child->y);
               gdk_region_intersect (&child_region, region);
+              gdk_region_offset (&child_region, - child->x, - child->y);
               
               gdk_window_invalidate_maybe_recurse ((GdkWindow *)child,
                                                    &child_region, child_func, user_data);
-              
-              gdk_region_offset (region, child->x, child->y);
             }
 
           temp_region_deinit( &child_region );
@@ -2967,8 +2964,8 @@
 
 
 static void
-gdk_window_impl_directfb_begin_paint_region (GdkPaintable *paintable,
-                                             GdkRegion    *region)
+gdk_window_impl_directfb_begin_paint_region (GdkPaintable    *paintable,
+                                             const GdkRegion *region)
 {
   GdkDrawableImplDirectFB *impl;
   GdkWindowImplDirectFB *wimpl;



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