Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT fullscreen
SWT fullscreen [message #503799] Tue, 15 December 2009 20:09 Go to next message
larsk is currently offline larsk
Messages: 22
Registered: October 2009
Location: Sweden
Junior Member
I am writing an application that is supposed to open a window in fullscreen. It works fine if I run it on the primary display. But if I open it on any of the other displays the window does'nt turn fullscreen. I run it on Mac OS 10.6 with SWT-cocoa64.
Does anyone know how to solve this?

package testApp;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;

public class Main
{
    Display display = new Display();
    Shell shell = new Shell(display);
    Button buttonOpen = new Button(shell, SWT.NONE);
    Button buttonClose = new Button(shell, SWT.NONE);
    Shell shellFS;

    public static void main(String[] args)
    {
        new Main();
    }

    Main()
    {
        shell.setBounds(150, 50, 800, 400);

        buttonOpen.setText("Open");
        buttonOpen.setLocation(40, 150);
        buttonOpen.pack();
        buttonOpen.addSelectionListener(openListener);

        buttonClose.setText("Close");
        buttonClose.setLocation(240, 150);
        buttonClose.pack();
        buttonClose.addSelectionListener(closeListener);

        shell.addKeyListener(closeFSWithQ);
        shell.open();

        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
                display.sleep();
        }
    }

    SelectionListener openListener = new SelectionListener()
    {
        @Override
        public void widgetSelected(SelectionEvent event)
        {
            open();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event)
        {

        }
    };

    SelectionListener closeListener = new SelectionListener()
    {
        @Override
        public void widgetSelected(SelectionEvent event)
        {
            shell.close();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event)
        {

        }
    };

    KeyListener closeFSWithQ = new KeyAdapter()
    {
        @Override
        public void keyPressed(KeyEvent e)
        {
            if (e.keyCode == 113)
            {
                close();
            }
        }
    };

    void close()
    {
        shellFS.setFullScreen(false);
        shellFS.close();
    }

    void open()
    {
        shellFS = new Shell(display);
        shellFS.addKeyListener(closeFSWithQ);
        shellFS.setFullScreen(true);
        shellFS.open();
    }
}
Re: SWT fullscreen [message #503942 is a reply to message #503799] Wed, 16 December 2009 10:08 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Hi,

I assume when you say "display" that you mean "monitor", as there's only one
Display ever used in your snippet. I don't currently have access to a Mac
with multiple monitors, but it sounds like a bug in swt, so I would suggest
logging a report at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT .
The only workaround I can think of in the meantime is to create a Shell with
no trim and set its size to the monitor's size.

Grant


"larsk" <larsk7@gmail.com> wrote in message
news:hg8qdt$7fs$1@build.eclipse.org...
> I am writing an application that is supposed to open a window in
fullscreen. It works fine if I run it on the primary display. But if I open
it on any of the other displays the window does'nt turn fullscreen. I run it
on Mac OS 10.6 with SWT-cocoa64.
> Does anyone know how to solve this?
>
> package testApp;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.events.KeyAdapter;
> import org.eclipse.swt.events.KeyEvent;
> import org.eclipse.swt.events.KeyListener;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.events.SelectionListener;
>
> public class Main
> {
> Display display = new Display();
> Shell shell = new Shell(display);
> Button buttonOpen = new Button(shell, SWT.NONE);
> Button buttonClose = new Button(shell, SWT.NONE);
> Shell shellFS;
>
> public static void main(String[] args)
> {
> new Main();
> }
>
> Main()
> {
> shell.setBounds(150, 50, 800, 400);
>
> buttonOpen.setText("Open");
> buttonOpen.setLocation(40, 150);
> buttonOpen.pack();
> buttonOpen.addSelectionListener(openListener);
>
> buttonClose.setText("Close");
> buttonClose.setLocation(240, 150);
> buttonClose.pack();
> buttonClose.addSelectionListener(closeListener);
>
> shell.addKeyListener(closeFSWithQ);
> shell.open();
>
> while (!shell.isDisposed())
> {
> if (!display.readAndDispatch())
> display.sleep();
> }
> }
>
> SelectionListener openListener = new SelectionListener()
> {
> @Override
> public void widgetSelected(SelectionEvent event)
> {
> open();
> }
>
> @Override
> public void widgetDefaultSelected(SelectionEvent event)
> {
>
> }
> };
>
> SelectionListener closeListener = new SelectionListener()
> {
> @Override
> public void widgetSelected(SelectionEvent event)
> {
> shell.close();
> }
>
> @Override
> public void widgetDefaultSelected(SelectionEvent event)
> {
>
> }
> };
>
> KeyListener closeFSWithQ = new KeyAdapter()
> {
> @Override
> public void keyPressed(KeyEvent e)
> {
> if (e.keyCode == 113)
> {
> close();
> }
> }
> };
>
> void close()
> {
> shellFS.setFullScreen(false);
> shellFS.close();
> }
>
> void open()
> {
> shellFS = new Shell(display);
> shellFS.addKeyListener(closeFSWithQ);
> shellFS.setFullScreen(true);
> shellFS.open();
> }
> }
Re: SWT fullscreen [message #504441 is a reply to message #503942] Sat, 19 December 2009 10:45 Go to previous messageGo to next message
larsk is currently offline larsk
Messages: 22
Registered: October 2009
Location: Sweden
Junior Member
Thanks for your answer!
Yes, I mean monitor.
What do you mean with "no trim"? Is that so the "bar" in the top disappears? I that case how do I make this happen?
Thanks!

Grant Gayed wrote on Wed, 16 December 2009 11:08
Hi,

I assume when you say "display" that you mean "monitor", as there's only one
Display ever used in your snippet. I don't currently have access to a Mac
with multiple monitors, but it sounds like a bug in swt, so I would suggest
logging a report at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT .
The only workaround I can think of in the meantime is to create a Shell with
no trim and set its size to the monitor's size.

Grant

Re: SWT fullscreen [message #504560 is a reply to message #504441] Mon, 21 December 2009 14:25 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Yes, the trim is the top bar, resize handles, etc. Do this by creating the
Shell with style SWT.NO_TRIM or SWT.ON_TOP.

Grant


"larsk" <larsk7@gmail.com> wrote in message
news:hgiatb$b63$1@build.eclipse.org...
> Thanks for your answer!
> Yes, I mean monitor.
> What do you mean with "no trim"? Is that so the "bar" in the top
disappears? I that case how do I make this happen?
> Thanks!
>
> Grant Gayed wrote on Wed, 16 December 2009 11:08
> > Hi,
> >
> > I assume when you say "display" that you mean "monitor", as there's only
one
> > Display ever used in your snippet. I don't currently have access to a
Mac
> > with multiple monitors, but it sounds like a bug in swt, so I would
suggest
> > logging a report at
> > https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform
&component=SWT .
> > The only workaround I can think of in the meantime is to create a Shell
with
> > no trim and set its size to the monitor's size.
> >
> > Grant
>
>
Re: SWT fullscreen [message #504824 is a reply to message #504560] Tue, 22 December 2009 20:27 Go to previous message
larsk is currently offline larsk
Messages: 22
Registered: October 2009
Location: Sweden
Junior Member
Thanks! It seems to work perfectly this way.


Grant Gayed wrote on Mon, 21 December 2009 15:25
Yes, the trim is the top bar, resize handles, etc. Do this by creating the
Shell with style SWT.NO_TRIM or SWT.ON_TOP.

Grant
Previous Topic:direct access to swt classes' fields
Next Topic:best way of accessing the size of text between tabs on each line?
Goto Forum:
  


Current Time: Wed Sep 17 03:38:23 GMT 2014

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

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