diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2006-10-26 21:48:36 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@redhat.com> | 2006-10-26 21:48:36 +0000 |
commit | fd1f7e4d08accf2f2c7bb2726e4ca40ae994fe80 (patch) | |
tree | 34351e5b390b8365d7234b55911aaa9741ba39d1 /native/jni/gtk-peer | |
parent | df757f3051eab08f54339840b45cecf091b0ef8b (diff) | |
download | classpath-fd1f7e4d08accf2f2c7bb2726e4ca40ae994fe80.tar.gz |
2006-10-26 Christian Elias Naur <elias@oddlabs.com>
* native/jni/gtk-peer/gtk_jawt.c (classpath_jawt_get_depth): New
function.
* native/jni/classpath/classpath_jawt.h: Likewise.
* native/jawt/jawt.c (_Jv_GetDrawingSurfaceInfo): Added
initializer for surface_info_x11->depth.
Diffstat (limited to 'native/jni/gtk-peer')
-rw-r--r-- | native/jni/gtk-peer/gtk_jawt.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/native/jni/gtk-peer/gtk_jawt.c b/native/jni/gtk-peer/gtk_jawt.c index 763db8d1e..2348a63fb 100644 --- a/native/jni/gtk-peer/gtk_jawt.c +++ b/native/jni/gtk-peer/gtk_jawt.c @@ -122,6 +122,41 @@ classpath_jawt_get_visualID (JNIEnv* env, jobject canvas) /* Does not require locking: meant to be called after the drawing surface is locked. */ +int +classpath_jawt_get_depth (JNIEnv* env, jobject canvas) +{ + GtkWidget *widget; + GdkVisual *visual; + void *ptr; + jobject peer; + jclass class_id; + jmethodID method_id; + + class_id = (*env)->GetObjectClass (env, canvas); + + method_id = (*env)->GetMethodID (env, class_id, + "getPeer", + "()Ljava/awt/peer/ComponentPeer;"); + + peer = (*env)->CallObjectMethod (env, canvas, method_id); + + ptr = NSA_GET_PTR (env, peer); + + widget = GTK_WIDGET (ptr); + + if (GTK_WIDGET_REALIZED (widget)) + { + visual = gtk_widget_get_visual (widget); + g_assert (visual != NULL); + + return visual->depth; + } + else + return (VisualID) NULL; +} + +/* Does not require locking: meant to be called after the drawing + surface is locked. */ Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas) { |