Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-01-08 16:27:35 -0500
committerEric Williams2019-01-24 14:01:33 -0500
commit5a838c080a6ceb66add0bde541a2eeedf458e970 (patch)
tree1d165971c6d40d564a844b447efcd744440e8b48
parent83fd3a87c6cf6d90a8d52931adf36200dc5d8891 (diff)
downloadeclipse.platform.swt-5a838c080a6ceb66add0bde541a2eeedf458e970.tar.gz
eclipse.platform.swt-5a838c080a6ceb66add0bde541a2eeedf458e970.tar.xz
eclipse.platform.swt-5a838c080a6ceb66add0bde541a2eeedf458e970.zip
Bug 540674: [GTK4] Adapt to new drawing model changes
Get basic Shell drawing to work -- see Snippet245 as an example. Change-Id: Ie326129db90b1982fdcaa4f060e1562bb75499c3 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java12
3 files changed, 20 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
index 1ca440b5b5..a09e7d521b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
@@ -976,10 +976,10 @@ static AtkObject *swt_fixed_get_accessible (GtkWidget *widget) {
static void swt_fixed_measure (GtkWidget *widget, GtkOrientation orientation, int for_size, int *minimum,
int *natural, int *minimum_baseline, int *natural_baseline) {
- natural = 0;
- natural_baseline = 0;
- minimum = 0;
- minimum_baseline = 0;
+ if (minimum) *minimum = 0;
+ if (natural) *natural = 0;
+ if (minimum_baseline) *minimum_baseline = -1;
+ if (natural_baseline) *natural_baseline = -1;
return;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 3b2fe474cd..9f3924b7c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -162,14 +162,14 @@ public Control (Composite parent, int style) {
void connectPaint () {
long /*int*/ paintHandle = paintHandle ();
- int paintMask = GDK.GDK_EXPOSURE_MASK;
- if (GTK.GTK4 && (hooksPaint() || drawRegion)) {
+ if (GTK.GTK4 && hooksPaint()) {
long /*int*/ widgetClass = GTK.GTK_WIDGET_GET_CLASS(paintHandle);
GtkWidgetClass widgetClassStruct = new GtkWidgetClass ();
OS.memmove(widgetClassStruct, widgetClass);
widgetClassStruct.snapshot = display.snapshotDrawProc;
OS.memmove(widgetClass, widgetClassStruct);
- } else {
+ } else if (!GTK.GTK4) {
+ int paintMask = GDK.GDK_EXPOSURE_MASK;
GTK.gtk_widget_add_events (paintHandle, paintMask);
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (EXPOSE_EVENT_INVERSE), false);
@@ -2097,6 +2097,7 @@ public void addPaintListener(PaintListener listener) {
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.Paint,typedListener);
+ if (GTK.GTK4) connectPaint();
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 0e46391345..a8f221c9fe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1025,6 +1025,15 @@ long /*int*/ topHandle () {
return shellHandle;
}
+@Override
+long /*int*/ paintHandle () {
+ if (GTK.GTK4) {
+ return handle;
+ } else {
+ return super.paintHandle();
+ }
+}
+
void fixActiveShell () {
if (display.activeShell == this) {
Shell shell = null;
@@ -1476,6 +1485,9 @@ long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
GTK.gtk_style_context_restore (context);
return 1;
}
+ if (GTK.GTK4) {
+ super.gtk_draw(widget, cairo);
+ }
return 0;
}
return super.gtk_draw (widget, cairo);

Back to the top