Merge lp:~cimi/overlay-scrollbar/fix-anjuta into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 229
Proposed branch: lp:~cimi/overlay-scrollbar/fix-anjuta
Merge into: lp:overlay-scrollbar
Diff against target: 80 lines (+35/-29)
1 file modified
os/os-pager.c (+35/-29)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-anjuta
Reviewer Review Type Date Requested Status
Loïc Molinari (community) Approve
Review via email: mp+59150@code.launchpad.net

Description of the change

Instead doing reparenting, simply destroy the previous window and recreate it

To post a comment you must log in.
Revision history for this message
Loïc Molinari (loic.molinari) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'os/os-pager.c'
2--- os/os-pager.c 2011-04-13 12:59:40 +0000
3+++ os/os-pager.c 2011-04-27 00:46:42 +0000
4@@ -78,41 +78,47 @@
5 static void
6 os_pager_create (OsPager *pager)
7 {
8+ GdkWindowAttr attributes;
9 OsPagerPrivate *priv;
10
11 priv = pager->priv;
12
13+ /* Instead reparenting,
14+ * which doesn't seem to work well,
15+ * destroy the window. */
16 if (priv->pager_window != NULL)
17 {
18- gdk_window_reparent (priv->pager_window,
19- gtk_widget_get_window (priv->parent),
20- priv->allocation.x,
21- priv->allocation.y);
22- }
23- else
24- {
25- GdkWindowAttr attributes;
26-
27- attributes.width = priv->allocation.width;
28- attributes.height = priv->allocation.height;
29- attributes.wclass = GDK_INPUT_OUTPUT;
30- attributes.window_type = GDK_WINDOW_CHILD;
31- attributes.visual = gtk_widget_get_visual (priv->parent);
32- attributes.colormap = gtk_widget_get_colormap (priv->parent);
33-
34- priv->pager_window = gdk_window_new (gtk_widget_get_window (priv->parent),
35- &attributes,
36- GDK_WA_VISUAL | GDK_WA_COLORMAP);
37-
38- g_object_ref_sink (priv->pager_window);
39-
40- gdk_window_set_transient_for (priv->pager_window,
41- gtk_widget_get_window (priv->parent));
42-
43- gdk_window_input_shape_combine_region (priv->pager_window,
44- gdk_region_new (),
45- 0, 0);
46- }
47+ /* From the Gdk documentation:
48+ * "Note that a window will not be destroyed
49+ * automatically when its reference count
50+ * reaches zero. You must call
51+ * gdk_window_destroy ()
52+ * yourself before that happens". */
53+ gdk_window_destroy (priv->pager_window);
54+
55+ g_object_unref (priv->pager_window);
56+ priv->pager_window = NULL;
57+ }
58+
59+ attributes.width = priv->allocation.width;
60+ attributes.height = priv->allocation.height;
61+ attributes.wclass = GDK_INPUT_OUTPUT;
62+ attributes.window_type = GDK_WINDOW_CHILD;
63+ attributes.visual = gtk_widget_get_visual (priv->parent);
64+ attributes.colormap = gtk_widget_get_colormap (priv->parent);
65+
66+ priv->pager_window = gdk_window_new (gtk_widget_get_window (priv->parent),
67+ &attributes,
68+ GDK_WA_VISUAL | GDK_WA_COLORMAP);
69+
70+ g_object_ref_sink (priv->pager_window);
71+
72+ gdk_window_set_transient_for (priv->pager_window,
73+ gtk_widget_get_window (priv->parent));
74+
75+ gdk_window_input_shape_combine_region (priv->pager_window,
76+ gdk_region_new (),
77+ 0, 0);
78 }
79
80 static void

Subscribers

People subscribed via source and target branches