I am working with GTK 1.2.10, on Linux 2.4.18 (Red Hat 9.0). I am attempting to create a GTK window through the JNI (see code attached below), and I receive the following assertion failure during execution:
(<unknown>:6338): Gtk-CRITICAL **: file gtkwindow.c: line 794 (gtk_window_new): assertion `type >= GTK_WINDOW_TOPLEVEL && type <= GTK_WINDOW_POPUP' failed
A series of other assertions subsequently fail, all seemingly because *mShell is null.
I'm creating the window with:
static GtkWidget *mShell = NULL; [snip] mShell = gtk_window_new (GTK_WINDOW_POPUP);
Why does this assertion fail?
Thanks in advance!
-Andrew Hogue
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= GtkMozEmbed.cpp =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include <jni.h> #include "GtkMozEmbed.h"
#include <jawt_md.h> #include <jawt.h>
#include <X11/Xlib.h>
#include <gdk/gdkx.h> #include <gtk/gtk.h> #include "gtkmozembed.h"
#include "nsGtkEventHandler.h"
#include <dlfcn.h>
/*
* Class: org_eclipse_swt_widgets_GtkMozEmbed
* Method: createTopLevelWindow
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_swt_widgets_GtkMozEmbed_createTopLevelWindow
(JNIEnv * env, jobject obj) {
static GtkWidget *mShell = NULL;
/* Initialise GTK */ gtk_set_locale (); gtk_init (0, NULL); gdk_rgb_init(); mShell = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_default_size(GTK_WINDOW(mShell), 300, 300); gtk_window_set_title(GTK_WINDOW(mShell), "Simple browser"); return (jint) mShell; }