Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 2fbacd7b75..9cc52654fe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -69,6 +69,7 @@ public abstract class Control extends Widget implements Drawable {
NSBezierPath regionPath;
long /*int*/ visibleRgn;
Accessible accessible;
+ boolean ignorePaint;
boolean touchEnabled;
final static int CLIPPING = 1 << 10;
@@ -1259,6 +1260,7 @@ boolean drawsBackground() {
@Override
void drawWidget (long /*int*/ id, NSGraphicsContext context, NSRect rect) {
+ if (ignorePaint) return;
if (id != paintView().id) return;
if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return;
@@ -3963,6 +3965,22 @@ void setFrameSize (long /*int*/ id, long /*int*/ sel, NSSize size) {
}
}
+@Override
+void cacheDisplayInRect_toBitmapImageRep (long id, long sel, NSRect rect, long rep) {
+ /*
+ * When a GC is created with a control as the Drawable and GC.copyArea() is
+ * called, a SWT.Paint event will be sent, unexpectedly. This happens because
+ * NSView.cacheDisplayInRect() calls drawRect() which causes a SWT.Paint event
+ * to be sent. The fix is to ignore this paint event and prevent SWT from
+ * sending it to the clients.
+ * In the callback, set the ignorePaint flag, then call the Cocoa
+ * implementation of cacheDisplayInRect_toBitmapImageRep(), then reset the ignorePaint flag.
+ */
+ ignorePaint = true;
+ super.cacheDisplayInRect_toBitmapImageRep(id, sel, rect, rep);
+ ignorePaint = false;
+}
+
/**
* Sets the layout data associated with the receiver to the argument.
*

Back to the top