[gtk+] Add a migration guide section about multiple backends



commit 985b0e57b25f2db06f94ae941d65766079a2a703
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 13 23:40:47 2011 -0500

    Add a migration guide section about multiple backends

 docs/reference/gtk/migrating-2to3.xml |   43 +++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-2to3.xml b/docs/reference/gtk/migrating-2to3.xml
index d9bb6a3..6022ce7 100644
--- a/docs/reference/gtk/migrating-2to3.xml
+++ b/docs/reference/gtk/migrating-2to3.xml
@@ -747,6 +747,49 @@ on_alpha_screen_changed (GtkWindow *window,
   </section>
 
   <section>
+    <title>Backend-specific code</title>
+    <para>
+      In GTK+ 2.x, GDK could only be compiled for one backend at a time,
+      and the %GDK_WINDOWING_X11 or %GDK_WINDOWING_WIN32 macros could
+      be used to find out which one you are dealing with:
+      <informalexample><programlisting>
+#ifdef GDK_WINDOWING_X11
+      if (timestamp != GDK_CURRENT_TIME)
+        gdk_x11_window_set_user_time (gdk_window, timestamp);
+#endif
+#ifdef GDK_WINDOWING_WIN32
+        /* ... win32 specific code ... */
+#endif
+      </programlisting></informalexample>
+      In GTK+ 3, GDK can be built with multiple backends, and currently
+      used backend has to be determined at runtime, typically using
+      type-check macros on a #GdkDisplay or #GdkWindow. You still need
+      to use the #GDK_WINDOWING macros to only compile code referring
+      to supported backends:
+      <informalexample><programlisting>
+#ifdef GDK_WINDOWING_X11
+      if (GDK_IS_X11_DISPLAY (display))
+        {
+          if (timestamp != GDK_CURRENT_TIME)
+            gdk_x11_window_set_user_time (gdk_window, timestamp);
+        }
+      else
+#endif
+#ifdef GDK_WINDOWING_WIN32
+      if (GDK_IS_WIN32_DISPLAY (display))
+        {
+          /* ... win32 specific code ... */
+        }
+      else
+#endif
+       {
+         g_warning ("Unsupported GDK backend");
+       }
+      </programlisting></informalexample>
+    </para>
+  </section>
+
+  <section>
     <title>The GtkWidget::draw signal</title>
     <para>
       The GtkWidget #GtkWidget::expose-event signal has been replaced by



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