Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Shell full screen support for OS X >= 10.7(Is it possible to set full screen support for any Shell?)
icon5.gif  Shell full screen support for OS X >= 10.7 [message #903935] Mon, 27 August 2012 11:09 Go to next message
Albert Pikus is currently offline Albert PikusFriend
Messages: 70
Registered: October 2009
Member
Hi, everyone,

I wonder if it is possible to enable/disable full screen button in top right corner of a Shell when application is running on Mac OS X 10.7 or higher. I noticed that a top-level Shell created with Display argument always has a "full screen button", while a child Shell (created with Shell argument) never has this button.

Looking at SWT API, there doesn't seem to be a method that would enable/disable full screen feature.

I would like to enable/disable full screen support for each Shell individually, no matter if this is a top-level or child Shell - is this possible at all?

I tested this with Mac OS X 10.7, Oracle Java 6 and SWT 4.2.


Best regards,

Albert

[Updated on: Mon, 27 August 2012 11:25]

Report message to a moderator

Re: Shell full screen support for OS X >= 10.7 [message #907175 is a reply to message #903935] Mon, 03 September 2012 12:59 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Albert Pikus wrote on Mon, 27 August 2012 07:09

I wonder if it is possible to enable/disable full screen button in top right corner of a Shell when application is running on Mac OS X 10.7 or higher. I noticed that a top-level Shell created with Display argument always has a "full screen button", while a child Shell (created with Shell argument) never has this button.


I don't think so: the choice was deliberately made (https://bugs.eclipse.org/bugs/show_bug.cgi?id=349148#c16). You could use platform-specific calls and reflection to enable it if you like -- see elsewhere in that bug for details.

Quote:

Looking at SWT API, there doesn't seem to be a method that would enable/disable full screen feature.

I would like to enable/disable full screen support for each Shell individually, no matter if this is a top-level or child Shell - is this possible at all?


See Shell#setFullscreen().

Brian.
Re: Shell full screen support for OS X >= 10.7 [message #907949 is a reply to message #907175] Tue, 04 September 2012 13:34 Go to previous messageGo to next message
Albert Pikus is currently offline Albert PikusFriend
Messages: 70
Registered: October 2009
Member
Brian de Alwis wrote on Mon, 03 September 2012 08:59
Albert Pikus wrote on Mon, 27 August 2012 07:09

I wonder if it is possible to enable/disable full screen button in top right corner of a Shell when application is running on Mac OS X 10.7 or higher. I noticed that a top-level Shell created with Display argument always has a "full screen button", while a child Shell (created with Shell argument) never has this button.


I don't think so: the choice was deliberately made (https://bugs.eclipse.org/bugs/show_bug.cgi?id=349148#c16). You could use platform-specific calls and reflection to enable it if you like -- see elsewhere in that bug for details.

Quote:

Looking at SWT API, there doesn't seem to be a method that would enable/disable full screen feature.

I would like to enable/disable full screen support for each Shell individually, no matter if this is a top-level or child Shell - is this possible at all?


See Shell#setFullscreen().

Brian.



Hi, thank you for your answer.

I'm aware of Shell's setFullscreen() method, but this is not what I want to do on Mac: I have a child Shell (created with parent Shell argument) that I would like to switch to/from full screen mode the "Mac way", that is, by using top right full screen button introduced with OS X 10.7.

So if I want to add "full screen" button to a child Shell, I'll have to use reflection. I think that this decision that only top level Shells (descendants of Display) can have full screen button is a bit clumsy: a typical case where full screen button would make sense in a non-top level Shell is a video player that opens inside application's child Shell.


Thank you for your suggestions, best regards,

Albert

Re: Shell full screen support for OS X >= 10.7 [message #911914 is a reply to message #907949] Wed, 12 September 2012 15:17 Go to previous messageGo to next message
Marco Hunsicker is currently offline Marco HunsickerFriend
Messages: 2
Registered: September 2012
Junior Member
I'm using this code to enable fullscreen mode. Only tested on 64bit Mountain Lion.

Field field = Control.class.getDeclaredField("view");
Object /*NSView*/ view = field.get(rShell);

if (view != null)
{
    Class<?> c = Class.forName("org.eclipse.swt.internal.cocoa.NSView");
    Object /*NSWindow*/ window = c.getDeclaredMethod("window").invoke(view);

    c = Class.forName("org.eclipse.swt.internal.cocoa.NSWindow");
    Method setCollectionBehavior = c.getDeclaredMethod(
        "setCollectionBehavior", JVM.is64bit() ? long.class : int.class);
    setCollectionBehavior.invoke(window, getFullScreenMask());
}


The fullscreen mask is 1 << 7.
Re: Shell full screen support for OS X >= 10.7 [message #912335 is a reply to message #911914] Thu, 13 September 2012 11:20 Go to previous messageGo to next message
Albert Pikus is currently offline Albert PikusFriend
Messages: 70
Registered: October 2009
Member
Marco Hunsicker wrote on Wed, 12 September 2012 11:17
I'm using this code to enable fullscreen mode. Only tested on 64bit Mountain Lion.

Field field = Control.class.getDeclaredField("view");
Object /*NSView*/ view = field.get(rShell);

if (view != null)
{
    Class<?> c = Class.forName("org.eclipse.swt.internal.cocoa.NSView");
    Object /*NSWindow*/ window = c.getDeclaredMethod("window").invoke(view);

    c = Class.forName("org.eclipse.swt.internal.cocoa.NSWindow");
    Method setCollectionBehavior = c.getDeclaredMethod(
        "setCollectionBehavior", JVM.is64bit() ? long.class : int.class);
    setCollectionBehavior.invoke(window, getFullScreenMask());
}


The fullscreen mask is 1 << 7.



Hi,

thank you for your suggestion. I'll try this approach since there is really no other way than using reflection.


Best regards,

Albert
Re: Shell full screen support for OS X >= 10.7 [message #928169 is a reply to message #912335] Sun, 30 September 2012 11:28 Go to previous message
Nicholas Rahn is currently offline Nicholas RahnFriend
Messages: 2
Registered: July 2009
Junior Member
@Marco, Thanks. This is great too for removing the fullscreen button (with mask of 0), which is necessary for me due to this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=389486

Cheers!
Previous Topic:issue with org.eclipse.swt.dnd.TextTransfer DND on Linux
Next Topic:How to initialize "Form" API Widget
Goto Forum:
  


Current Time: Fri Apr 26 16:29:38 GMT 2024

Powered by FUDForum. Page generated in 0.03641 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top