Last change
on this file was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
1.5 KB
|
Line | |
---|
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.
|
---|
7 |
|
---|
8 | #include <java/awt/Dimension.h>
|
---|
9 |
|
---|
10 | #include <gnu/awt/gtk/GtkToolkit.h>
|
---|
11 | #include <gcj/cni.h>
|
---|
12 |
|
---|
13 | #include <gtk/gtk.h>
|
---|
14 |
|
---|
15 |
|
---|
16 | // GTK requires the program's argc and argv variables.
|
---|
17 | extern char **_Jv_argv;
|
---|
18 | extern int _Jv_argc;
|
---|
19 |
|
---|
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 ()
|
---|
24 | {
|
---|
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);
|
---|
30 | }
|
---|
31 |
|
---|
32 | void
|
---|
33 | gnu::awt::gtk::GtkToolkit::beep ()
|
---|
34 | {
|
---|
35 | GDK_THREADS_ENTER ();
|
---|
36 | gdk_beep ();
|
---|
37 | GDK_THREADS_LEAVE ();
|
---|
38 | }
|
---|
39 |
|
---|
40 | jint
|
---|
41 | gnu::awt::gtk::GtkToolkit::getScreenResolution ()
|
---|
42 | {
|
---|
43 | jint res;
|
---|
44 |
|
---|
45 | GDK_THREADS_ENTER ();
|
---|
46 |
|
---|
47 | res = (int) (gdk_screen_width () / (gdk_screen_width_mm () / 25.4));
|
---|
48 |
|
---|
49 | GDK_THREADS_LEAVE ();
|
---|
50 | return res;
|
---|
51 | }
|
---|
52 |
|
---|
53 | ::java::awt::Dimension *
|
---|
54 | gnu::awt::gtk::GtkToolkit::getScreenSize ()
|
---|
55 | {
|
---|
56 | ::java::awt::Dimension *dim = new ::java::awt::Dimension ();
|
---|
57 |
|
---|
58 | GDK_THREADS_ENTER ();
|
---|
59 |
|
---|
60 | dim->width = gdk_screen_width ();
|
---|
61 | dim->height = gdk_screen_height ();
|
---|
62 |
|
---|
63 | GDK_THREADS_LEAVE ();
|
---|
64 | return dim;
|
---|
65 | }
|
---|
66 |
|
---|
67 | void
|
---|
68 | gnu::awt::gtk::GtkToolkit::sync ()
|
---|
69 | {
|
---|
70 | GDK_THREADS_ENTER ();
|
---|
71 | gdk_flush ();
|
---|
72 | GDK_THREADS_LEAVE ();
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.