~ubuntu-branches/ubuntu/precise/gtk+2.0/precise-updates

« back to all changes in this revision

Viewing changes to docs/reference/gtk/html/gtk-migrating-ClientSideWindows.html

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2011-09-08 20:30:15 UTC
  • mfrom: (1.14.10 upstream)
  • Revision ID: package-import@ubuntu.com-20110908203015-hmdoq5jt1bl50nq3
Tags: 2.24.6-0ubuntu1
* debian/watch: Look for bz2 tarballs, and restrict to GTK 2 versions.
* New upstream bug fix release.
* Drop 094_git_fileselector_error.patch, include_m4_dir.patch: Included
  upstream.
* 003_gdk.pc_privates.patch, 009_gtk-export-filechooser.patch: Unfuzz.
* debian/libgail-doc.install, debian/libgtk2.0-doc.install.in: Install
  documentation from the source tree, as it's not being installed any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
<a name="gtk-migrating-ClientSideWindows"></a>Migrating to client-side windows</h2></div></div></div>
25
25
<p>
26
26
    In version 2.18, GDK has been changed to use client-side windows. This
27
 
    means that there is no longer a 1-1 correspondence between <a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#GdkWindow"><span class="type">GdkWindows</span></a>
 
27
    means that there is no longer a 1-1 correspondence between <a href="../gdk/gdk-Windows.html#GdkWindow"><span class="type">GdkWindows</span></a>
28
28
    and windows in the underlying window system. In particular, it is no
29
29
    longer correct to assume that each window has an associated XID.
30
30
    Code that makes this assumption can sometimes be fixed by calling
31
 
    <a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#gdk-window-ensure-native"><code class="function">gdk_window_ensure_native()</code></a> on the windows in question.
32
 
    Calling <a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#gdk-x11-drawable-get-xid"><code class="function">gdk_x11_drawable_get_xid()</code></a> (or <a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a>) from the
 
31
    <a href="../gdk/gdk-Windows.html#gdk-window-ensure-native"><code class="function">gdk_window_ensure_native()</code></a> on the windows in question.
 
32
    Calling <a href="../gdk/gdk-X-Window-System-Interaction.html#gdk-x11-drawable-get-xid"><code class="function">gdk_x11_drawable_get_xid()</code></a> (or <a href="../gdk/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a>) from the
33
33
    X11-specific API on a non-native window will explicitly call
34
 
    <a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#gdk-window-ensure-native"><code class="function">gdk_window_ensure_native()</code></a>, so old code using this will continue to
35
 
    work. A small gotcha is that the <a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a> call is no longer a
 
34
    <a href="../gdk/gdk-Windows.html#gdk-window-ensure-native"><code class="function">gdk_window_ensure_native()</code></a>, so old code using this will continue to
 
35
    work. A small gotcha is that the <a href="../gdk/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a> call is no longer a
36
36
    trivial accessor for the XID of the window, and thus must not be called
37
37
    from another thread without taking locking precautions.
38
38
  </p>
48
48
    using <code class="function">XRestackWindows()</code>. Fixing this properly requires to fix the code
49
49
    to use GDK functions to achieve whatever it is trying to achieve.
50
50
    To make this easier in the case of stacking order changes, we've added
51
 
    a <a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#gdk-window-restack"><code class="function">gdk_window_restack()</code></a> function.
 
51
    a <a href="../gdk/gdk-Windows.html#gdk-window-restack"><code class="function">gdk_window_restack()</code></a> function.
52
52
  </p>
53
53
<p>
54
54
    One change that can cause problems for some applications is that GDK
59
59
<p>
60
60
    Problems can also occur when using cairo for drawing. One thing that can
61
61
    go wrong is clip handling. If you ever need to reset the clip region on
62
 
    a cairo_t (i.e. use <a href="/home/mclasen/gnome-3.0/install/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-reset-clip"><code class="function">cairo_reset_clip()</code></a>), you have to to use
63
 
    <a href="http://library.gnome.org/devel/gdk3/gdk-Cairo-Interaction.html#gdk-cairo-reset-clip"><code class="function">gdk_cairo_reset_clip()</code></a> instead. The reason for this is that the <a href="/home/mclasen/gnome-3.0/install/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-reset-clip"><code class="function">cairo_reset_clip()</code></a> call will remove the initial clip region that limits your drawing to
 
62
    a cairo_t (i.e. use <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-reset-clip"><code class="function">cairo_reset_clip()</code></a>), you have to to use
 
63
    <a href="../gdk/gdk-Cairo-Interaction.html#gdk-cairo-reset-clip"><code class="function">gdk_cairo_reset_clip()</code></a> instead. The reason for this is that the <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-reset-clip"><code class="function">cairo_reset_clip()</code></a> call will remove the initial clip region that limits your drawing to
64
64
    the client-side window at hand, so you will end up drawing over stuff
65
 
    outside the window. You also need to use <a href="http://library.gnome.org/devel/gdk3/gdk-Cairo-Interaction.html#gdk-cairo-reset-clip"><code class="function">gdk_cairo_reset_clip()</code></a> if you
 
65
    outside the window. You also need to use <a href="../gdk/gdk-Cairo-Interaction.html#gdk-cairo-reset-clip"><code class="function">gdk_cairo_reset_clip()</code></a> if you
66
66
    use a cairo_t that was not allocated in a double-buffered expose handler
67
67
    and keep it in use after window hierarchy changes (resizing, moving,
68
68
    stacking order changes). The easiest fix for this kind of problem is to
69
69
    simply create a new cairo context for each expose event.
70
70
  </p>
71
71
<p>
72
 
    Due to a weird API in XClearArea the <a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#gdk-window-clear-area"><code class="function">gdk_window_clear_area()</code></a> call handled
 
72
    Due to a weird API in XClearArea the <a href="../gdk/gdk-Windows.html#gdk-window-clear-area"><code class="function">gdk_window_clear_area()</code></a> call handled
73
73
    a specified width or height of zero to mean "to end of window" for
74
74
    non-double-buffered drawing. This has been changed to be consistent with
75
75
    the docs and what happens in the double-buffered case. All code in GTK+
76
76
    that relied on this has been fixed, but it is possible (although unlikely)
77
77
    that third party applications rely on this. If you need to do this, just
78
 
    implement it yourself using <a href="http://library.gnome.org/devel/gdk3/gdk-Drawing-Primitives.html#gdk-drawable-get-size"><code class="function">gdk_drawable_get_size()</code></a>.
 
78
    implement it yourself using <a href="../gdk/gdk-Drawing-Primitives.html#gdk-drawable-get-size"><code class="function">gdk_drawable_get_size()</code></a>.
79
79
  </p>
80
80
</div>
81
81
<div class="footer">