41 |
#include <gdk/gdkprivate.h> |
#include <gdk/gdkprivate.h> |
42 |
#include <gdk/gdkx.h> |
#include <gdk/gdkx.h> |
43 |
|
|
44 |
static jmethodID initComponentGraphicsID; |
static jmethodID initComponentGraphicsUnlockedID; |
45 |
|
|
46 |
void |
void |
47 |
cp_gtk_graphics_init_jni (void) |
cp_gtk_graphics_init_jni (void) |
51 |
gdkgraphics = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(), |
gdkgraphics = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(), |
52 |
"gnu/java/awt/peer/gtk/GdkGraphics"); |
"gnu/java/awt/peer/gtk/GdkGraphics"); |
53 |
|
|
54 |
initComponentGraphicsID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics, |
initComponentGraphicsUnlockedID = |
55 |
"initComponentGraphics", |
(*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics, |
56 |
"()V"); |
"initComponentGraphicsUnlocked", |
57 |
|
"()V"); |
58 |
} |
} |
59 |
|
|
60 |
struct state_table *cp_gtk_native_graphics_state_table; |
struct state_table *cp_gtk_native_graphics_state_table; |
176 |
gdk_threads_leave (); |
gdk_threads_leave (); |
177 |
} |
} |
178 |
|
|
|
/* copy the native state of the peer (GtkWidget *) to the native state |
|
|
of the graphics object */ |
|
179 |
JNIEXPORT void JNICALL |
JNIEXPORT void JNICALL |
180 |
Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 |
Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked |
181 |
(JNIEnv *env, jobject obj, jobject peer) |
(JNIEnv *env, jobject obj, jobject peer) |
182 |
{ |
{ |
183 |
struct graphics *g = NULL; |
struct graphics *g = NULL; |
185 |
GtkWidget *widget = NULL; |
GtkWidget *widget = NULL; |
186 |
GdkColor color; |
GdkColor color; |
187 |
|
|
|
gdk_threads_enter (); |
|
|
|
|
188 |
g = (struct graphics *) g_malloc (sizeof (struct graphics)); |
g = (struct graphics *) g_malloc (sizeof (struct graphics)); |
189 |
ptr = NSA_GET_PTR (env, peer); |
ptr = NSA_GET_PTR (env, peer); |
190 |
g->x_offset = 0; |
g->x_offset = 0; |
201 |
color = widget->style->fg[GTK_STATE_NORMAL]; |
color = widget->style->fg[GTK_STATE_NORMAL]; |
202 |
|
|
203 |
NSA_SET_G_PTR (env, obj, g); |
NSA_SET_G_PTR (env, obj, g); |
204 |
|
} |
205 |
|
|
206 |
|
/* copy the native state of the peer (GtkWidget *) to the native state |
207 |
|
of the graphics object */ |
208 |
|
JNIEXPORT void JNICALL |
209 |
|
Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 |
210 |
|
(JNIEnv *env, jobject obj, jobject peer) |
211 |
|
{ |
212 |
|
gdk_threads_enter (); |
213 |
|
Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked |
214 |
|
(env, obj, peer); |
215 |
gdk_threads_leave (); |
gdk_threads_leave (); |
216 |
} |
} |
217 |
|
|
673 |
static void |
static void |
674 |
realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject jgraphics) |
realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject jgraphics) |
675 |
{ |
{ |
676 |
gdk_threads_leave (); |
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), |
677 |
|
jgraphics, |
678 |
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), jgraphics, initComponentGraphicsID); |
initComponentGraphicsUnlockedID); |
679 |
|
|
680 |
NSA_DEL_GLOBAL_G_REF (cp_gtk_gdk_env(), jgraphics); |
NSA_DEL_GLOBAL_G_REF (cp_gtk_gdk_env(), jgraphics); |
|
|
|
|
gdk_threads_enter (); |
|
681 |
} |
} |