diff options
author | Felipe Heidrich | 2012-02-01 16:28:43 +0000 |
---|---|---|
committer | Felipe Heidrich | 2012-02-01 16:28:43 +0000 |
commit | 0cdae858d3d85466b83a302717fee6ddac6c196e (patch) | |
tree | e9479db6df96acc00fb766a5e4dd2ec333178a4f | |
parent | f4d658dbbb93912c6981201eadf9d14696ded147 (diff) | |
parent | 4b2aecb71f54c184e8ee8ca9bf6d67941caf9780 (diff) | |
download | eclipse.platform.swt-AERO_WORK.tar.gz eclipse.platform.swt-AERO_WORK.tar.xz eclipse.platform.swt-AERO_WORK.zip |
Merge branch 'master' into AERO_WORKAERO_WORK
28 files changed, 340 insertions, 62 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 @@ <method class_method="true" selector="currentCursor" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="hotSpot" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> <method selector="initWithImage:hotSpot:" swt_gen="true"> <arg swt_gen="true"></arg> <arg swt_gen="true"></arg> @@ -1823,6 +1826,10 @@ <method selector="numberOfItems" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="performKeyEquivalent:" swt_gen="true"> + <arg swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method class_method="true" selector="popUpContextMenu:withEvent:forView:" swt_gen="true"> <arg swt_gen="true"></arg> <arg swt_gen="true"></arg> 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..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 @@ -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/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 979688a89a..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 @@ -1312,6 +1312,7 @@ 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_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:"); @@ -2485,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 PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index b7aca3fc8c..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 @@ -7702,24 +7710,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_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/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..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 *) */ @@ -6084,20 +6085,6 @@ public static final void gtk_calendar_set_display_options(int /*long*/ calendar, /** * @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 *) * @param year cast=(guint *) * @param month cast=(guint *) * @param day cast=(guint *) 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/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); + } } } 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/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); 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; } } 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 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. * <p> 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); 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..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 @@ -669,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 = DEFAULT_WIDTH; - if (height == 0) height = DEFAULT_HEIGHT; return new Point (width, height); } 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); } 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/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; 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 512ddbae68..c39f90036f 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 @@ -342,7 +342,11 @@ public void setSelection (int value) { * <li>{@link SWT#ERROR}</li> * <li>{@link SWT#PAUSED}</li> * </ul> - * + * <p> + * Note: This operation is a hint and is not supported on + * platforms that do not have this concept. + * </p> + * * @param state the new state * * @exception SWTException <ul> 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<br> SWT</h1> +<h2>SWT Build 3820a - Thursday January 26, 2012</h2> + +<blockquote> +<a href=https://bugs.eclipse.org/bugs/buglist.cgi?bug_file_loc=;bug_file_loc_type=allwordssubstr;bug_id=;bugidtype=include;chfield=resolution;target_milestone=;chfieldfrom=2012-01-20+17%3A04%3A28+-0500;chfieldto=2012-01-25+17%3A29%3A03+%2B0000;chfieldvalue=FIXED;classification=Eclipse;component=SWT;email1=;email2=;emailtype1=substring;emailtype2=substring;field-1-0-0=classification;field-1-1-0=product;field-1-2-0=component;field0-0-0=noop;keywords=;keywords_type=allwords;long_desc=;long_desc_type=allwordssubstr;product=Platform;query_format=advanced;remaction=;short_desc=;short_desc_type=allwordssubstr;status_whiteboard=;status_whiteboard_type=allwordssubstr;type-1-0-0=anyexact;type-1-1-0=anyexact;type-1-2-0=anyexact;type0-0-0=noop;value-1-0-0=Eclipse;value-1-1-0=Platform;value-1-2-0=SWT;value0-0-0=;votes=;query_based_on=>Bugs fixed</a> +</blockquote> + <h2>SWT Build 3820 - Saturday January 21, 2012</h2> <blockquote> 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..375196fe2a --- /dev/null +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet361.java @@ -0,0 +1,208 @@ +/******************************************************************************* + * 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. + * 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/ + * + * @since 3.8 + */ +import java.awt.Color; +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(); + Point p = shell.toDisplay(r.x, r.y); + 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); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1); + data.widthHint = 640; + data.heightHint = 480; + composite.setLayoutData(data); + Frame frame = SWT_AWT.new_Frame(composite); + 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); + } + } + }; + frame.add(canvas); + composite.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + e.result = "Image drawn in AWT Canvas"; + } + }); + + shell.pack(); + 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; + } + +} |