FSF GCC merge 02/23/03
[official-gcc.git] / libjava / gnu / awt / gtk / natGtkToolkit.cc
blobe7949395235d4793e40ee7e33ec2be6eaab6dda8
1 // This file was created by `gcjh -stubs'. -*- c++ -*-
2 //
3 // This file is intended to give you a head start on implementing native
4 // methods using CNI.
5 // Be aware: running `gcjh -stubs ' once more for this class may
6 // overwrite any edits you have made to this file.
8 #include <java/awt/Dimension.h>
10 #include <gnu/awt/gtk/GtkToolkit.h>
11 #include <gcj/cni.h>
13 #include <gtk/gtk.h>
16 // GTK requires the program's argc and argv variables.
17 extern char **_Jv_argv;
18 extern int _Jv_argc;
20 // Call gtk_init. It is very important that this happen before any other
21 // gtk calls.
22 void
23 gnu::awt::gtk::GtkToolkit::gtkInit ()
25 // Initialize GLib in thread-safe mode. We assume that GLib is using the
26 // same native threads library as libgcj. Refer to comments in
27 // GtkComponentPeer constructor.
28 g_thread_init (NULL);
29 gtk_init (&_Jv_argc, &_Jv_argv);
32 void
33 gnu::awt::gtk::GtkToolkit::beep ()
35 GDK_THREADS_ENTER ();
36 gdk_beep ();
37 GDK_THREADS_LEAVE ();
40 jint
41 gnu::awt::gtk::GtkToolkit::getScreenResolution ()
43 jint res;
45 GDK_THREADS_ENTER ();
47 res = (int) (gdk_screen_width () / (gdk_screen_width_mm () / 25.4));
49 GDK_THREADS_LEAVE ();
50 return res;
53 ::java::awt::Dimension *
54 gnu::awt::gtk::GtkToolkit::getScreenSize ()
56 ::java::awt::Dimension *dim = new ::java::awt::Dimension ();
58 GDK_THREADS_ENTER ();
60 dim->width = gdk_screen_width ();
61 dim->height = gdk_screen_height ();
63 GDK_THREADS_LEAVE ();
64 return dim;
67 void
68 gnu::awt::gtk::GtkToolkit::sync ()
70 GDK_THREADS_ENTER ();
71 gdk_flush ();
72 GDK_THREADS_LEAVE ();