gcc/libjava/gnu/awt/gtk/natGtkToolkit.cc
Bryce McKinlay 0acff4bc96 prims.cc (_Jv_argv, _Jv_argc): New fields.
2000-10-02  Bryce McKinlay  <bryce@albatross.co.nz>

	* prims.cc (_Jv_argv, _Jv_argc): New fields.
	(JvRunMain): Set _Jv_argv and _Jv_argc.
	* java/awt/Component.java: Minor fixes.
	* java/awt/Image.java (UndefinedProperty): Initialize final field.
	* java/awt/Toolkit.java (systemEventQueue): Removed.
	(getDefaultToolkit): Default to "gnu.awt.gtk.GtkToolkit".
	* java/awt/Window.java (getToolkit): Don't call super.
	* java/awt/image/BufferedImage.java: Fix definate assignment errors.
	* java/awt/peer/ContainerPeer.java (insets): Remove unused method.
	* gnu/awt/gtk/GtkComponentPeer.java: New file.
	* gnu/awt/gtk/GtkContainerPeer.java: New file.
	* gnu/awt/gtk/GtkFramePeer.java: New file.
	* gnu/awt/gtk/GtkMainThread.java: New file.
	* gnu/awt/gtk/GtkToolkit.java: New file.
	* gnu/awt/gtk/GtkWindowPeer.java: New file.
	* gnu/awt/gtk/gtkcommon.cc: New file.
	* gnu/awt/gtk/gtkcommon.h: New file.
	* gnu/awt/gtk/natGtkComponentPeer.cc: New file.
	* gnu/awt/gtk/natGtkContainerPeer.cc: New file.
	* gnu/awt/gtk/natGtkFramePeer.cc: New file.
	* gnu/awt/gtk/natGtkMainThread.cc: New file.
	* gnu/awt/gtk/natGtkToolkit.cc: New file.
	* gnu/awt/gtk/natGtkWindowPeer.cc: New file.

From-SVN: r36688
2000-10-02 06:14:25 +01:00

76 lines
1.5 KiB
C++

// This file was created by `gcjh -stubs'. -*- c++ -*-
//
// This file is intended to give you a head start on implementing native
// methods using CNI.
// Be aware: running `gcjh -stubs ' once more for this class may
// overwrite any edits you have made to this file.
#include <java/awt/Dimension.h>
#include <gnu/awt/gtk/GtkToolkit.h>
#include <gcj/cni.h>
#include <gtk/gtk.h>
// GTK requires the program's argc and argv variables.
extern char **_Jv_argv;
extern int _Jv_argc;
// Call gtk_init. It is very important that this happen before any other
// gtk calls.
void
gnu::awt::gtk::GtkToolkit::gtkInit ()
{
// Initialize GLib in thread-safe mode. We assume that GLib is using the
// same native threads library as libgcj. Refer to comments in
// GtkComponentPeer constructor.
g_thread_init (NULL);
gtk_init (&_Jv_argc, &_Jv_argv);
}
void
gnu::awt::gtk::GtkToolkit::beep ()
{
GDK_THREADS_ENTER ();
gdk_beep ();
GDK_THREADS_LEAVE ();
}
jint
gnu::awt::gtk::GtkToolkit::getScreenResolution ()
{
jint res;
GDK_THREADS_ENTER ();
res = (int) (gdk_screen_width () / (gdk_screen_width_mm () / 25.4));
GDK_THREADS_LEAVE ();
return res;
}
::java::awt::Dimension *
gnu::awt::gtk::GtkToolkit::getScreenSize ()
{
::java::awt::Dimension *dim = new ::java::awt::Dimension ();
GDK_THREADS_ENTER ();
dim->width = gdk_screen_width ();
dim->height = gdk_screen_height ();
GDK_THREADS_LEAVE ();
return dim;
}
void
gnu::awt::gtk::GtkToolkit::sync ()
{
GDK_THREADS_ENTER ();
gdk_flush ();
GDK_THREADS_LEAVE ();
}