Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » getting fullscreen button on window

This thread is locked; no one can reply to it. rss feed Print
getting fullscreen button on window
William Labbett
Member #4,486
March 2004
avatar

hi,

Does allegro provide a way to recieve a signal that the fullscreen button has been pressed or do we need to use platform specific code for that.

You know what I mean : the middle button on the top of the window.

using A5

Sorry if this has already been asked somewhere else.

Matthew Leverton
Supreme Loser
January 1999
avatar

If the window is set to be resizable, then you'll get a ALLEGRO_EVENT_DISPLAY_RESIZE event.

What do you want to do when the window is maximized?

William Labbett
Member #4,486
March 2004
avatar

Thanks. Switch to fullsreen.

Matthew Leverton
Supreme Loser
January 1999
avatar

Are you using ALLEGRO_FULLSCREEN_WINDOW flag? You can toggle that flag to easily switch back and forth.

But I'm not sure if Allegro automatically makes the maximize button switch to full screen with that flag set. It would be nice if it did.

Thomas Fjellstrom
Member #476
June 2000
avatar

That's not what it does though. The maximize button tells the window manager (even on windows) to make the window fill the available screen area that isn't taken up by any docks (start bar) or the window frame itself.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matthew Leverton
Supreme Loser
January 1999
avatar

The maximize button tells the window manager (even on windows)

Yeah but I've seen a few Windows applications that override the maximize button to go full screen. It would be nice if Allegro could do that on windows that were set with FULLSCREEN_WINDOW.

William Labbett
Member #4,486
March 2004
avatar

Are you using ALLEGRO_FULLSCREEN_WINDOW flag? You can toggle that flag to easily switch back and forth.

No. Does it mean al_create_display() has to be recalled ?

Matthew Leverton
Supreme Loser
January 1999
avatar

No. Does it mean al_create_display() has to be recalled ?

I've not used it, but my understanding is that the switch is automatic. Just call al_toggle_display_flag() with the proper display and flag.

Thomas Fjellstrom
Member #476
June 2000
avatar

Yeah but I've seen a few Windows applications that override the maximize button to go full screen. It would be nice if Allegro could do that on windows that were set with FULLSCREEN_WINDOW.

I suppose it'd be nice to get a new event for the maximize button. But how many people would actually expect the maximize button to do anything other than maximize? I think its a bad design call.

No. Does it mean al_create_display() has to be recalled ?

use ALLEGRO_FULLSCREEN_WINDOW instead of ALLEGRO_FULLSCREEN and you can switch between fullscreen and windowed modes. Note though, it means you're stuck with what ever resolution the user has set at the time, so you'll have to handle all kinds of resolutions and sizes.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

No, you just call al_toggle_display_option(ALLEGRO_FULLSCREEN_WINDOW). And you don't have to have it set to use that. It either has to 1) start off as a windowed display or 2) start off in FULLSCREEN_WINDOW mode.

William Labbett
Member #4,486
March 2004
avatar

As easy as that ? Cool.

only thing - in order to call the toggle function I need a way to do :

if( middle resize button pressed )
{
   toggle();
}

Is there a specifc event for that button ?

Matthew Leverton
Supreme Loser
January 1999
avatar

I suppose it'd be nice to get a new event for the maximize button. But how many people would actually expect the maximize button to do anything other than maximize? I think its a bad design call.

It's not for every situation, but I think given the use of FULLSCREEN_WINDOW, it make sense (particularly if the window is not resizable).

But being able to catch a MAXIMIZE event would be sufficient. (Acknowledge the resize, and then switch to full screen.) However, you may want to use maximize but not let the window be resizable. Not sure if Allegro supports that sort of thing or not.

Is there a specifc event for that button ?

No.

William Labbett
Member #4,486
March 2004
avatar

It would nice to be able to use the button for switching to fullscreen but then if it was used only for that then they'd be no way to set a maximum windowed mode.

Thomas Fjellstrom
Member #476
June 2000
avatar

No, you just call al_toggle_display_option(ALLEGRO_FULLSCREEN_WINDOW). And you don't have to have it set to use that. It either has to 1) start off as a windowed display or 2) start off in FULLSCREEN_WINDOW mode.

Of course, you're right.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

William Labbett
Member #4,486
March 2004
avatar

As it stands then the only way to switch to a proper fullscreen mode is via some button of one's own making. Is that right ?

Thomas Fjellstrom
Member #476
June 2000
avatar

Or a key shortcut.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

Without some kind of hacks like checking the new screen size is the full screen (with decorations), I think that's right.

Go to: