Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Windows: oversized window

This thread is locked; no one can reply to it. rss feed Print
Windows: oversized window
Gassa
Member #5,298
December 2004
avatar

I'd like to know how to handle the situation when I try to create a window with dimensions greater than the current resolution.

Currently, when using Allegro 5.0.10:

1. If the height is greater than what the desktop can allow, the window header tries to go above the top of the screen. It may or may not succeed, probably depending on Windows display settings and/or themes.

2. al_get_display_width and al_get_display_height still return the sizes I picked.

3. Most annoying: mouse event coordinates become different than pixel coordinates.

An example program is on Pastebin. It tries to create a 2500x1500 window (larger than most common resolutions), and then draws a dot at the center and another dot at mouse coordinates. It also prints mouse coordinates on standard output after each movement. The program exits on mouse click.

Locally, I experience the following behavior (screen resolution 1920x1080):

(1) Mouse coordinates when in upper left corner are reported as (290, 210), probably they are generally (MAX_X - RES_X) / 2 and (MAX_Y - RES_Y) / 2 where MAX_* are window dimensions and RES_* is screen resolution.

(2) The dot corresponding to mouse coordinates is above and to the left of the actual mouse cursor. More so when the cursor is at lower right.

So: This is a bug, right? Can it be fixed (or is it already) in later versions? And how do I overcome it (for example, query the system what would be the maximum possible dimensions)?

Ivan Kazmenko.

Upd: Bump. No one interested in looking into it? Fine :( where is the proper place to report bugs, then?

SiegeLord
Member #7,827
October 2006
avatar

Yeah, this still happens with current versions of 5.1... very bizzare!

One way to avoid this is to query the monitor resolutions via the monitor API (http://liballeg.org/a5docs/trunk/monitor.html#allegro_monitor_info and http://liballeg.org/a5docs/trunk/fullscreen_mode.html#allegro_display_mode, also see ex_monitorinfo). Typically desktop resolution will be the highest available for any given adapter(screen).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Gassa
Member #5,298
December 2004
avatar

Thank you for the reply! allegro_monitor_info (0, ...) gives 0 0 1920 1080 to me.

I've faced the next problem on this road: in at least Windows 8, when I choose Large (150%) scale in Display options, my Allegro window also gets scaled 150% up.
So, a height-900 window suffers from the same effect locally, being scaled up to 1350 height which is greater than 1080.

So, the possible paths seem to be
(1) disable scaling for my Allegro window, and
(2) query the scaling settings.

Does Allegro allow one or both of the above? Currently, the size of the display stays 900 after creation but is in fact 1350 on the monitor, and the height of the monitor is 1080 so does not take scaling into account. So, the 900 and 1080 I see from my program are basically in different units.

SiegeLord
Member #7,827
October 2006
avatar

For OSX we do both, but prefer to disable the scaling. This needs to be implemented for Windows, but it hasn't yet (I wonder if it's related to this bug somehow?).

There's no way to query the scaling factor/dpi, but that's something that would be useful too.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: