diff options
author | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-08-01 17:25:20 -0400 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-08-01 17:25:20 -0400 |
commit | b454bc113a8533fb302edd8590066684b051dbde (patch) | |
tree | 3c55796b4f9f69ed1bf75309d2ea02b73f597076 | |
parent | 81a2c84649a4453c790d7b6a9f36522a82f5f56a (diff) | |
download | eclipse.platform.swt-b454bc113a8533fb302edd8590066684b051dbde.tar.gz eclipse.platform.swt-b454bc113a8533fb302edd8590066684b051dbde.tar.xz eclipse.platform.swt-b454bc113a8533fb302edd8590066684b051dbde.zip |
Bug 377600 - SWT Cocoa Shell class doesn't implement SWT.NO_FOCUS style
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java | 12 |
1 files changed, 11 insertions, 1 deletions
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 f897e09350..02f7754f3a 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 @@ -537,6 +537,16 @@ boolean canBecomeKeyWindow (int /*long*/ id, int /*long*/ sel) { if (isPopup) return false; // Only answer if SWT created the window. if (window != null) { + if ((style & SWT.NO_FOCUS) != 0) { + NSEvent nsEvent = NSApplication.sharedApplication().currentEvent(); + if (nsEvent != null && nsEvent.type() == OS.NSLeftMouseDown) { + NSView contentView = window.contentView(); + if (contentView != null) { + NSView view = contentView.hitTest(nsEvent.locationInWindow()); + if (view == contentView) return false; + } + } + } int /*long*/ styleMask = window.styleMask(); if (styleMask == OS.NSBorderlessWindowMask || (styleMask & (OS.NSNonactivatingPanelMask | OS.NSDocModalWindowMask | OS.NSResizableWindowMask)) != 0) return true; } @@ -1939,7 +1949,7 @@ void setWindowVisible (boolean visible, boolean key) { // when its parent is shown. boolean parentMinimized = parent != null && parentWindow ().isMiniaturized(); if (!parentMinimized) { - if (key) { + if (key && (style & SWT.NO_FOCUS) == 0) { makeKeyAndOrderFront (); } else { window.orderFront (null); |