On Montag, 2. Februar 2004 02:33, Mike wrote:
> I am trying to compile the gtk widget for windows, as I already have a
> gtk application wich works but needs a good browser.
>
> I have managed to compile gtkmozembed2.cpp I am now stuck on an error
> with EmbedPrivate.cpp.
>
> Is there any reason why gtkmozembed shouldnt compile on windows? I have
> all of the gtk development headers installed (and compiled correctly)
>
> I am trying with gtk 1.2, would I have more luck with gtk 2.0?
>

Hello,

this is a patch with port to win32.
I've done that almost a year ago, but it should still apply.
There is some code cleaning needed, but I hope you can
solve that ;-)

best wishes,
Michal
Only in mozilla/embedding/browser/gtk/src/: .Makefile.swo
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/EmbedContentListener.cpp mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp
--- mozilla.org/embedding/browser/gtk/src/EmbedContentListener.cpp	2002-09-07 18:09:12.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp	2003-03-22 22:55:06.000000000 +0100
@@ -19,7 +19,12 @@
  *   Christopher Blizzard <[EMAIL PROTECTED]>
  */
 
-#include <strings.h>
+#ifdef XP_PC
+  #include <string.h>
+  #define strcasecmp(x,y) (_stricmp(x,y))
+#else
+  #include <strings.h>
+#endif
 #include <nsXPIDLString.h>
 
 #include "nsIURI.h"
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/EmbedPrivate.cpp mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp
--- mozilla.org/embedding/browser/gtk/src/EmbedPrivate.cpp	2002-08-06 07:20:30.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp	2003-03-22 22:57:22.000000000 +0100
@@ -199,7 +199,7 @@
   mNavigation->SetSessionHistory(mSessionHistory);
 
   // create the window
-  mWindow->CreateWindow();
+  mWindow->CreateWindowXX();
 
   // bind the progress listener to the browser object
   nsCOMPtr<nsISupportsWeakReference> supportsWeak;
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/EmbedWindow.cpp mozilla/embedding/browser/gtk/src/EmbedWindow.cpp
--- mozilla.org/embedding/browser/gtk/src/EmbedWindow.cpp	2002-09-07 18:09:12.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/EmbedWindow.cpp	2003-03-22 23:04:10.000000000 +0100
@@ -31,6 +31,10 @@
 #include "EmbedPrivate.h"
 #include "EmbedPrompter.h"
 
+#ifdef XP_PC
+ #include <gdk/gdkwin32.h>
+#endif
+
 GtkWidget *EmbedWindow::sTipWindow = nsnull;
 
 EmbedWindow::EmbedWindow(void)
@@ -66,7 +70,7 @@
 }
 
 nsresult
-EmbedWindow::CreateWindow(void)
+EmbedWindow::CreateWindowXX(void)
 {
   nsresult rv;
   GtkWidget *ownerAsWidget = GTK_WIDGET(mOwner->mOwningWidget);
@@ -74,7 +78,12 @@
   // Get the base window interface for the web browser object and
   // create the window.
   mBaseWindow = do_QueryInterface(mWebBrowser);
-  rv = mBaseWindow->InitWindow(GTK_WIDGET(mOwner->mOwningWidget),
+  rv = mBaseWindow->InitWindow(
+             #ifdef XP_PC
+ 			         nsNativeWidget(GDK_DRAWABLE_WIN32DATA (GTK_WIDGET(mOwner->mOwningWidget)->window)->xid),
+             #else
+               GTK_WIDGET(mOwner->mOwningWidget),
+             #endif
 			       nsnull,
 			       0, 0, 
 			       ownerAsWidget->allocation.width,
@@ -309,7 +318,7 @@
 NS_IMETHODIMP
 EmbedWindow::GetSiteWindow(void **aSiteWindow)
 {
-  GtkWidget *ownerAsWidget (GTK_WIDGET(mOwner->mOwningWidget));
+  GtkWidget *ownerAsWidget = (GTK_WIDGET(mOwner->mOwningWidget));
   *aSiteWindow = NS_STATIC_CAST(void *, ownerAsWidget);
   return NS_OK;
 }
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/EmbedWindow.h mozilla/embedding/browser/gtk/src/EmbedWindow.h
--- mozilla.org/embedding/browser/gtk/src/EmbedWindow.h	2001-07-16 03:38:30.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/EmbedWindow.h	2003-03-22 15:37:16.000000000 +0100
@@ -51,7 +51,7 @@
   virtual ~EmbedWindow();
 
   nsresult Init            (EmbedPrivate *aOwner);
-  nsresult CreateWindow    (void);
+  nsresult CreateWindowXX    (void);
   void     ReleaseChildren (void);
 
   NS_DECL_ISUPPORTS
Only in mozilla/embedding/browser/gtk/src/: Makefile
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/Makefile.in mozilla/embedding/browser/gtk/src/Makefile.in
--- mozilla.org/embedding/browser/gtk/src/Makefile.in	2002-09-23 20:13:28.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/Makefile.in	2003-03-23 00:32:02.000000000 +0100
@@ -79,10 +79,17 @@
 
 endif
 
+ifeq ($(OS_ARCH), WINNT)
+SHARED_LIBRARY_LIBS= \
+		$(DIST)/lib/embed_base_s.$(LIB_SUFFIX) \
+		$(DIST)/lib/mpfilelocprovider_s.$(LIB_SUFFIX) \
+		$(NULL)
+else
 SHARED_LIBRARY_LIBS= \
 		$(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \
 		$(DIST)/lib/libmpfilelocprovider_s.$(LIB_SUFFIX) \
 		$(NULL)
+endif
 
 EXPORTS		= \
 		gtkmozembed.h \
@@ -91,9 +98,12 @@
 EXTRA_DSO_LDOPTS = \
 		$(MOZ_COMPONENT_LIBS) \
 		$(XPCOM_GLUE_LIBS) \
-		-lgtksuperwin \
 		$(NULL)
 
+ifneq ($(OS_ARCH), WINNT)
+EXTRA_DSO_LDOPTS += -lgtksuperwin
+endif
+
 EXTRA_DSO_LDOPTS += $(MOZ_GTK_LDFLAGS)
 
 include $(topsrcdir)/config/rules.mk
@@ -109,7 +119,12 @@
 endif
 endif
 
+ifeq ($(OS_ARCH), WINNT)
+CXXFLAGS += $(MOZ_GTK_CFLAGS) `pkg-config --msvc-syntax --cflags gtk+-1.3-win32-production`
+LDFLAGS += `pkg-config --msvc-syntax --libs gtk+-1.3-win32-production` /implib:gtkembedmoz.lib
+else
 CXXFLAGS        += $(MOZ_GTK_CFLAGS)
+endif
 
 ifdef BUILD_STATIC_LIBS
 
Only in mozilla/embedding/browser/gtk/src/: Makefile.in~
Only in mozilla/embedding/browser/gtk/src/: gtkembedmoz.dll
Only in mozilla/embedding/browser/gtk/src/: gtkembedmoz.exp
Only in mozilla/embedding/browser/gtk/src/: gtkembedmoz.ilk
Only in mozilla/embedding/browser/gtk/src/: gtkembedmoz.lib
Only in mozilla/embedding/browser/gtk/src/: gtkembedmoz.pdb
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/gtkmozembed.h mozilla/embedding/browser/gtk/src/gtkmozembed.h
--- mozilla.org/embedding/browser/gtk/src/gtkmozembed.h	2001-08-31 23:47:00.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/gtkmozembed.h	2003-03-22 23:09:12.000000000 +0100
@@ -23,6 +23,11 @@
 #ifndef gtkmozembed_h
 #define gtkmozembed_h
 
+#ifdef XP_PC
+  #include <string.h>
+  #define NS_EXPORT _declspec(dllexport)
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -83,38 +88,38 @@
 				gint status, gpointer message);
 };
 
-GtkType      gtk_moz_embed_get_type         (void);
-GtkWidget   *gtk_moz_embed_new              (void);
-void         gtk_moz_embed_push_startup     (void);
-void         gtk_moz_embed_pop_startup      (void);
-void         gtk_moz_embed_set_comp_path    (char *aPath);
-void         gtk_moz_embed_set_profile_path (char *aDir, char *aName);
-void         gtk_moz_embed_load_url         (GtkMozEmbed *embed, 
+NS_EXPORT GtkType      gtk_moz_embed_get_type         (void);
+NS_EXPORT GtkWidget   *gtk_moz_embed_new              (void);
+NS_EXPORT void         gtk_moz_embed_push_startup     (void);
+NS_EXPORT void         gtk_moz_embed_pop_startup      (void);
+NS_EXPORT void         gtk_moz_embed_set_comp_path    (char *aPath);
+NS_EXPORT void         gtk_moz_embed_set_profile_path (char *aDir, char *aName);
+NS_EXPORT void         gtk_moz_embed_load_url         (GtkMozEmbed *embed, 
 					     const char *url);
-void         gtk_moz_embed_stop_load        (GtkMozEmbed *embed);
-gboolean     gtk_moz_embed_can_go_back      (GtkMozEmbed *embed);
-gboolean     gtk_moz_embed_can_go_forward   (GtkMozEmbed *embed);
-void         gtk_moz_embed_go_back          (GtkMozEmbed *embed);
-void         gtk_moz_embed_go_forward       (GtkMozEmbed *embed);
-void         gtk_moz_embed_render_data      (GtkMozEmbed *embed, 
+NS_EXPORT void         gtk_moz_embed_stop_load        (GtkMozEmbed *embed);
+NS_EXPORT gboolean     gtk_moz_embed_can_go_back      (GtkMozEmbed *embed);
+NS_EXPORT gboolean     gtk_moz_embed_can_go_forward   (GtkMozEmbed *embed);
+NS_EXPORT void         gtk_moz_embed_go_back          (GtkMozEmbed *embed);
+NS_EXPORT void         gtk_moz_embed_go_forward       (GtkMozEmbed *embed);
+NS_EXPORT void         gtk_moz_embed_render_data      (GtkMozEmbed *embed, 
 					     const char *data,
 					     guint32 len,
 					     const char *base_uri, 
 					     const char *mime_type);
-void         gtk_moz_embed_open_stream      (GtkMozEmbed *embed,
+NS_EXPORT void         gtk_moz_embed_open_stream      (GtkMozEmbed *embed,
 					     const char *base_uri,
 					     const char *mime_type);
-void         gtk_moz_embed_append_data      (GtkMozEmbed *embed,
+NS_EXPORT void         gtk_moz_embed_append_data      (GtkMozEmbed *embed,
 					     const char *data, guint32 len);
-void         gtk_moz_embed_close_stream     (GtkMozEmbed *embed);
-char        *gtk_moz_embed_get_link_message (GtkMozEmbed *embed);
-char        *gtk_moz_embed_get_js_status    (GtkMozEmbed *embed);
-char        *gtk_moz_embed_get_title        (GtkMozEmbed *embed);
-char        *gtk_moz_embed_get_location     (GtkMozEmbed *embed);
-void         gtk_moz_embed_reload           (GtkMozEmbed *embed, gint32 flags);
-void         gtk_moz_embed_set_chrome_mask  (GtkMozEmbed *embed, 
+NS_EXPORT void         gtk_moz_embed_close_stream     (GtkMozEmbed *embed);
+NS_EXPORT char        *gtk_moz_embed_get_link_message (GtkMozEmbed *embed);
+NS_EXPORT char        *gtk_moz_embed_get_js_status    (GtkMozEmbed *embed);
+NS_EXPORT char        *gtk_moz_embed_get_title        (GtkMozEmbed *embed);
+NS_EXPORT char        *gtk_moz_embed_get_location     (GtkMozEmbed *embed);
+NS_EXPORT void         gtk_moz_embed_reload           (GtkMozEmbed *embed, gint32 flags);
+NS_EXPORT void         gtk_moz_embed_set_chrome_mask  (GtkMozEmbed *embed, 
 					     guint32 flags);
-guint32      gtk_moz_embed_get_chrome_mask  (GtkMozEmbed *embed);
+NS_EXPORT guint32      gtk_moz_embed_get_chrome_mask  (GtkMozEmbed *embed);
 
 /* enum types */
 #define GTK_TYPE_MOZ_EMBED_PROGRESS_FLAGS \
@@ -221,7 +226,7 @@
 				guint chromemask);
 };
 
-GtkMozEmbedSingle *
+NS_EXPORT GtkMozEmbedSingle *
 gtk_moz_embed_single_get(void);
 
 #ifdef __cplusplus
diff -ru -x '*.obj' -x .deps mozilla.org/embedding/browser/gtk/src/gtkmozembed2.cpp mozilla/embedding/browser/gtk/src/gtkmozembed2.cpp
--- mozilla.org/embedding/browser/gtk/src/gtkmozembed2.cpp	2002-01-12 06:04:58.000000000 +0100
+++ mozilla/embedding/browser/gtk/src/gtkmozembed2.cpp	2003-03-22 23:17:04.000000000 +0100
@@ -37,7 +37,7 @@
 #include <nsReadableUtils.h>
 
 // so we can get callbacks from the mozarea
-#include <gtkmozarea.h>
+//#include <gtkmozarea.h>
 
 class nsIDirectoryServiceProvider;
 
@@ -182,13 +182,14 @@
 
 // signal handlers for tracking the focus and and focus out events on
 // the toplevel window.
-
+/*
 static void
 handle_toplevel_focus_in (GtkMozArea    *aArea,
 			  GtkMozEmbed   *aEmbed);
 static void
 handle_toplevel_focus_out(GtkMozArea    *aArea,
 			  GtkMozEmbed   *aEmbed);
+*/
 
 // globals for this type of widget
 
@@ -539,6 +540,7 @@
 				 GTK_OBJECT(child_widget));
 
   // connect to the toplevel focus out events for the child
+  /*
   GtkMozArea *mozarea = GTK_MOZAREA(child_widget);
   gtk_signal_connect_while_alive(GTK_OBJECT(mozarea),
 				 "toplevel_focus_in",
@@ -551,6 +553,7 @@
 				 GTK_SIGNAL_FUNC(handle_toplevel_focus_out),
 				 embed,
 				 GTK_OBJECT(mozarea));
+*/
 }
 
 static void
@@ -663,6 +666,7 @@
   return FALSE;
 }
 
+/*
 static void
 handle_toplevel_focus_in (GtkMozArea    *aArea,
 			  GtkMozEmbed   *aEmbed)
@@ -682,6 +686,7 @@
 
   embedPrivate->TopLevelFocusOut();
 }
+*/
 
 // Widget methods
 
Only in mozilla/embedding/browser/gtk/src/: module.rc
Only in mozilla/embedding/browser/gtk/src/: module.res

Reply via email to