Merge lp:~cyphermox/seamonkey/lp575160 into lp:~mozillateam/seamonkey/seamonkey-2.0.dev

Proposed by Mathieu Trudel-Lapierre
Status: Merged
Merged at revision: 233
Proposed branch: lp:~cyphermox/seamonkey/lp575160
Merge into: lp:~mozillateam/seamonkey/seamonkey-2.0.dev
Diff against target: 1481 lines (+1451/-1)
3 files modified
debian/changelog (+8/-1)
debian/patches/lp575160_destroy_child_windows.patch (+1442/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~cyphermox/seamonkey/lp575160
Reviewer Review Type Date Requested Status
Mozilla Team Pending
Review via email: mp+37196@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-09-27 12:16:56 +0000
3+++ debian/changelog 2010-09-30 22:17:46 +0000
4@@ -1,5 +1,6 @@
5 seamonkey (2.0.8+build1+nobinonly-0ubuntu2) UNRELEASED; urgency=low
6
7+ [ Chris Coulson ]
8 * Fix LP: #646632 - No dictionaries present in Seamonkey. Ship a
9 symlink to the system dictionaries and add the necessary postinst
10 magic to fix current 2.0.8 users
11@@ -7,7 +8,13 @@
12 - update debian/rules
13 - update debian/seamonkey-browser.install
14
15- -- Chris Coulson <chris.coulson@canonical.com> Mon, 27 Sep 2010 13:14:31 +0100
16+ [ Mathieu Trudel-Lapierre ]
17+ * Fix LP: #575160 - Apply patch set from Debian iceape to fix RenderBadPicture
18+ errors: properly walk through child windows as a window is destroyed.
19+ - update debian/patches/series
20+ - add debian/patches/lp575160_destroy_child_windows.patch
21+
22+ -- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Thu, 30 Sep 2010 18:12:01 -0400
23
24 seamonkey (2.0.8+build1+nobinonly-0ubuntu1) maverick; urgency=low
25
26
27=== added file 'debian/patches/lp575160_destroy_child_windows.patch'
28--- debian/patches/lp575160_destroy_child_windows.patch 1970-01-01 00:00:00 +0000
29+++ debian/patches/lp575160_destroy_child_windows.patch 2010-09-30 22:17:46 +0000
30@@ -0,0 +1,1442 @@
31+From: Mike Hommey <glandium@debian.org>
32+Subject: patches from Debian applied to 1.9.1 for seamonkey/iceape
33+Bug-Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=522635
34+Bug-Ubuntu: https://launchpad.net/bugs/575160
35+Last-Updated: 2010-09-30
36+
37+This patchset was added following a comment by Karl Tomlinson [0] on the
38+Mozilla bug indicating the patchset from Mike Hommey [1] could be applied
39+by distributions if using system cairo.
40+
41+[0] - https://bugzilla.mozilla.org/show_bug.cgi?id=522635#c43
42+[1] - https://bugzilla.mozilla.org/show_bug.cgi?id=522635#c21
43+
44+--- a/mozilla/widget/src/gtk2/Makefile.in
45++++ a/mozilla/widget/src/gtk2/Makefile.in
46+@@ -78,7 +78,6 @@ endif
47+
48+ CSRCS = \
49+ mozcontainer.c \
50+- mozdrawingarea.c \
51+ keysym2ucs.c \
52+ nsPrintdGTK.c \
53+ $(NULL)
54+@@ -152,7 +151,6 @@ endif
55+ EXPORTS = \
56+ nsGTKToolkit.h \
57+ nsIImageToPixbuf.h \
58+- mozdrawingarea.h \
59+ mozcontainer.h \
60+ $(NULL)
61+
62+--- a/mozilla/widget/src/gtk2/mozcontainer.c
63++++ a/mozilla/widget/src/gtk2/mozcontainer.c
64+@@ -294,8 +294,15 @@ moz_container_realize (GtkWidget *widget)
65+
66+ /* create the shell window */
67+
68+- attributes.event_mask = gtk_widget_get_events (widget);
69+- attributes.event_mask |= (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK);
70++ attributes.event_mask = (gtk_widget_get_events (widget) |
71++ GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
72++ GDK_VISIBILITY_NOTIFY_MASK |
73++ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
74++ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
75++#ifdef HAVE_GTK_MOTION_HINTS
76++ GDK_POINTER_MOTION_HINT_MASK |
77++#endif
78++ GDK_POINTER_MOTION_MASK);
79+ attributes.x = widget->allocation.x;
80+ attributes.y = widget->allocation.y;
81+ attributes.width = widget->allocation.width;
82+--- a/mozilla/widget/src/gtk2/mozcontainer.h
83++++ a/mozilla/widget/src/gtk2/mozcontainer.h
84+@@ -40,6 +40,7 @@
85+ #define __MOZ_CONTAINER_H__
86+
87+ #include <gtk/gtkcontainer.h>
88++#include <gtk/gtkversion.h>
89+
90+ #ifdef __cplusplus
91+ extern "C" {
92+@@ -83,6 +84,11 @@ extern "C" {
93+ #define IS_MOZ_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE))
94+ #define MOZ_CONAINTER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
95+
96++#if (GTK_CHECK_VERSION(2, 12, 0) || \
97++ (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON)))
98++#define HAVE_GTK_MOTION_HINTS
99++#endif
100++
101+ typedef struct _MozContainer MozContainer;
102+ typedef struct _MozContainerClass MozContainerClass;
103+
104+--- a/mozilla/widget/src/gtk2/mozdrawingarea.c
105++++ a/mozilla/widget/src/gtk2/mozdrawingarea.c
106+@@ -1,241 +0,0 @@
107+-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
108+-/* vim:expandtab:shiftwidth=4:tabstop=4:
109+- */
110+-/* ***** BEGIN LICENSE BLOCK *****
111+- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
112+- *
113+- * The contents of this file are subject to the Mozilla Public License Version
114+- * 1.1 (the "License"); you may not use this file except in compliance with
115+- * the License. You may obtain a copy of the License at
116+- * http://www.mozilla.org/MPL/
117+- *
118+- * Software distributed under the License is distributed on an "AS IS" basis,
119+- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
120+- * for the specific language governing rights and limitations under the
121+- * License.
122+- *
123+- * The Original Code is mozilla.org code.
124+- *
125+- * The Initial Developer of the Original Code is Christopher Blizzard
126+- * <blizzard@mozilla.org>. Portions created by the Initial Developer
127+- * are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
128+- *
129+- * Contributor(s):
130+- *
131+- * Alternatively, the contents of this file may be used under the terms of
132+- * either the GNU General Public License Version 2 or later (the "GPL"), or
133+- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
134+- * in which case the provisions of the GPL or the LGPL are applicable instead
135+- * of those above. If you wish to allow use of your version of this file only
136+- * under the terms of either the GPL or the LGPL, and not to allow others to
137+- * use your version of this file under the terms of the MPL, indicate your
138+- * decision by deleting the provisions above and replace them with the notice
139+- * and other provisions required by the GPL or the LGPL. If you do not delete
140+- * the provisions above, a recipient may use your version of this file under
141+- * the terms of any one of the MPL, the GPL or the LGPL.
142+- *
143+- * ***** END LICENSE BLOCK ***** */
144+-
145+-#include "mozdrawingarea.h"
146+-
147+-/* init methods */
148+-static void moz_drawingarea_class_init (MozDrawingareaClass *klass);
149+-static void moz_drawingarea_init (MozDrawingarea *drawingarea);
150+-
151+-/* static methods */
152+-static void moz_drawingarea_create_windows (MozDrawingarea *drawingarea,
153+- GdkWindow *parent,
154+- GtkWidget *widget,
155+- GdkVisual *visual);
156+-
157+-static void moz_drawingarea_finalize (GObject *object);
158+-
159+-static GObjectClass *parent_class = NULL;
160+-
161+-GtkType
162+-moz_drawingarea_get_type(void)
163+-{
164+- static GtkType moz_drawingarea_type = 0;
165+-
166+- if (!moz_drawingarea_type) {
167+- static GTypeInfo moz_drawingarea_info = {
168+- sizeof(MozDrawingareaClass), /* class size */
169+- NULL, /* base_init */
170+- NULL, /* base_finalize */
171+- (GClassInitFunc) moz_drawingarea_class_init, /* class_init */
172+- NULL, /* class_destroy */
173+- NULL, /* class_data */
174+- sizeof(MozDrawingarea), /* instance_size */
175+- 0, /* n_preallocs */
176+- (GInstanceInitFunc) moz_drawingarea_init, /* instance_init */
177+- NULL, /* value_table */
178+- };
179+- moz_drawingarea_type =
180+- g_type_register_static (G_TYPE_OBJECT,
181+- "MozDrawingarea",
182+- &moz_drawingarea_info, 0);
183+- }
184+-
185+- return moz_drawingarea_type;
186+-}
187+-
188+-MozDrawingarea *
189+-moz_drawingarea_new (MozDrawingarea *parent, MozContainer *widget_parent,
190+- GdkVisual *visual)
191+-{
192+- MozDrawingarea *drawingarea;
193+-
194+- drawingarea = g_object_new(MOZ_DRAWINGAREA_TYPE, NULL);
195+-
196+- if (!parent)
197+- moz_drawingarea_create_windows(drawingarea,
198+- GTK_WIDGET(widget_parent)->window,
199+- GTK_WIDGET(widget_parent),
200+- visual);
201+- else
202+- moz_drawingarea_create_windows(drawingarea,
203+- parent->inner_window,
204+- GTK_WIDGET(widget_parent),
205+- visual);
206+-
207+- return drawingarea;
208+-}
209+-
210+-void
211+-moz_drawingarea_class_init (MozDrawingareaClass *klass)
212+-{
213+- GObjectClass *object_class = G_OBJECT_CLASS (klass);
214+-
215+- object_class->finalize = moz_drawingarea_finalize;
216+-
217+- parent_class = g_type_class_peek_parent(klass);
218+-}
219+-
220+-void
221+-moz_drawingarea_init (MozDrawingarea *drawingarea)
222+-{
223+-
224+-}
225+-
226+-void
227+-moz_drawingarea_reparent (MozDrawingarea *drawingarea, GdkWindow *aNewParent)
228+-{
229+- gdk_window_reparent(drawingarea->clip_window,
230+- aNewParent, 0, 0);
231+-}
232+-
233+-void
234+-moz_drawingarea_create_windows (MozDrawingarea *drawingarea, GdkWindow *parent,
235+- GtkWidget *widget, GdkVisual *visual)
236+-{
237+- GdkWindowAttr attributes;
238+- gint attributes_mask = 0;
239+-
240+- /* create the clipping window */
241+- attributes.event_mask = 0;
242+- attributes.x = 0;
243+- attributes.y = 0;
244+- attributes.width = 1;
245+- attributes.height = 1;
246+- attributes.wclass = GDK_INPUT_OUTPUT;
247+- attributes.window_type = GDK_WINDOW_CHILD;
248+- if (!visual) {
249+- attributes.visual = gtk_widget_get_visual (widget);
250+- attributes.colormap = gtk_widget_get_colormap (widget);
251+- } else {
252+- attributes.visual = visual;
253+- attributes.colormap = gdk_colormap_new(visual, 0);
254+- }
255+-
256+- attributes_mask |= GDK_WA_VISUAL | GDK_WA_COLORMAP |
257+- GDK_WA_X | GDK_WA_Y;
258+-
259+- drawingarea->clip_window = gdk_window_new (parent, &attributes,
260+- attributes_mask);
261+- gdk_window_set_user_data(drawingarea->clip_window, widget);
262+-
263+- /* set the default pixmap to None so that you don't end up with the
264+- gtk default which is BlackPixel. */
265+- gdk_window_set_back_pixmap(drawingarea->clip_window, NULL, FALSE);
266+-
267+- attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
268+- GDK_VISIBILITY_NOTIFY_MASK |
269+- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
270+- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
271+-#ifdef HAVE_GTK_MOTION_HINTS
272+- GDK_POINTER_MOTION_HINT_MASK |
273+-#endif
274+- GDK_POINTER_MOTION_MASK);
275+- /* create the inner window */
276+- drawingarea->inner_window = gdk_window_new (drawingarea->clip_window,
277+- &attributes, attributes_mask);
278+- gdk_window_set_user_data(drawingarea->inner_window, widget);
279+-
280+- /* set the default pixmap to None so that you don't end up with the
281+- gtk default which is BlackPixel. */
282+- gdk_window_set_back_pixmap(drawingarea->inner_window, NULL, FALSE);
283+-
284+- if (visual) {
285+- g_object_unref(attributes.colormap);
286+- }
287+-}
288+-
289+-void
290+-moz_drawingarea_finalize (GObject *object)
291+-{
292+- MozDrawingarea *drawingarea;
293+- gpointer user_data;
294+-
295+- g_return_if_fail(IS_MOZ_DRAWINGAREA(object));
296+-
297+- drawingarea = MOZ_DRAWINGAREA(object);
298+-
299+- gdk_window_destroy(drawingarea->inner_window);
300+- gdk_window_destroy(drawingarea->clip_window);
301+-
302+- (* parent_class->finalize) (object);
303+-}
304+-
305+-void
306+-moz_drawingarea_move (MozDrawingarea *drawingarea,
307+- gint x, gint y)
308+-{
309+- gdk_window_move(drawingarea->clip_window, x, y);
310+-}
311+-
312+-void
313+-moz_drawingarea_resize (MozDrawingarea *drawingarea,
314+- gint width, gint height)
315+-{
316+- gdk_window_resize(drawingarea->clip_window, width, height);
317+- gdk_window_resize(drawingarea->inner_window, width, height);
318+-}
319+-
320+-void
321+-moz_drawingarea_move_resize (MozDrawingarea *drawingarea,
322+- gint x, gint y, gint width, gint height)
323+-{
324+- gdk_window_resize(drawingarea->inner_window, width, height);
325+- gdk_window_move_resize(drawingarea->clip_window, x, y, width, height);
326+-}
327+-
328+-void
329+-moz_drawingarea_set_visibility (MozDrawingarea *drawingarea,
330+- gboolean visibility)
331+-{
332+- if (visibility) {
333+- gdk_window_show_unraised(drawingarea->inner_window);
334+- gdk_window_show_unraised(drawingarea->clip_window);
335+- }
336+- else {
337+- gdk_window_hide(drawingarea->clip_window);
338+- gdk_window_hide(drawingarea->inner_window);
339+- }
340+-}
341+-
342+-void
343+-moz_drawingarea_scroll (MozDrawingarea *drawingarea,
344+- gint x, gint y)
345+-{
346+- gdk_window_scroll(drawingarea->inner_window, x, y);
347+-}
348+--- a/mozilla/widget/src/gtk2/mozdrawingarea.h
349++++ a/mozilla/widget/src/gtk2/mozdrawingarea.h
350+@@ -1,101 +0,0 @@
351+-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
352+-/* vim:expandtab:shiftwidth=4:tabstop=4:
353+- */
354+-/* ***** BEGIN LICENSE BLOCK *****
355+- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
356+- *
357+- * The contents of this file are subject to the Mozilla Public License Version
358+- * 1.1 (the "License"); you may not use this file except in compliance with
359+- * the License. You may obtain a copy of the License at
360+- * http://www.mozilla.org/MPL/
361+- *
362+- * Software distributed under the License is distributed on an "AS IS" basis,
363+- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
364+- * for the specific language governing rights and limitations under the
365+- * License.
366+- *
367+- * The Original Code is mozilla.org code.
368+- *
369+- * The Initial Developer of the Original Code is Christopher Blizzard
370+- * <blizzard@mozilla.org>. Portions created by the Initial Developer
371+- * are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
372+- *
373+- * Contributor(s):
374+- *
375+- * Alternatively, the contents of this file may be used under the terms of
376+- * either the GNU General Public License Version 2 or later (the "GPL"), or
377+- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
378+- * in which case the provisions of the GPL or the LGPL are applicable instead
379+- * of those above. If you wish to allow use of your version of this file only
380+- * under the terms of either the GPL or the LGPL, and not to allow others to
381+- * use your version of this file under the terms of the MPL, indicate your
382+- * decision by deleting the provisions above and replace them with the notice
383+- * and other provisions required by the GPL or the LGPL. If you do not delete
384+- * the provisions above, a recipient may use your version of this file under
385+- * the terms of any one of the MPL, the GPL or the LGPL.
386+- *
387+- * ***** END LICENSE BLOCK ***** */
388+-
389+-#ifndef __MOZ_DRAWINGAREA_H__
390+-#define __MOZ_DRAWINGAREA_H__
391+-
392+-#include <gdk/gdkwindow.h>
393+-#include <gtk/gtkversion.h>
394+-#include "mozcontainer.h"
395+-
396+-#ifdef __cplusplus
397+-extern "C" {
398+-#endif /* __cplusplus */
399+-
400+-#define MOZ_DRAWINGAREA_TYPE (moz_drawingarea_get_type())
401+-#define MOZ_DRAWINGAREA(obj) (GTK_CHECK_CAST((obj), MOZ_DRAWINGAREA_TYPE, MozDrawingarea))
402+-#define MOZ_DRAWINGAREA_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), MOZ_DRAWINGAREA_TYPE, MozDrawingareaClass))
403+-#define IS_MOZ_DRAWINGAREA(obj) (GTK_CHECK_TYPE((obj), MOZ_DRAWINGAREA_TYPE))
404+-#define IS_MOZ_DRAWINGAREA_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), MOZ_DRAWINGAREA_TYPE))
405+-#define MOZ_DRAWINGAREA_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), MOZ_DRAWINGAREA_TYPE, MozDrawingareaClass))
406+-
407+-#if (GTK_CHECK_VERSION(2, 12, 0) || \
408+- (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON)))
409+-#define HAVE_GTK_MOTION_HINTS
410+-#endif
411+-
412+-typedef struct _MozDrawingarea MozDrawingarea;
413+-typedef struct _MozDrawingareaClass MozDrawingareaClass;
414+-
415+-struct _MozDrawingarea
416+-{
417+- GObject parent_instance;
418+- /* AFAIK this clip_window (and thus this whole class) exists solely to
419+- * make gdk_window_scroll() smooth for nsIWidget::Scroll(). */
420+- GdkWindow *clip_window;
421+- GdkWindow *inner_window;
422+-};
423+-
424+-struct _MozDrawingareaClass
425+-{
426+- GObjectClass parent_class;
427+-};
428+-
429+-GtkType moz_drawingarea_get_type (void);
430+-MozDrawingarea *moz_drawingarea_new (MozDrawingarea *parent,
431+- MozContainer *widget_parent,
432+- GdkVisual *visual);
433+-void moz_drawingarea_reparent (MozDrawingarea *drawingarea,
434+- GdkWindow *aNewParent);
435+-void moz_drawingarea_move (MozDrawingarea *drawingarea,
436+- gint x, gint y);
437+-void moz_drawingarea_resize (MozDrawingarea *drawingarea,
438+- gint width, gint height);
439+-void moz_drawingarea_move_resize (MozDrawingarea *drawingarea,
440+- gint x, gint y,
441+- gint width, gint height);
442+-void moz_drawingarea_set_visibility (MozDrawingarea *drawingarea,
443+- gboolean visibility);
444+-void moz_drawingarea_scroll (MozDrawingarea *drawingarea,
445+- gint x, gint y);
446+-
447+-#ifdef __cplusplus
448+-}
449+-#endif /* __cplusplus */
450+-
451+-#endif /* __MOZ_DRAWINGAREA_H__ */
452+--- a/mozilla/widget/src/gtk2/nsWindow.cpp
453++++ a/mozilla/widget/src/gtk2/nsWindow.cpp
454+@@ -368,7 +368,7 @@ nsWindow::nsWindow()
455+ mPreferredWidth = 0;
456+ mPreferredHeight = 0;
457+ mContainer = nsnull;
458+- mDrawingarea = nsnull;
459++ mGdkWindow = nsnull;
460+ mShell = nsnull;
461+ mWindowGroup = nsnull;
462+ mContainerGotFocus = PR_FALSE;
463+@@ -673,9 +673,7 @@ CheckDestroyInvisibleContainer()
464+
465+ // Change the containing GtkWidget on a sub-hierarchy of GdkWindows belonging
466+ // to aOldWidget and rooted at aWindow, and reparent any child GtkWidgets of
467+-// the GdkWindow hierarchy. If aNewWidget is NULL, the reference to
468+-// aOldWidget is removed from its GdkWindows, and child GtkWidgets are
469+-// destroyed.
470++// the GdkWindow hierarchy to aNewWidget.
471+ static void
472+ SetWidgetForHierarchy(GdkWindow *aWindow,
473+ GtkWidget *aOldWidget,
474+@@ -694,13 +692,7 @@ SetWidgetForHierarchy(GdkWindow *aWindow,
475+
476+ // This window belongs to a child widget, which will no longer be a
477+ // child of aOldWidget.
478+- if (aNewWidget) {
479+- gtk_widget_reparent(widget, aNewWidget);
480+- } else {
481+- // aNewWidget == NULL indicates that the window is about to be
482+- // destroyed.
483+- gtk_widget_destroy(widget);
484+- }
485++ gtk_widget_reparent(widget, aNewWidget);
486+
487+ return;
488+ }
489+@@ -714,6 +706,30 @@ SetWidgetForHierarchy(GdkWindow *aWindow,
490+ gdk_window_set_user_data(aWindow, aNewWidget);
491+ }
492+
493++// Walk the list of child windows and call destroy on them.
494++void
495++nsWindow::DestroyChildWindows()
496++{
497++ if (!mGdkWindow)
498++ return;
499++
500++ while (GList *children = gdk_window_peek_children(mGdkWindow)) {
501++ GdkWindow *child = GDK_WINDOW(children->data);
502++ nsWindow *kid = get_window_for_gdk_window(child);
503++ if (kid) {
504++ kid->Destroy();
505++ } else {
506++ // This child is not an nsWindow.
507++ // Destroy the child GtkWidget.
508++ gpointer data;
509++ gdk_window_get_user_data(child, &data);
510++ if (GTK_IS_WIDGET(data)) {
511++ gtk_widget_destroy(static_cast<GtkWidget*>(data));
512++ }
513++ }
514++ }
515++}
516++
517+ NS_IMETHODIMP
518+ nsWindow::Destroy(void)
519+ {
520+@@ -751,15 +767,6 @@ nsWindow::Destroy(void)
521+
522+ NativeShow(PR_FALSE);
523+
524+- // walk the list of children and call destroy on them. Have to be
525+- // careful, though -- calling destroy on a kid may actually remove
526+- // it from our child list, losing its sibling links.
527+- for (nsIWidget* kid = mFirstChild; kid; ) {
528+- nsIWidget* next = kid->GetNextSibling();
529+- kid->Destroy();
530+- kid = next;
531+- }
532+-
533+ #ifdef USE_XIM
534+ IMEDestroyContext();
535+ #endif
536+@@ -796,35 +803,26 @@ nsWindow::Destroy(void)
537+ gtk_widget_destroy(mShell);
538+ mShell = nsnull;
539+ mContainer = nsnull;
540++ NS_ABORT_IF_FALSE(!mGdkWindow,
541++ "mGdkWindow should be NULL when mContainer is destroyed");
542+ }
543+ else if (mContainer) {
544+ gtk_widget_destroy(GTK_WIDGET(mContainer));
545+ mContainer = nsnull;
546++ NS_ABORT_IF_FALSE(!mGdkWindow,
547++ "mGdkWindow should be NULL when mContainer is destroyed");
548+ }
549+- else if (owningWidget) {
550+- // Remove references from GdkWindows back to their container
551+- // widget while the GdkWindow hierarchy is still available.
552+- // (OnContainerUnrealize does this when the MozContainer widget is
553+- // destroyed.)
554+- SetWidgetForHierarchy(mDrawingarea->clip_window, owningWidget, NULL);
555+- }
556+-
557+- if (mDrawingarea) {
558+- g_object_set_data(G_OBJECT(mDrawingarea->clip_window),
559+- "nsWindow", NULL);
560+- g_object_set_data(G_OBJECT(mDrawingarea->inner_window),
561+- "nsWindow", NULL);
562+-
563+- g_object_set_data(G_OBJECT(mDrawingarea->clip_window),
564+- "mozdrawingarea", NULL);
565+- g_object_set_data(G_OBJECT(mDrawingarea->inner_window),
566+- "mozdrawingarea", NULL);
567+-
568+- NS_ASSERTION(!get_gtk_widget_for_gdk_window(mDrawingarea->inner_window),
569+- "widget reference not removed");
570++ else if (mGdkWindow) {
571++ // Destroy child windows to ensure that their mThebesSurfaces are
572++ // released and to remove references from GdkWindows back to their
573++ // container widget. (OnContainerUnrealize() does this when the
574++ // MozContainer widget is destroyed.)
575++ DestroyChildWindows();
576+
577+- g_object_unref(mDrawingarea);
578+- mDrawingarea = nsnull;
579++ gdk_window_set_user_data(mGdkWindow, NULL);
580++ g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
581++ gdk_window_destroy(mGdkWindow);
582++ mGdkWindow = nsnull;
583+ }
584+
585+ if (gInvisibleContainer && owningWidget == gInvisibleContainer) {
586+@@ -851,7 +849,7 @@ nsWindow::GetParent(void)
587+ NS_IMETHODIMP
588+ nsWindow::SetParent(nsIWidget *aNewParent)
589+ {
590+- if (mContainer || !mDrawingarea || !mParent) {
591++ if (mContainer || !mGdkWindow || !mParent) {
592+ NS_NOTREACHED("nsWindow::SetParent - reparenting a non-child window");
593+ return NS_ERROR_NOT_IMPLEMENTED;
594+ }
595+@@ -866,12 +864,12 @@ nsWindow::SetParent(nsIWidget *aNewParent)
596+ if (!oldContainer) {
597+ // The GdkWindows have been destroyed so there is nothing else to
598+ // reparent.
599+- NS_ABORT_IF_FALSE(GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed,
600++ NS_ABORT_IF_FALSE(GDK_WINDOW_OBJECT(mGdkWindow)->destroyed,
601+ "live GdkWindow with no widget");
602+ return NS_OK;
603+ }
604+
605+- NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed,
606++ NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(mGdkWindow)->destroyed,
607+ "destroyed GdkWindow with widget");
608+
609+ GdkWindow* newParentWindow = NULL;
610+@@ -901,11 +899,10 @@ nsWindow::SetParent(nsIWidget *aNewParent)
611+ if (newContainer != oldContainer) {
612+ NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(newParentWindow)->destroyed,
613+ "destroyed GdkWindow with widget");
614+- SetWidgetForHierarchy(mDrawingarea->clip_window, oldContainer,
615+- newContainer);
616++ SetWidgetForHierarchy(mGdkWindow, oldContainer, newContainer);
617+ }
618+
619+- moz_drawingarea_reparent(mDrawingarea, newParentWindow);
620++ gdk_window_reparent(mGdkWindow, newParentWindow, 0, 0);
621+ }
622+
623+ return NS_OK;
624+@@ -1216,8 +1213,8 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
625+ if (mIsTopLevel) {
626+ gtk_window_move(GTK_WINDOW(mShell), aX, aY);
627+ }
628+- else if (mDrawingarea) {
629+- moz_drawingarea_move(mDrawingarea, aX, aY);
630++ else if (mGdkWindow) {
631++ gdk_window_move(mGdkWindow, aX, aY);
632+ }
633+
634+ return NS_OK;
635+@@ -1244,19 +1241,19 @@ nsWindow::SetZIndex(PRInt32 aZIndex)
636+
637+ NS_ASSERTION(!mContainer, "Expected Mozilla child widget");
638+
639+- // We skip the nsWindows that don't have mDrawingareas.
640++ // We skip the nsWindows that don't have mGdkWindows.
641+ // These are probably in the process of being destroyed.
642+
643+ if (!GetNextSibling()) {
644+ // We're to be on top.
645+- if (mDrawingarea)
646+- gdk_window_raise(mDrawingarea->clip_window);
647++ if (mGdkWindow)
648++ gdk_window_raise(mGdkWindow);
649+ } else {
650+ // All the siblings before us need to be below our widget.
651+ for (nsWindow* w = this; w;
652+ w = static_cast<nsWindow*>(w->GetPrevSibling())) {
653+- if (w->mDrawingarea)
654+- gdk_window_lower(w->mDrawingarea->clip_window);
655++ if (w->mGdkWindow)
656++ gdk_window_lower(w->mGdkWindow);
657+ }
658+ }
659+ return NS_OK;
660+@@ -1500,7 +1497,7 @@ nsWindow::SetCursor(nsCursor aCursor)
661+ {
662+ // if we're not the toplevel window pass up the cursor request to
663+ // the toplevel window to handle it.
664+- if (!mContainer && mDrawingarea) {
665++ if (!mContainer && mGdkWindow) {
666+ nsWindow *window = GetContainerWindow();
667+ if (!window)
668+ return NS_ERROR_FAILURE;
669+@@ -1583,7 +1580,7 @@ nsWindow::SetCursor(imgIContainer* aCursor,
670+ {
671+ // if we're not the toplevel window pass up the cursor request to
672+ // the toplevel window to handle it.
673+- if (!mContainer && mDrawingarea) {
674++ if (!mContainer && mGdkWindow) {
675+ nsWindow *window = GetContainerWindow();
676+ if (!window)
677+ return NS_ERROR_FAILURE;
678+@@ -1710,10 +1707,10 @@ nsWindow::Validate()
679+ {
680+ // Get the update for this window and, well, just drop it on the
681+ // floor.
682+- if (!mDrawingarea)
683++ if (!mGdkWindow)
684+ return NS_OK;
685+
686+- GdkRegion *region = gdk_window_get_update_area(mDrawingarea->inner_window);
687++ GdkRegion *region = gdk_window_get_update_area(mGdkWindow);
688+
689+ if (region)
690+ gdk_region_destroy(region);
691+@@ -1724,6 +1721,9 @@ nsWindow::Validate()
692+ NS_IMETHODIMP
693+ nsWindow::Invalidate(PRBool aIsSynchronous)
694+ {
695++ if (!mGdkWindow)
696++ return NS_OK;
697++
698+ GdkRectangle rect;
699+
700+ rect.x = mBounds.x;
701+@@ -1734,13 +1734,9 @@ nsWindow::Invalidate(PRBool aIsSynchronous)
702+ LOGDRAW(("Invalidate (all) [%p]: %d %d %d %d\n", (void *)this,
703+ rect.x, rect.y, rect.width, rect.height));
704+
705+- if (!mDrawingarea)
706+- return NS_OK;
707+-
708+- gdk_window_invalidate_rect(mDrawingarea->inner_window,
709+- &rect, FALSE);
710++ gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
711+ if (aIsSynchronous)
712+- gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
713++ gdk_window_process_updates(mGdkWindow, FALSE);
714+
715+ return NS_OK;
716+ }
717+@@ -1749,6 +1745,9 @@ NS_IMETHODIMP
718+ nsWindow::Invalidate(const nsRect &aRect,
719+ PRBool aIsSynchronous)
720+ {
721++ if (!mGdkWindow)
722++ return NS_OK;
723++
724+ GdkRectangle rect;
725+
726+ rect.x = aRect.x;
727+@@ -1759,13 +1758,9 @@ nsWindow::Invalidate(const nsRect &aRect,
728+ LOGDRAW(("Invalidate (rect) [%p]: %d %d %d %d (sync: %d)\n", (void *)this,
729+ rect.x, rect.y, rect.width, rect.height, aIsSynchronous));
730+
731+- if (!mDrawingarea)
732+- return NS_OK;
733+-
734+- gdk_window_invalidate_rect(mDrawingarea->inner_window,
735+- &rect, FALSE);
736++ gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
737+ if (aIsSynchronous)
738+- gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
739++ gdk_window_process_updates(mGdkWindow, FALSE);
740+
741+ return NS_OK;
742+ }
743+@@ -1777,7 +1772,7 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
744+ GdkRegion *region = nsnull;
745+ aRegion->GetNativeRegion((void *&)region);
746+
747+- if (region && mDrawingarea) {
748++ if (region && mGdkWindow) {
749+ GdkRectangle rect;
750+ gdk_region_get_clipbox(region, &rect);
751+
752+@@ -1785,7 +1780,7 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
753+ (void *)this,
754+ rect.x, rect.y, rect.width, rect.height, aIsSynchronous));
755+
756+- gdk_window_invalidate_region(mDrawingarea->inner_window,
757++ gdk_window_invalidate_region(mGdkWindow,
758+ region, FALSE);
759+ }
760+ else {
761+@@ -1799,10 +1794,10 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
762+ NS_IMETHODIMP
763+ nsWindow::Update()
764+ {
765+- if (!mDrawingarea)
766++ if (!mGdkWindow)
767+ return NS_OK;
768+
769+- gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
770++ gdk_window_process_updates(mGdkWindow, FALSE);
771+ return NS_OK;
772+ }
773+
774+@@ -1817,7 +1812,7 @@ nsWindow::Scroll(PRInt32 aDx,
775+ PRInt32 aDy,
776+ nsRect *aClipRect)
777+ {
778+- if (!mDrawingarea)
779++ if (!mGdkWindow)
780+ return NS_OK;
781+
782+ D_DEBUG_AT( ns_Window, "%s( %4d,%4d )\n", __FUNCTION__, aDx, aDy );
783+@@ -1827,7 +1822,7 @@ nsWindow::Scroll(PRInt32 aDx,
784+ aClipRect->x, aClipRect->y, aClipRect->width, aClipRect->height );
785+ }
786+
787+- moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
788++ gdk_window_scroll(mGdkWindow, aDx, aDy);
789+
790+ // Update bounds on our child windows
791+ for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
792+@@ -1847,10 +1842,10 @@ NS_IMETHODIMP
793+ nsWindow::ScrollWidgets(PRInt32 aDx,
794+ PRInt32 aDy)
795+ {
796+- if (!mDrawingarea)
797++ if (!mGdkWindow)
798+ return NS_OK;
799+
800+- moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
801++ gdk_window_scroll(mGdkWindow, aDx, aDy);
802+ return NS_OK;
803+ }
804+
805+@@ -1868,10 +1863,10 @@ nsWindow::GetNativeData(PRUint32 aDataType)
806+ switch (aDataType) {
807+ case NS_NATIVE_WINDOW:
808+ case NS_NATIVE_WIDGET: {
809+- if (!mDrawingarea)
810++ if (!mGdkWindow)
811+ return nsnull;
812+
813+- return mDrawingarea->inner_window;
814++ return mGdkWindow;
815+ break;
816+ }
817+
818+@@ -1991,8 +1986,8 @@ nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
819+ &x, &y);
820+ LOG(("WidgetToScreen (container) %d %d\n", x, y));
821+ }
822+- else if (mDrawingarea) {
823+- gdk_window_get_origin(mDrawingarea->inner_window, &x, &y);
824++ else if (mGdkWindow) {
825++ gdk_window_get_origin(mGdkWindow, &x, &y);
826+ LOG(("WidgetToScreen (drawing) %d %d\n", x, y));
827+ }
828+
829+@@ -2013,8 +2008,8 @@ nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
830+ gdk_window_get_root_origin(GTK_WIDGET(mContainer)->window,
831+ &x, &y);
832+ }
833+- else if (mDrawingarea) {
834+- gdk_window_get_origin(mDrawingarea->inner_window, &x, &y);
835++ else if (mGdkWindow) {
836++ gdk_window_get_origin(mGdkWindow, &x, &y);
837+ }
838+
839+ aNewRect.x = aOldRect.x - x;
840+@@ -2065,7 +2060,7 @@ nsWindow::CaptureMouse(PRBool aCapture)
841+ {
842+ LOG(("CaptureMouse %p\n", (void *)this));
843+
844+- if (!mDrawingarea)
845++ if (!mGdkWindow)
846+ return NS_OK;
847+
848+ GtkWidget *widget = GetMozContainerWidget();
849+@@ -2089,7 +2084,7 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
850+ PRBool aDoCapture,
851+ PRBool aConsumeRollupEvent)
852+ {
853+- if (!mDrawingarea)
854++ if (!mGdkWindow)
855+ return NS_OK;
856+
857+ GtkWidget *widget = GetMozContainerWidget();
858+@@ -2271,11 +2266,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
859+ return FALSE;
860+ }
861+
862+- if (!mDrawingarea)
863+- return FALSE;
864+-
865+- // handle exposes for the inner window only
866+- if (aEvent->window != mDrawingarea->inner_window)
867++ if (!mGdkWindow)
868+ return FALSE;
869+
870+ static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
871+@@ -2320,7 +2311,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
872+ nsRefPtr<gfxContext> ctx = rc->ThebesContext();
873+
874+ gfxPlatformGtk::GetPlatform()->SetGdkDrawable(ctx->OriginalSurface(),
875+- GDK_DRAWABLE(mDrawingarea->inner_window));
876++ GDK_DRAWABLE(mGdkWindow));
877+
878+ // clip to the update region
879+ ctx->Save();
880+@@ -2381,7 +2372,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
881+ if (gForce24bpp) {
882+ depth = 24; // 24 always
883+ } else {
884+- depth = gdk_drawable_get_depth(GDK_DRAWABLE(mDrawingarea->inner_window));
885++ depth = gdk_drawable_get_depth(GDK_DRAWABLE(mGdkWindow));
886+ }
887+
888+ if (!gUseBufferPixmap ||
889+@@ -2390,7 +2381,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
890+ {
891+ // create a one-off always if we're not using the global pixmap
892+ // if gUseBufferPixmap == TRUE, who's redrawing an area bigger than the screen?
893+- bufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mDrawingarea->inner_window),
894++ bufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mGdkWindow),
895+ boundsRect.width, boundsRect.height,
896+ depth);
897+ bufferPixmapSize.width = boundsRect.width;
898+@@ -2405,7 +2396,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
899+ gBufferPixmapSize.width = PR_MAX(gBufferPixmapSize.width, boundsRect.width);
900+ gBufferPixmapSize.height = PR_MAX(gBufferPixmapSize.height, boundsRect.height);
901+
902+- gBufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mDrawingarea->inner_window),
903++ gBufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mGdkWindow),
904+ gBufferPixmapSize.width, gBufferPixmapSize.height,
905+ depth);
906+
907+@@ -2575,8 +2566,11 @@ nsWindow::OnContainerUnrealize(GtkWidget *aWidget)
908+ NS_ASSERTION(mContainer == MOZ_CONTAINER(aWidget),
909+ "unexpected \"unrealize\" signal");
910+
911+- if (mDrawingarea) {
912+- SetWidgetForHierarchy(mDrawingarea->clip_window, aWidget, NULL);
913++ if (mGdkWindow) {
914++ DestroyChildWindows();
915++
916++ g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
917++ mGdkWindow = NULL;
918+ }
919+ }
920+
921+@@ -2595,11 +2589,9 @@ nsWindow::OnSizeAllocate(GtkWidget *aWidget, GtkAllocation *aAllocation)
922+ mBounds.width = rect.width;
923+ mBounds.height = rect.height;
924+
925+- if (!mDrawingarea)
926++ if (!mGdkWindow)
927+ return;
928+
929+- moz_drawingarea_resize (mDrawingarea, rect.width, rect.height);
930+-
931+ if (mTransparencyBitmap) {
932+ ApplyTransparencyBitmap();
933+ }
934+@@ -2668,7 +2660,7 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
935+
936+ event.time = aEvent->time;
937+
938+- event.exit = is_top_level_mouse_exit(mDrawingarea->inner_window, aEvent)
939++ event.exit = is_top_level_mouse_exit(mGdkWindow, aEvent)
940+ ? nsMouseEvent::eTopLevel : nsMouseEvent::eChild;
941+
942+ LOG(("OnLeaveNotify: %p\n", (void *)this));
943+@@ -2797,7 +2789,7 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
944+ }
945+ else {
946+ // XXX see OnScrollEvent()
947+- if (aEvent->window == mDrawingarea->inner_window) {
948++ if (aEvent->window == mGdkWindow) {
949+ event.refPoint.x = nscoord(aEvent->x);
950+ event.refPoint.y = nscoord(aEvent->y);
951+ } else {
952+@@ -2828,7 +2820,7 @@ nsWindow::InitButtonEvent(nsMouseEvent &aEvent,
953+ GdkEventButton *aGdkEvent)
954+ {
955+ // XXX see OnScrollEvent()
956+- if (aGdkEvent->window == mDrawingarea->inner_window) {
957++ if (aGdkEvent->window == mGdkWindow) {
958+ aEvent.refPoint.x = nscoord(aGdkEvent->x);
959+ aEvent.refPoint.y = nscoord(aGdkEvent->y);
960+ } else {
961+@@ -3373,7 +3365,7 @@ nsWindow::OnScrollEvent(GtkWidget *aWidget, GdkEventScroll *aEvent)
962+ break;
963+ }
964+
965+- if (aEvent->window == mDrawingarea->inner_window) {
966++ if (aEvent->window == mGdkWindow) {
967+ // we are the window that the event happened on so no need for expensive ScreenToWidget
968+ event.refPoint.x = nscoord(aEvent->x);
969+ event.refPoint.y = nscoord(aEvent->y);
970+@@ -3469,12 +3461,12 @@ nsWindow::ThemeChanged()
971+ nsEventStatus status = nsEventStatus_eIgnore;
972+ DispatchEvent(&event, status);
973+
974+- if (!mDrawingarea || NS_UNLIKELY(mIsDestroyed))
975++ if (!mGdkWindow || NS_UNLIKELY(mIsDestroyed))
976+ return;
977+
978+ // Dispatch NS_THEMECHANGED to all child windows
979+ GList *children =
980+- gdk_window_peek_children(mDrawingarea->inner_window);
981++ gdk_window_peek_children(mGdkWindow);
982+ while (children) {
983+ GdkWindow *gdkWin = GDK_WINDOW(children->data);
984+
985+@@ -3823,6 +3815,38 @@ GetBrandName(nsXPIDLString& brandName)
986+ brandName.Assign(NS_LITERAL_STRING("Mozilla"));
987+ }
988+
989++static GdkWindow *
990++CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
991++{
992++ GdkWindowAttr attributes;
993++ gint attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
994++
995++ attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
996++ GDK_VISIBILITY_NOTIFY_MASK |
997++ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
998++ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
999++#ifdef HAVE_GTK_MOTION_HINTS
1000++ GDK_POINTER_MOTION_HINT_MASK |
1001++#endif
1002++ GDK_POINTER_MOTION_MASK);
1003++
1004++ attributes.width = 1;
1005++ attributes.height = 1;
1006++ attributes.wclass = GDK_INPUT_OUTPUT;
1007++ attributes.visual = gtk_widget_get_visual(widget);
1008++ attributes.colormap = gtk_widget_get_colormap(widget);
1009++ attributes.window_type = GDK_WINDOW_CHILD;
1010++
1011++ GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
1012++ gdk_window_set_user_data(window, widget);
1013++
1014++ /* set the default pixmap to None so that you don't end up with the
1015++ gtk default which is BlackPixel. */
1016++ gdk_window_set_back_pixmap(window, NULL, FALSE);
1017++
1018++ return window;
1019++}
1020++
1021+ nsresult
1022+ nsWindow::NativeCreate(nsIWidget *aParent,
1023+ nsNativeWidget aNativeParent,
1024+@@ -3866,8 +3890,7 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1025+ }
1026+
1027+ // figure out our parent window
1028+- MozDrawingarea *parentArea = nsnull;
1029+- MozContainer *parentMozContainer = nsnull;
1030++ GtkWidget *parentMozContainer = nsnull;
1031+ GtkContainer *parentGtkContainer = nsnull;
1032+ GdkWindow *parentGdkWindow = nsnull;
1033+ GtkWindow *topLevelParent = nsnull;
1034+@@ -3880,28 +3903,10 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1035+ parentGtkContainer = GTK_CONTAINER(aNativeParent);
1036+
1037+ if (parentGdkWindow) {
1038+- // find the mozarea on that window
1039+- gpointer user_data = nsnull;
1040+- user_data = g_object_get_data(G_OBJECT(parentGdkWindow),
1041+- "mozdrawingarea");
1042+- parentArea = MOZ_DRAWINGAREA(user_data);
1043+-
1044+- NS_ASSERTION(parentArea, "no drawingarea for parent widget!\n");
1045+- if (!parentArea)
1046+- return NS_ERROR_FAILURE;
1047+-
1048+- // get the user data for the widget - it should be a container
1049+- user_data = nsnull;
1050+- gdk_window_get_user_data(parentArea->inner_window, &user_data);
1051+- NS_ASSERTION(user_data, "no user data for parentArea\n");
1052+- if (!user_data)
1053+- return NS_ERROR_FAILURE;
1054++ // get the widget for the window - it should be a moz container
1055++ parentMozContainer = get_gtk_widget_for_gdk_window(parentGdkWindow);
1056+
1057+- // Get the parent moz container
1058+- parentMozContainer = MOZ_CONTAINER(user_data);
1059+- NS_ASSERTION(parentMozContainer,
1060+- "owning widget is not a mozcontainer!\n");
1061+- if (!parentMozContainer)
1062++ if (!IS_MOZ_CONTAINER(parentMozContainer))
1063+ return NS_ERROR_FAILURE;
1064+
1065+ // get the toplevel window just in case someone needs to use it
1066+@@ -3910,8 +3915,6 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1067+ GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(parentMozContainer)));
1068+ }
1069+
1070+- GdkVisual* visual = nsnull;
1071+-
1072+ // ok, create our windows
1073+ switch (mWindowType) {
1074+ case eWindowType_dialog:
1075+@@ -3939,11 +3942,11 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1076+ GdkWindow* dialoglead = mShell->window;
1077+ gdk_window_set_group(dialoglead, dialoglead);
1078+ }
1079+- if (parentArea) {
1080++ if (parentGdkWindow) {
1081+ nsWindow *parentnsWindow =
1082+- get_window_for_gdk_window(parentArea->inner_window);
1083++ get_window_for_gdk_window(parentGdkWindow);
1084+ NS_ASSERTION(parentnsWindow,
1085+- "no nsWindow for parentArea!");
1086++ "no nsWindow for parentGdkWindow!");
1087+ if (parentnsWindow && parentnsWindow->mWindowGroup) {
1088+ gtk_window_group_add_window(parentnsWindow->mWindowGroup,
1089+ GTK_WINDOW(mShell));
1090+@@ -4009,15 +4012,16 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1091+ }
1092+
1093+ // create our container
1094+- mContainer = MOZ_CONTAINER(moz_container_new());
1095+- gtk_container_add(GTK_CONTAINER(mShell), GTK_WIDGET(mContainer));
1096+- gtk_widget_realize(GTK_WIDGET(mContainer));
1097++ GtkWidget *container = moz_container_new();
1098++ mContainer = MOZ_CONTAINER(container);
1099++ gtk_container_add(GTK_CONTAINER(mShell), container);
1100++ gtk_widget_realize(container);
1101+
1102+ // make sure this is the focus widget in the container
1103+- gtk_window_set_focus(GTK_WINDOW(mShell), GTK_WIDGET(mContainer));
1104++ gtk_window_set_focus(GTK_WINDOW(mShell), container);
1105+
1106+ // and the drawing area
1107+- mDrawingarea = moz_drawingarea_new(nsnull, mContainer, visual);
1108++ mGdkWindow = container->window;
1109+
1110+ if (mWindowType == eWindowType_popup) {
1111+ // gdk does not automatically set the cursor for "temporary"
1112+@@ -4033,14 +4037,15 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1113+ break;
1114+ case eWindowType_child: {
1115+ if (parentMozContainer) {
1116+- mDrawingarea = moz_drawingarea_new(parentArea, parentMozContainer, visual);
1117++ mGdkWindow = CreateGdkWindow(parentGdkWindow, parentMozContainer);
1118+ }
1119+ else if (parentGtkContainer) {
1120+- mContainer = MOZ_CONTAINER(moz_container_new());
1121+- gtk_container_add(parentGtkContainer, GTK_WIDGET(mContainer));
1122+- gtk_widget_realize(GTK_WIDGET(mContainer));
1123++ GtkWidget *container = moz_container_new();
1124++ mContainer = MOZ_CONTAINER(container);
1125++ gtk_container_add(parentGtkContainer, container);
1126++ gtk_widget_realize(container);
1127+
1128+- mDrawingarea = moz_drawingarea_new(nsnull, mContainer, visual);
1129++ mGdkWindow = container->window;
1130+ }
1131+ else {
1132+ NS_WARNING("Warning: tried to create a new child widget with no parent!");
1133+@@ -4061,17 +4066,8 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1134+ gtk_widget_set_double_buffered (GTK_WIDGET(mContainer),FALSE);
1135+ #endif
1136+
1137+- // label the drawing area with this object so we can find our way
1138+- // home
1139+- g_object_set_data(G_OBJECT(mDrawingarea->clip_window), "nsWindow",
1140+- this);
1141+- g_object_set_data(G_OBJECT(mDrawingarea->inner_window), "nsWindow",
1142+- this);
1143+-
1144+- g_object_set_data(G_OBJECT(mDrawingarea->clip_window), "mozdrawingarea",
1145+- mDrawingarea);
1146+- g_object_set_data(G_OBJECT(mDrawingarea->inner_window), "mozdrawingarea",
1147+- mDrawingarea);
1148++ // label the drawing window with this object so we can find our way home
1149++ g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", this);
1150+
1151+ if (mContainer)
1152+ g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
1153+@@ -4161,13 +4157,9 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1154+ (void *)GTK_WIDGET(mContainer)->window,
1155+ GDK_WINDOW_XWINDOW(GTK_WIDGET(mContainer)->window)));
1156+ }
1157+-
1158+- if (mDrawingarea) {
1159+- LOG(("\tmDrawingarea %p %p %p %lx %lx\n", (void *)mDrawingarea,
1160+- (void *)mDrawingarea->clip_window,
1161+- (void *)mDrawingarea->inner_window,
1162+- GDK_WINDOW_XWINDOW(mDrawingarea->clip_window),
1163+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)));
1164++ else if (mGdkWindow) {
1165++ LOG(("\tmGdkWindow %p %lx\n", (void *)mGdkWindow,
1166++ GDK_WINDOW_XWINDOW(mGdkWindow)));
1167+ }
1168+
1169+ // resize so that everything is set to the right dimensions
1170+@@ -4325,16 +4317,16 @@ nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
1171+ gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
1172+ }
1173+ else if (mContainer) {
1174++ GtkWidget *widget = GTK_WIDGET(mContainer);
1175+ GtkAllocation allocation;
1176+- allocation.x = 0;
1177+- allocation.y = 0;
1178++ allocation.x = widget->allocation.x;
1179++ allocation.y = widget->allocation.y;
1180+ allocation.width = aWidth;
1181+ allocation.height = aHeight;
1182+- gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation);
1183++ gtk_widget_size_allocate(widget, &allocation);
1184+ }
1185+-
1186+- if (mDrawingarea) {
1187+- moz_drawingarea_resize (mDrawingarea, aWidth, aHeight);
1188++ else if (mGdkWindow) {
1189++ gdk_window_resize(mGdkWindow, aWidth, aHeight);
1190+ }
1191+ }
1192+
1193+@@ -4360,19 +4352,18 @@ nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
1194+ gtk_window_move(GTK_WINDOW(mShell), aX, aY);
1195+
1196+ gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
1197+- moz_drawingarea_resize(mDrawingarea, aWidth, aHeight);
1198++ gdk_window_resize(mGdkWindow, aWidth, aHeight);
1199+ }
1200+ else if (mContainer) {
1201+ GtkAllocation allocation;
1202+- allocation.x = 0;
1203+- allocation.y = 0;
1204++ allocation.x = aX;
1205++ allocation.y = aY;
1206+ allocation.width = aWidth;
1207+ allocation.height = aHeight;
1208+ gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation);
1209+- moz_drawingarea_move_resize(mDrawingarea, aX, aY, aWidth, aHeight);
1210+ }
1211+- else if (mDrawingarea) {
1212+- moz_drawingarea_move_resize(mDrawingarea, aX, aY, aWidth, aHeight);
1213++ else if (mGdkWindow) {
1214++ gdk_window_move_resize(mGdkWindow, aX, aY, aWidth, aHeight);
1215+ }
1216+ }
1217+
1218+@@ -4401,16 +4392,14 @@ nsWindow::NativeShow (PRBool aAction)
1219+ SetUserTimeAndStartupIDForActivatedWindow(mShell);
1220+ }
1221+
1222+- moz_drawingarea_set_visibility(mDrawingarea, aAction);
1223+ gtk_widget_show(GTK_WIDGET(mContainer));
1224+ gtk_widget_show(mShell);
1225+ }
1226+ else if (mContainer) {
1227+- moz_drawingarea_set_visibility(mDrawingarea, TRUE);
1228+ gtk_widget_show(GTK_WIDGET(mContainer));
1229+ }
1230+- else if (mDrawingarea) {
1231+- moz_drawingarea_set_visibility(mDrawingarea, TRUE);
1232++ else if (mGdkWindow) {
1233++ gdk_window_show_unraised(mGdkWindow);
1234+ }
1235+ }
1236+ else {
1237+@@ -4420,10 +4409,9 @@ nsWindow::NativeShow (PRBool aAction)
1238+ }
1239+ else if (mContainer) {
1240+ gtk_widget_hide(GTK_WIDGET(mContainer));
1241+- moz_drawingarea_set_visibility(mDrawingarea, FALSE);
1242+ }
1243+- if (mDrawingarea) {
1244+- moz_drawingarea_set_visibility(mDrawingarea, FALSE);
1245++ else if (mGdkWindow) {
1246++ gdk_window_hide(mGdkWindow);
1247+ }
1248+ }
1249+ }
1250+@@ -4684,11 +4672,11 @@ nsWindow::GrabPointer(void)
1251+ return;
1252+ }
1253+
1254+- if (!mDrawingarea)
1255++ if (!mGdkWindow)
1256+ return;
1257+
1258+ gint retval;
1259+- retval = gdk_pointer_grab(mDrawingarea->inner_window, TRUE,
1260++ retval = gdk_pointer_grab(mGdkWindow, TRUE,
1261+ (GdkEventMask)(GDK_BUTTON_PRESS_MASK |
1262+ GDK_BUTTON_RELEASE_MASK |
1263+ GDK_ENTER_NOTIFY_MASK |
1264+@@ -4730,8 +4718,8 @@ nsWindow::GrabKeyboard(void)
1265+
1266+ if (mTransientParent)
1267+ grabWindow = GTK_WIDGET(mTransientParent)->window;
1268+- else if (mDrawingarea)
1269+- grabWindow = mDrawingarea->inner_window;
1270++ else if (mGdkWindow)
1271++ grabWindow = mGdkWindow;
1272+ else
1273+ return;
1274+
1275+@@ -4777,11 +4765,11 @@ nsWindow::GetToplevelWidget(GtkWidget **aWidget)
1276+ GtkWidget *
1277+ nsWindow::GetMozContainerWidget()
1278+ {
1279+- if (!mDrawingarea)
1280++ if (!mGdkWindow)
1281+ return NULL;
1282+
1283+ GtkWidget *owningWidget =
1284+- get_gtk_widget_for_gdk_window(mDrawingarea->inner_window);
1285++ get_gtk_widget_for_gdk_window(mGdkWindow);
1286+ return owningWidget;
1287+ }
1288+
1289+@@ -4821,10 +4809,10 @@ nsWindow::SetUrgencyHint(GtkWidget *top_window, PRBool state)
1290+ void *
1291+ nsWindow::SetupPluginPort(void)
1292+ {
1293+- if (!mDrawingarea)
1294++ if (!mGdkWindow)
1295+ return nsnull;
1296+
1297+- if (GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed == TRUE)
1298++ if (GDK_WINDOW_OBJECT(mGdkWindow)->destroyed == TRUE)
1299+ return nsnull;
1300+
1301+ // we have to flush the X queue here so that any plugins that
1302+@@ -4832,22 +4820,19 @@ nsWindow::SetupPluginPort(void)
1303+ // this window in case it was just created
1304+ #ifdef MOZ_X11
1305+ XWindowAttributes xattrs;
1306+- XGetWindowAttributes(GDK_DISPLAY (),
1307+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1308++ XGetWindowAttributes(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mGdkWindow),
1309+ &xattrs);
1310+ XSelectInput (GDK_DISPLAY (),
1311+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1312++ GDK_WINDOW_XWINDOW(mGdkWindow),
1313+ xattrs.your_event_mask |
1314+ SubstructureNotifyMask);
1315+
1316+- gdk_window_add_filter(mDrawingarea->inner_window,
1317+- plugin_window_filter_func,
1318+- this);
1319++ gdk_window_add_filter(mGdkWindow, plugin_window_filter_func, this);
1320+
1321+ XSync(GDK_DISPLAY(), False);
1322+ #endif /* MOZ_X11 */
1323+
1324+- return (void *)GDK_WINDOW_XWINDOW(mDrawingarea->inner_window);
1325++ return (void *)GDK_WINDOW_XWINDOW(mGdkWindow);
1326+ }
1327+
1328+ nsresult
1329+@@ -4907,14 +4892,13 @@ nsWindow::SetNonXEmbedPluginFocus()
1330+ Window curFocusWindow;
1331+ int focusState;
1332+
1333+- XGetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1334++ XGetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1335+ &curFocusWindow,
1336+ &focusState);
1337+
1338+ LOGFOCUS(("\t curFocusWindow=%p\n", curFocusWindow));
1339+
1340+- GdkWindow* toplevel = gdk_window_get_toplevel
1341+- (mDrawingarea->inner_window);
1342++ GdkWindow* toplevel = gdk_window_get_toplevel(mGdkWindow);
1343+ GdkWindow *gdkfocuswin = gdk_window_lookup(curFocusWindow);
1344+
1345+ // lookup with the focus proxy window is supposed to get the
1346+@@ -4926,11 +4910,11 @@ nsWindow::SetNonXEmbedPluginFocus()
1347+
1348+ // switch the focus from the focus proxy to the plugin window
1349+ mOldFocusWindow = curFocusWindow;
1350+- XRaiseWindow(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1351+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window));
1352++ XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
1353++ GDK_WINDOW_XWINDOW(mGdkWindow));
1354+ gdk_error_trap_push();
1355+- XSetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1356+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1357++ XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1358++ GDK_WINDOW_XWINDOW(mGdkWindow),
1359+ RevertToNone,
1360+ CurrentTime);
1361+ gdk_flush();
1362+@@ -4939,8 +4923,7 @@ nsWindow::SetNonXEmbedPluginFocus()
1363+ gdk_window_add_filter(NULL, plugin_client_message_filter, this);
1364+
1365+ LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus oldfocus=%p new=%p\n",
1366+- mOldFocusWindow,
1367+- GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)));
1368++ mOldFocusWindow, GDK_WINDOW_XWINDOW(mGdkWindow)));
1369+ }
1370+
1371+ void
1372+@@ -4957,7 +4940,7 @@ nsWindow::LoseNonXEmbedPluginFocus()
1373+ Window curFocusWindow;
1374+ int focusState;
1375+
1376+- XGetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1377++ XGetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1378+ &curFocusWindow,
1379+ &focusState);
1380+
1381+@@ -4966,12 +4949,12 @@ nsWindow::LoseNonXEmbedPluginFocus()
1382+ // event filter that blocks the WM_TAKE_FOCUS is enough. WM and gtk2
1383+ // will take care of the focus later.
1384+ if (!curFocusWindow ||
1385+- curFocusWindow == GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)) {
1386++ curFocusWindow == GDK_WINDOW_XWINDOW(mGdkWindow)) {
1387+
1388+ gdk_error_trap_push();
1389+- XRaiseWindow(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1390++ XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
1391+ mOldFocusWindow);
1392+- XSetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1393++ XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1394+ mOldFocusWindow,
1395+ RevertToParent,
1396+ CurrentTime);
1397+@@ -6655,13 +6638,11 @@ nsWindow::IMESetCursorPosition(const nsTextEventReply& aReply)
1398+
1399+ // Get the position of the refWindow in screen.
1400+ gint refX, refY;
1401+- gdk_window_get_origin(refWindow->mDrawingarea->inner_window,
1402+- &refX, &refY);
1403++ gdk_window_get_origin(refWindow->mGdkWindow, &refX, &refY);
1404+
1405+ // Get the position of IM context owner window in screen.
1406+ gint ownerX, ownerY;
1407+- gdk_window_get_origin(ownerWindow->mDrawingarea->inner_window,
1408+- &ownerX, &ownerY);
1409++ gdk_window_get_origin(ownerWindow->mGdkWindow, &ownerX, &ownerY);
1410+
1411+ // Compute the caret position in the IM owner window.
1412+ GdkRectangle area;
1413+@@ -6807,7 +6788,7 @@ nsWindow::GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState)
1414+ GdkModifierType modifiers = gdk_keyboard_get_modifiers();
1415+ PRUint32 capsLockMask, numLockMask, scrollLockMask;
1416+ PRBool foundMasks = gdk_keyboard_get_modmap_masks(
1417+- GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1418++ GDK_WINDOW_XDISPLAY(mGdkWindow),
1419+ &capsLockMask, &numLockMask, &scrollLockMask);
1420+ if (!foundMasks)
1421+ return NS_ERROR_NOT_IMPLEMENTED;
1422+@@ -7138,10 +7119,12 @@ nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
1423+ gfxASurface*
1424+ nsWindow::GetThebesSurface()
1425+ {
1426++ if (!mGdkWindow)
1427++ return nsnull;
1428++
1429+ GdkDrawable* d;
1430+ gint x_offset, y_offset;
1431+- gdk_window_get_internal_paint_info(mDrawingarea->inner_window,
1432+- &d, &x_offset, &y_offset);
1433++ gdk_window_get_internal_paint_info(mGdkWindow, &d, &x_offset, &y_offset);
1434+
1435+ #ifdef MOZ_X11
1436+ gint width, height;
1437+@@ -7217,7 +7200,7 @@ nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVert
1438+ }
1439+
1440+ // get the gdk window for this widget
1441+- GdkWindow* gdk_window = mDrawingarea->inner_window;
1442++ GdkWindow* gdk_window = mGdkWindow;
1443+ if (!GDK_IS_WINDOW(gdk_window)) {
1444+ return NS_ERROR_FAILURE;
1445+ }
1446+--- a/mozilla/widget/src/gtk2/nsWindow.h
1447++++ a/mozilla/widget/src/gtk2/nsWindow.h
1448+@@ -43,7 +43,6 @@
1449+ #include "nsAutoPtr.h"
1450+
1451+ #include "mozcontainer.h"
1452+-#include "mozdrawingarea.h"
1453+ #include "nsWeakReference.h"
1454+
1455+ #include "nsIDragService.h"
1456+@@ -480,6 +479,7 @@ protected:
1457+ PRUint32 mPreferredHeight;
1458+
1459+ private:
1460++ void DestroyChildWindows();
1461+ void GetToplevelWidget(GtkWidget **aWidget);
1462+ GtkWidget *GetMozContainerWidget();
1463+ nsWindow *GetContainerWindow();
1464+@@ -492,7 +492,7 @@ private:
1465+
1466+ GtkWidget *mShell;
1467+ MozContainer *mContainer;
1468+- MozDrawingarea *mDrawingarea;
1469++ GdkWindow *mGdkWindow;
1470+
1471+ GtkWindowGroup *mWindowGroup;
1472+
1473
1474=== modified file 'debian/patches/series'
1475--- debian/patches/series 2010-04-26 14:29:16 +0000
1476+++ debian/patches/series 2010-09-30 22:17:46 +0000
1477@@ -2,3 +2,4 @@
1478 cleaner_dist_clean.patch
1479 no_dynamic_nss_softokn.patch
1480 fix_installer.patch
1481+lp575160_destroy_child_windows.patch

Subscribers

People subscribed via source and target branches

to status/vote changes: