[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Fix awt.datatransfer fro gtk+-2.4
From: |
Mark Wielaard |
Subject: |
[cp-patches] FYI: Fix awt.datatransfer fro gtk+-2.4 |
Date: |
Sun, 04 Sep 2005 01:41:58 +0200 |
Hi,
This makes the GtkClipboard and GtkSelection compile (warning free) for
gtk+-2.4. We do loose functionality. URI/File lists and Images are not
copy/pastable and we cannot detect clipboard changes outside our
application anymore. But text and serialized objects do work for gtk+
2.4 versions.
2005-09-03 Mark Wielaard <address@hidden>
Fixes bug #23701
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
(clipboard_owner_change_cb): Only used when GTK_MINOR_VERSION > 4.
(Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState):
Only request owner-change events for GTK_MINOR_VERSION > 4.
(clipboard_get_func): Only handle pixbuf and uri when
GTK_MINOR_VERSION > 4.
(Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent): Only call
gtk_target_list_add_* functions when GTK_MINOR_VERSION > 4. Similar
for gtk_clipboard_set_can_store.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
(Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped): Mark
flipx and flipy unused for GTK_MINOR_VERSION <= 4.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
(clipboard_targets_received): Don't handle images for
GTK_MINOR_VERSION <= 4.
(Java_gnu_java_awt_peer_gtk_GtkSelection_requestImage): Likewise.
(clipboard_uris_received): Likewise for text/uri-list.
(Java_gnu_java_awt_peer_gtk_GtkSelection_requestURIs): Likewise.
Tested against gtk+ 2.4.18 and 2.6.10.
Committed,
Mark
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c,v
retrieving revision 1.1
diff -u -r1.1 gnu_java_awt_peer_gtk_GtkSelection.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c 22 Aug 2005
10:36:15 -0000 1.1
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c 3 Sep 2005
23:36:56 -0000
@@ -64,8 +64,11 @@
if (target_data != NULL && target_data->length > 0)
{
include_text = gtk_selection_data_targets_include_text (target_data);
+
+#if GTK_MINOR_VERSION > 4
include_image = gtk_selection_data_targets_include_image (target_data,
TRUE);
+#endif
if (gtk_selection_data_get_targets (target_data, &targets, &targets_len))
{
int i;
@@ -270,11 +273,15 @@
return;
}
+#if GTK_MINOR_VERSION > 4
gdk_threads_enter ();
gtk_clipboard_request_image (cp_gtk_clipboard,
clipboard_image_received,
(gpointer) selection_obj);
gdk_threads_leave ();
+#else
+ clipboard_image_received (cp_gtk_clipboard, NULL, (gpointer) selection_obj);
+#endif
}
static jmethodID urisAvailableID;
@@ -290,9 +297,14 @@
jobject selection_obj = (jobject) selection;
JNIEnv *env = cp_gtk_gdk_env ();
+#if GTK_MINOR_VERSION > 4
if (uri_data != NULL)
uris = gtk_selection_data_get_uris (uri_data);
-
+#else
+ if (uri_data != NULL)
+ uris = NULL;
+#endif
+
if (uris != NULL)
{
int len, i;
@@ -326,7 +338,9 @@
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkSelection_requestURIs (JNIEnv *env, jobject obj)
{
+#if GTK_MINOR_VERSION > 4
GdkAtom uri_atom;
+#endif
jobject selection_obj;
selection_obj = (*env)->NewGlobalRef(env, obj);
if (selection_obj == NULL)
@@ -343,6 +357,7 @@
return;
}
+#if GTK_MINOR_VERSION > 4
/* There is no real request_uris so we have to make one ourselves. */
gdk_threads_enter ();
uri_atom = gdk_atom_intern ("text/uri-list", FALSE);
@@ -351,6 +366,9 @@
clipboard_uris_received,
(gpointer) selection_obj);
gdk_threads_leave ();
+#else
+ clipboard_uris_received (cp_gtk_clipboard, NULL, (gpointer) selection_obj);
+#endif
}
static jmethodID bytesAvailableID;
signature.asc
Description: This is a digitally signed message part
- [cp-patches] FYI: Fix awt.datatransfer fro gtk+-2.4,
Mark Wielaard <=