[gtkmm] Remove Gdk::Drawable, which is replaced by more use of Gdk::Window.



commit 9a0bc65f770a6c62c5e2dadbd40f1ca0009bd9c8
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Dec 3 11:01:25 2010 +0100

    Remove Gdk::Drawable, which is replaced by more use of Gdk::Window.
    
      * tools/extra_defs_gen/generate_defs_gtk.cc: Remove mention of
      GDK_TYPE_DRAWABLE.
    * gdk/src/drawable.[hg|ccg]: Removed. API generally uses Gdk::Window now
    instead.
    * gdk/src/filelist.am:
    * gdk/gdkmm.h: Removed mentions of drawable.
    * gdk/src/window.[hg|ccg]: This now derives from Glib::Object instead of
    Gdk::Drawable, though it still has a strangely-named typedef.
    * gdk/gdkmm/general.[h|cc]:
    * gdk/src/display.hg:
      * gdk/src/pixbuf.hg: Adapt the includes.

 ChangeLog                                 |   18 ++++++-
 gdk/gdkmm.h                               |    1 -
 gdk/gdkmm/general.cc                      |    1 +
 gdk/gdkmm/general.h                       |    1 +
 gdk/src/display.hg                        |    1 -
 gdk/src/drawable.ccg                      |   28 ----------
 gdk/src/drawable.hg                       |   79 -----------------------------
 gdk/src/filelist.am                       |    1 -
 gdk/src/pixbuf.hg                         |   62 +++++++++++++++++++----
 gdk/src/window.ccg                        |    2 +-
 gdk/src/window.hg                         |   20 +++----
 tools/extra_defs_gen/generate_defs_gtk.cc |    1 -
 12 files changed, 80 insertions(+), 135 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e8a3d62..509cc10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,20 @@
-2010-12-02  Murray Cumming  <murrayc murrayc com>>
+2010-12-03  Murray Cumming  <murrayc murrayc com>
+
+	Remove Gdk::Drawable, which is replaced by more use of Gdk::Window.
+
+  * tools/extra_defs_gen/generate_defs_gtk.cc: Remove mention of 
+  GDK_TYPE_DRAWABLE.
+	* gdk/src/drawable.[hg|ccg]: Removed. API generally uses Gdk::Window now 
+	instead.
+	* gdk/src/filelist.am:
+	* gdk/gdkmm.h: Removed mentions of drawable.
+	* gdk/src/window.[hg|ccg]: This now derives from Glib::Object instead of 
+	Gdk::Drawable, though it still has a strangely-named typedef.
+	* gdk/gdkmm/general.[h|cc]:
+	* gdk/src/display.hg:
+  * gdk/src/pixbuf.hg: Adapt the includes.
+  
+2010-12-02  Murray Cumming  <murrayc murrayc com>
 
 	Revert the previous commit's removal of newer ComboBox methods.
 
diff --git a/gdk/gdkmm.h b/gdk/gdkmm.h
index 1899865..5f3fdae 100644
--- a/gdk/gdkmm.h
+++ b/gdk/gdkmm.h
@@ -26,7 +26,6 @@
 
 #include <gdkmm/types.h>
 #include <gdkmm/visual.h>
-#include <gdkmm/drawable.h>
 #include <gdkmm/window.h>
 #include <gdkmm/pixbuf.h>
 #include <gdkmm/pixbufanimation.h>
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index d2df4ed..f65b448 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -19,6 +19,7 @@
  */
 
 #include <gdkmm/general.h>
+#include <gdkmm/color.h>
 #include <gdk/gdk.h>
 
 namespace Gdk
diff --git a/gdk/gdkmm/general.h b/gdk/gdkmm/general.h
index 5c9ccac..9cea49c 100644
--- a/gdk/gdkmm/general.h
+++ b/gdk/gdkmm/general.h
@@ -21,6 +21,7 @@
 #define _GDKMM_GENERAL_H
 
 #include <gdkmm/pixbuf.h>
+#include <gdkmm/color.h>
 #include <cairomm/context.h>
 #include <cairomm/region.h>
 
diff --git a/gdk/src/display.hg b/gdk/src/display.hg
index 27c913a..7d20770 100644
--- a/gdk/src/display.hg
+++ b/gdk/src/display.hg
@@ -32,7 +32,6 @@ namespace Gdk
 
 _CC_INCLUDE(gdk/gdk.h)
 
-class Drawable;
 class DeviceManager;
 
  /** Gdk::Display object's purpose is two fold:
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index 768913b..067e172 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -20,7 +20,6 @@ gdkmm_files_hg =		\
 	display.hg		\
 	displaymanager.hg	\
 	dragcontext.hg		\
-	drawable.hg		\
 	event.hg		\
 	pixbuf.hg		\
 	pixbufanimation.hg	\
diff --git a/gdk/src/pixbuf.hg b/gdk/src/pixbuf.hg
index 70acdda..e40dee5 100644
--- a/gdk/src/pixbuf.hg
+++ b/gdk/src/pixbuf.hg
@@ -19,7 +19,7 @@
 // the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
 _CONFIGINCLUDE(gdkmmconfig.h)
 
-#include <gdkmm/drawable.h>
+#include <gdkmm/window.h>
 #include <gdkmm/pixbufformat.h>
 #include <gdkmm/types.h>
 #include <giomm/inputstream.h>
@@ -52,12 +52,33 @@ class Pixbuf : public Glib::Object
 
 protected:
 
-
-  /** Creates a pixbuf object from a drawable.
+  //TODO: Throw an exception when the C function returns NULL?
+  /** Transfers image data from a #GdkWindow and converts it to an RGB(A)
+   * representation inside a Gdk::Pixbuf. In other words, copies
+   * image data from a server-side drawable to a client-side RGB(A) buffer.
+   * This allows you to efficiently read individual pixels on the client side.
+   * 
+   * This function will create an RGB pixbuf with 8 bits per channel with
+   * the same size specified by the @a width and @a height arguments. The pixbuf
+   * will contain an alpha channel if the @a window contains one.
+   *
+   * If the window is off the screen, then there is no image data in the
+   * obscured/offscreen regions to be placed in the pixbuf. The contents of
+   * portions of the pixbuf corresponding to the offscreen region are undefined.
+   *
+   * If the window you're obtaining data from is partially obscured by
+   * other windows, then the contents of the pixbuf areas corresponding
+   * to the obscured regions are undefined.
+   *
+   * If the window is not mapped (typically because it's iconified/minimized
+   * or not on the current workspace), then an invalid object will be returned.
+   *
+   * If memory can't be allocated for the return value, an invalid object will be returned
+   * instead.
    *
-   * @param src Source drawable.
-   * @param src_x Source X coordinate within drawable.
-   * @param src_y Source Y coordinate within drawable.
+   * @param src Source window.
+   * @param src_x Source X coordinate within the window.
+   * @param src_y Source Y coordinate within the window.
    * @param width Width in pixels of region to get.
    * @param height Height in pixels of region to get.
    *
@@ -78,11 +99,32 @@ protected:
 public:
   typedef sigc::slot<void, const guint8*> SlotDestroyData;
 
-  /** Creates a pixbuf object from a drawable.
+  /** Transfers image data from a #GdkWindow and converts it to an RGB(A)
+   * representation inside a Gdk::Pixbuf. In other words, copies
+   * image data from a server-side drawable to a client-side RGB(A) buffer.
+   * This allows you to efficiently read individual pixels on the client side.
+   * 
+   * This function will create an RGB pixbuf with 8 bits per channel with
+   * the same size specified by the @a width and @a height arguments. The pixbuf
+   * will contain an alpha channel if the @a window contains one.
+   *
+   * If the window is off the screen, then there is no image data in the
+   * obscured/offscreen regions to be placed in the pixbuf. The contents of
+   * portions of the pixbuf corresponding to the offscreen region are undefined.
+   *
+   * If the window you're obtaining data from is partially obscured by
+   * other windows, then the contents of the pixbuf areas corresponding
+   * to the obscured regions are undefined.
+   *
+   * If the window is not mapped (typically because it's iconified/minimized
+   * or not on the current workspace), then an invalid object will be returned.
+   *
+   * If memory can't be allocated for the return value, an invalid object will be returned
+   * instead.
    *
-   * @param src Source drawable.
-   * @param src_x Source X coordinate within drawable.
-   * @param src_y Source Y coordinate within drawable.
+   * @param src Source window.
+   * @param src_x Source X coordinate within the window.
+   * @param src_y Source Y coordinate within the window.
    * @param width Width in pixels of region to get.
    * @param height Height in pixels of region to get.
    *
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index cb3f957..3924f5f 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -29,7 +29,7 @@ namespace Gdk
 
 Window::Window(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask)
 :
-  Drawable((GdkDrawable*) gdk_window_new(Glib::unwrap(parent), attributes, attributes_mask))
+  Glib::Object((GObject*) gdk_window_new(Glib::unwrap(parent), attributes, attributes_mask))
 {
   //GdkWindow is X11/win32-specific, so we probably can't derived our own GType.
 }
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index d1dd538..32def1e 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -1,4 +1,4 @@
-/* Copyright(C) 1998-2002 The gtkmm Development Team
+/* Copyright(C) 1998-2010 The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,21 +17,16 @@
 
 _CONFIGINCLUDE(gdkmmconfig.h)
 
-#include <gdkmm/drawable.h>
+#include <glibmm/object.h>
 //#include <gdkmm/cursor.h>
 #include <gdkmm/types.h>
 #include <cairomm/region.h>
+#include <cairomm/pattern.h>
+#include <gdkmm/visual.h>
 #include <gdk/gdk.h>
 
 _DEFS(gdkmm,gdk)
-_PINCLUDE(gdkmm/private/drawable_p.h)
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-extern "C" {
-// Custom struct prototype, because this isn't what the code-generator expects:
-typedef struct _GdkDrawable GdkWindow;
-} // extern "C"
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+_PINCLUDE(glibmm/private/object_p.h)
 
 namespace Gdk
 {
@@ -50,16 +45,17 @@ _WRAP_ENUM(GrabStatus, GdkGrabStatus)
 
 class Cursor;
 class Device;
+class Pixbuf;
 
 /** A Gdk::Window is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such
  * as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as
  * a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Windows. For example, each Gtk::Button has a
  * Gdk::Window associated with it.
  */
-class Window : public Gdk::Drawable
+class Window : public Glib::Object
 {
   // GdkWindow is a typedef to GdkDrawable, but it's actually a GdkWindowObject.
-  _CLASS_GOBJECT(Window, GdkWindow, GDK_WINDOW_OBJECT, Gdk::Drawable, GdkDrawable, GdkWindowObject)
+  _CLASS_GOBJECT(Window, GdkWindow, GDK_WINDOW, Glib::Object, GObject, GdkWindowObject)
   _STRUCT_NOT_HIDDEN
   _IGNORE(gdk_window_set_hints, gdk_window_destroy, gdk_window_new, gdk_window_get_deskrelative_origin)
   _IGNORE(gdk_window_destroy_notify, gdk_window_is_destroyed)
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 2c08cbc..c8e9eca 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -41,7 +41,6 @@ int main(int argc, char** argv)
 #if !defined(G_OS_WIN32)
             << get_defs( GDK_TYPE_DISPLAY_MANAGER )
 #endif /* G_OS_WIN32 */
-            << get_defs( GDK_TYPE_DRAWABLE )
             << get_defs( GDK_TYPE_PIXBUF )
             << get_defs( GDK_TYPE_PIXBUF_ANIMATION )
             << get_defs( GDK_TYPE_PIXBUF_LOADER )



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