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