From 1e97cfb9b61b252080e4356bdc92332b8dc82c93 Mon Sep 17 00:00:00 2001 From: "blizzard%redhat.com" Date: Mon, 6 Dec 1999 20:28:47 +0000 Subject: [PATCH] bring the gtk embedded code back from the dead. this is a fix for bug #20396. git-svn-id: svn://10.0.0.236/trunk@55441 18797224-902f-48f8-a5cc-f745e15eee43 --- .../embed/gtk/lib/GtkMozillaContainer.cpp | 24 ++++++++++++++++--- .../embed/gtk/lib/GtkMozillaContainer.h | 5 ++++ mozilla/webshell/embed/gtk/lib/Makefile.am | 1 + mozilla/webshell/embed/gtk/lib/Makefile.in | 11 ++++----- mozilla/webshell/embed/gtk/lib/gtkmozilla.cpp | 9 +++---- mozilla/webshell/embed/gtk/lib/gtkmozilla.h | 6 ++--- 6 files changed, 37 insertions(+), 19 deletions(-) diff --git a/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.cpp b/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.cpp index db3b1bae930..e438c52b3b6 100644 --- a/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.cpp +++ b/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.cpp @@ -36,13 +36,14 @@ GtkMozillaContainer::GtkMozillaContainer(GtkMozilla *moz, nsIPref * aPrefs) { mWebShell = nsnull; - width = height = 0; mStream = nsnull; mChannel = nsnull; mLoadGroup = nsnull; mContext = nsnull; + mMozArea = nsnull; + mSuperWin = nsnull; mozilla = moz; @@ -79,9 +80,17 @@ GtkMozillaContainer::Show() { width = alloc->width; height = alloc->height; + + // we need to create the mozbox here that will shim + // between the superwin and the widget. + + mMozArea = gtk_mozarea_new(); + gtk_container_add(GTK_CONTAINER(mozilla), mMozArea); + gtk_widget_realize(mMozArea); + mSuperWin = GTK_MOZAREA(mMozArea)->superwin; //printf("Init, size: %d, %d\n", width, height); - mWebShell->Init((nsNativeWidget *)mozilla, + mWebShell->Init((nsNativeWidget *)mSuperWin, 0, 0, width, @@ -95,6 +104,9 @@ GtkMozillaContainer::Show() } } + gdk_window_show(mSuperWin->bin_window); + gdk_window_show(mSuperWin->shell_window); + if (mWebShell) { mWebShell->Show(); @@ -105,13 +117,19 @@ void GtkMozillaContainer::Resize(gint w, gint h) { int new_size; + GtkAllocation alloc; // printf("GtkMozillaContainer::Resize called width: %d, %d\n", w, h); new_size = ((width != w) || (height != h)); if (new_size && mWebShell) { width = w; height = h; //printf("GtkMozillaContainer::Resize setting to: %d, %d\n", width, height); - gtk_layout_set_size(GTK_LAYOUT(mozilla), width, height); + alloc.x = GTK_WIDGET(mozilla)->allocation.x; + alloc.y = GTK_WIDGET(mozilla)->allocation.y; + alloc.width = w; + alloc.height = h; + gtk_widget_size_allocate(GTK_WIDGET(mozilla), &alloc); + gdk_superwin_resize(mSuperWin, width, height); mWebShell->SetBounds(0, 0, width, height); } } diff --git a/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.h b/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.h index f21885f1d04..eeeb63bc17a 100644 --- a/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.h +++ b/mozilla/webshell/embed/gtk/lib/GtkMozillaContainer.h @@ -21,6 +21,8 @@ #include "nsIWebShell.h" #include "GtkMozillaInputStream.h" #include "gtkmozilla.h" +#include "gdksuperwin.h" +#include "gtkmozarea.h" class nsIWebShell; @@ -110,6 +112,9 @@ protected: GtkMozilla *mozilla; int width, height; + GtkWidget *mMozArea; + GdkSuperWin *mSuperWin; + /* Stream stuff: */ GtkMozillaInputStream *mStream; diff --git a/mozilla/webshell/embed/gtk/lib/Makefile.am b/mozilla/webshell/embed/gtk/lib/Makefile.am index 4c764ece052..af7c0a5eb3e 100644 --- a/mozilla/webshell/embed/gtk/lib/Makefile.am +++ b/mozilla/webshell/embed/gtk/lib/Makefile.am @@ -36,6 +36,7 @@ ALL_MOZ_LIBS = \ $(JSJ_LIB) \ $(NSPR_LIBS) \ $(TK_LIBS) \ + -lgtksuperwin \ $(NULL) MOZILLA_LIBS=-L$(MOZILLA_DIR)/lib \ diff --git a/mozilla/webshell/embed/gtk/lib/Makefile.in b/mozilla/webshell/embed/gtk/lib/Makefile.in index 547674f26d5..d2fdda54726 100644 --- a/mozilla/webshell/embed/gtk/lib/Makefile.in +++ b/mozilla/webshell/embed/gtk/lib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -46,10 +46,9 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -102,7 +101,7 @@ GECKO_LIBS = -lraptorgfx $(NULL) JSJ_LIB = TK_LIBS = -ALL_MOZ_LIBS = $(GECKO_LIBS) $(BASE_LIBS) $(JSJ_LIB) $(NSPR_LIBS) $(TK_LIBS) $(NULL) +ALL_MOZ_LIBS = $(GECKO_LIBS) $(BASE_LIBS) $(JSJ_LIB) $(NSPR_LIBS) $(TK_LIBS) -lgtksuperwin $(NULL) MOZILLA_LIBS = -L$(MOZILLA_DIR)/lib $(ALL_MOZ_LIBS) @@ -282,7 +281,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pr $$/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -362,7 +361,7 @@ uninstall: uninstall-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) diff --git a/mozilla/webshell/embed/gtk/lib/gtkmozilla.cpp b/mozilla/webshell/embed/gtk/lib/gtkmozilla.cpp index 5571bde9cbc..9e095649646 100644 --- a/mozilla/webshell/embed/gtk/lib/gtkmozilla.cpp +++ b/mozilla/webshell/embed/gtk/lib/gtkmozilla.cpp @@ -62,7 +62,7 @@ enum { }; static guint mozilla_signals[LAST_SIGNAL] = { 0 }; -static GtkLayoutClass *parent_class = NULL; +static GtkFixedClass *parent_class = NULL; static void gtk_mozilla_class_init (GtkMozillaClass *klass) @@ -73,7 +73,7 @@ gtk_mozilla_class_init (GtkMozillaClass *klass) object_class = (GtkObjectClass*) klass; widget_class = (GtkWidgetClass*) klass; - parent_class = (GtkLayoutClass *)gtk_type_class (GTK_TYPE_LAYOUT); + parent_class = (GtkFixedClass *)gtk_type_class (GTK_TYPE_FIXED); mozilla_signals[WILL_LOAD_URL] = gtk_signal_new ("will_load_url", @@ -142,9 +142,6 @@ gtk_mozilla_init (GtkMozilla *moz) moz->mozilla_container = NULL; - gtk_layout_set_hadjustment (GTK_LAYOUT (moz), NULL); - gtk_layout_set_vadjustment (GTK_LAYOUT (moz), NULL); - GTK_WIDGET_SET_FLAGS (GTK_WIDGET(moz), GTK_CAN_FOCUS); moz->mozilla_container = new GtkMozillaContainer(moz,sPrefs); @@ -175,7 +172,7 @@ gtk_mozilla_get_type (void) 0, 0 }; - mozilla_type = gtk_type_unique (GTK_TYPE_LAYOUT, &mozilla_info); + mozilla_type = gtk_type_unique (GTK_TYPE_FIXED, &mozilla_info); //printf("Setting up registry.\n"); diff --git a/mozilla/webshell/embed/gtk/lib/gtkmozilla.h b/mozilla/webshell/embed/gtk/lib/gtkmozilla.h index 7fcd4e92073..682fa18388b 100644 --- a/mozilla/webshell/embed/gtk/lib/gtkmozilla.h +++ b/mozilla/webshell/embed/gtk/lib/gtkmozilla.h @@ -27,8 +27,6 @@ extern "C" { #endif /* __cplusplus */ -#include - #define GTK_TYPE_MOZILLA (gtk_mozilla_get_type ()) #define GTK_MOZILLA(obj) GTK_CHECK_CAST ((obj), GTK_TYPE_MOZILLA, GtkMozilla) #define GTK_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MOZILLA, GtkMozillaClass) @@ -56,14 +54,14 @@ typedef struct _GtkMozillaClass GtkMozillaClass; struct _GtkMozilla { - GtkLayout layout; + GtkFixed fixed; void *mozilla_container; }; struct _GtkMozillaClass { - GtkLayoutClass parent_class; + GtkFixedClass parent_class; gint (*will_load_url) (GtkMozilla *mozilla, const gchar *url,