Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-05-27 14:25:24 -0400
committerEric Williams2019-06-11 15:41:28 -0400
commitf7637e66ba1a0e60c7e4919d99cfaf4e62663d20 (patch)
treeed1c30057b928ff942baf08aafccf40ce6815616 /bundles/org.eclipse.swt/Eclipse SWT PI
parentaedb93fcdacf0c965a697676566985de1ac16f45 (diff)
downloadeclipse.platform.swt-f7637e66ba1a0e60c7e4919d99cfaf4e62663d20.tar.gz
eclipse.platform.swt-f7637e66ba1a0e60c7e4919d99cfaf4e62663d20.tar.xz
eclipse.platform.swt-f7637e66ba1a0e60c7e4919d99cfaf4e62663d20.zip
Bug 547557: [GTK] Shell.print(GC) not implemented
Implement Shell.print(GC) using a GdkPixbuf obtained from the root GdkWindow. This only works on GTK3 + X11, Wayland and GTK4 will likely need a different approach which will take more time to investigate. Tested on GTK3.24 on X11, both inside a flatpak and not. Output behaves as expected, no AllNonBrowser JUnit tests fail. Change-Id: Ibf39d60f2e97c1ecf8e45c9cdda6da3e9d7e160e Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java13
5 files changed, 28 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index f88e3fd40d..9783370d4a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -1657,6 +1657,18 @@ JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1pixbuf_1get_1byte_1length)
}
#endif
+#ifndef NO__1gdk_1pixbuf_1get_1from_1window
+JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1pixbuf_1get_1from_1window)
+ (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1pixbuf_1get_1from_1window_FUNC);
+ rc = (jlong)gdk_pixbuf_get_from_window((GdkWindow *)arg0, arg1, arg2, arg3, arg4);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1pixbuf_1get_1from_1window_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1pixbuf_1get_1has_1alpha
JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1pixbuf_1get_1has_1alpha)
(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 98f86dd750..11abf15d99 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -274,6 +274,7 @@
#define NO__1gtk_1widget_1style_1get__J_3B_3JJ
#define NO__1gtk_1css_1provider_1load_1from_1data__I_3BI_3I
#define NO__1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J
+#define NO__1gdk_1pixbuf_1get_1from_1window
// Some GtkContainer functions don't exist on GTK4
#define NO__1gtk_1container_1propagate_1draw
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 3d9d40141a..9218cda91e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -136,6 +136,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1pixbuf_1format_1get_1name",
"_1gdk_1pixbuf_1get_1bits_1per_1sample",
"_1gdk_1pixbuf_1get_1byte_1length",
+ "_1gdk_1pixbuf_1get_1from_1window",
"_1gdk_1pixbuf_1get_1has_1alpha",
"_1gdk_1pixbuf_1get_1height",
"_1gdk_1pixbuf_1get_1n_1channels",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index acb253ec53..8fa62cb8c8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -146,6 +146,7 @@ typedef enum {
_1gdk_1pixbuf_1format_1get_1name_FUNC,
_1gdk_1pixbuf_1get_1bits_1per_1sample_FUNC,
_1gdk_1pixbuf_1get_1byte_1length_FUNC,
+ _1gdk_1pixbuf_1get_1from_1window_FUNC,
_1gdk_1pixbuf_1get_1has_1alpha_FUNC,
_1gdk_1pixbuf_1get_1height_FUNC,
_1gdk_1pixbuf_1get_1n_1channels_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index 6132c5c132..e8072b71f8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -1548,6 +1548,19 @@ public class GDK extends OS {
lock.unlock();
}
}
+ /**
+ * @param window cast=(GdkWindow *)
+ */
+ public static final native long _gdk_pixbuf_get_from_window(long window, int x, int y, int width, int height);
+ /** [GTK3 only, if-def'd in os.h] */
+ public static final long gdk_pixbuf_get_from_window(long window, int x, int y, int width, int height) {
+ lock.lock();
+ try {
+ return _gdk_pixbuf_get_from_window(window, x, y, width, height);
+ } finally {
+ lock.unlock();
+ }
+ }
/** @param pixbuf cast=(const GdkPixbuf *) */
public static final native int _gdk_pixbuf_get_height(long pixbuf);
public static final int gdk_pixbuf_get_height(long pixbuf) {

Back to the top