fix for bug #21169. fix problems with resizing and showing the gtkmozilla widget when embedding it. r=pavlov, a=chofmann

This commit is contained in:
blizzard%redhat.com 1999-12-08 23:07:13 +00:00
Родитель da80c1d2de
Коммит 7a4c6ea9e2
2 изменённых файлов: 27 добавлений и 10 удалений

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

@ -64,6 +64,8 @@ void
GtkMozillaContainer::Show()
{
GtkAllocation *alloc = &GTK_WIDGET(mozilla)->allocation;
// g_print("GtkMozillaContainer::Show\n");
nsresult rv = nsRepository::CreateInstance(kWebShellCID,
nsnull,
@ -87,6 +89,7 @@ GtkMozillaContainer::Show()
mMozArea = gtk_mozarea_new();
gtk_container_add(GTK_CONTAINER(mozilla), mMozArea);
gtk_widget_realize(mMozArea);
gtk_widget_show(mMozArea);
mSuperWin = GTK_MOZAREA(mMozArea)->superwin;
//printf("Init, size: %d, %d\n", width, height);
@ -116,11 +119,10 @@ GtkMozillaContainer::Show()
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) {
// g_print("GtkMozillaContainer::Resize called width: %d, %d\n", w, h);
if (mWebShell) {
width = w;
height = h;
//printf("GtkMozillaContainer::Resize setting to: %d, %d\n", width, height);
@ -128,7 +130,7 @@ GtkMozillaContainer::Resize(gint w, gint h)
alloc.y = GTK_WIDGET(mozilla)->allocation.y;
alloc.width = w;
alloc.height = h;
gtk_widget_size_allocate(GTK_WIDGET(mozilla), &alloc);
// gtk_widget_size_allocate(GTK_WIDGET(mozilla), &alloc);
gdk_superwin_resize(mSuperWin, width, height);
mWebShell->SetBounds(0, 0, width, height);
}

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

@ -32,6 +32,7 @@ extern "C" void NS_SetupRegistry();
static void gtk_mozilla_realize(GtkWidget *widget);
static void gtk_mozilla_finalize (GtkObject *object);
static void gtk_mozilla_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
typedef gboolean (*GtkSignal_BOOL__POINTER_INT) (GtkObject * object,
gpointer arg1,
@ -108,6 +109,7 @@ gtk_mozilla_class_init (GtkMozillaClass *klass)
object_class->finalize = gtk_mozilla_finalize;
widget_class->realize = gtk_mozilla_realize;
widget_class->size_allocate = gtk_mozilla_size_allocate;
klass->will_load_url = NULL;
klass->begin_load_url = NULL;
@ -129,6 +131,17 @@ gtk_mozilla_realize (GtkWidget *widget)
moz_container->Show();
}
static void
gtk_mozilla_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
g_return_if_fail(widget != NULL);
g_return_if_fail(GTK_IS_WIDGET(widget));
g_return_if_fail(GTK_IS_MOZILLA(widget));
if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
(*GTK_WIDGET_CLASS(parent_class)->size_allocate)(widget, allocation);
gtk_mozilla_resize(GTK_MOZILLA(widget), allocation->width, allocation->height);
}
// THIS is a total hack. Needed cause mozilla wont work without prefs
// no more. Having the prefs be static over here is bad and a better
// fix is to make them members of some kind of structure which gets
@ -151,7 +164,7 @@ static void event_processor_callback(gpointer data,
gint source,
GdkInputCondition condition)
{
printf("event_processor_callback()\n");
// printf("event_processor_callback()\n");
nsIEventQueue *eventQueue = (nsIEventQueue*)data;
eventQueue->ProcessPendingEvents();
}
@ -161,6 +174,7 @@ GtkType
gtk_mozilla_get_type (void)
{
static GtkType mozilla_type = 0;
nsresult rv;
if (!mozilla_type) {
static const GtkTypeInfo mozilla_info = {
@ -184,9 +198,9 @@ gtk_mozilla_get_type (void)
// Create the Event Queue for the UI thread...
nsresult rv = nsServiceManager::GetService(kEventQueueServiceCID,
NS_GET_IID(nsIEventQueueService),
(nsISupports **)&aEventQService);
rv = nsServiceManager::GetService(kEventQueueServiceCID,
NS_GET_IID(nsIEventQueueService),
(nsISupports **)&aEventQService);
if (!NS_SUCCEEDED(rv)) {
printf("Could not obtain the event queue service\n");
@ -234,7 +248,8 @@ gtk_mozilla_get_type (void)
event_processor_callback,
EQueue);
nsIThread::SetMainThread();
// XXX chris this is generating a bad warning.
// nsIThread::SetMainThread();
}