summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam <lshanmug@in.ibm.com>2012-08-28 12:13:27 +0530
committerLakshmi Shanmugam <lshanmug@in.ibm.com>2012-09-07 14:00:05 +0530
commitf29e60c3bf36f15f433cda3ac2ae070ac635dffc (patch)
treeedf91b729623df36f2b07219e5af43d8f26afe3e
parentb9729f2b6df70fadc49c8b129fafe116a971892c (diff)
downloadeclipse.platform.swt-f29e60c3bf36f15f433cda3ac2ae070ac635dffc.tar.gz
eclipse.platform.swt-f29e60c3bf36f15f433cda3ac2ae070ac635dffc.tar.xz
eclipse.platform.swt-f29e60c3bf36f15f433cda3ac2ae070ac635dffc.zip
Bug 378383-Request for a notification of full-screen changes
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java6
4 files changed, 16 insertions, 32 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 dadc558f17..80daea4f87 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
@@ -150,12 +150,11 @@ public class OS extends C {
public static final int /*long*/ sel_frameSizeForContentSize_horizontalScrollerClass_verticalScrollerClass_borderType_controlSize_scrollerStyle_ = sel_registerName("frameSizeForContentSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle:");
public static final int /*long*/ sel_scrollerStyle = sel_registerName("scrollerStyle");
public static final int /*long*/ sel_toggleFullScreen_ = sel_registerName("toggleFullScreen:");
- public static final int /*long*/ sel_windowDidEnterFullScreen_ = sel_registerName("windowDidEnterFullScreen:");
- public static final int /*long*/ sel_windowDidExitFullScreen_ = sel_registerName("windowDidExitFullScreen:");
public static final int NSScrollerStyleLegacy = 0;
public static final int NSScrollerStyleOverlay = 1;
public static final int NSWindowFullScreenButton = 7;
+ public static final int NSFullScreenWindowMask = 1 << 14;
public static final int NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7;
public static final int NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8;
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 9c606fd4d7..cdc8ba5b94 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
@@ -2907,10 +2907,6 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_systemSettingsChanged_, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowDidMiniaturize_, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowDidDeminiaturize_, proc3, "@:@");
- if (OS.VERSION >= 0x1070) {
- OS.class_addMethod(cls, OS.sel_windowDidEnterFullScreen_, proc3, "@:@");
- OS.class_addMethod(cls, OS.sel_windowDidExitFullScreen_, proc3, "@:@");
- }
OS.objc_registerClassPair(cls);
}
@@ -5689,10 +5685,6 @@ static int /*long*/ windowProc(int /*long*/ id, int /*long*/ sel, int /*long*/ a
widget.windowDidMiniturize(id, sel, arg0);
} else if (sel == OS.sel_windowDidDeminiaturize_) {
widget.windowDidDeminiturize(id, sel, arg0);
- } else if (sel == OS.sel_windowDidEnterFullScreen_) {
- widget.windowDidEnterFullScreen(id, sel, arg0);
- } else if (sel == OS.sel_windowDidExitFullScreen_) {
- widget.windowDidExitFullScreen(id, sel, arg0);
} else if (sel == OS.sel_touchesBeganWithEvent_) {
widget.touchesBeganWithEvent(id, sel, arg0);
} else if (sel == OS.sel_touchesMovedWithEvent_) {
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 fc8181af25..ef4b26e7cb 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
@@ -631,7 +631,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
rect.width = trim.width;
rect.height = trim.height;
if (window != null) {
- if (!fullScreen && !fixResize()) {
+ if (!_getFullScreen() && !fixResize()) {
float /*double*/ h = rect.height;
rect = window.frameRectForContentRect(rect);
rect.y += h-rect.height;
@@ -971,6 +971,13 @@ public Rectangle getClientArea () {
*/
public boolean getFullScreen () {
checkWidget();
+ return _getFullScreen ();
+}
+
+boolean _getFullScreen () {
+ if ((window.collectionBehavior() & OS.NSWindowCollectionBehaviorFullScreenPrimary) != 0) {
+ return (window.styleMask() & OS.NSFullScreenWindowMask) != 0 ? true : false;
+ }
return fullScreen;
}
@@ -1027,7 +1034,7 @@ public Point getLocation () {
public boolean getMaximized () {
checkWidget();
if (window == null) return false;
- return !fullScreen && window.isZoomed();
+ return !_getFullScreen() && window.isZoomed();
}
Shell getModalShell () {
@@ -1596,7 +1603,7 @@ void setBounds (int x, int y, int width, int height, boolean move, boolean resiz
return;
}
}
- if (fullScreen) setFullScreen (false);
+ if (_getFullScreen ()) setFullScreen (false);
boolean sheet = window.isSheet();
if (sheet && move && !resize) return;
int screenHeight = (int) display.getPrimaryFrame().height;
@@ -1684,14 +1691,14 @@ public void setEnabled (boolean enabled) {
public void setFullScreen (boolean fullScreen) {
checkWidget ();
if (window == null) return;
- if (this.fullScreen == fullScreen) return;
- this.fullScreen = fullScreen;
+ if (_getFullScreen () == fullScreen) return;
if ((window.collectionBehavior() & OS.NSWindowCollectionBehaviorFullScreenPrimary) != 0) {
OS.objc_msgSend(window.id, OS.sel_toggleFullScreen_, 0);
return;
}
+ this.fullScreen = fullScreen;
if (fullScreen) {
currentFrame = window.frame();
window.setShowsResizeIndicator(false); //only hides resize indicator
@@ -2144,11 +2151,11 @@ void windowDidBecomeKey(int /*long*/ id, int /*long*/ sel, int /*long*/ notifica
Shell parentShell = this;
while (parentShell.parent != null) {
parentShell = (Shell) parentShell.parent;
- if (parentShell.fullScreen) {
+ if (parentShell._getFullScreen ()) {
break;
}
}
- if (!parentShell.fullScreen || menuBar != null) {
+ if (!parentShell._getFullScreen () || menuBar != null) {
updateSystemUIMode ();
} else {
parentShell.updateSystemUIMode ();
@@ -2166,21 +2173,13 @@ void windowDidMiniturize(int /*long*/ id, int /*long*/ sel, int /*long*/ notific
sendEvent(SWT.Iconify);
}
-void windowDidEnterFullScreen(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
- this.fullScreen = true;
-}
-
-void windowDidExitFullScreen(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
- this.fullScreen = false;
-}
-
void windowDidMove(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
moved = true;
sendEvent(SWT.Move);
}
void windowDidResize(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
- if (fullScreen && ((window.collectionBehavior() & OS.NSWindowCollectionBehaviorFullScreenPrimary) == 0)) {
+ if (((window.collectionBehavior() & OS.NSWindowCollectionBehaviorFullScreenPrimary) == 0) && fullScreen) {
window.setFrame(fullScreenFrame, true);
NSRect contentViewFrame = new NSRect();
contentViewFrame.width = fullScreenFrame.width;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index 1e5f964597..d3f6668a63 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -2096,12 +2096,6 @@ void windowDidMiniturize(int /*long*/ id, int /*long*/ sel, int /*long*/ notific
void windowDidDeminiturize(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
}
-void windowDidEnterFullScreen(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
-}
-
-void windowDidExitFullScreen(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
-}
-
void windowSendEvent(int /*long*/ id, int /*long*/ sel, int /*long*/ event) {
callSuper(id, sel, event);
}