Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158183 Details for
Bug 282274
[Shell] setFullscreen is mising
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
Bug-282274.patch (text/plain), 16.61 KB, created by
Ivan Furnadjiev
on 2010-02-04 10:42:32 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2010-02-04 10:42:32 EST
Size:
16.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/swt/widgets/Shell.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Shell.java,v >retrieving revision 1.60 >diff -u -r1.60 Shell.java >--- src/org/eclipse/swt/widgets/Shell.java 3 Feb 2010 00:00:07 -0000 1.60 >+++ src/org/eclipse/swt/widgets/Shell.java 4 Feb 2010 15:39:01 -0000 >@@ -15,8 +15,7 @@ > import org.eclipse.rwt.lifecycle.ProcessActionRunner; > import org.eclipse.swt.SWT; > import org.eclipse.swt.SWTException; >-import org.eclipse.swt.events.ShellEvent; >-import org.eclipse.swt.events.ShellListener; >+import org.eclipse.swt.events.*; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.internal.events.ActivateEvent; >@@ -123,6 +122,7 @@ > private static final int MODE_NONE = 0; > private static final int MODE_MAXIMIZED = 1; > private static final int MODE_MINIMIZED = 2; >+ private static final int MODE_FULLSCREEN = 4; > > private static final int INITIAL_SIZE_PERCENT = 60; > private static final int MIN_WIDTH_LIMIT = 80; >@@ -134,6 +134,7 @@ > private Button defaultButton; > private Button saveDefault; > private Control savedFocus; // TODO [rh] move to Decorations when exist >+ private Rectangle savedBounds; > private int mode; > private boolean modified; > private int minWidth; >@@ -538,16 +539,28 @@ > return result; > } > >+ public int getBorderWidth() { >+ return getFullScreen() ? 0 : super.getBorderWidth(); >+ } >+ > private int getTitleBarHeight() { >- ShellThemeAdapter themeAdapter >- = ( ShellThemeAdapter )getAdapter( IThemeAdapter.class ); >- return themeAdapter.getTitleBarHeight( this ); >+ int result = 0; >+ if( !getFullScreen() ) { >+ ShellThemeAdapter themeAdapter >+ = ( ShellThemeAdapter )getAdapter( IThemeAdapter.class ); >+ result = themeAdapter.getTitleBarHeight( this ); >+ } >+ return result; > } > > private Rectangle getTitleBarMargin() { >- ShellThemeAdapter themeAdapter >- = ( ShellThemeAdapter )getAdapter( IThemeAdapter.class ); >- return themeAdapter.getTitleBarMargin( this ); >+ Rectangle result = new Rectangle( 0, 0, 0, 0 ); >+ if( !getFullScreen() ) { >+ ShellThemeAdapter themeAdapter >+ = ( ShellThemeAdapter )getAdapter( IThemeAdapter.class ); >+ result = themeAdapter.getTitleBarMargin( this ); >+ } >+ return result; > } > > private int getMenuBarHeight() { >@@ -570,6 +583,7 @@ > void updateMode() { > mode &= ~MODE_MAXIMIZED; > mode &= ~MODE_MINIMIZED; >+ mode &= ~MODE_FULLSCREEN; > } > > ///////////////////// >@@ -1197,6 +1211,7 @@ > * @see #setMaximized > */ > public void setMinimized( final boolean minimized ) { >+ checkWidget(); > if( minimized ) { > mode |= MODE_MINIMIZED; > } else { >@@ -1231,15 +1246,22 @@ > * @see #setMinimized > */ > public void setMaximized( final boolean maximized ) { >- if( maximized ) { >- if( mode != MODE_MAXIMIZED ) { >- setActive(); >- setBounds( display.getBounds() ); >+ checkWidget(); >+ if( ( mode & MODE_FULLSCREEN ) == 0 ) { >+ if( maximized ) { >+ if( ( mode & MODE_MAXIMIZED ) == 0 ) { >+ setActive(); >+ savedBounds = getBounds(); >+ setBounds( display.getBounds(), false ); >+ } >+ mode |= MODE_MAXIMIZED; >+ mode &= ~MODE_MINIMIZED; >+ } else { >+ if( ( mode & MODE_MAXIMIZED ) != 0 ) { >+ setBounds( savedBounds, false ); >+ } >+ mode &= ~MODE_MAXIMIZED; > } >- mode |= MODE_MAXIMIZED; >- mode &= ~MODE_MINIMIZED; >- } else { >- mode &= ~MODE_MAXIMIZED; > } > } > >@@ -1258,7 +1280,8 @@ > * @see #setMinimized > */ > public boolean getMinimized() { >- return ( this.mode & MODE_MINIMIZED ) != 0; >+ checkWidget(); >+ return ( mode & MODE_MINIMIZED ) != 0; > } > > /** >@@ -1276,7 +1299,73 @@ > * @see #setMaximized > */ > public boolean getMaximized() { >- return mode == MODE_MAXIMIZED; >+ checkWidget(); >+ return ( mode & MODE_FULLSCREEN ) == 0 >+ && ( mode & MODE_MINIMIZED ) == 0 >+ && ( mode & MODE_MAXIMIZED ) != 0; >+ } >+ >+ /** >+ * Sets the full screen state of the receiver. >+ * If the argument is <code>true</code> causes the receiver >+ * to switch to the full screen state, and if the argument is >+ * <code>false</code> and the receiver was previously switched >+ * into full screen state, causes the receiver to switch back >+ * to either the maximized or normal states. >+ * <p> >+ * Note: The result of intermixing calls to <code>setFullScreen(true)</code>, >+ * <code>setMaximized(true)</code> and <code>setMinimized(true)</code> will >+ * vary by platform. Typically, the behavior will match the platform user's >+ * expectations, but not always. This should be avoided if possible. >+ * </p> >+ * >+ * @param fullScreen the new fullscreen state >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 1.3 >+ */ >+ public void setFullScreen( final boolean fullScreen ) { >+ checkWidget(); >+ if( ( ( mode & MODE_FULLSCREEN ) != 0 ) != fullScreen ) { >+ if( fullScreen ) { >+ setActive(); >+ if( ( mode & MODE_MAXIMIZED ) == 0 ) { >+ savedBounds = getBounds(); >+ } >+ setBounds( display.getBounds(), false ); >+ mode |= MODE_FULLSCREEN; >+ mode &= ~MODE_MINIMIZED; >+ } else { >+ if( ( mode & MODE_MAXIMIZED ) == 0 ) { >+ setBounds( savedBounds, false ); >+ } >+ mode &= ~MODE_FULLSCREEN; >+ } >+ layout(); >+ } >+ } >+ >+ /** >+ * Returns <code>true</code> if the receiver is currently >+ * in fullscreen state, and false otherwise. >+ * <p> >+ * >+ * @return the fullscreen state >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 1.3 >+ */ >+ public boolean getFullScreen() { >+ checkWidget(); >+ return ( this.mode & MODE_FULLSCREEN ) != 0; > } > > /////////////////// >#P org.eclipse.rap.rwt.q07 >Index: src/org/eclipse/swt/internal/widgets/shellkit/ShellLCA.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/shellkit/ShellLCA.java,v >retrieving revision 1.22 >diff -u -r1.22 ShellLCA.java >--- src/org/eclipse/swt/internal/widgets/shellkit/ShellLCA.java 3 Feb 2010 15:52:29 -0000 1.22 >+++ src/org/eclipse/swt/internal/widgets/shellkit/ShellLCA.java 4 Feb 2010 15:39:04 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -38,6 +38,7 @@ > static final String PROP_ACTIVE_CONTROL = "activeControl"; > static final String PROP_ACTIVE_SHELL = "activeShell"; > static final String PROP_MODE = "mode"; >+ static final String PROP_FULLSCREEN = "fullScreen"; > static final String PROP_MINIMUM_SIZE = "minimumSize"; > static final String PROP_SHELL_LISTENER = "shellListener"; > private static final String PROP_SHELL_MENU = "menuBar"; >@@ -55,6 +56,8 @@ > adapter.preserve( PROP_IMAGE, shell.getImage() ); > adapter.preserve( PROP_ALPHA, new Integer( shell.getAlpha() ) ); > adapter.preserve( PROP_MODE, getMode( shell ) ); >+ adapter.preserve( PROP_FULLSCREEN, >+ Boolean.valueOf( shell.getFullScreen() ) ); > adapter.preserve( PROP_SHELL_LISTENER, > Boolean.valueOf( ShellEvent.hasListener( shell ) ) ); > adapter.preserve( PROP_SHELL_MENU, shell.getMenuBar() ); >@@ -119,7 +122,8 @@ > > public void renderChanges( final Widget widget ) throws IOException { > Shell shell = ( Shell )widget; >- // TODO [rst] Do not render bounds if shell is maximized >+ // Important: Order matters, write setMode() before setBounds() >+ writeMode( shell ); > ControlLCAUtil.writeChanges( shell ); > writeImage( shell ); > writeText( shell ); >@@ -128,7 +132,7 @@ > // strange behavior! > writeOpen( shell ); > writeActiveShell( shell ); >- writeMode( shell ); >+ writeFullScreen( shell ); > writeCloseListener( shell ); > writeMinimumSize( shell ); > writeDefaultButton( shell ); >@@ -335,11 +339,20 @@ > writer.set( PROP_SHELL_LISTENER, "hasShellListener", newValue, defValue ); > } > >+ private static void writeFullScreen( final Shell shell ) throws IOException { >+ Object defValue = Boolean.FALSE; >+ Boolean newValue = Boolean.valueOf( shell.getFullScreen() ); >+ if( WidgetLCAUtil.hasChanged( shell, PROP_FULLSCREEN, newValue, defValue ) ) { >+ JSWriter writer = JSWriter.getWriterFor( shell ); >+ writer.set( "fullScreen", newValue ); >+ } >+ } >+ > private static String getMode( final Shell shell ) { > String result = null; > if( shell.getMinimized() ) { > result = "minimized"; >- } else if( shell.getMaximized() ) { >+ } else if( shell.getMaximized() || shell.getFullScreen() ) { > result = "maximized"; > } > return result; >Index: js/org/eclipse/swt/widgets/Shell.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/js/org/eclipse/swt/widgets/Shell.js,v >retrieving revision 1.17 >diff -u -r1.17 Shell.js >--- js/org/eclipse/swt/widgets/Shell.js 16 Dec 2009 18:26:47 -0000 1.17 >+++ js/org/eclipse/swt/widgets/Shell.js 4 Feb 2010 15:39:04 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -483,6 +483,14 @@ > this._blocker = null; > } > } >+ }, >+ >+ setFullScreen : function( fullScreen ) { >+ if( fullScreen ) { >+ this._captionBar.setDisplay( false ); >+ } else { >+ this._captionBar.setDisplay( this.hasState( "rwt_TITLE" ) ); >+ } > } > } > } ); >#P org.eclipse.rap.rwt.test >Index: src/org/eclipse/swt/widgets/Shell_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Shell_Test.java,v >retrieving revision 1.26 >diff -u -r1.26 Shell_Test.java >--- src/org/eclipse/swt/widgets/Shell_Test.java 3 Feb 2010 00:00:09 -0000 1.26 >+++ src/org/eclipse/swt/widgets/Shell_Test.java 4 Feb 2010 15:39:06 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -22,6 +22,7 @@ > import org.eclipse.swt.events.*; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.internal.widgets.IDisplayAdapter; > import org.eclipse.swt.internal.widgets.IShellAdapter; > import org.eclipse.swt.layout.FillLayout; > >@@ -131,7 +132,7 @@ > assertNull( backgroundShell[ 0 ] ); > assertTrue( failed[ 0 ] ); > } >- >+ > public void testInitialValues() { > Display display = new Display(); > Shell shell = new Shell( display, SWT.NONE ); >@@ -593,6 +594,132 @@ > } > } > >+ public void testFullScreen() { >+ Fixture.fakePhase( PhaseId.PROCESS_ACTION ); >+ final java.util.List log = new ArrayList(); >+ Display display = new Display(); >+ Rectangle displayBounds = new Rectangle( 0, 0, 800, 600 ); >+ getDisplayAdapter( display ).setBounds( displayBounds ); >+ Shell shell = new Shell( display ); >+ Rectangle shellBounds = new Rectangle( 10, 10, 100, 100 ); >+ shell.setBounds( shellBounds ); >+ shell.addControlListener( new ControlListener() { >+ public void controlMoved( final ControlEvent event ) { >+ log.add( "controlMoved" ); >+ } >+ public void controlResized( final ControlEvent event ) { >+ log.add( "controlResized" ); >+ } >+ } ); >+ shell.open(); >+ assertFalse( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ >+ log.clear(); >+ shell.setMaximized( true ); >+ assertFalse( shell.getFullScreen() ); >+ assertTrue( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 2, log.size() ); >+ assertEquals( "controlMoved", log.get( 0 ) ); >+ assertEquals( "controlResized", log.get( 1 ) ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ shell.setMinimized( true ); >+ assertFalse( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertTrue( shell.getMinimized() ); >+ >+ shell.setMinimized( false ); >+ assertFalse( shell.getFullScreen() ); >+ assertTrue( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ >+ log.clear(); >+ shell.setFullScreen( true ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ log.clear(); >+ shell.setMaximized( true ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ log.clear(); >+ shell.setMaximized( false ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ log.clear(); >+ shell.setMinimized( true ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertTrue( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ >+ log.clear(); >+ shell.setMinimized( false ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ >+ log.clear(); >+ shell.setFullScreen( false ); >+ assertFalse( shell.getFullScreen() ); >+ assertTrue( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 0, log.size() ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ shell.setMaximized( false ); >+ shell.setMinimized( true ); >+ log.clear(); >+ shell.setFullScreen( true ); >+ assertTrue( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 2, log.size() ); >+ assertEquals( "controlMoved", log.get( 0 ) ); >+ assertEquals( "controlResized", log.get( 1 ) ); >+ assertEquals( displayBounds, shell.getBounds() ); >+ >+ log.clear(); >+ shell.setFullScreen( false ); >+ assertFalse( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 2, log.size() ); >+ assertEquals( "controlMoved", log.get( 0 ) ); >+ assertEquals( "controlResized", log.get( 1 ) ); >+ assertEquals( shellBounds, shell.getBounds() ); >+ >+ shell.setFullScreen( true ); >+ log.clear(); >+ shell.setBounds( 20, 20, 200, 200 ); >+ assertFalse( shell.getFullScreen() ); >+ assertFalse( shell.getMaximized() ); >+ assertFalse( shell.getMinimized() ); >+ assertEquals( 2, log.size() ); >+ assertEquals( "controlMoved", log.get( 0 ) ); >+ assertEquals( "controlResized", log.get( 1 ) ); >+ } >+ >+ private static IDisplayAdapter getDisplayAdapter( final Display display ) { >+ Object adapter = display.getAdapter( IDisplayAdapter.class ); >+ return ( IDisplayAdapter )adapter; >+ } >+ > protected void setUp() throws Exception { > Fixture.setUp(); > Fixture.fakePhase( PhaseId.PROCESS_ACTION );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 282274
: 158183