[A5] Display always on top?
Mark Oates

Is it possible to create a (fullscreen window) display so that it is always in front?

In a multi-monitor configuration like this:

{"name":"607332","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/d\/5da3049d8c624dd915871ee08ae0bbb6.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/d\/5da3049d8c624dd915871ee08ae0bbb6"}607332

If I drag a window over, that window becomes the focused window and is brought to the front, on top of the allegro display:

{"name":"607333","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/2\/d28c445acf967ef59e5cf2caf197cd9d.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/2\/d28c445acf967ef59e5cf2caf197cd9d"}607333

But I want the display to always be on top, like a powerpoint presentation window:

{"name":"607331","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/8\/4894e3d65d89b11c104c3209d7dcabb1.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/8\/4894e3d65d89b11c104c3209d7dcabb1"}607331

Is there a setting for that somewhere?

AMCerasoli

I don't understand what you're trying to do...... hahahahahaha I'm kidding. You almost made a movie there man!.

Anyway, and what if you create a "real" fullscreen display in the second monitor? is not possible? I think that way nothing would be able to get on top.

Mark Oates

I don't understand what you're trying to do.

Ok, that was funny. :P

Quote:

Anyway, and what if you create a "real" fullscreen display in the second monitor? is not possible? I think that way nothing would be able to get on top.

The problem with that is when I just select a window in the primary display, the fullscreen is disappears (minimizes?)

AMCerasoli

The problem with that is when I just select a window in the primary display, the fullscreen is disappears (minimizes?)

Awww it's true. But I'm almost 100% sure that there is a way of doing it with the Windows handler (you know the HWND stuff) but I haven't done it before.

You'll probably need to get the Handler (al_get_win_window_handle(ALLEGRO_DISPLAY *display)) and then with some Windows specific code set it to be at the top all the time.

Maybe using something like SetWindowPos?

Mark Oates

You'll probably need to get the Handler (al_get_win_window_handle(ALLEGRO_DISPLAY *display)) and then with some Windows specific code set it to be at the top all the time.Maybe using something like SetWindowPos [msdn.microsoft.com]?

That's it!!! ;D ;D

AMCerasoli, you're a genjus!!!

I just added this code:

  HWND window_handle = al_get_win_window_handle(control_display->display);
  SetWindowPos(window_handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);

[edit] That makes me so haappyyyy!!! :D

Matthew Leverton

Now set that same flag on the other window and see what happens.

Mark Oates

Oh neat. It's like a topmost group.

Thomas Fjellstrom

Needs more bunnies.

pkrcel

Needs more bunnies.

Ditto.

AMCerasoli

Well I want to announce to everybody that Mark asked me to get marry with him. He sent me a PM because he was afraid that I could reject him.

The wedding is around 15 of April of this year in Tokyo. You're of course all invited.

That makes me so haappyyyy!!!

Me too!

Thomas Fjellstrom

Congrats!

Mark Oates

Well I want to announce to everybody that Mark asked me to get marry with him.

{"name":"607335","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/35d34c734e7448f1e0307f7f2356b28e.gif","w":500,"h":281,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/35d34c734e7448f1e0307f7f2356b28e"}607335

Well..... OK :-*.

But we have to get a prenup. You ain't gettin' my Bitcoinzz! >:(

[edit]

On topic, I should note that when using ALLEGRO_FULLSCREEN_WINDOW, it does not have the expected behavior and a dragged window will appear above it. However, if the display is created with ALLEGRO_NOFRAME then it does work as expected.

#SelectExpand
1#include <allegro5/allegro_windows.h> 2 3// ... 4 5int adapter_to_pick = 0; // the monitor to display it on 6 7// grab the monitor info 8ALLEGRO_MONITOR_INFO monitor_info; 9al_get_monitor_info(adapter_to_pick, &monitor_info); 10int monitor_width = monitor_info.x2 - monitor_info.x1; 11int monitor_height = monitor_info.y2 - monitor_info.y1; 12 13// create the display 14al_set_new_display_adapter(adapter_to_pick); 15al_set_new_display_flags(ALLEGRO_NOFRAME); 16ALLEGRO_DISPLAY *display = al_create_display(width, height); 17 18// make it a fullscreen window that is always on top, and does not move or resize 19HWND window_handle = al_get_win_window_handle(display); 20SetWindowPos(window_handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE); 21 22// prevent the mouse cursor from showing as well 23al_hide_mouse_cursor(display);

Trent Gamblin
Quote:

SWP_NOMOVE + SWP_NOSIZE

Nit pick, but those mean don't honor the position and size parameters from the call, not what the comment says. :)

Thread #612307. Printed from Allegro.cc