Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/seamonkey/2.0.5: 001-seamonkey_gentoo_install_dirs.patch 104-no_dynamic_nss_softokn.patch 118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch 200_fix-system-hunspell-dict-detections.patch 300-seamonkey-fix-jemalloc-vs-aslr.patch 310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch 700-sparc-build.patch
Date: Sat, 26 Jun 2010 11:41:55
Message-Id: 20100626114147.06A1B2CF77@corvid.gentoo.org
1 polynomial-c 10/06/26 11:41:46
2
3 Added: 001-seamonkey_gentoo_install_dirs.patch
4 104-no_dynamic_nss_softokn.patch
5 118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch
6 200_fix-system-hunspell-dict-detections.patch
7 300-seamonkey-fix-jemalloc-vs-aslr.patch
8 310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch
9 700-sparc-build.patch
10 Log:
11 Time to use the patchsets repo again...
12
13 Revision Changes Path
14 1.1 src/patchsets/seamonkey/2.0.5/001-seamonkey_gentoo_install_dirs.patch
15
16 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/001-seamonkey_gentoo_install_dirs.patch?rev=1.1&view=markup
17 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/001-seamonkey_gentoo_install_dirs.patch?rev=1.1&content-type=text/plain
18
19 Index: 001-seamonkey_gentoo_install_dirs.patch
20 ===================================================================
21 diff -ur work.orig/config/autoconf.mk.in work/config/autoconf.mk.in
22 --- work.orig/config/autoconf.mk.in 2009-04-27 19:03:11.000000000 +0000
23 +++ work/config/autoconf.mk.in 2009-04-27 19:11:19.000000000 +0000
24 @@ -60,14 +60,14 @@
25 prefix = @prefix@
26 exec_prefix = @exec_prefix@
27 bindir = @bindir@
28 -includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
29 +includedir = @includedir@/$(MOZ_APP_NAME)
30 libdir = @libdir@
31 datadir = @datadir@
32 mandir = @mandir@
33 -idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
34 +idldir = $(datadir)/idl/$(MOZ_APP_NAME)
35
36 -installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
37 -sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
38 +installdir = $(libdir)/$(MOZ_APP_NAME)
39 +sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel
40
41 MOZDEPTH = $(DEPTH)/mozilla
42 DIST = $(MOZDEPTH)/dist
43
44
45
46 1.1 src/patchsets/seamonkey/2.0.5/104-no_dynamic_nss_softokn.patch
47
48 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/104-no_dynamic_nss_softokn.patch?rev=1.1&view=markup
49 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/104-no_dynamic_nss_softokn.patch?rev=1.1&content-type=text/plain
50
51 Index: 104-no_dynamic_nss_softokn.patch
52 ===================================================================
53 ---
54 directory/c-sdk/component_versions.mk | 2 +-
55 1 file changed, 1 insertion(+), 1 deletion(-)
56
57 Index: seamonkey-2.0-2.0~a1~cvs20080123t1257+nobinonly/directory/c-sdk/component_versions.mk
58 ===================================================================
59 --- seamonkey-2.0-2.0~a1~cvs20080123t1257+nobinonly.orig/directory/c-sdk/component_versions.mk
60 +++ seamonkey-2.0-2.0~a1~cvs20080123t1257+nobinonly/directory/c-sdk/component_versions.mk
61 @@ -41,17 +41,17 @@
62 # NSPR - Netscape Portable Runtime
63 NSPR_LIBVERSION = 4
64 NSPR_RELEASE_TAG = v4.4.1
65 NSPR_RELEASE_TREE = $(COMPONENTS_DIR)
66
67 # NSS - Network Security Services
68 NSSVERS = 3
69 NSS_RELEASE_TAG = NSS_3_9_3_RTM
70 -NSS_DYNAMIC_SOFTOKN = 1
71 +NSS_DYNAMIC_SOFTOKN = 0
72 NSS_RELEASE_TREE = $(COMPONENTS_DIR)
73
74 # SVRCORE - Client/server utility library
75 SVRCORE_RELEASE_TAG = SVRCORE_4_0_RTM
76 SVRCORE_RELEASE_TREE = $(COMPONENTS_DIR)
77
78 # LDAP library
79 LDAPVERS = 60
80
81
82
83 1.1 src/patchsets/seamonkey/2.0.5/118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch
84
85 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch?rev=1.1&view=markup
86 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch?rev=1.1&content-type=text/plain
87
88 Index: 118-bz467766_att351173-dont-reset-user-prefs-on-upgrade.patch
89 ===================================================================
90
91 This bug is due to the fact, applications are restarted before extension
92 defaults are loaded.
93
94 To reproduce, choose any preference and set the values like:
95 system default:
96 pref("prefkey",systemvalue);
97 extension default:
98 pref("prefkey", extensiondefault);
99 user pref:
100 user_pref("prefkey", systemvalue);
101
102 Next, trigger application behaviour similar to upgrade by removing compreg.dat
103 from profile and start the application.
104
105 Result:
106 User sees extensiondefault after upgrade, because the user_pref has been
107 eliminated ... which is definitly not what the user expects because he explicitly
108 had *systemvalue* set before the upgrade.
109
110 Evaluation:
111 The bug happens because restart is performed *before* extension defaults have been
112 loaded and the prefapi.cpp always eliminate user preference if the user preference
113 is equal to the actual default (which happens to be extensiondefault normally - so
114 no reset, but is systemvalue during restart).
115
116 Fix:
117 1. savePrefs should not try to be smart ... this patch removes the heuristic that guesses
118 whether a setting can be eliminated or not; it should be sufficient to only eliminate
119 prefs in hashPrefs.
120
121 2. This patch prevents hashPrefs from eliminating the user pref in case we are in
122 *startup* ... unfortunately no such state info exists, which lets us guess that
123 we are in startup for the previously not dealt case: !set_default &&
124 !pref_ValueChanged(pref->defaultPref, value, type) && !PREF_HAS_USER_VALUE(pref).
125
126 If is the case we explicitly remember that this setting is a user-pref ...
127 even though it might be temporarily equal to the default pref.
128
129 ---
130 modules/libpref/src/prefapi.cpp | 20 ++++++++++++++------
131 1 file changed, 14 insertions(+), 6 deletions(-)
132
133 Index: mozilla/modules/libpref/src/prefapi.cpp
134 ===================================================================
135 --- mozilla.orig/modules/libpref/src/prefapi.cpp
136 +++ mozilla/modules/libpref/src/prefapi.cpp
137 @@ -324,23 +324,20 @@
138 if (!pref)
139 return PL_DHASH_NEXT;
140
141 nsCAutoString prefValue;
142
143 // where we're getting our pref from
144 PrefValue* sourcePref;
145
146 - if (PREF_HAS_USER_VALUE(pref) &&
147 - pref_ValueChanged(pref->defaultPref,
148 - pref->userPref,
149 - (PrefType) PREF_TYPE(pref)))
150 - sourcePref = &pref->userPref;
151 - else if (PREF_IS_LOCKED(pref))
152 + if (PREF_IS_LOCKED(pref))
153 sourcePref = &pref->defaultPref;
154 + else if (PREF_HAS_USER_VALUE(pref))
155 + sourcePref = &pref->userPref;
156 else
157 // do not save default prefs that haven't changed
158 return PL_DHASH_NEXT;
159
160 // strings are in quotes!
161 if (pref->flags & PREF_STRING) {
162 prefValue = '\"';
163 str_escape(sourcePref->stringVal, prefValue);
164 @@ -742,16 +739,27 @@
165 Otherwise, set the user value only if it has changed */
166 if ( !pref_ValueChanged(pref->defaultPref, value, type) )
167 {
168 if (PREF_HAS_USER_VALUE(pref))
169 {
170 pref->flags &= ~PREF_USERSET;
171 if (!PREF_IS_LOCKED(pref))
172 valueChanged = PR_TRUE;
173 + } else {
174 + // this is tricky: we have !set_default ...
175 + // thus we are setting a user pref; however the user
176 + // pref set is same as *current default*; this normally
177 + // means to un-set ... however since we have
178 + // !PREF_HAS_USER_VALUE(pref) this can only be during
179 + // startup
180 + pref_SetValue(&pref->userPref, value, type);
181 + pref->flags |= PREF_USERSET;
182 + if (!PREF_IS_LOCKED(pref))
183 + valueChanged = PR_TRUE;
184 }
185 }
186 else if ( !PREF_HAS_USER_VALUE(pref) ||
187 pref_ValueChanged(pref->userPref, value, type) )
188 {
189 pref_SetValue(&pref->userPref, value, type);
190 pref->flags |= PREF_USERSET;
191 if (!PREF_IS_LOCKED(pref))
192
193
194
195 1.1 src/patchsets/seamonkey/2.0.5/200_fix-system-hunspell-dict-detections.patch
196
197 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/200_fix-system-hunspell-dict-detections.patch?rev=1.1&view=markup
198 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/200_fix-system-hunspell-dict-detections.patch?rev=1.1&content-type=text/plain
199
200 Index: 200_fix-system-hunspell-dict-detections.patch
201 ===================================================================
202 diff -r e06632956519 mozilla/extensions/spellcheck/Makefile.in
203 --- a/mozilla/extensions/spellcheck/Makefile.in Sun Apr 04 07:02:14 2010 +0300
204 +++ b/mozilla/extensions/spellcheck/Makefile.in Tue Apr 06 23:07:03 2010 -0500
205 @@ -42,13 +42,19 @@
206 include $(DEPTH)/config/autoconf.mk
207
208 MODULE = spellchecker
209 +ifndef MOZ_NATIVE_HUNSPELL
210 DIRS = idl locales
211 +else
212 +DIRS = idl
213 +endif
214
215 ifeq (camino,$(MOZ_BUILD_APP))
216 DIRS += osxspell
217 else
218 +ifndef MOZ_NATIVE_HUNSPELL
219 DIRS += hunspell
220 endif
221 +endif
222
223 DIRS += src
224
225 diff -r e06632956519 mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp
226 --- a/mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp Sun Apr 04 07:02:14 2010 +0300
227 +++ b/mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp Tue Apr 06 23:07:03 2010 -0500
228 @@ -63,6 +63,9 @@
229 #include "nsISimpleEnumerator.h"
230 #include "nsIDirectoryEnumerator.h"
231 #include "nsIFile.h"
232 +#ifdef MOZ_NATIVE_HUNSPELL
233 +#include "nsILocalFile.h"
234 +#endif
235 #include "nsDirectoryServiceUtils.h"
236 #include "nsDirectoryServiceDefs.h"
237 #include "mozISpellI18NManager.h"
238 @@ -307,7 +310,16 @@
239 return;
240
241 nsCOMPtr<nsIFile> dictDir;
242 - rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY,
243 + #ifdef MOZ_NATIVE_HUNSPELL
244 + nsCOMPtr<nsILocalFile> localFile;
245 + rv = NS_NewNativeLocalFile(nsDependentCString("/usr/share/myspell"),PR_TRUE, getter_AddRefs(localFile));
246 + if (localFile && NS_SUCCEEDED(rv)) {
247 + localFile->QueryInterface(NS_GET_IID(nsIFile), getter_AddRefs(dictDir));
248 + LoadDictionariesFromDir(dictDir);
249 + }
250 + else {
251 + #endif
252 + rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY,
253 NS_GET_IID(nsIFile), getter_AddRefs(dictDir));
254 if (NS_SUCCEEDED(rv)) {
255 LoadDictionariesFromDir(dictDir);
256 @@ -332,6 +344,9 @@
257 LoadDictionariesFromDir(appDir);
258 }
259 }
260 +#ifdef MOZ_NATIVE_HUNSPELL
261 + }
262 +#endif
263
264 nsCOMPtr<nsISimpleEnumerator> dictDirs;
265 rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST,
266 diff -r e06632956519 mozilla/extensions/spellcheck/src/Makefile.in
267 --- a/mozilla/extensions/spellcheck/src/Makefile.in Sun Apr 04 07:02:14 2010 +0300
268 +++ b/mozilla/extensions/spellcheck/src/Makefile.in Tue Apr 06 23:07:03 2010 -0500
269 @@ -63,9 +63,15 @@
270 txtsvc \
271 uconv \
272 unicharutil \
273 + xulapp \
274 $(NULL)
275
276 -CPPSRCS = \
277 +ifdef MOZ_NATIVE_HUNSPELL
278 +CPPSRCS += mozHunspell.cpp \
279 + mozHunspellDirProvider.cpp
280 +endif
281 +
282 +CPPSRCS += \
283 mozSpellCheckerFactory.cpp \
284 mozSpellChecker.cpp \
285 mozPersonalDictionary.cpp \
286 @@ -80,8 +86,15 @@
287 SHARED_LIBRARY_LIBS += ../osxspell/src/$(LIB_PREFIX)osxspell_s.$(LIB_SUFFIX)
288 LOCAL_INCLUDES += -I$(srcdir)/../osxspell/src
289 else
290 +ifndef MOZ_NATIVE_HUNSPELL
291 SHARED_LIBRARY_LIBS += ../hunspell/src/$(LIB_PREFIX)hunspell_s.$(LIB_SUFFIX)
292 LOCAL_INCLUDES += -I$(srcdir)/../hunspell/src
293 +else
294 +LOCAL_INCLUDES += $(MOZ_HUNSPELL_CFLAGS) \
295 + -I$(srcdir)/../hunspell/src \
296 + -DMOZ_NATIVE_HUNSPELL \
297 + $(NULL)
298 +endif
299 endif
300
301 EXTRA_DSO_LDOPTS = \
302 @@ -96,3 +109,11 @@
303 LOCAL_INCLUDES += \
304 -I$(topsrcdir)/xpcom/io \
305 $(NULL)
306 +
307 +ifdef MOZ_NATIVE_HUNSPELL
308 +export:: $(srcdir)/../hunspell/src/mozHunspell.cpp $(srcdir)/../hunspell/src/mozHunspellDirProvider.cpp
309 + $(INSTALL) $(srcdir)/../hunspell/src/mozHunspell.* $(srcdir)/../hunspell/src/mozHunspellDirProvider.* .
310 +GARBAGE += mozHunspell.$(OBJ_SUFFIX) mozHunspell.cpp mozHunspellDirProvider.$(OBJ_SUFFIX) mozHunspellDirProvider.cpp
311 +clean::
312 + rm -f mozHunspell.* mozHunspellDirProvider.*
313 +endif
314
315
316
317 1.1 src/patchsets/seamonkey/2.0.5/300-seamonkey-fix-jemalloc-vs-aslr.patch
318
319 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/300-seamonkey-fix-jemalloc-vs-aslr.patch?rev=1.1&view=markup
320 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/300-seamonkey-fix-jemalloc-vs-aslr.patch?rev=1.1&content-type=text/plain
321
322 Index: 300-seamonkey-fix-jemalloc-vs-aslr.patch
323 ===================================================================
324 diff -urpx 'cscope*' -x '.*.swp' mozilla/memory/jemalloc/jemalloc.c~ mozilla/memory/jemalloc/jemalloc.c
325 --- mozilla/memory/jemalloc/jemalloc.c~ 2009-07-30 17:30:25.000000000 +0200
326 +++ mozilla/memory/jemalloc/jemalloc.c 2009-08-10 14:28:59.000000000 +0200
327 @@ -392,7 +392,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib
328 static const bool __isthreaded = true;
329 #endif
330
331 -#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
332 +#if defined(MOZ_MEMORY_SOLARIS) || defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
333 #define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */
334 #endif
335
336 @@ -2305,20 +2305,31 @@ pages_map_align(size_t size, int pfd, si
337 * We don't use MAP_FIXED here, because it can cause the *replacement*
338 * of existing mappings, and we only want to create new mappings.
339 */
340 -#ifdef MALLOC_PAGEFILE
341 - if (pfd != -1) {
342 - ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
343 - MAP_NOSYNC | MAP_ALIGN, pfd, 0);
344 - } else
345 -#endif
346 - {
347 - ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
348 - MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
349 - }
350 + ret = mmap(NULL, size + alignment, PROT_READ | PROT_WRITE, MAP_PRIVATE |
351 + MAP_NOSYNC| MAP_ANON, -1, 0);
352 assert(ret != NULL);
353
354 if (ret == MAP_FAILED)
355 ret = NULL;
356 + else {
357 + uintptr_t aligned_ret;
358 + size_t extra_size;
359 +
360 + aligned_ret = (uintptr_t)ret + alignment - 1;
361 + aligned_ret &= ~(alignment - 1);
362 + extra_size = aligned_ret - (uintptr_t)ret;
363 + munmap(ret, extra_size);
364 + munmap(ret + extra_size + size, alignment - extra_size);
365 + ret = (void *)aligned_ret;
366 +#ifdef MALLOC_PAGEFILE
367 + if (pfd != -1) {
368 + ret = mmap(ret, size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
369 + MAP_NOSYNC | MAP_FIXED, pfd, 0);
370 + }
371 + if (ret == MAP_FAILED)
372 + ret = NULL;
373 +#endif
374 + }
375 return (ret);
376 }
377 #endif
378
379
380
381
382 1.1 src/patchsets/seamonkey/2.0.5/310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch
383
384 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch?rev=1.1&view=markup
385 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch?rev=1.1&content-type=text/plain
386
387 Index: 310-gecko-1.9.1-cairo-1.8.10-crash-fix.patch
388 ===================================================================
389 # https://bugzilla.mozilla.org/show_bug.cgi?id=522635
390
391 --- mozilla/widget/src/gtk2/Makefile.in
392 +++ mozilla/widget/src/gtk2/Makefile.in
393 @@ -78,7 +78,6 @@ endif
394
395 CSRCS = \
396 mozcontainer.c \
397 - mozdrawingarea.c \
398 keysym2ucs.c \
399 nsPrintdGTK.c \
400 $(NULL)
401 @@ -152,7 +151,6 @@ endif
402 EXPORTS = \
403 nsGTKToolkit.h \
404 nsIImageToPixbuf.h \
405 - mozdrawingarea.h \
406 mozcontainer.h \
407 $(NULL)
408
409 --- mozilla/widget/src/gtk2/mozcontainer.c
410 +++ mozilla/widget/src/gtk2/mozcontainer.c
411 @@ -294,8 +294,15 @@ moz_container_realize (GtkWidget *widget)
412
413 /* create the shell window */
414
415 - attributes.event_mask = gtk_widget_get_events (widget);
416 - attributes.event_mask |= (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK);
417 + attributes.event_mask = (gtk_widget_get_events (widget) |
418 + GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
419 + GDK_VISIBILITY_NOTIFY_MASK |
420 + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
421 + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
422 +#ifdef HAVE_GTK_MOTION_HINTS
423 + GDK_POINTER_MOTION_HINT_MASK |
424 +#endif
425 + GDK_POINTER_MOTION_MASK);
426 attributes.x = widget->allocation.x;
427 attributes.y = widget->allocation.y;
428 attributes.width = widget->allocation.width;
429 --- mozilla/widget/src/gtk2/mozcontainer.h
430 +++ mozilla/widget/src/gtk2/mozcontainer.h
431 @@ -40,6 +40,7 @@
432 #define __MOZ_CONTAINER_H__
433
434 #include <gtk/gtkcontainer.h>
435 +#include <gtk/gtkversion.h>
436
437 #ifdef __cplusplus
438 extern "C" {
439 @@ -83,6 +84,11 @@ extern "C" {
440 #define IS_MOZ_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE))
441 #define MOZ_CONAINTER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
442
443 +#if (GTK_CHECK_VERSION(2, 12, 0) || \
444 + (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON)))
445 +#define HAVE_GTK_MOTION_HINTS
446 +#endif
447 +
448 typedef struct _MozContainer MozContainer;
449 typedef struct _MozContainerClass MozContainerClass;
450
451 deleted file mode 100644
452 --- mozilla/widget/src/gtk2/mozdrawingarea.c
453 +++ /dev/null
454 @@ -1,241 +0,0 @@
455 -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
456 -/* vim:expandtab:shiftwidth=4:tabstop=4:
457 - */
458 -/* ***** BEGIN LICENSE BLOCK *****
459 - * Version: MPL 1.1/GPL 2.0/LGPL 2.1
460 - *
461 - * The contents of this file are subject to the Mozilla Public License Version
462 - * 1.1 (the "License"); you may not use this file except in compliance with
463 - * the License. You may obtain a copy of the License at
464 - * http://www.mozilla.org/MPL/
465 - *
466 - * Software distributed under the License is distributed on an "AS IS" basis,
467 - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
468 - * for the specific language governing rights and limitations under the
469 - * License.
470 - *
471 - * The Original Code is mozilla.org code.
472 - *
473 - * The Initial Developer of the Original Code is Christopher Blizzard
474 - * <blizzard@×××××××.org>. Portions created by the Initial Developer
475 - * are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
476 - *
477 - * Contributor(s):
478 - *
479 - * Alternatively, the contents of this file may be used under the terms of
480 - * either the GNU General Public License Version 2 or later (the "GPL"), or
481 - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
482 - * in which case the provisions of the GPL or the LGPL are applicable instead
483 - * of those above. If you wish to allow use of your version of this file only
484 - * under the terms of either the GPL or the LGPL, and not to allow others to
485 - * use your version of this file under the terms of the MPL, indicate your
486 - * decision by deleting the provisions above and replace them with the notice
487 - * and other provisions required by the GPL or the LGPL. If you do not delete
488 - * the provisions above, a recipient may use your version of this file under
489 - * the terms of any one of the MPL, the GPL or the LGPL.
490 - *
491 - * ***** END LICENSE BLOCK ***** */
492 -
493 -#include "mozdrawingarea.h"
494 -
495 -/* init methods */
496 -static void moz_drawingarea_class_init (MozDrawingareaClass *klass);
497 -static void moz_drawingarea_init (MozDrawingarea *drawingarea);
498 -
499 -/* static methods */
500 -static void moz_drawingarea_create_windows (MozDrawingarea *drawingarea,
501 - GdkWindow *parent,
502 - GtkWidget *widget,
503 - GdkVisual *visual);
504 -
505 -static void moz_drawingarea_finalize (GObject *object);
506 -
507 -static GObjectClass *parent_class = NULL;
508 -
509 -GtkType
510 -moz_drawingarea_get_type(void)
511 -{
512 - static GtkType moz_drawingarea_type = 0;
513 -
514 - if (!moz_drawingarea_type) {
515 - static GTypeInfo moz_drawingarea_info = {
516 - sizeof(MozDrawingareaClass), /* class size */
517 - NULL, /* base_init */
518 - NULL, /* base_finalize */
519 - (GClassInitFunc) moz_drawingarea_class_init, /* class_init */
520 - NULL, /* class_destroy */
521 - NULL, /* class_data */
522 - sizeof(MozDrawingarea), /* instance_size */
523 - 0, /* n_preallocs */
524 - (GInstanceInitFunc) moz_drawingarea_init, /* instance_init */
525 - NULL, /* value_table */
526 - };
527 - moz_drawingarea_type =
528 - g_type_register_static (G_TYPE_OBJECT,
529 - "MozDrawingarea",
530 - &moz_drawingarea_info, 0);
531 - }
532 -
533 - return moz_drawingarea_type;
534 -}
535 -
536 -MozDrawingarea *
537 -moz_drawingarea_new (MozDrawingarea *parent, MozContainer *widget_parent,
538 - GdkVisual *visual)
539 -{
540 - MozDrawingarea *drawingarea;
541 -
542 - drawingarea = g_object_new(MOZ_DRAWINGAREA_TYPE, NULL);
543 -
544 - if (!parent)
545 - moz_drawingarea_create_windows(drawingarea,
546 - GTK_WIDGET(widget_parent)->window,
547 - GTK_WIDGET(widget_parent),
548 - visual);
549 - else
550 - moz_drawingarea_create_windows(drawingarea,
551 - parent->inner_window,
552 - GTK_WIDGET(widget_parent),
553 - visual);
554 -
555 - return drawingarea;
556 -}
557 -
558 -void
559 -moz_drawingarea_class_init (MozDrawingareaClass *klass)
560 -{
561 - GObjectClass *object_class = G_OBJECT_CLASS (klass);
562 -
563 - object_class->finalize = moz_drawingarea_finalize;
564 -
565 - parent_class = g_type_class_peek_parent(klass);
566 -}
567 -
568 -void
569 -moz_drawingarea_init (MozDrawingarea *drawingarea)
570 -{
571 -
572 -}
573 -
574 -void
575 -moz_drawingarea_reparent (MozDrawingarea *drawingarea, GdkWindow *aNewParent)
576 -{
577 - gdk_window_reparent(drawingarea->clip_window,
578 - aNewParent, 0, 0);
579 -}
580 -
581 -void
582 -moz_drawingarea_create_windows (MozDrawingarea *drawingarea, GdkWindow *parent,
583 - GtkWidget *widget, GdkVisual *visual)
584 -{
585 - GdkWindowAttr attributes;
586 - gint attributes_mask = 0;
587 -
588 - /* create the clipping window */
589 - attributes.event_mask = 0;
590 - attributes.x = 0;
591 - attributes.y = 0;
592 - attributes.width = 1;
593 - attributes.height = 1;
594 - attributes.wclass = GDK_INPUT_OUTPUT;
595 - attributes.window_type = GDK_WINDOW_CHILD;
596 - if (!visual) {
597 - attributes.visual = gtk_widget_get_visual (widget);
598 - attributes.colormap = gtk_widget_get_colormap (widget);
599 - } else {
600 - attributes.visual = visual;
601 - attributes.colormap = gdk_colormap_new(visual, 0);
602 - }
603 -
604 - attributes_mask |= GDK_WA_VISUAL | GDK_WA_COLORMAP |
605 - GDK_WA_X | GDK_WA_Y;
606 -
607 - drawingarea->clip_window = gdk_window_new (parent, &attributes,
608 - attributes_mask);
609 - gdk_window_set_user_data(drawingarea->clip_window, widget);
610 -
611 - /* set the default pixmap to None so that you don't end up with the
612 - gtk default which is BlackPixel. */
613 - gdk_window_set_back_pixmap(drawingarea->clip_window, NULL, FALSE);
614 -
615 - attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
616 - GDK_VISIBILITY_NOTIFY_MASK |
617 - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
618 - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
619 -#ifdef HAVE_GTK_MOTION_HINTS
620 - GDK_POINTER_MOTION_HINT_MASK |
621 -#endif
622 - GDK_POINTER_MOTION_MASK);
623 - /* create the inner window */
624 - drawingarea->inner_window = gdk_window_new (drawingarea->clip_window,
625 - &attributes, attributes_mask);
626 - gdk_window_set_user_data(drawingarea->inner_window, widget);
627 -
628 - /* set the default pixmap to None so that you don't end up with the
629 - gtk default which is BlackPixel. */
630 - gdk_window_set_back_pixmap(drawingarea->inner_window, NULL, FALSE);
631 -
632 - if (visual) {
633 - g_object_unref(attributes.colormap);
634 - }
635 -}
636 -
637 -void
638 -moz_drawingarea_finalize (GObject *object)
639 -{
640 - MozDrawingarea *drawingarea;
641 - gpointer user_data;
642 -
643 - g_return_if_fail(IS_MOZ_DRAWINGAREA(object));
644 -
645 - drawingarea = MOZ_DRAWINGAREA(object);
646 -
647 - gdk_window_destroy(drawingarea->inner_window);
648 - gdk_window_destroy(drawingarea->clip_window);
649 -
650 - (* parent_class->finalize) (object);
651 -}
652 -
653 -void
654 -moz_drawingarea_move (MozDrawingarea *drawingarea,
655 - gint x, gint y)
656 -{
657 - gdk_window_move(drawingarea->clip_window, x, y);
658 -}
659 -
660 -void
661 -moz_drawingarea_resize (MozDrawingarea *drawingarea,
662 - gint width, gint height)
663 -{
664 - gdk_window_resize(drawingarea->clip_window, width, height);
665 - gdk_window_resize(drawingarea->inner_window, width, height);
666 -}
667 -
668 -void
669 -moz_drawingarea_move_resize (MozDrawingarea *drawingarea,
670 - gint x, gint y, gint width, gint height)
671 -{
672 - gdk_window_resize(drawingarea->inner_window, width, height);
673 - gdk_window_move_resize(drawingarea->clip_window, x, y, width, height);
674 -}
675 -
676 -void
677 -moz_drawingarea_set_visibility (MozDrawingarea *drawingarea,
678 - gboolean visibility)
679 -{
680 - if (visibility) {
681 - gdk_window_show_unraised(drawingarea->inner_window);
682 - gdk_window_show_unraised(drawingarea->clip_window);
683 - }
684 - else {
685 - gdk_window_hide(drawingarea->clip_window);
686 - gdk_window_hide(drawingarea->inner_window);
687 - }
688 -}
689 -
690 -void
691 -moz_drawingarea_scroll (MozDrawingarea *drawingarea,
692 - gint x, gint y)
693 -{
694 - gdk_window_scroll(drawingarea->inner_window, x, y);
695 -}
696 deleted file mode 100644
697 --- mozilla/widget/src/gtk2/mozdrawingarea.h
698 +++ /dev/null
699 @@ -1,101 +0,0 @@
700 -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
701 -/* vim:expandtab:shiftwidth=4:tabstop=4:
702 - */
703 -/* ***** BEGIN LICENSE BLOCK *****
704 - * Version: MPL 1.1/GPL 2.0/LGPL 2.1
705 - *
706 - * The contents of this file are subject to the Mozilla Public License Version
707 - * 1.1 (the "License"); you may not use this file except in compliance with
708 - * the License. You may obtain a copy of the License at
709 - * http://www.mozilla.org/MPL/
710 - *
711 - * Software distributed under the License is distributed on an "AS IS" basis,
712 - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
713 - * for the specific language governing rights and limitations under the
714 - * License.
715 - *
716 - * The Original Code is mozilla.org code.
717 - *
718 - * The Initial Developer of the Original Code is Christopher Blizzard
719 - * <blizzard@×××××××.org>. Portions created by the Initial Developer
720 - * are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
721 - *
722 - * Contributor(s):
723 - *
724 - * Alternatively, the contents of this file may be used under the terms of
725 - * either the GNU General Public License Version 2 or later (the "GPL"), or
726 - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
727 - * in which case the provisions of the GPL or the LGPL are applicable instead
728 - * of those above. If you wish to allow use of your version of this file only
729 - * under the terms of either the GPL or the LGPL, and not to allow others to
730 - * use your version of this file under the terms of the MPL, indicate your
731 - * decision by deleting the provisions above and replace them with the notice
732 - * and other provisions required by the GPL or the LGPL. If you do not delete
733 - * the provisions above, a recipient may use your version of this file under
734 - * the terms of any one of the MPL, the GPL or the LGPL.
735 - *
736 - * ***** END LICENSE BLOCK ***** */
737 -
738 -#ifndef __MOZ_DRAWINGAREA_H__
739 -#define __MOZ_DRAWINGAREA_H__
740 -
741 -#include <gdk/gdkwindow.h>
742 -#include <gtk/gtkversion.h>
743 -#include "mozcontainer.h"
744 -
745 -#ifdef __cplusplus
746 -extern "C" {
747 -#endif /* __cplusplus */
748 -
749 -#define MOZ_DRAWINGAREA_TYPE (moz_drawingarea_get_type())
750 -#define MOZ_DRAWINGAREA(obj) (GTK_CHECK_CAST((obj), MOZ_DRAWINGAREA_TYPE, MozDrawingarea))
751 -#define MOZ_DRAWINGAREA_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), MOZ_DRAWINGAREA_TYPE, MozDrawingareaClass))
752 -#define IS_MOZ_DRAWINGAREA(obj) (GTK_CHECK_TYPE((obj), MOZ_DRAWINGAREA_TYPE))
753 -#define IS_MOZ_DRAWINGAREA_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), MOZ_DRAWINGAREA_TYPE))
754 -#define MOZ_DRAWINGAREA_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), MOZ_DRAWINGAREA_TYPE, MozDrawingareaClass))
755 -
756 -#if (GTK_CHECK_VERSION(2, 12, 0) || \
757 - (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON)))
758 -#define HAVE_GTK_MOTION_HINTS
759 -#endif
760 -
761 -typedef struct _MozDrawingarea MozDrawingarea;
762 -typedef struct _MozDrawingareaClass MozDrawingareaClass;
763 -
764 -struct _MozDrawingarea
765 -{
766 - GObject parent_instance;
767 - /* AFAIK this clip_window (and thus this whole class) exists solely to
768 - * make gdk_window_scroll() smooth for nsIWidget::Scroll(). */
769 - GdkWindow *clip_window;
770 - GdkWindow *inner_window;
771 -};
772 -
773 -struct _MozDrawingareaClass
774 -{
775 - GObjectClass parent_class;
776 -};
777 -
778 -GtkType moz_drawingarea_get_type (void);
779 -MozDrawingarea *moz_drawingarea_new (MozDrawingarea *parent,
780 - MozContainer *widget_parent,
781 - GdkVisual *visual);
782 -void moz_drawingarea_reparent (MozDrawingarea *drawingarea,
783 - GdkWindow *aNewParent);
784 -void moz_drawingarea_move (MozDrawingarea *drawingarea,
785 - gint x, gint y);
786 -void moz_drawingarea_resize (MozDrawingarea *drawingarea,
787 - gint width, gint height);
788 -void moz_drawingarea_move_resize (MozDrawingarea *drawingarea,
789 - gint x, gint y,
790 - gint width, gint height);
791 -void moz_drawingarea_set_visibility (MozDrawingarea *drawingarea,
792 - gboolean visibility);
793 -void moz_drawingarea_scroll (MozDrawingarea *drawingarea,
794 - gint x, gint y);
795 -
796 -#ifdef __cplusplus
797 -}
798 -#endif /* __cplusplus */
799 -
800 -#endif /* __MOZ_DRAWINGAREA_H__ */
801 --- mozilla/widget/src/gtk2/nsWindow.cpp
802 +++ mozilla/widget/src/gtk2/nsWindow.cpp
803 @@ -368,7 +368,7 @@ nsWindow::nsWindow()
804 mPreferredWidth = 0;
805 mPreferredHeight = 0;
806 mContainer = nsnull;
807 - mDrawingarea = nsnull;
808 + mGdkWindow = nsnull;
809 mShell = nsnull;
810 mWindowGroup = nsnull;
811 mContainerGotFocus = PR_FALSE;
812 @@ -673,9 +673,7 @@ CheckDestroyInvisibleContainer()
813
814 // Change the containing GtkWidget on a sub-hierarchy of GdkWindows belonging
815 // to aOldWidget and rooted at aWindow, and reparent any child GtkWidgets of
816 -// the GdkWindow hierarchy. If aNewWidget is NULL, the reference to
817 -// aOldWidget is removed from its GdkWindows, and child GtkWidgets are
818 -// destroyed.
819 +// the GdkWindow hierarchy to aNewWidget.
820 static void
821 SetWidgetForHierarchy(GdkWindow *aWindow,
822 GtkWidget *aOldWidget,
823 @@ -694,13 +692,7 @@ SetWidgetForHierarchy(GdkWindow *aWindow,
824
825 // This window belongs to a child widget, which will no longer be a
826 // child of aOldWidget.
827 - if (aNewWidget) {
828 - gtk_widget_reparent(widget, aNewWidget);
829 - } else {
830 - // aNewWidget == NULL indicates that the window is about to be
831 - // destroyed.
832 - gtk_widget_destroy(widget);
833 - }
834 + gtk_widget_reparent(widget, aNewWidget);
835
836 return;
837 }
838 @@ -714,6 +706,30 @@ SetWidgetForHierarchy(GdkWindow *aWindow,
839 gdk_window_set_user_data(aWindow, aNewWidget);
840 }
841
842 +// Walk the list of child windows and call destroy on them.
843 +void
844 +nsWindow::DestroyChildWindows()
845 +{
846 + if (!mGdkWindow)
847 + return;
848 +
849 + while (GList *children = gdk_window_peek_children(mGdkWindow)) {
850 + GdkWindow *child = GDK_WINDOW(children->data);
851 + nsWindow *kid = get_window_for_gdk_window(child);
852 + if (kid) {
853 + kid->Destroy();
854 + } else {
855 + // This child is not an nsWindow.
856 + // Destroy the child GtkWidget.
857 + gpointer data;
858 + gdk_window_get_user_data(child, &data);
859 + if (GTK_IS_WIDGET(data)) {
860 + gtk_widget_destroy(static_cast<GtkWidget*>(data));
861 + }
862 + }
863 + }
864 +}
865 +
866 NS_IMETHODIMP
867 nsWindow::Destroy(void)
868 {
869 @@ -751,15 +767,6 @@ nsWindow::Destroy(void)
870
871 NativeShow(PR_FALSE);
872
873 - // walk the list of children and call destroy on them. Have to be
874 - // careful, though -- calling destroy on a kid may actually remove
875 - // it from our child list, losing its sibling links.
876 - for (nsIWidget* kid = mFirstChild; kid; ) {
877 - nsIWidget* next = kid->GetNextSibling();
878 - kid->Destroy();
879 - kid = next;
880 - }
881 -
882 #ifdef USE_XIM
883 IMEDestroyContext();
884 #endif
885 @@ -796,35 +803,26 @@ nsWindow::Destroy(void)
886 gtk_widget_destroy(mShell);
887 mShell = nsnull;
888 mContainer = nsnull;
889 + NS_ABORT_IF_FALSE(!mGdkWindow,
890 + "mGdkWindow should be NULL when mContainer is destroyed");
891 }
892 else if (mContainer) {
893 gtk_widget_destroy(GTK_WIDGET(mContainer));
894 mContainer = nsnull;
895 + NS_ABORT_IF_FALSE(!mGdkWindow,
896 + "mGdkWindow should be NULL when mContainer is destroyed");
897 }
898 - else if (owningWidget) {
899 - // Remove references from GdkWindows back to their container
900 - // widget while the GdkWindow hierarchy is still available.
901 - // (OnContainerUnrealize does this when the MozContainer widget is
902 - // destroyed.)
903 - SetWidgetForHierarchy(mDrawingarea->clip_window, owningWidget, NULL);
904 - }
905 -
906 - if (mDrawingarea) {
907 - g_object_set_data(G_OBJECT(mDrawingarea->clip_window),
908 - "nsWindow", NULL);
909 - g_object_set_data(G_OBJECT(mDrawingarea->inner_window),
910 - "nsWindow", NULL);
911 -
912 - g_object_set_data(G_OBJECT(mDrawingarea->clip_window),
913 - "mozdrawingarea", NULL);
914 - g_object_set_data(G_OBJECT(mDrawingarea->inner_window),
915 - "mozdrawingarea", NULL);
916 -
917 - NS_ASSERTION(!get_gtk_widget_for_gdk_window(mDrawingarea->inner_window),
918 - "widget reference not removed");
919 + else if (mGdkWindow) {
920 + // Destroy child windows to ensure that their mThebesSurfaces are
921 + // released and to remove references from GdkWindows back to their
922 + // container widget. (OnContainerUnrealize() does this when the
923 + // MozContainer widget is destroyed.)
924 + DestroyChildWindows();
925
926 - g_object_unref(mDrawingarea);
927 - mDrawingarea = nsnull;
928 + gdk_window_set_user_data(mGdkWindow, NULL);
929 + g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
930 + gdk_window_destroy(mGdkWindow);
931 + mGdkWindow = nsnull;
932 }
933
934 if (gInvisibleContainer && owningWidget == gInvisibleContainer) {
935 @@ -851,7 +849,7 @@ nsWindow::GetParent(void)
936 NS_IMETHODIMP
937 nsWindow::SetParent(nsIWidget *aNewParent)
938 {
939 - if (mContainer || !mDrawingarea || !mParent) {
940 + if (mContainer || !mGdkWindow || !mParent) {
941 NS_NOTREACHED("nsWindow::SetParent - reparenting a non-child window");
942 return NS_ERROR_NOT_IMPLEMENTED;
943 }
944 @@ -866,12 +864,12 @@ nsWindow::SetParent(nsIWidget *aNewParent)
945 if (!oldContainer) {
946 // The GdkWindows have been destroyed so there is nothing else to
947 // reparent.
948 - NS_ABORT_IF_FALSE(GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed,
949 + NS_ABORT_IF_FALSE(GDK_WINDOW_OBJECT(mGdkWindow)->destroyed,
950 "live GdkWindow with no widget");
951 return NS_OK;
952 }
953
954 - NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed,
955 + NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(mGdkWindow)->destroyed,
956 "destroyed GdkWindow with widget");
957
958 GdkWindow* newParentWindow = NULL;
959 @@ -901,11 +899,10 @@ nsWindow::SetParent(nsIWidget *aNewParent)
960 if (newContainer != oldContainer) {
961 NS_ABORT_IF_FALSE(!GDK_WINDOW_OBJECT(newParentWindow)->destroyed,
962 "destroyed GdkWindow with widget");
963 - SetWidgetForHierarchy(mDrawingarea->clip_window, oldContainer,
964 - newContainer);
965 + SetWidgetForHierarchy(mGdkWindow, oldContainer, newContainer);
966 }
967
968 - moz_drawingarea_reparent(mDrawingarea, newParentWindow);
969 + gdk_window_reparent(mGdkWindow, newParentWindow, 0, 0);
970 }
971
972 return NS_OK;
973 @@ -1216,8 +1213,8 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
974 if (mIsTopLevel) {
975 gtk_window_move(GTK_WINDOW(mShell), aX, aY);
976 }
977 - else if (mDrawingarea) {
978 - moz_drawingarea_move(mDrawingarea, aX, aY);
979 + else if (mGdkWindow) {
980 + gdk_window_move(mGdkWindow, aX, aY);
981 }
982
983 return NS_OK;
984 @@ -1244,19 +1241,19 @@ nsWindow::SetZIndex(PRInt32 aZIndex)
985
986 NS_ASSERTION(!mContainer, "Expected Mozilla child widget");
987
988 - // We skip the nsWindows that don't have mDrawingareas.
989 + // We skip the nsWindows that don't have mGdkWindows.
990 // These are probably in the process of being destroyed.
991
992 if (!GetNextSibling()) {
993 // We're to be on top.
994 - if (mDrawingarea)
995 - gdk_window_raise(mDrawingarea->clip_window);
996 + if (mGdkWindow)
997 + gdk_window_raise(mGdkWindow);
998 } else {
999 // All the siblings before us need to be below our widget.
1000 for (nsWindow* w = this; w;
1001 w = static_cast<nsWindow*>(w->GetPrevSibling())) {
1002 - if (w->mDrawingarea)
1003 - gdk_window_lower(w->mDrawingarea->clip_window);
1004 + if (w->mGdkWindow)
1005 + gdk_window_lower(w->mGdkWindow);
1006 }
1007 }
1008 return NS_OK;
1009 @@ -1500,7 +1497,7 @@ nsWindow::SetCursor(nsCursor aCursor)
1010 {
1011 // if we're not the toplevel window pass up the cursor request to
1012 // the toplevel window to handle it.
1013 - if (!mContainer && mDrawingarea) {
1014 + if (!mContainer && mGdkWindow) {
1015 nsWindow *window = GetContainerWindow();
1016 if (!window)
1017 return NS_ERROR_FAILURE;
1018 @@ -1583,7 +1580,7 @@ nsWindow::SetCursor(imgIContainer* aCursor,
1019 {
1020 // if we're not the toplevel window pass up the cursor request to
1021 // the toplevel window to handle it.
1022 - if (!mContainer && mDrawingarea) {
1023 + if (!mContainer && mGdkWindow) {
1024 nsWindow *window = GetContainerWindow();
1025 if (!window)
1026 return NS_ERROR_FAILURE;
1027 @@ -1710,10 +1707,10 @@ nsWindow::Validate()
1028 {
1029 // Get the update for this window and, well, just drop it on the
1030 // floor.
1031 - if (!mDrawingarea)
1032 + if (!mGdkWindow)
1033 return NS_OK;
1034
1035 - GdkRegion *region = gdk_window_get_update_area(mDrawingarea->inner_window);
1036 + GdkRegion *region = gdk_window_get_update_area(mGdkWindow);
1037
1038 if (region)
1039 gdk_region_destroy(region);
1040 @@ -1724,6 +1721,9 @@ nsWindow::Validate()
1041 NS_IMETHODIMP
1042 nsWindow::Invalidate(PRBool aIsSynchronous)
1043 {
1044 + if (!mGdkWindow)
1045 + return NS_OK;
1046 +
1047 GdkRectangle rect;
1048
1049 rect.x = mBounds.x;
1050 @@ -1734,13 +1734,9 @@ nsWindow::Invalidate(PRBool aIsSynchronous)
1051 LOGDRAW(("Invalidate (all) [%p]: %d %d %d %d\n", (void *)this,
1052 rect.x, rect.y, rect.width, rect.height));
1053
1054 - if (!mDrawingarea)
1055 - return NS_OK;
1056 -
1057 - gdk_window_invalidate_rect(mDrawingarea->inner_window,
1058 - &rect, FALSE);
1059 + gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
1060 if (aIsSynchronous)
1061 - gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
1062 + gdk_window_process_updates(mGdkWindow, FALSE);
1063
1064 return NS_OK;
1065 }
1066 @@ -1749,6 +1745,9 @@ NS_IMETHODIMP
1067 nsWindow::Invalidate(const nsRect &aRect,
1068 PRBool aIsSynchronous)
1069 {
1070 + if (!mGdkWindow)
1071 + return NS_OK;
1072 +
1073 GdkRectangle rect;
1074
1075 rect.x = aRect.x;
1076 @@ -1759,13 +1758,9 @@ nsWindow::Invalidate(const nsRect &aRect,
1077 LOGDRAW(("Invalidate (rect) [%p]: %d %d %d %d (sync: %d)\n", (void *)this,
1078 rect.x, rect.y, rect.width, rect.height, aIsSynchronous));
1079
1080 - if (!mDrawingarea)
1081 - return NS_OK;
1082 -
1083 - gdk_window_invalidate_rect(mDrawingarea->inner_window,
1084 - &rect, FALSE);
1085 + gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
1086 if (aIsSynchronous)
1087 - gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
1088 + gdk_window_process_updates(mGdkWindow, FALSE);
1089
1090 return NS_OK;
1091 }
1092 @@ -1777,7 +1772,7 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
1093 GdkRegion *region = nsnull;
1094 aRegion->GetNativeRegion((void *&)region);
1095
1096 - if (region && mDrawingarea) {
1097 + if (region && mGdkWindow) {
1098 GdkRectangle rect;
1099 gdk_region_get_clipbox(region, &rect);
1100
1101 @@ -1785,7 +1780,7 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
1102 (void *)this,
1103 rect.x, rect.y, rect.width, rect.height, aIsSynchronous));
1104
1105 - gdk_window_invalidate_region(mDrawingarea->inner_window,
1106 + gdk_window_invalidate_region(mGdkWindow,
1107 region, FALSE);
1108 }
1109 else {
1110 @@ -1799,10 +1794,10 @@ nsWindow::InvalidateRegion(const nsIRegion* aRegion,
1111 NS_IMETHODIMP
1112 nsWindow::Update()
1113 {
1114 - if (!mDrawingarea)
1115 + if (!mGdkWindow)
1116 return NS_OK;
1117
1118 - gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
1119 + gdk_window_process_updates(mGdkWindow, FALSE);
1120 return NS_OK;
1121 }
1122
1123 @@ -1817,7 +1812,7 @@ nsWindow::Scroll(PRInt32 aDx,
1124 PRInt32 aDy,
1125 nsRect *aClipRect)
1126 {
1127 - if (!mDrawingarea)
1128 + if (!mGdkWindow)
1129 return NS_OK;
1130
1131 D_DEBUG_AT( ns_Window, "%s( %4d,%4d )\n", __FUNCTION__, aDx, aDy );
1132 @@ -1827,7 +1822,7 @@ nsWindow::Scroll(PRInt32 aDx,
1133 aClipRect->x, aClipRect->y, aClipRect->width, aClipRect->height );
1134 }
1135
1136 - moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
1137 + gdk_window_scroll(mGdkWindow, aDx, aDy);
1138
1139 // Update bounds on our child windows
1140 for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
1141 @@ -1847,10 +1842,10 @@ NS_IMETHODIMP
1142 nsWindow::ScrollWidgets(PRInt32 aDx,
1143 PRInt32 aDy)
1144 {
1145 - if (!mDrawingarea)
1146 + if (!mGdkWindow)
1147 return NS_OK;
1148
1149 - moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
1150 + gdk_window_scroll(mGdkWindow, aDx, aDy);
1151 return NS_OK;
1152 }
1153
1154 @@ -1868,10 +1863,10 @@ nsWindow::GetNativeData(PRUint32 aDataType)
1155 switch (aDataType) {
1156 case NS_NATIVE_WINDOW:
1157 case NS_NATIVE_WIDGET: {
1158 - if (!mDrawingarea)
1159 + if (!mGdkWindow)
1160 return nsnull;
1161
1162 - return mDrawingarea->inner_window;
1163 + return mGdkWindow;
1164 break;
1165 }
1166
1167 @@ -1991,8 +1986,8 @@ nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
1168 &x, &y);
1169 LOG(("WidgetToScreen (container) %d %d\n", x, y));
1170 }
1171 - else if (mDrawingarea) {
1172 - gdk_window_get_origin(mDrawingarea->inner_window, &x, &y);
1173 + else if (mGdkWindow) {
1174 + gdk_window_get_origin(mGdkWindow, &x, &y);
1175 LOG(("WidgetToScreen (drawing) %d %d\n", x, y));
1176 }
1177
1178 @@ -2013,8 +2008,8 @@ nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
1179 gdk_window_get_root_origin(GTK_WIDGET(mContainer)->window,
1180 &x, &y);
1181 }
1182 - else if (mDrawingarea) {
1183 - gdk_window_get_origin(mDrawingarea->inner_window, &x, &y);
1184 + else if (mGdkWindow) {
1185 + gdk_window_get_origin(mGdkWindow, &x, &y);
1186 }
1187
1188 aNewRect.x = aOldRect.x - x;
1189 @@ -2065,7 +2060,7 @@ nsWindow::CaptureMouse(PRBool aCapture)
1190 {
1191 LOG(("CaptureMouse %p\n", (void *)this));
1192
1193 - if (!mDrawingarea)
1194 + if (!mGdkWindow)
1195 return NS_OK;
1196
1197 GtkWidget *widget = GetMozContainerWidget();
1198 @@ -2089,7 +2084,7 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
1199 PRBool aDoCapture,
1200 PRBool aConsumeRollupEvent)
1201 {
1202 - if (!mDrawingarea)
1203 + if (!mGdkWindow)
1204 return NS_OK;
1205
1206 GtkWidget *widget = GetMozContainerWidget();
1207 @@ -2271,11 +2266,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
1208 return FALSE;
1209 }
1210
1211 - if (!mDrawingarea)
1212 - return FALSE;
1213 -
1214 - // handle exposes for the inner window only
1215 - if (aEvent->window != mDrawingarea->inner_window)
1216 + if (!mGdkWindow)
1217 return FALSE;
1218
1219 static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
1220 @@ -2320,7 +2311,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
1221 nsRefPtr<gfxContext> ctx = rc->ThebesContext();
1222
1223 gfxPlatformGtk::GetPlatform()->SetGdkDrawable(ctx->OriginalSurface(),
1224 - GDK_DRAWABLE(mDrawingarea->inner_window));
1225 + GDK_DRAWABLE(mGdkWindow));
1226
1227 // clip to the update region
1228 ctx->Save();
1229 @@ -2381,7 +2372,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
1230 if (gForce24bpp) {
1231 depth = 24; // 24 always
1232 } else {
1233 - depth = gdk_drawable_get_depth(GDK_DRAWABLE(mDrawingarea->inner_window));
1234 + depth = gdk_drawable_get_depth(GDK_DRAWABLE(mGdkWindow));
1235 }
1236
1237 if (!gUseBufferPixmap ||
1238 @@ -2390,7 +2381,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
1239 {
1240 // create a one-off always if we're not using the global pixmap
1241 // if gUseBufferPixmap == TRUE, who's redrawing an area bigger than the screen?
1242 - bufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mDrawingarea->inner_window),
1243 + bufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mGdkWindow),
1244 boundsRect.width, boundsRect.height,
1245 depth);
1246 bufferPixmapSize.width = boundsRect.width;
1247 @@ -2405,7 +2396,7 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
1248 gBufferPixmapSize.width = PR_MAX(gBufferPixmapSize.width, boundsRect.width);
1249 gBufferPixmapSize.height = PR_MAX(gBufferPixmapSize.height, boundsRect.height);
1250
1251 - gBufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mDrawingarea->inner_window),
1252 + gBufferPixmap = gdk_pixmap_new(GDK_DRAWABLE(mGdkWindow),
1253 gBufferPixmapSize.width, gBufferPixmapSize.height,
1254 depth);
1255
1256 @@ -2575,8 +2566,11 @@ nsWindow::OnContainerUnrealize(GtkWidget *aWidget)
1257 NS_ASSERTION(mContainer == MOZ_CONTAINER(aWidget),
1258 "unexpected \"unrealize\" signal");
1259
1260 - if (mDrawingarea) {
1261 - SetWidgetForHierarchy(mDrawingarea->clip_window, aWidget, NULL);
1262 + if (mGdkWindow) {
1263 + DestroyChildWindows();
1264 +
1265 + g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
1266 + mGdkWindow = NULL;
1267 }
1268 }
1269
1270 @@ -2595,11 +2589,9 @@ nsWindow::OnSizeAllocate(GtkWidget *aWidget, GtkAllocation *aAllocation)
1271 mBounds.width = rect.width;
1272 mBounds.height = rect.height;
1273
1274 - if (!mDrawingarea)
1275 + if (!mGdkWindow)
1276 return;
1277
1278 - moz_drawingarea_resize (mDrawingarea, rect.width, rect.height);
1279 -
1280 if (mTransparencyBitmap) {
1281 ApplyTransparencyBitmap();
1282 }
1283 @@ -2668,7 +2660,7 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
1284
1285 event.time = aEvent->time;
1286
1287 - event.exit = is_top_level_mouse_exit(mDrawingarea->inner_window, aEvent)
1288 + event.exit = is_top_level_mouse_exit(mGdkWindow, aEvent)
1289 ? nsMouseEvent::eTopLevel : nsMouseEvent::eChild;
1290
1291 LOG(("OnLeaveNotify: %p\n", (void *)this));
1292 @@ -2797,7 +2789,7 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
1293 }
1294 else {
1295 // XXX see OnScrollEvent()
1296 - if (aEvent->window == mDrawingarea->inner_window) {
1297 + if (aEvent->window == mGdkWindow) {
1298 event.refPoint.x = nscoord(aEvent->x);
1299 event.refPoint.y = nscoord(aEvent->y);
1300 } else {
1301 @@ -2828,7 +2820,7 @@ nsWindow::InitButtonEvent(nsMouseEvent &aEvent,
1302 GdkEventButton *aGdkEvent)
1303 {
1304 // XXX see OnScrollEvent()
1305 - if (aGdkEvent->window == mDrawingarea->inner_window) {
1306 + if (aGdkEvent->window == mGdkWindow) {
1307 aEvent.refPoint.x = nscoord(aGdkEvent->x);
1308 aEvent.refPoint.y = nscoord(aGdkEvent->y);
1309 } else {
1310 @@ -3373,7 +3365,7 @@ nsWindow::OnScrollEvent(GtkWidget *aWidget, GdkEventScroll *aEvent)
1311 break;
1312 }
1313
1314 - if (aEvent->window == mDrawingarea->inner_window) {
1315 + if (aEvent->window == mGdkWindow) {
1316 // we are the window that the event happened on so no need for expensive ScreenToWidget
1317 event.refPoint.x = nscoord(aEvent->x);
1318 event.refPoint.y = nscoord(aEvent->y);
1319 @@ -3469,12 +3461,12 @@ nsWindow::ThemeChanged()
1320 nsEventStatus status = nsEventStatus_eIgnore;
1321 DispatchEvent(&event, status);
1322
1323 - if (!mDrawingarea || NS_UNLIKELY(mIsDestroyed))
1324 + if (!mGdkWindow || NS_UNLIKELY(mIsDestroyed))
1325 return;
1326
1327 // Dispatch NS_THEMECHANGED to all child windows
1328 GList *children =
1329 - gdk_window_peek_children(mDrawingarea->inner_window);
1330 + gdk_window_peek_children(mGdkWindow);
1331 while (children) {
1332 GdkWindow *gdkWin = GDK_WINDOW(children->data);
1333
1334 @@ -3823,6 +3815,38 @@ GetBrandName(nsXPIDLString& brandName)
1335 brandName.Assign(NS_LITERAL_STRING("Mozilla"));
1336 }
1337
1338 +static GdkWindow *
1339 +CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
1340 +{
1341 + GdkWindowAttr attributes;
1342 + gint attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
1343 +
1344 + attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
1345 + GDK_VISIBILITY_NOTIFY_MASK |
1346 + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
1347 + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
1348 +#ifdef HAVE_GTK_MOTION_HINTS
1349 + GDK_POINTER_MOTION_HINT_MASK |
1350 +#endif
1351 + GDK_POINTER_MOTION_MASK);
1352 +
1353 + attributes.width = 1;
1354 + attributes.height = 1;
1355 + attributes.wclass = GDK_INPUT_OUTPUT;
1356 + attributes.visual = gtk_widget_get_visual(widget);
1357 + attributes.colormap = gtk_widget_get_colormap(widget);
1358 + attributes.window_type = GDK_WINDOW_CHILD;
1359 +
1360 + GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
1361 + gdk_window_set_user_data(window, widget);
1362 +
1363 + /* set the default pixmap to None so that you don't end up with the
1364 + gtk default which is BlackPixel. */
1365 + gdk_window_set_back_pixmap(window, NULL, FALSE);
1366 +
1367 + return window;
1368 +}
1369 +
1370 nsresult
1371 nsWindow::NativeCreate(nsIWidget *aParent,
1372 nsNativeWidget aNativeParent,
1373 @@ -3866,8 +3890,7 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1374 }
1375
1376 // figure out our parent window
1377 - MozDrawingarea *parentArea = nsnull;
1378 - MozContainer *parentMozContainer = nsnull;
1379 + GtkWidget *parentMozContainer = nsnull;
1380 GtkContainer *parentGtkContainer = nsnull;
1381 GdkWindow *parentGdkWindow = nsnull;
1382 GtkWindow *topLevelParent = nsnull;
1383 @@ -3880,28 +3903,10 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1384 parentGtkContainer = GTK_CONTAINER(aNativeParent);
1385
1386 if (parentGdkWindow) {
1387 - // find the mozarea on that window
1388 - gpointer user_data = nsnull;
1389 - user_data = g_object_get_data(G_OBJECT(parentGdkWindow),
1390 - "mozdrawingarea");
1391 - parentArea = MOZ_DRAWINGAREA(user_data);
1392 -
1393 - NS_ASSERTION(parentArea, "no drawingarea for parent widget!\n");
1394 - if (!parentArea)
1395 - return NS_ERROR_FAILURE;
1396 -
1397 - // get the user data for the widget - it should be a container
1398 - user_data = nsnull;
1399 - gdk_window_get_user_data(parentArea->inner_window, &user_data);
1400 - NS_ASSERTION(user_data, "no user data for parentArea\n");
1401 - if (!user_data)
1402 - return NS_ERROR_FAILURE;
1403 + // get the widget for the window - it should be a moz container
1404 + parentMozContainer = get_gtk_widget_for_gdk_window(parentGdkWindow);
1405
1406 - // Get the parent moz container
1407 - parentMozContainer = MOZ_CONTAINER(user_data);
1408 - NS_ASSERTION(parentMozContainer,
1409 - "owning widget is not a mozcontainer!\n");
1410 - if (!parentMozContainer)
1411 + if (!IS_MOZ_CONTAINER(parentMozContainer))
1412 return NS_ERROR_FAILURE;
1413
1414 // get the toplevel window just in case someone needs to use it
1415 @@ -3910,8 +3915,6 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1416 GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(parentMozContainer)));
1417 }
1418
1419 - GdkVisual* visual = nsnull;
1420 -
1421 // ok, create our windows
1422 switch (mWindowType) {
1423 case eWindowType_dialog:
1424 @@ -3939,11 +3942,11 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1425 GdkWindow* dialoglead = mShell->window;
1426 gdk_window_set_group(dialoglead, dialoglead);
1427 }
1428 - if (parentArea) {
1429 + if (parentGdkWindow) {
1430 nsWindow *parentnsWindow =
1431 - get_window_for_gdk_window(parentArea->inner_window);
1432 + get_window_for_gdk_window(parentGdkWindow);
1433 NS_ASSERTION(parentnsWindow,
1434 - "no nsWindow for parentArea!");
1435 + "no nsWindow for parentGdkWindow!");
1436 if (parentnsWindow && parentnsWindow->mWindowGroup) {
1437 gtk_window_group_add_window(parentnsWindow->mWindowGroup,
1438 GTK_WINDOW(mShell));
1439 @@ -4009,15 +4012,16 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1440 }
1441
1442 // create our container
1443 - mContainer = MOZ_CONTAINER(moz_container_new());
1444 - gtk_container_add(GTK_CONTAINER(mShell), GTK_WIDGET(mContainer));
1445 - gtk_widget_realize(GTK_WIDGET(mContainer));
1446 + GtkWidget *container = moz_container_new();
1447 + mContainer = MOZ_CONTAINER(container);
1448 + gtk_container_add(GTK_CONTAINER(mShell), container);
1449 + gtk_widget_realize(container);
1450
1451 // make sure this is the focus widget in the container
1452 - gtk_window_set_focus(GTK_WINDOW(mShell), GTK_WIDGET(mContainer));
1453 + gtk_window_set_focus(GTK_WINDOW(mShell), container);
1454
1455 // and the drawing area
1456 - mDrawingarea = moz_drawingarea_new(nsnull, mContainer, visual);
1457 + mGdkWindow = container->window;
1458
1459 if (mWindowType == eWindowType_popup) {
1460 // gdk does not automatically set the cursor for "temporary"
1461 @@ -4033,14 +4037,15 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1462 break;
1463 case eWindowType_child: {
1464 if (parentMozContainer) {
1465 - mDrawingarea = moz_drawingarea_new(parentArea, parentMozContainer, visual);
1466 + mGdkWindow = CreateGdkWindow(parentGdkWindow, parentMozContainer);
1467 }
1468 else if (parentGtkContainer) {
1469 - mContainer = MOZ_CONTAINER(moz_container_new());
1470 - gtk_container_add(parentGtkContainer, GTK_WIDGET(mContainer));
1471 - gtk_widget_realize(GTK_WIDGET(mContainer));
1472 + GtkWidget *container = moz_container_new();
1473 + mContainer = MOZ_CONTAINER(container);
1474 + gtk_container_add(parentGtkContainer, container);
1475 + gtk_widget_realize(container);
1476
1477 - mDrawingarea = moz_drawingarea_new(nsnull, mContainer, visual);
1478 + mGdkWindow = container->window;
1479 }
1480 else {
1481 NS_WARNING("Warning: tried to create a new child widget with no parent!");
1482 @@ -4061,17 +4066,8 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1483 gtk_widget_set_double_buffered (GTK_WIDGET(mContainer),FALSE);
1484 #endif
1485
1486 - // label the drawing area with this object so we can find our way
1487 - // home
1488 - g_object_set_data(G_OBJECT(mDrawingarea->clip_window), "nsWindow",
1489 - this);
1490 - g_object_set_data(G_OBJECT(mDrawingarea->inner_window), "nsWindow",
1491 - this);
1492 -
1493 - g_object_set_data(G_OBJECT(mDrawingarea->clip_window), "mozdrawingarea",
1494 - mDrawingarea);
1495 - g_object_set_data(G_OBJECT(mDrawingarea->inner_window), "mozdrawingarea",
1496 - mDrawingarea);
1497 + // label the drawing window with this object so we can find our way home
1498 + g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", this);
1499
1500 if (mContainer)
1501 g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
1502 @@ -4161,13 +4157,9 @@ nsWindow::NativeCreate(nsIWidget *aParent,
1503 (void *)GTK_WIDGET(mContainer)->window,
1504 GDK_WINDOW_XWINDOW(GTK_WIDGET(mContainer)->window)));
1505 }
1506 -
1507 - if (mDrawingarea) {
1508 - LOG(("\tmDrawingarea %p %p %p %lx %lx\n", (void *)mDrawingarea,
1509 - (void *)mDrawingarea->clip_window,
1510 - (void *)mDrawingarea->inner_window,
1511 - GDK_WINDOW_XWINDOW(mDrawingarea->clip_window),
1512 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)));
1513 + else if (mGdkWindow) {
1514 + LOG(("\tmGdkWindow %p %lx\n", (void *)mGdkWindow,
1515 + GDK_WINDOW_XWINDOW(mGdkWindow)));
1516 }
1517
1518 // resize so that everything is set to the right dimensions
1519 @@ -4325,16 +4317,16 @@ nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
1520 gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
1521 }
1522 else if (mContainer) {
1523 + GtkWidget *widget = GTK_WIDGET(mContainer);
1524 GtkAllocation allocation;
1525 - allocation.x = 0;
1526 - allocation.y = 0;
1527 + allocation.x = widget->allocation.x;
1528 + allocation.y = widget->allocation.y;
1529 allocation.width = aWidth;
1530 allocation.height = aHeight;
1531 - gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation);
1532 + gtk_widget_size_allocate(widget, &allocation);
1533 }
1534 -
1535 - if (mDrawingarea) {
1536 - moz_drawingarea_resize (mDrawingarea, aWidth, aHeight);
1537 + else if (mGdkWindow) {
1538 + gdk_window_resize(mGdkWindow, aWidth, aHeight);
1539 }
1540 }
1541
1542 @@ -4360,19 +4352,18 @@ nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
1543 gtk_window_move(GTK_WINDOW(mShell), aX, aY);
1544
1545 gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
1546 - moz_drawingarea_resize(mDrawingarea, aWidth, aHeight);
1547 + gdk_window_resize(mGdkWindow, aWidth, aHeight);
1548 }
1549 else if (mContainer) {
1550 GtkAllocation allocation;
1551 - allocation.x = 0;
1552 - allocation.y = 0;
1553 + allocation.x = aX;
1554 + allocation.y = aY;
1555 allocation.width = aWidth;
1556 allocation.height = aHeight;
1557 gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation);
1558 - moz_drawingarea_move_resize(mDrawingarea, aX, aY, aWidth, aHeight);
1559 }
1560 - else if (mDrawingarea) {
1561 - moz_drawingarea_move_resize(mDrawingarea, aX, aY, aWidth, aHeight);
1562 + else if (mGdkWindow) {
1563 + gdk_window_move_resize(mGdkWindow, aX, aY, aWidth, aHeight);
1564 }
1565 }
1566
1567 @@ -4401,16 +4392,14 @@ nsWindow::NativeShow (PRBool aAction)
1568 SetUserTimeAndStartupIDForActivatedWindow(mShell);
1569 }
1570
1571 - moz_drawingarea_set_visibility(mDrawingarea, aAction);
1572 gtk_widget_show(GTK_WIDGET(mContainer));
1573 gtk_widget_show(mShell);
1574 }
1575 else if (mContainer) {
1576 - moz_drawingarea_set_visibility(mDrawingarea, TRUE);
1577 gtk_widget_show(GTK_WIDGET(mContainer));
1578 }
1579 - else if (mDrawingarea) {
1580 - moz_drawingarea_set_visibility(mDrawingarea, TRUE);
1581 + else if (mGdkWindow) {
1582 + gdk_window_show_unraised(mGdkWindow);
1583 }
1584 }
1585 else {
1586 @@ -4420,10 +4409,9 @@ nsWindow::NativeShow (PRBool aAction)
1587 }
1588 else if (mContainer) {
1589 gtk_widget_hide(GTK_WIDGET(mContainer));
1590 - moz_drawingarea_set_visibility(mDrawingarea, FALSE);
1591 }
1592 - if (mDrawingarea) {
1593 - moz_drawingarea_set_visibility(mDrawingarea, FALSE);
1594 + else if (mGdkWindow) {
1595 + gdk_window_hide(mGdkWindow);
1596 }
1597 }
1598 }
1599 @@ -4684,11 +4672,11 @@ nsWindow::GrabPointer(void)
1600 return;
1601 }
1602
1603 - if (!mDrawingarea)
1604 + if (!mGdkWindow)
1605 return;
1606
1607 gint retval;
1608 - retval = gdk_pointer_grab(mDrawingarea->inner_window, TRUE,
1609 + retval = gdk_pointer_grab(mGdkWindow, TRUE,
1610 (GdkEventMask)(GDK_BUTTON_PRESS_MASK |
1611 GDK_BUTTON_RELEASE_MASK |
1612 GDK_ENTER_NOTIFY_MASK |
1613 @@ -4730,8 +4718,8 @@ nsWindow::GrabKeyboard(void)
1614
1615 if (mTransientParent)
1616 grabWindow = GTK_WIDGET(mTransientParent)->window;
1617 - else if (mDrawingarea)
1618 - grabWindow = mDrawingarea->inner_window;
1619 + else if (mGdkWindow)
1620 + grabWindow = mGdkWindow;
1621 else
1622 return;
1623
1624 @@ -4777,11 +4765,11 @@ nsWindow::GetToplevelWidget(GtkWidget **aWidget)
1625 GtkWidget *
1626 nsWindow::GetMozContainerWidget()
1627 {
1628 - if (!mDrawingarea)
1629 + if (!mGdkWindow)
1630 return NULL;
1631
1632 GtkWidget *owningWidget =
1633 - get_gtk_widget_for_gdk_window(mDrawingarea->inner_window);
1634 + get_gtk_widget_for_gdk_window(mGdkWindow);
1635 return owningWidget;
1636 }
1637
1638 @@ -4821,10 +4809,10 @@ nsWindow::SetUrgencyHint(GtkWidget *top_window, PRBool state)
1639 void *
1640 nsWindow::SetupPluginPort(void)
1641 {
1642 - if (!mDrawingarea)
1643 + if (!mGdkWindow)
1644 return nsnull;
1645
1646 - if (GDK_WINDOW_OBJECT(mDrawingarea->inner_window)->destroyed == TRUE)
1647 + if (GDK_WINDOW_OBJECT(mGdkWindow)->destroyed == TRUE)
1648 return nsnull;
1649
1650 // we have to flush the X queue here so that any plugins that
1651 @@ -4832,22 +4820,19 @@ nsWindow::SetupPluginPort(void)
1652 // this window in case it was just created
1653 #ifdef MOZ_X11
1654 XWindowAttributes xattrs;
1655 - XGetWindowAttributes(GDK_DISPLAY (),
1656 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1657 + XGetWindowAttributes(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mGdkWindow),
1658 &xattrs);
1659 XSelectInput (GDK_DISPLAY (),
1660 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1661 + GDK_WINDOW_XWINDOW(mGdkWindow),
1662 xattrs.your_event_mask |
1663 SubstructureNotifyMask);
1664
1665 - gdk_window_add_filter(mDrawingarea->inner_window,
1666 - plugin_window_filter_func,
1667 - this);
1668 + gdk_window_add_filter(mGdkWindow, plugin_window_filter_func, this);
1669
1670 XSync(GDK_DISPLAY(), False);
1671 #endif /* MOZ_X11 */
1672
1673 - return (void *)GDK_WINDOW_XWINDOW(mDrawingarea->inner_window);
1674 + return (void *)GDK_WINDOW_XWINDOW(mGdkWindow);
1675 }
1676
1677 nsresult
1678 @@ -4907,14 +4892,13 @@ nsWindow::SetNonXEmbedPluginFocus()
1679 Window curFocusWindow;
1680 int focusState;
1681
1682 - XGetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1683 + XGetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1684 &curFocusWindow,
1685 &focusState);
1686
1687 LOGFOCUS(("\t curFocusWindow=%p\n", curFocusWindow));
1688
1689 - GdkWindow* toplevel = gdk_window_get_toplevel
1690 - (mDrawingarea->inner_window);
1691 + GdkWindow* toplevel = gdk_window_get_toplevel(mGdkWindow);
1692 GdkWindow *gdkfocuswin = gdk_window_lookup(curFocusWindow);
1693
1694 // lookup with the focus proxy window is supposed to get the
1695 @@ -4926,11 +4910,11 @@ nsWindow::SetNonXEmbedPluginFocus()
1696
1697 // switch the focus from the focus proxy to the plugin window
1698 mOldFocusWindow = curFocusWindow;
1699 - XRaiseWindow(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1700 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window));
1701 + XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
1702 + GDK_WINDOW_XWINDOW(mGdkWindow));
1703 gdk_error_trap_push();
1704 - XSetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1705 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window),
1706 + XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1707 + GDK_WINDOW_XWINDOW(mGdkWindow),
1708 RevertToNone,
1709 CurrentTime);
1710 gdk_flush();
1711 @@ -4939,8 +4923,7 @@ nsWindow::SetNonXEmbedPluginFocus()
1712 gdk_window_add_filter(NULL, plugin_client_message_filter, this);
1713
1714 LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus oldfocus=%p new=%p\n",
1715 - mOldFocusWindow,
1716 - GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)));
1717 + mOldFocusWindow, GDK_WINDOW_XWINDOW(mGdkWindow)));
1718 }
1719
1720 void
1721 @@ -4957,7 +4940,7 @@ nsWindow::LoseNonXEmbedPluginFocus()
1722 Window curFocusWindow;
1723 int focusState;
1724
1725 - XGetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1726 + XGetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1727 &curFocusWindow,
1728 &focusState);
1729
1730 @@ -4966,12 +4949,12 @@ nsWindow::LoseNonXEmbedPluginFocus()
1731 // event filter that blocks the WM_TAKE_FOCUS is enough. WM and gtk2
1732 // will take care of the focus later.
1733 if (!curFocusWindow ||
1734 - curFocusWindow == GDK_WINDOW_XWINDOW(mDrawingarea->inner_window)) {
1735 + curFocusWindow == GDK_WINDOW_XWINDOW(mGdkWindow)) {
1736
1737 gdk_error_trap_push();
1738 - XRaiseWindow(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1739 + XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
1740 mOldFocusWindow);
1741 - XSetInputFocus(GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1742 + XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
1743 mOldFocusWindow,
1744 RevertToParent,
1745 CurrentTime);
1746 @@ -6655,13 +6638,11 @@ nsWindow::IMESetCursorPosition(const nsTextEventReply& aReply)
1747
1748 // Get the position of the refWindow in screen.
1749 gint refX, refY;
1750 - gdk_window_get_origin(refWindow->mDrawingarea->inner_window,
1751 - &refX, &refY);
1752 + gdk_window_get_origin(refWindow->mGdkWindow, &refX, &refY);
1753
1754 // Get the position of IM context owner window in screen.
1755 gint ownerX, ownerY;
1756 - gdk_window_get_origin(ownerWindow->mDrawingarea->inner_window,
1757 - &ownerX, &ownerY);
1758 + gdk_window_get_origin(ownerWindow->mGdkWindow, &ownerX, &ownerY);
1759
1760 // Compute the caret position in the IM owner window.
1761 GdkRectangle area;
1762 @@ -6807,7 +6788,7 @@ nsWindow::GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState)
1763 GdkModifierType modifiers = gdk_keyboard_get_modifiers();
1764 PRUint32 capsLockMask, numLockMask, scrollLockMask;
1765 PRBool foundMasks = gdk_keyboard_get_modmap_masks(
1766 - GDK_WINDOW_XDISPLAY(mDrawingarea->inner_window),
1767 + GDK_WINDOW_XDISPLAY(mGdkWindow),
1768 &capsLockMask, &numLockMask, &scrollLockMask);
1769 if (!foundMasks)
1770 return NS_ERROR_NOT_IMPLEMENTED;
1771 @@ -7138,10 +7119,12 @@ nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
1772 gfxASurface*
1773 nsWindow::GetThebesSurface()
1774 {
1775 + if (!mGdkWindow)
1776 + return nsnull;
1777 +
1778 GdkDrawable* d;
1779 gint x_offset, y_offset;
1780 - gdk_window_get_internal_paint_info(mDrawingarea->inner_window,
1781 - &d, &x_offset, &y_offset);
1782 + gdk_window_get_internal_paint_info(mGdkWindow, &d, &x_offset, &y_offset);
1783
1784 #ifdef MOZ_X11
1785 gint width, height;
1786 @@ -7217,7 +7200,7 @@ nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVert
1787 }
1788
1789 // get the gdk window for this widget
1790 - GdkWindow* gdk_window = mDrawingarea->inner_window;
1791 + GdkWindow* gdk_window = mGdkWindow;
1792 if (!GDK_IS_WINDOW(gdk_window)) {
1793 return NS_ERROR_FAILURE;
1794 }
1795 --- mozilla/widget/src/gtk2/nsWindow.h
1796 +++ mozilla/widget/src/gtk2/nsWindow.h
1797 @@ -43,7 +43,6 @@
1798 #include "nsAutoPtr.h"
1799
1800 #include "mozcontainer.h"
1801 -#include "mozdrawingarea.h"
1802 #include "nsWeakReference.h"
1803
1804 #include "nsIDragService.h"
1805 @@ -480,6 +479,7 @@ protected:
1806 PRUint32 mPreferredHeight;
1807
1808 private:
1809 + void DestroyChildWindows();
1810 void GetToplevelWidget(GtkWidget **aWidget);
1811 GtkWidget *GetMozContainerWidget();
1812 nsWindow *GetContainerWindow();
1813 @@ -492,7 +492,7 @@ private:
1814
1815 GtkWidget *mShell;
1816 MozContainer *mContainer;
1817 - MozDrawingarea *mDrawingarea;
1818 + GdkWindow *mGdkWindow;
1819
1820 GtkWindowGroup *mWindowGroup;
1821
1822
1823
1824
1825 1.1 src/patchsets/seamonkey/2.0.5/700-sparc-build.patch
1826
1827 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/700-sparc-build.patch?rev=1.1&view=markup
1828 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/seamonkey/2.0.5/700-sparc-build.patch?rev=1.1&content-type=text/plain
1829
1830 Index: 700-sparc-build.patch
1831 ===================================================================
1832 --- mozilla/js/src/nanojit/CodeAlloc.cpp
1833 +++ mozilla/js/src/nanojit/CodeAlloc.cpp
1834 @@ -247,8 +247,20 @@
1835 #endif
1836
1837 #ifdef AVMPLUS_SPARC
1838 +#ifdef __linux__ // bugzilla 502369
1839 +void sync_instruction_memory(caddr_t v, u_int len)
1840 +{
1841 + caddr_t end = v + len;
1842 + caddr_t p = v;
1843 + while (p < end) {
1844 + asm("flush %0" : : "r" (p));
1845 + p += 32;
1846 + }
1847 +}
1848 +#else
1849 extern "C" void sync_instruction_memory(caddr_t v, u_int len);
1850 #endif
1851 +#endif
1852
1853 #if defined NANOJIT_IA32 || defined NANOJIT_X64
1854 // intel chips have dcache/icache interlock