Windows build fixup. I haven't really tested whether tabs actually *work* in this scenario (widget sizing and parenting might be interesting), but it's at least enough to allow other people to start really working on code.

This commit is contained in:
Benjamin Smedberg 2009-07-07 12:26:49 -04:00
parent a49dc40cea
commit 3f30a9cbf6
6 changed files with 48 additions and 10 deletions

View File

@ -89,10 +89,12 @@
#include "TabParent.h"
#ifdef MOZ_WIDGET_GTK2
#include "mozcontainer.h"
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#endif
using namespace mozilla;
using namespace mozilla::tabs;
@ -1102,6 +1104,18 @@ nsFrameLoader::TryNewProcess()
// FIXME check that this widget has the size and position we expect for
// this iframe?
nsPresContext* presContext = ourFrame->PresContext();
#ifdef XP_WIN
HWND parentwin =
static_cast<HWND>(w->GetNativeData(NS_NATIVE_WINDOW));
mChildProcess = new TabParent(parentwin);
mChildProcess->Move(0, 0,
presContext->AppUnitsToDevPixels(ourFrame->GetSize().width),
presContext->AppUnitsToDevPixels(ourFrame->GetSize().height));
#elif defined(MOZ_WIDGET_GTK2)
GdkWindow* parent_win =
static_cast<GdkWindow*>(w->GetNativeData(NS_NATIVE_WINDOW));
@ -1118,7 +1132,6 @@ nsFrameLoader::TryNewProcess()
gtk_widget_realize(socket);
// set the child window's size and position
nsPresContext* presContext = ourFrame->PresContext();
GtkAllocation alloc;
alloc.x = 0; // setting position doesn't look necessary
alloc.y = 0;
@ -1134,5 +1147,9 @@ nsFrameLoader::TryNewProcess()
mChildProcess->Move(0, 0, alloc.width, alloc.height);
#else
#error TODO for this platform
#endif
return PR_TRUE;
}

View File

@ -8,8 +8,11 @@
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeItem.h"
#include "nsThreadUtils.h"
#ifdef MOZ_WIDGET_GTK2
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#endif
using namespace mozilla::tabs;
@ -35,14 +38,24 @@ TabChild::Answerinit(const MagicWindowHandle& parentWidget)
{
printf("creating %d!\n", NS_IsMainThread());
#ifdef MOZ_WIDGET_GTK2
gtk_init(NULL, NULL);
#endif
nsCOMPtr<nsIWebBrowser> webBrowser(do_CreateInstance(NS_WEBBROWSER_CONTRACTID));
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(webBrowser);
#ifdef MOZ_WIDGET_GTK2
GtkWidget* win = gtk_plug_new((GdkNativeWindow)parentWidget);
gtk_widget_show(win);
#elif defined(XP_WIN)
HWND win = parentWidget;
#else
#error You lose!
#endif
baseWindow->InitWindow(win, 0, 0, 0, 0, 0);
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(baseWindow));
@ -69,10 +82,10 @@ TabChild::AnswerloadURL(const String& uri)
}
nsresult
TabChild::Answermove(const uint32_t& x,
const uint32_t& y,
const uint32_t& width,
const uint32_t& height)
TabChild::Answermove(const PRUint32& x,
const PRUint32& y,
const PRUint32& width,
const PRUint32& height)
{
printf("[TabChild] MOVE to (x,y)=(%ud, %ud), (w,h)= (%ud, %ud)\n",
x, y, width, height);

View File

@ -26,10 +26,10 @@ public:
virtual nsresult Answerinit(const MagicWindowHandle& parentWidget);
virtual nsresult AnswerloadURL(const String& uri);
virtual nsresult Answermove(const uint32_t& x,
const uint32_t& y,
const uint32_t& width,
const uint32_t& height);
virtual nsresult Answermove(const PRUint32& x,
const PRUint32& y,
const PRUint32& width,
const PRUint32& height);
private:
MagicWindowHandle mWidget;

View File

@ -38,7 +38,9 @@ bool TabProcessParent::Launch()
cmdLine.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
base::ProcessHandle process;
#if defined(OS_POSIX)
#if defined(OS_WIN)
base::LaunchApp(cmdLine, false, false, &process);
#elif defined(OS_POSIX)
base::LaunchApp(cmdLine.argv(), mFileMap, false, &process);
#else
#error Loser

View File

@ -1,6 +1,8 @@
#ifndef mozilla_tabs_TabTypes_h
#define mozilla_tabs_TabTypes_h
#include "base/basictypes.h"
#ifdef XP_WIN
#include <windows.h>

View File

@ -200,8 +200,12 @@ XRE_InitChildProcess(int aArgc,
NS_ENSURE_ARG_POINTER(aArgv[0]);
if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS")) {
#ifdef OS_POSIX
printf("\n\nCHILDCHILDCHILDCHILD\n debug me @%d\n\n", getpid());
sleep(30);
#elif defined(OS_WIN)
Sleep(30000);
#endif
}
base::AtExitManager exitManager;