From d488a4d4364bff56b3dc173fe69008f7bb9621ed Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Wed, 25 Jan 2012 12:30:57 -0500 Subject: 357559 - [4.2] CTabFolders in some views show overly-large buttons or cheese --- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 8 ++++++-- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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 912e78f2b0..55e26ca171 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 @@ -653,6 +653,10 @@ public Point computeSize (int wHint, int hHint, boolean changed) { } Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) { + return computeNativeSize (h, wHint, hHint, changed, DEFAULT_WIDTH, DEFAULT_HEIGHT); +} + +Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed, int defaultWidth, int defaultHeight) { int width = wHint, height = hHint; if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { GtkRequisition requisition = new GtkRequisition (); @@ -669,8 +673,8 @@ Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) width = wHint == SWT.DEFAULT ? requisition.width : wHint; height = hHint == SWT.DEFAULT ? requisition.height : hHint; } - if (width == 0) width = DEFAULT_WIDTH; - if (height == 0) height = DEFAULT_HEIGHT; + if (width == 0) width = defaultWidth; + if (height == 0) height = defaultHeight; return new Point (width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index 3d30124842..4457c04c55 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -145,7 +145,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - return computeNativeSize (handle, wHint, hHint, changed); + return computeNativeSize (handle, wHint, hHint, changed, 0, 0); } Widget computeTabGroup () { -- cgit v1.2.3 From 5c3ae466c77f7b0782a2b458254d2aca85b4f799 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Wed, 25 Jan 2012 12:29:06 -0500 Subject: v3820 --- bundles/org.eclipse.swt/buildnotes_swt.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/org.eclipse.swt/buildnotes_swt.html b/bundles/org.eclipse.swt/buildnotes_swt.html index 6026817c22..3d97fa0566 100644 --- a/bundles/org.eclipse.swt/buildnotes_swt.html +++ b/bundles/org.eclipse.swt/buildnotes_swt.html @@ -11,6 +11,12 @@ Eclipse Platform Build Notes
SWT +

SWT Build 3820a - Thursday January 26, 2012

+ +
+Bugs fixed +
+

SWT Build 3820 - Saturday January 21, 2012

-- cgit v1.2.3 From f5f169975f78acfb62d02c5946132af058ccb5e6 Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Wed, 25 Jan 2012 17:22:51 -0500 Subject: use java2d to modify awt image displayed in swt gui --- .../src/org/eclipse/swt/snippets/Snippet361.java | 198 +++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java new file mode 100644 index 0000000000..81ee2f06c3 --- /dev/null +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -0,0 +1,198 @@ +/******************************************************************************* + * Copyright (c) 2012 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.snippets; + +/* + * example snippet: use Java2D to modify an image being displayed in an SWT GUI + * + * For a list of all SWT example snippets see + * http://www.eclipse.org/swt/snippets/ + * + * @since 3.8 + */ +import java.awt.Frame; +import java.awt.Canvas; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.geom.AffineTransform; + +import org.eclipse.swt.*; +import org.eclipse.swt.widgets.*; +import org.eclipse.swt.layout.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.printing.*; +import org.eclipse.swt.accessibility.*; +import org.eclipse.swt.awt.SWT_AWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +public class Snippet361 { + static Composite composite; // SWT + static Canvas canvas; // AWT + static Image image = null; // AWT + static double translateX = 0, translateY = 0; + static double rotate = 0; + + public static void main(String[] args) { + final Display display = new Display(); + final Shell shell = new Shell(display); + shell.setText("Translate and Rotate an AWT Image in an SWT GUI"); + shell.setLayout(new GridLayout(8, false)); + + Button fileButton = new Button(shell, SWT.PUSH); + fileButton.setText("&Open Image File"); + fileButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String filename = new FileDialog(shell).open(); + if (filename != null) { + image = Toolkit.getDefaultToolkit().getImage(filename); + canvas.repaint(); + } + } + }); + + new Label(shell, SWT.NONE).setText("Translate &X by:"); + final Combo translateXCombo = new Combo(shell, SWT.NONE); + translateXCombo.setItems(new String[] {"0", "image width", "image height", "100", "200"}); + translateXCombo.select(0); + translateXCombo.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + translateX = numericValue(translateXCombo); + canvas.repaint(); + } + }); + + new Label(shell, SWT.NONE).setText("Translate &Y by:"); + final Combo translateYCombo = new Combo(shell, SWT.NONE); + translateYCombo.setItems(new String[] {"0", "image width", "image height", "100", "200"}); + translateYCombo.select(0); + translateYCombo.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + translateY = numericValue(translateYCombo); + canvas.repaint(); + } + }); + + new Label(shell, SWT.NONE).setText("&Rotate by:"); + final Combo rotateCombo = new Combo(shell, SWT.NONE); + rotateCombo.setItems(new String[] {"0", "Pi", "Pi/2", "Pi/4", "Pi/8"}); + rotateCombo.select(0); + rotateCombo.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + rotate = numericValue(rotateCombo); + canvas.repaint(); + } + }); + + Button printButton = new Button(shell, SWT.PUSH); + printButton.setText("&Print Image"); + printButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + Rectangle r = composite.getBounds(); + System.out.println(r); + Point p = shell.toDisplay(r.x, r.y); + System.out.println(p); + org.eclipse.swt.graphics.Image snapshotImage + = new org.eclipse.swt.graphics.Image(display, r.width-2, r.height-2); + GC snapshotGC = new GC(display); + snapshotGC.copyArea(snapshotImage, p.x+1, p.y+1); + PrintDialog dialog = new PrintDialog(shell, SWT.NONE); + PrinterData data = new PrinterData(); + data.orientation = PrinterData.LANDSCAPE; + dialog.setPrinterData(data); + data = dialog.open(); + if (data != null) { + Printer printer = new Printer(data); + Point screenDPI = display.getDPI(); + Point printerDPI = printer.getDPI(); + int scaleFactor = printerDPI.x / screenDPI.x; + Rectangle trim = printer.computeTrim(0, 0, 0, 0); + if (printer.startJob("Print Image")) { + ImageData imageData = snapshotImage.getImageData(); + org.eclipse.swt.graphics.Image printerImage + = new org.eclipse.swt.graphics.Image(printer, imageData); + GC printerGC = new GC(printer); + if (printer.startPage()) { + printerGC.drawImage( + printerImage, + 0, + 0, + imageData.width, + imageData.height, + -trim.x, + -trim.y, + scaleFactor * imageData.width, + scaleFactor * imageData.height); + printer.endPage(); + } + printerGC.dispose(); + printer.endJob(); + } + printer.dispose(); + } + snapshotImage.dispose(); + snapshotGC.dispose (); + } + }); + + composite = new Composite(shell, SWT.EMBEDDED | SWT.BORDER); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1)); + Frame frame = SWT_AWT.new_Frame(composite); + canvas = new Canvas() { + public void paint (Graphics g) { + if (image != null) { + Graphics2D g2d = (Graphics2D) g; + AffineTransform t = new AffineTransform(); + t.translate(translateX, translateY); + t.rotate(rotate); + g2d.setTransform(t); + g.drawImage(image, 0, 0, this); + } + } + }; + frame.add(canvas); + composite.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + e.result = "AWT Canvas showing Image"; + } + }); + + shell.open(); + while(!shell.isDisposed()) { + if (!display.readAndDispatch()) display.sleep(); + } + display.dispose(); + } + + static double numericValue(Combo combo) { + String string = combo.getText(); + if (string.equals("image width")) return image.getWidth(canvas); + if (string.equals("image height")) return image.getHeight(canvas); + if (string.equals("100")) return (double) 100; + if (string.equals("200")) return (double) 200; + if (string.equals("Pi")) return Math.PI; + if (string.equals("Pi/2")) return Math.PI / (double) 2; + if (string.equals("Pi/4")) return Math.PI / (double) 4; + if (string.equals("Pi/8")) return Math.PI / (double) 8; + /* Allow user-entered numbers. */ + Double d = (double) 0; + try { + d = new Double(string); + } catch(NumberFormatException ex) { + }; + return d; + } + +} -- cgit v1.2.3 From ccacc0579ad724e5e6606103c04b8166879c34a7 Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Wed, 25 Jan 2012 17:28:28 -0500 Subject: update comments --- .../src/org/eclipse/swt/snippets/Snippet361.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java index 81ee2f06c3..cb4d7a3c85 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -11,7 +11,8 @@ package org.eclipse.swt.snippets; /* - * example snippet: use Java2D to modify an image being displayed in an SWT GUI + * example snippet: use Java2D to modify an image being displayed in an SWT GUI. + * Take a screen snapshot to print the image to a printer. * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ @@ -153,6 +154,7 @@ public class Snippet361 { canvas = new Canvas() { public void paint (Graphics g) { if (image != null) { + /* Use Java2D here to modify the image as desired. */ Graphics2D g2d = (Graphics2D) g; AffineTransform t = new AffineTransform(); t.translate(translateX, translateY); -- cgit v1.2.3 From 934aa196b8c3a5a2b8cbbdf32ca385793f69de82 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Thu, 26 Jan 2012 10:43:51 -0500 Subject: Bug 369757 - [3.7.x] GLCanvas maintenance fix causes NullPointerException when changing parent on Mac --- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Canvas.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Canvas.java index a1257fdb0f..ada4d15082 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Canvas.java @@ -610,8 +610,11 @@ void viewWillMoveToWindow(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) super.viewWillMoveToWindow(id, sel, arg0); if (glcontext != null) { new NSWindow(arg0).setOpaque(false); - NSWindow window = view.window(); - window.setOpaque(getShell().region == null); + Shell shell = getShell(); + NSWindow window = shell.window; + if (window != null) { + window.setOpaque(shell.region == null); + } } } -- cgit v1.2.3 From 6f1d087b428a735c63b7cb023a054ebc44beff72 Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Thu, 26 Jan 2012 14:29:38 -0500 Subject: fill Canvas background with white before drawing --- .../src/org/eclipse/swt/snippets/Snippet361.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java index cb4d7a3c85..d619394380 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -19,6 +19,7 @@ package org.eclipse.swt.snippets; * * @since 3.8 */ +import java.awt.Color; import java.awt.Frame; import java.awt.Canvas; import java.awt.Graphics; @@ -102,9 +103,7 @@ public class Snippet361 { printButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Rectangle r = composite.getBounds(); - System.out.println(r); Point p = shell.toDisplay(r.x, r.y); - System.out.println(p); org.eclipse.swt.graphics.Image snapshotImage = new org.eclipse.swt.graphics.Image(display, r.width-2, r.height-2); GC snapshotGC = new GC(display); @@ -154,12 +153,17 @@ public class Snippet361 { canvas = new Canvas() { public void paint (Graphics g) { if (image != null) { + g.setColor(Color.WHITE); + g.fillRect(0, 0, canvas.getWidth(), canvas.getHeight()); + /* Use Java2D here to modify the image as desired. */ Graphics2D g2d = (Graphics2D) g; AffineTransform t = new AffineTransform(); t.translate(translateX, translateY); t.rotate(rotate); g2d.setTransform(t); + /*------------*/ + g.drawImage(image, 0, 0, this); } } @@ -167,7 +171,7 @@ public class Snippet361 { frame.add(canvas); composite.getAccessible().addAccessibleListener(new AccessibleAdapter() { public void getName(AccessibleEvent e) { - e.result = "AWT Canvas showing Image"; + e.result = "Image drawn in AWT Canvas"; } }); -- cgit v1.2.3 From 474c95af739a4cba237a80cddc4c08b2cdd1361a Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Fri, 27 Jan 2012 15:13:24 -0500 Subject: pack shell --- .../src/org/eclipse/swt/snippets/Snippet361.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java index d619394380..258b398e3e 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -148,7 +148,9 @@ public class Snippet361 { }); composite = new Composite(shell, SWT.EMBEDDED | SWT.BORDER); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1)); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1); + data.heightHint = 400; + composite.setLayoutData(data); Frame frame = SWT_AWT.new_Frame(composite); canvas = new Canvas() { public void paint (Graphics g) { @@ -175,6 +177,7 @@ public class Snippet361 { } }); + shell.pack(); shell.open(); while(!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); -- cgit v1.2.3 From 733bed1af9e71b9e41898b18193bf25558a590ee Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Fri, 27 Jan 2012 17:15:57 -0500 Subject: snippet361 cross-platform shell size --- .../src/org/eclipse/swt/snippets/Snippet361.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java index 258b398e3e..375196fe2a 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -149,7 +149,8 @@ public class Snippet361 { composite = new Composite(shell, SWT.EMBEDDED | SWT.BORDER); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1); - data.heightHint = 400; + data.widthHint = 640; + data.heightHint = 480; composite.setLayoutData(data); Frame frame = SWT_AWT.new_Frame(composite); canvas = new Canvas() { -- cgit v1.2.3 From 2a6c4451d9a0891362f45912ce416ce64990a08b Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Tue, 31 Jan 2012 14:39:33 +0530 Subject: Bug 358022-Set text editor background to black, mouse cursor becomes invisible --- .../org/eclipse/swt/internal/cocoa/NSCursor.java | 6 ++++ .../cocoa/org/eclipse/swt/internal/cocoa/OS.java | 1 + .../cocoa/org/eclipse/swt/graphics/Cursor.java | 37 ++++++++++++++++++---- .../cocoa/org/eclipse/swt/widgets/Combo.java | 6 ++++ .../cocoa/org/eclipse/swt/widgets/Spinner.java | 5 +++ .../cocoa/org/eclipse/swt/widgets/Text.java | 5 +++ 6 files changed, 53 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java index 8dad7fa24b..d70c8bd49a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java @@ -44,6 +44,12 @@ public static NSCursor currentCursor() { return result != 0 ? new NSCursor(result) : null; } +public NSPoint hotSpot() { + NSPoint result = new NSPoint(); + OS.objc_msgSend_stret(result, this.id, OS.sel_hotSpot); + return result; +} + public NSCursor initWithImage(NSImage newImage, NSPoint aPoint) { int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_initWithImage_hotSpot_, newImage != null ? newImage.id : 0, aPoint); return result == this.id ? this : (result != 0 ? new NSCursor(result) : null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 979688a89a..1605efdf46 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1311,6 +1311,7 @@ public static final int /*long*/ sel_highlightSelectionInClipRect_ = sel_registe public static final int /*long*/ sel_hitPart = sel_registerName("hitPart"); public static final int /*long*/ sel_hitTest_ = sel_registerName("hitTest:"); public static final int /*long*/ sel_hitTestForEvent_inRect_ofView_ = sel_registerName("hitTestForEvent:inRect:ofView:"); +public static final int /*long*/ sel_hotSpot = sel_registerName("hotSpot"); public static final int /*long*/ sel_host = sel_registerName("host"); public static final int /*long*/ sel_hourOfDay = sel_registerName("hourOfDay"); public static final int /*long*/ sel_iconForFile_ = sel_registerName("iconForFile:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java index a214cd4b62..b6e5382398 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java @@ -63,6 +63,25 @@ public final class Cursor extends Resource { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, }; + static final byte[] SHADOWED_IBEAM_SOURCE = new byte[] { + (byte)0x55, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x55, (byte)0x55, (byte)0x55, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x55, (byte)0x55, (byte)0x55, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x55, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x55, (byte)0x55, (byte)0x55, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xAA, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x55, (byte)0x55, (byte)0x55, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + }; + /** * the handle to the OS cursor resource * (Warning: This field is platform dependent) @@ -133,11 +152,12 @@ public Cursor(Device device, int style) { super(device); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); + boolean shouldCreateCursor = false; try { switch (style) { case SWT.CURSOR_HAND: handle = NSCursor.pointingHandCursor(); break; case SWT.CURSOR_ARROW: handle = NSCursor.arrowCursor(); break; - case SWT.CURSOR_WAIT: break; + case SWT.CURSOR_WAIT: shouldCreateCursor = true; break; case SWT.CURSOR_CROSS: handle = NSCursor.crosshairCursor(); break; case SWT.CURSOR_APPSTARTING: handle = NSCursor.arrowCursor(); break; case SWT.CURSOR_HELP: handle = NSCursor.crosshairCursor(); break; @@ -155,12 +175,12 @@ public Cursor(Device device, int style) { case SWT.CURSOR_SIZESW: handle = NSCursor.crosshairCursor(); break; case SWT.CURSOR_SIZENW: handle = NSCursor.crosshairCursor(); break; case SWT.CURSOR_UPARROW: handle = NSCursor.crosshairCursor(); break; - case SWT.CURSOR_IBEAM: handle = NSCursor.IBeamCursor(); break; + case SWT.CURSOR_IBEAM: shouldCreateCursor = true; break; case SWT.CURSOR_NO: handle = NSCursor.crosshairCursor(); break; default: SWT.error(SWT.ERROR_INVALID_ARGUMENT); } - if (handle == null && style == SWT.CURSOR_WAIT) { + if (handle == null && shouldCreateCursor) { NSImage nsImage = (NSImage)new NSImage().alloc(); NSBitmapImageRep nsImageRep = (NSBitmapImageRep)new NSBitmapImageRep().alloc(); handle = (NSCursor)new NSCursor().alloc(); @@ -171,11 +191,14 @@ public Cursor(Device device, int style) { nsImage = nsImage.initWithSize(size); nsImageRep = nsImageRep.initWithBitmapDataPlanes(0, width, height, 8, 4, true, false, OS.NSDeviceRGBColorSpace, OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width*4, 32); - OS.memmove(nsImageRep.bitmapData(), WAIT_SOURCE, WAIT_SOURCE.length); - nsImage.addRepresentation(nsImageRep); NSPoint point = new NSPoint(); - point.x = 0; - point.y = 0; + if (style == SWT.CURSOR_WAIT) { + OS.memmove(nsImageRep.bitmapData(), WAIT_SOURCE, WAIT_SOURCE.length); + } else { //style == SWT.CURSOR_IBEAM + OS.memmove(nsImageRep.bitmapData(), SHADOWED_IBEAM_SOURCE, SHADOWED_IBEAM_SOURCE.length); + point.x = 4; point.y = 8; // values from NSCursor.IBeamCursor().hotSpot(); + } + nsImage.addRepresentation(nsImageRep); handle = handle.initWithImage(nsImage, point); nsImageRep.release(); nsImage.release(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java index 406bc49794..a7789bae86 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java @@ -595,6 +595,12 @@ boolean dragDetect(int x, int y, boolean filter, boolean[] consume) { return super.dragDetect(x, y, filter, consume); } + +Cursor findCursor () { + Cursor cursor = super.findCursor (); + return (cursor != null || (style & SWT.READ_ONLY) != 0) ? cursor : display.getSystemCursor (SWT.CURSOR_IBEAM); +} + public int getCaretPosition() { checkWidget(); return selectionRange != null ? (int)/*64*/selectionRange.location : 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java index 1f774436b4..b5c65aafbb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java @@ -355,6 +355,11 @@ void drawInteriorWithFrame_inView(int id, int sel, NSRect cellFrame, int viewid) super.drawInteriorWithFrame_inView(id, sel, cellFrame, viewid); } +Cursor findCursor () { + Cursor cursor = super.findCursor (); + return (cursor != null || (style & SWT.READ_ONLY) != 0) ? cursor : display.getSystemCursor (SWT.CURSOR_IBEAM); +} + NSView focusView () { return textView; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java index 82c66ce803..27e5184e07 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java @@ -662,6 +662,11 @@ void enableWidget(boolean enabled) { } } +Cursor findCursor () { + Cursor cursor = super.findCursor (); + return (cursor != null) ? cursor : display.getSystemCursor (SWT.CURSOR_IBEAM); +} + /** * Returns the line number of the caret. *

-- cgit v1.2.3 From 92000571a779c912f9d2bbe1c98caf331818d15b Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Tue, 31 Jan 2012 15:44:15 -0500 Subject: 368993 - Label with size hint {0, 0} layouted to {64, 64} --- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 6 ------ .../Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java | 2 ++ .../Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java | 2 ++ .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | 2 ++ .../Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java | 2 +- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 2 ++ 6 files changed, 9 insertions(+), 7 deletions(-) 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 55e26ca171..5dc29c6d8c 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 @@ -653,10 +653,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) { } Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) { - return computeNativeSize (h, wHint, hHint, changed, DEFAULT_WIDTH, DEFAULT_HEIGHT); -} - -Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed, int defaultWidth, int defaultHeight) { int width = wHint, height = hHint; if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { GtkRequisition requisition = new GtkRequisition (); @@ -673,8 +669,6 @@ Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed, width = wHint == SWT.DEFAULT ? requisition.width : wHint; height = hHint == SWT.DEFAULT ? requisition.height : hHint; } - if (width == 0) width = defaultWidth; - if (height == 0) height = defaultHeight; return new Point (width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java index 2de634602f..ef8661e2d1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java @@ -117,6 +117,8 @@ public Point computeSize (int wHint, int hHint, boolean changed) { if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); + if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; + if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; int border = OS.gtk_container_get_border_width (handle); size.x += 2 * border; size.y += 2 * border; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java index 5ea80a8294..a4bc31fb68 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java @@ -251,6 +251,8 @@ public Point computeSize (int wHint, int hHint, boolean changed) { if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); + if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; + if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; Rectangle trim = computeTrim (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 222d6e603e..465fbec8f6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -482,6 +482,8 @@ public Point computeSize (int wHint, int hHint, boolean changed) { if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); + if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; + if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; Rectangle trim = computeTrim (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index 4457c04c55..3d30124842 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -145,7 +145,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - return computeNativeSize (handle, wHint, hHint, changed, 0, 0); + return computeNativeSize (handle, wHint, hHint, changed); } Widget computeTabGroup () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 67210ef839..6c9eefffe8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -537,6 +537,8 @@ public Point computeSize (int wHint, int hHint, boolean changed) { if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); + if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; + if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; Rectangle trim = computeTrim (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; -- cgit v1.2.3 From 49414e687e8dd970398fad4ea36d97ab635cb3a8 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Tue, 31 Jan 2012 16:33:09 -0500 Subject: Bug 369599 - Weird window flash when opening tooltip --- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 eb12628c08..3092d2897c 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 @@ -2105,8 +2105,11 @@ public int /*long*/ internal_new_GC (GCData data) { * to create a GC on a deferred NSWindow. */ if (window.windowNumber() <= 0) { + float /*double*/ alpha = window.alphaValue(); + window.setAlphaValue(0); window.orderBack(null); - window.orderOut(null); + window.orderOut(null); + window.setAlphaValue(alpha); } NSGraphicsContext graphicsContext = NSGraphicsContext.graphicsContextWithWindow (window); NSGraphicsContext flippedContext = NSGraphicsContext.graphicsContextWithGraphicsPort(graphicsContext.graphicsPort(), true); -- cgit v1.2.3 From 0fc9a694d7469800fdb4849776d3de00cc1d2797 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Tue, 31 Jan 2012 17:32:55 -0500 Subject: Bug 368757 - Using ESC as accelerator does not work on OS X, but on Windows --- .../eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras | 7 +++++++ .../cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java | 2 +- .../cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java | 6 +++++- .../Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java | 2 +- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java | 9 +++++++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 3d248b28fb..9ad591e3c8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -1130,6 +1130,9 @@ + + + @@ -1823,6 +1826,10 @@ + + + + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java index d70c8bd49a..c6a2587b27 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java index 15e8b657a4..b9320e824a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -69,6 +69,10 @@ public int /*long*/ numberOfItems() { return OS.objc_msgSend(this.id, OS.sel_numberOfItems); } +public boolean performKeyEquivalent(NSEvent theEvent) { + return OS.objc_msgSend_bool(this.id, OS.sel_performKeyEquivalent_, theEvent != null ? theEvent.id : 0); +} + public static void popUpContextMenu(NSMenu menu, NSEvent event, NSView view) { OS.objc_msgSend(OS.class_NSMenu, OS.sel_popUpContextMenu_withEvent_forView_, menu != null ? menu.id : 0, event != null ? event.id : 0, view != null ? view.id : 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 1605efdf46..0ac973f28d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1311,8 +1311,8 @@ public static final int /*long*/ sel_highlightSelectionInClipRect_ = sel_registe public static final int /*long*/ sel_hitPart = sel_registerName("hitPart"); public static final int /*long*/ sel_hitTest_ = sel_registerName("hitTest:"); public static final int /*long*/ sel_hitTestForEvent_inRect_ofView_ = sel_registerName("hitTestForEvent:inRect:ofView:"); -public static final int /*long*/ sel_hotSpot = sel_registerName("hotSpot"); public static final int /*long*/ sel_host = sel_registerName("host"); +public static final int /*long*/ sel_hotSpot = sel_registerName("hotSpot"); public static final int /*long*/ sel_hourOfDay = sel_registerName("hourOfDay"); public static final int /*long*/ sel_iconForFile_ = sel_registerName("iconForFile:"); public static final int /*long*/ sel_iconForFileType_ = sel_registerName("iconForFileType:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java index a3aa7a3cf6..07d0b564c3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java @@ -2222,6 +2222,15 @@ void windowSendEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ event) { break; case OS.NSKeyDown: + /* + * Feature in Cocoa. For some reason, Cocoa does not perform accelerators + * with ESC key code. The fix is to perform the accelerators ourselves. + */ + if (nsEvent.keyCode() == 53 /* ESC */ && menuBar != null && !menuBar.isDisposed()) { + if (menuBar.nsMenu.performKeyEquivalent(nsEvent)) { + return; + } + } /** * Feature in cocoa. Control+Tab, Ctrl+Shift+Tab, Ctrl+PageDown and Ctrl+PageUp are * swallowed to handle native traversal. If we find that, force the key event to -- cgit v1.2.3 From 5db5c1dca04aab70c6da0d8e51099b4a60336357 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Wed, 25 Jan 2012 00:36:23 +0200 Subject: Get rid of gtk_calendar_display_options. This function has been used only for pre-2.4 GTK, is deprecated for long time and is removed in GTK 3. --- .../org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c | 18 ------------------ .../Eclipse SWT PI/gtk/library/os_stats.c | 5 ++--- .../Eclipse SWT PI/gtk/library/os_stats.h | 1 - .../gtk/org/eclipse/swt/internal/gtk/OS.java | 14 -------------- .../gtk/org/eclipse/swt/widgets/DateTime.java | 6 +----- 5 files changed, 3 insertions(+), 41 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 b7aca3fc8c..511f2aa00b 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 @@ -7702,24 +7702,6 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1clear_1marks) } #endif -#ifndef NO__1gtk_1calendar_1display_1options -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1display_1options) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1) -{ - OS_NATIVE_ENTER(env, that, _1gtk_1calendar_1display_1options_FUNC); -/* - gtk_calendar_display_options((GtkCalendar *)arg0, (GtkCalendarDisplayOptions)arg1); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_calendar_display_options) - if (fp) { - ((void (CALLING_CONVENTION*)(GtkCalendar *, GtkCalendarDisplayOptions))fp)((GtkCalendar *)arg0, (GtkCalendarDisplayOptions)arg1); - } - } - OS_NATIVE_EXIT(env, that, _1gtk_1calendar_1display_1options_FUNC); -} -#endif - #ifndef NO__1gtk_1calendar_1get_1date JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1get_1date) (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2, jintArray arg3) 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 e3e9a7d6f4..fc78945e22 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 @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1380; -int OS_nativeFunctionCallCount[1380]; +int OS_nativeFunctionCount = 1379; +int OS_nativeFunctionCallCount[1379]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -631,7 +631,6 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1button_1new", "_1gtk_1button_1set_1relief", "_1gtk_1calendar_1clear_1marks", - "_1gtk_1calendar_1display_1options", "_1gtk_1calendar_1get_1date", "_1gtk_1calendar_1mark_1day", "_1gtk_1calendar_1new", 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 494ac90691..311f8bee1f 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 @@ -639,7 +639,6 @@ typedef enum { _1gtk_1button_1new_FUNC, _1gtk_1button_1set_1relief_FUNC, _1gtk_1calendar_1clear_1marks_FUNC, - _1gtk_1calendar_1display_1options_FUNC, _1gtk_1calendar_1get_1date_FUNC, _1gtk_1calendar_1mark_1day_FUNC, _1gtk_1calendar_1new_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index c43f3966e9..95aba417a5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -6081,20 +6081,6 @@ public static final void gtk_calendar_set_display_options(int /*long*/ calendar, lock.unlock(); } } -/** - * @method flags=dynamic - * @param calendar cast=(GtkCalendar *) - * @param flags cast=(GtkCalendarDisplayOptions) - */ -public static final native void _gtk_calendar_display_options(int /*long*/ calendar, int flags); -public static final void gtk_calendar_display_options(int /*long*/ calendar, int flags) { - lock.lock(); - try { - _gtk_calendar_display_options(calendar, flags); - } finally { - lock.unlock(); - } -} /** * @method flags=dynamic * @param calendar cast=(GtkCalendar *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java index 0d8c8097a6..020e8a958c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java @@ -343,11 +343,7 @@ void createHandle (int index) { handle = OS.gtk_calendar_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); - if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) { - OS.gtk_calendar_set_display_options(handle, OS.GTK_CALENDAR_SHOW_HEADING | OS.GTK_CALENDAR_SHOW_DAY_NAMES); - } else { - OS.gtk_calendar_display_options(handle, OS.GTK_CALENDAR_SHOW_HEADING | OS.GTK_CALENDAR_SHOW_DAY_NAMES); - } + OS.gtk_calendar_set_display_options(handle, OS.GTK_CALENDAR_SHOW_HEADING | OS.GTK_CALENDAR_SHOW_DAY_NAMES); } else { super.createHandle(index); } -- cgit v1.2.3 From 6a6819c42d1e3be98b1484b2432fe381c3569546 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Wed, 25 Jan 2012 01:15:11 +0200 Subject: Make gdk_pango_context_set_colormap dynamic. This function needs to be called only on GTK versions prior to 2.6. On newer versions the colormap is set automatically. --- bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c | 8 ++++++++ bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h | 1 + .../Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java | 1 + .../Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java | 7 ++++++- .../Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java | 7 ++++++- 5 files changed, 22 insertions(+), 2 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 511f2aa00b..b40a20bb16 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 @@ -5966,7 +5966,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1pango_1context_1set_1colormap) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { OS_NATIVE_ENTER(env, that, _1gdk_1pango_1context_1set_1colormap_FUNC); +/* gdk_pango_context_set_colormap((PangoContext *)arg0, (GdkColormap *)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_pango_context_set_colormap) + if (fp) { + ((void (CALLING_CONVENTION*)(PangoContext *, GdkColormap *))fp)((PangoContext *)arg0, (GdkColormap *)arg1); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1pango_1context_1set_1colormap_FUNC); } #endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index f52d9290de..ca24b575cd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -173,6 +173,7 @@ #define gtk_widget_is_composited_LIB LIB_GTK #define gtk_widget_get_tooltip_text_LIB LIB_GTK #define gtk_widget_set_tooltip_text_LIB LIB_GTK +#define gdk_pango_context_set_colormap_LIB LIB_GDK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK #define gdk_x11_screen_lookup_visual_LIB LIB_GDK #define gdk_threads_set_lock_functions_LIB LIB_GDK diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 95aba417a5..bec390a70b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -4538,6 +4538,7 @@ public static final int /*long*/ gdk_pango_context_get() { } } /** + * @method flags=dynamic * @param context cast=(PangoContext *) * @param colormap cast=(GdkColormap *) */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index bf75352497..23f6ec879b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -612,7 +612,12 @@ void createLayout() { data.layout = layout; OS.pango_context_set_language(context, OS.gtk_get_default_language()); OS.pango_context_set_base_dir(context, (data.style & SWT.MIRRORED) != 0 ? OS.PANGO_DIRECTION_RTL : OS.PANGO_DIRECTION_LTR); - OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + /* + * Colormap is automatically set for GTK 2.6.0 and newer. + */ + if (OS.GTK_VERSION < OS.VERSION(2, 6, 0)) { + OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + } if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) { OS.pango_layout_set_auto_dir(layout, false); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java index 60fe06088b..7ce8f7f9fb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java @@ -79,7 +79,12 @@ public TextLayout (Device device) { if (context == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.pango_context_set_language(context, OS.gtk_get_default_language()); OS.pango_context_set_base_dir(context, OS.PANGO_DIRECTION_LTR); - OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + /* + * Colormap is automatically set for GTK 2.6.0 and newer. + */ + if (OS.GTK_VERSION < OS.VERSION(2, 6, 0)) { + OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + } layout = OS.pango_layout_new(context); if (layout == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.pango_layout_set_font_description(layout, device.systemFont.handle); -- cgit v1.2.3 From 442b778a907836e56f477706a2d1ac6bfa6d0970 Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Wed, 1 Feb 2012 12:07:31 +0530 Subject: Bug 363309-Key events posted with Display.post() do not honor Shiftkey state --- .../Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java | 2 +- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 0ac973f28d..39fc577bf4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -2486,7 +2486,7 @@ public static final int kCGPathElementMoveToPoint = 0; public static final int kCGPathStroke = 2; public static final int kCGScrollEventUnitLine = 1; public static final int kCGScrollEventUnitPixel = 0; -public static final int kCGSessionEventTap = 1; +public static final int kCGHIDEventTap = 0; public static final int kCGTextFillStroke = 2; public static final int kCTParagraphStyleSpecifierBaseWritingDirection = 13; public static final int kCTWritingDirectionLeftToRight = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index d0f387e635..eeb4578b73 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -3151,7 +3151,7 @@ public boolean post(Event event) { if (vKey == -1) { for (short i = 0 ; i <= 0x7F ; i++) { deadKeyState[0] = 0; - OS.UCKeyTranslate (uchrPtr, i, (short)(type == SWT.KeyDown ? OS.kUCKeyActionDown : OS.kUCKeyActionUp), OS.shiftKey, OS.LMGetKbdType(), 0, deadKeyState, maxStringLength, actualStringLength, output); + OS.UCKeyTranslate (uchrPtr, i, (short)(type == SWT.KeyDown ? OS.kUCKeyActionDown : OS.kUCKeyActionUp), (OS.shiftKey >> 8) & 0xFF, OS.LMGetKbdType(), 0, deadKeyState, maxStringLength, actualStringLength, output); if (output[0] == event.character) { vKey = i; break; @@ -3230,12 +3230,12 @@ public boolean post(Event event) { // returnValue is true if we called CGPostKeyboardEvent (10.5 only). if (returnValue == false) { if (eventRef != 0) { + OS.CGEventPost(OS.kCGHIDEventTap, eventRef); + OS.CFRelease(eventRef); try { Thread.sleep(1); } catch (Exception e) { } - OS.CGEventPost(OS.kCGSessionEventTap, eventRef); - OS.CFRelease(eventRef); returnValue = true; } } -- cgit v1.2.3 From 4b2aecb71f54c184e8ee8ca9bf6d67941caf9780 Mon Sep 17 00:00:00 2001 From: Felipe Heidrich Date: Wed, 1 Feb 2012 11:09:12 -0500 Subject: Bug 368710 - ProgressBar created with SWT.INDETERMINATE does not pause on Windows XP --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java index 46023b78d4..d2bf5f051e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java @@ -337,7 +337,11 @@ public void setSelection (int value) { *

  • {@link SWT#ERROR}
  • *
  • {@link SWT#PAUSED}
  • * - * + *

    + * Note: This operation is a hint and is not supported on + * platforms that do not have this concept. + *

    + * * @param state the new state * * @exception SWTException