bring the gtk embedded code back from the dead. this is a fix for bug #20396.

This commit is contained in:
blizzard%redhat.com 1999-12-06 20:28:47 +00:00
Родитель 6fdb0078cb
Коммит 5e54586f2c
6 изменённых файлов: 30 добавлений и 249 удалений

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -1,123 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "MPL"); you may not use this file except in
* compliance with the MPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of the Original Code is Alexander. Portions
* created by Alexander Larsson are Copyright (C) 1999
* Alexander Larsson. All Rights Reserved.
*/
#ifndef GTKMOZILLACONTAINER_H
#define GTKMOZILLACONTAINER_H
#include <gtk/gtk.h>
#include "nsIWebShell.h"
#include "GtkMozillaInputStream.h"
#include "gtkmozilla.h"
class nsIWebShell;
class nsIPref;
class GtkMozillaContainer : public nsIWebShellContainer
{
public:
// nsISupports interface declaration
NS_DECL_ISUPPORTS
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus);
NS_IMETHOD NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
nsIWebShell *&aNewWebShell);
NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell,
PRBool& aFocusTaken);
NS_IMETHOD CanCreateNewWebShell(PRBool& aResult);
NS_IMETHOD SetNewWebShellInfo(const nsString& aName, const nsString& anURL,
nsIWebShell* aOpenerShell, PRUint32 aChromeMask,
nsIWebShell** aNewShell, nsIWebShell** anInnerShell);
NS_IMETHOD FindWebShellWithName(const PRUnichar* aName,
nsIWebShell*& aResult);
NS_IMETHOD ContentShellAdded(nsIWebShell* aChildShell,
nsIContent* frameNode);
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& anAnchorAlignment,
const nsString& aPopupAlignment,
nsIDOMWindow* aWindow, nsIDOMWindow** outPopup);
NS_IMETHOD ChildShellAdded(nsIWebShell** aChildShell, nsIContent* frameNode);
// Construction
GtkMozillaContainer(GtkMozilla *moz, nsIPref * aPrefs); // standard constructor
virtual ~GtkMozillaContainer();
void Show();
void Resize(gint w, gint h);
void LoadURL(const char *url);
void Stop();
void Reload(GtkMozillaReloadType type);
gint Back();
gint CanBack();
gint Forward();
gint CanForward();
gint GoTo(gint history_index);
gint GetHistoryLength();
gint GetHistoryIndex();
/* Stream stuff: */
gint StartStream(const char *base_url,
const char *action,
nsISupports * ctxt,
const char *content_type);
gint WriteStream(const char *data,
gint offset,
gint len);
void EndStream(void);
protected:
nsresult CreateContentViewer(const char *aCommand,
nsIChannel * aChannel,
nsILoadGroup * aLoadGroup,
const char* aContentType,
nsIContentViewerContainer* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListenerResult,
nsIContentViewer** aDocViewerResult);
nsIWebShell *mWebShell;
nsIPref *mPrefs;
GtkMozilla *mozilla;
int width, height;
/* Stream stuff: */
GtkMozillaInputStream *mStream;
nsIChannel *mChannel;
nsILoadGroup *mLoadGroup;
nsISupports *mContext;
nsIStreamListener *mListener;
};
#endif /* GTKMOZILLACONTAINER_H */

Просмотреть файл

@ -36,6 +36,7 @@ ALL_MOZ_LIBS = \
$(JSJ_LIB) \
$(NSPR_LIBS) \
$(TK_LIBS) \
-lgtksuperwin \
$(NULL)
MOZILLA_LIBS=-L$(MOZILLA_DIR)/lib \

Просмотреть файл

@ -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)

Просмотреть файл

@ -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");

Просмотреть файл

@ -1,111 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is this file, released
* May 28, 1999.
*
* The Initial Developer of the Original Code is Alexander
* Larsson. Portions created by Alexander Larsson are
* Copyright (C) 1999 Alexander Larsson. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef GTKMOZILLA_H
#define GTKMOZILLA_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <gtk/gtklayout.h>
#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)
#define GTK_IS_MOZILLA(obj) GTK_CHECK_TYPE ((obj), GTK_TYPE_MOZILLA)
#define GTK_IS_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MOZILLA)
typedef enum GtkMozillaReloadType {
GTK_URL_RELOAD = 0,
GTK_URL_RELOAD_BYPASS_CACHE,
GTK_URL_RELOAD_BYPASS_PROXY,
GTK_URL_RELOAD_BYPASS_CACHE_AND_PROXY,
GTK_URL_RELOAD_MAX
} GtkMozillaReloadType;
typedef enum GtkMozillaLoadType {
GTK_LOAD_URL,
GTK_LOAD_HISTORY,
GTK_LOAD_LINK,
GTK_LOAD_REFRESH
} GtkMozillaLoadType;
typedef struct _GtkMozilla GtkMozilla;
typedef struct _GtkMozillaClass GtkMozillaClass;
struct _GtkMozilla
{
GtkLayout layout;
void *mozilla_container;
};
struct _GtkMozillaClass
{
GtkLayoutClass parent_class;
gint (*will_load_url) (GtkMozilla *mozilla,
const gchar *url,
GtkMozillaLoadType load_type);
void (*begin_load_url) (GtkMozilla *mozilla,
const gchar *url);
void (*end_load_url) (GtkMozilla *mozilla,
const gchar *url,
gint status);
};
extern GtkType gtk_mozilla_get_type(void);
extern GtkWidget* gtk_mozilla_new(void);
extern void gtk_mozilla_load_url(GtkMozilla *moz, const char *url);
extern void gtk_mozilla_stop(GtkMozilla *moz);
extern void gtk_mozilla_reload(GtkMozilla *moz, GtkMozillaReloadType reload_type);
extern void gtk_mozilla_resize(GtkMozilla *moz, gint width, gint height);
extern void gtk_mozilla_back(GtkMozilla *moz);
extern void gtk_mozilla_forward(GtkMozilla *moz);
extern gint gtk_mozilla_can_back(GtkMozilla *moz);
extern gint gtk_mozilla_can_forward(GtkMozilla *moz);
extern void gtk_mozilla_goto_history(GtkMozilla *moz, gint index);
extern gint gtk_mozilla_get_history_length(GtkMozilla *moz);
extern gint gtk_mozilla_get_history_index(GtkMozilla *moz);
extern gint gtk_mozilla_stream_start(GtkMozilla *moz,
const char *base_url,
const char *action,
const char *content_type);
extern gint gtk_mozilla_stream_start_html(GtkMozilla *moz,
const char *base_url);
extern gint gtk_mozilla_stream_write(GtkMozilla *moz,
const char *data,
gint offset,
gint len);
extern void gtk_mozilla_stream_end(GtkMozilla *moz);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GTKMOZILLA_H */