Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-09-06 17:56:19 +0000
committerEric Williams2019-09-11 18:12:44 +0000
commita323d29b464742ac12e5cb42948bc0d6f843f3c7 (patch)
tree4eb812f7af872a7b61859a55d876c2c4a692fa71 /bundles/org.eclipse.swt/Eclipse SWT PI
parent3c0e74f1ed5a447b60eb0a783979cf9144e65960 (diff)
downloadeclipse.platform.swt-a323d29b464742ac12e5cb42948bc0d6f843f3c7.tar.gz
eclipse.platform.swt-a323d29b464742ac12e5cb42948bc0d6f843f3c7.tar.xz
eclipse.platform.swt-a323d29b464742ac12e5cb42948bc0d6f843f3c7.zip
Bug 299550: [GTK] Make "Print Selection" work
Implement selection printing on GTK. Note that the selection option is always available, even if no text is selected. In this case, a blank page will be printed. Tested on GTK3.24 with X11. Printing in the IDE works for all supported cases as expected. Change-Id: I540c0fe7ff5d5d5517ee1dc249c91bf9b83d4a1e 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.c20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java25
4 files changed, 49 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 000161b36f..df4e97d791 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
@@ -8409,6 +8409,16 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1print_1unix_1dialog_1set_1embed_1page_1
}
#endif
+#ifndef NO__1gtk_1print_1unix_1dialog_1set_1has_1selection
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1print_1unix_1dialog_1set_1has_1selection)
+ (JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
+{
+ GTK_NATIVE_ENTER(env, that, _1gtk_1print_1unix_1dialog_1set_1has_1selection_FUNC);
+ gtk_print_unix_dialog_set_has_selection((GtkPrintUnixDialog *)arg0, arg1);
+ GTK_NATIVE_EXIT(env, that, _1gtk_1print_1unix_1dialog_1set_1has_1selection_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1print_1unix_1dialog_1set_1manual_1capabilities
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
@@ -8439,6 +8449,16 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1print_1unix_1dialog_1set_1settings)
}
#endif
+#ifndef NO__1gtk_1print_1unix_1dialog_1set_1support_1selection
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1print_1unix_1dialog_1set_1support_1selection)
+ (JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
+{
+ GTK_NATIVE_ENTER(env, that, _1gtk_1print_1unix_1dialog_1set_1support_1selection_FUNC);
+ gtk_print_unix_dialog_set_support_selection((GtkPrintUnixDialog *)arg0, arg1);
+ GTK_NATIVE_EXIT(env, that, _1gtk_1print_1unix_1dialog_1set_1support_1selection_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1printer_1get_1backend
JNIEXPORT jlong JNICALL GTK_NATIVE(_1gtk_1printer_1get_1backend)
(JNIEnv *env, jclass that, jlong arg0)
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 4828ccc0e9..c72ea32f92 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
@@ -676,9 +676,11 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1print_1unix_1dialog_1new",
"_1gtk_1print_1unix_1dialog_1set_1current_1page",
"_1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup",
+ "_1gtk_1print_1unix_1dialog_1set_1has_1selection",
"_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities",
"_1gtk_1print_1unix_1dialog_1set_1page_1setup",
"_1gtk_1print_1unix_1dialog_1set_1settings",
+ "_1gtk_1print_1unix_1dialog_1set_1support_1selection",
"_1gtk_1printer_1get_1backend",
"_1gtk_1printer_1get_1name",
"_1gtk_1printer_1is_1default",
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 71bbc4ecac..77ffdee96d 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
@@ -674,9 +674,11 @@ typedef enum {
_1gtk_1print_1unix_1dialog_1new_FUNC,
_1gtk_1print_1unix_1dialog_1set_1current_1page_FUNC,
_1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup_FUNC,
+ _1gtk_1print_1unix_1dialog_1set_1has_1selection_FUNC,
_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities_FUNC,
_1gtk_1print_1unix_1dialog_1set_1page_1setup_FUNC,
_1gtk_1print_1unix_1dialog_1set_1settings_FUNC,
+ _1gtk_1print_1unix_1dialog_1set_1support_1selection_FUNC,
_1gtk_1printer_1get_1backend_FUNC,
_1gtk_1printer_1get_1name_FUNC,
_1gtk_1printer_1is_1default_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index 5b811b8691..500aafea2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -87,6 +87,7 @@ public class GTK extends OS {
public static final int GTK_PRINT_PAGES_ALL = 0;
public static final int GTK_PRINT_PAGES_CURRENT = 1;
public static final int GTK_PRINT_PAGES_RANGES = 2;
+ public static final int GTK_PRINT_PAGES_SELECTION = 3;
public static final int GTK_PRINT_DUPLEX_SIMPLEX = 0;
public static final int GTK_PRINT_DUPLEX_HORIZONTAL = 1;
public static final int GTK_PRINT_DUPLEX_VERTICAL = 2;
@@ -5339,6 +5340,30 @@ public class GTK extends OS {
lock.unlock();
}
}
+ /**
+ * @param dialog cast=(GtkPrintUnixDialog *)
+ */
+ public static final native void _gtk_print_unix_dialog_set_support_selection(long dialog, boolean support_selection);
+ public static final void gtk_print_unix_dialog_set_support_selection(long dialog, boolean support_selection) {
+ lock.lock();
+ try {
+ _gtk_print_unix_dialog_set_support_selection(dialog, support_selection);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param dialog cast=(GtkPrintUnixDialog *)
+ */
+ public static final native void _gtk_print_unix_dialog_set_has_selection(long dialog, boolean has_selection);
+ public static final void gtk_print_unix_dialog_set_has_selection(long dialog, boolean has_selection) {
+ lock.lock();
+ try {
+ _gtk_print_unix_dialog_set_has_selection(dialog, has_selection);
+ } finally {
+ lock.unlock();
+ }
+ }
public static final native long _gtk_progress_bar_new();
public static final long gtk_progress_bar_new() {
lock.lock();

Back to the top