[racket] Second display monitor issue

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Mon May 28 11:26:49 EDT 2012

Now I've looked at it more closely, it seems you're right - that is the best way  to get an HMONITER (going through the adapter seems to be an alternative but not a better one). 

Sorry for the noise.

Cheers,

Kieron

On May 26, 2012, at 19:59, Matthew Flatt <mflatt at cs.utah.edu> wrote:

> EnumDisplayMonitors() is the way I see to get an HMONITOR, which is
> needed for GetMonitorInfo. Is there another way?
> 
> At Sat, 26 May 2012 15:03:50 -0600, Kieron Hardy wrote:
>> Thanks Matthew for the fix - it seems to work fine - and wow done so
>> quickly too!
>> 
>> Is there a reason you have Windows enumerate the display monitors (with
>> EnumDisplayMonitors) and then ask Windows for details for each of those
>> monitors (with GetMonitorInfoW)? I am thinking that a more direct approach
>> would be to have some sort of in-range step through the monitors in turn
>> directly and collecting and processing the data that way. I am probably
>> missing something but the enumerate-first approach seems to be doing more
>> work than strictly necessary. Admittedly it's a terribly minor quibble,
>> it's only a tiny bit more work, what with the small number of monitors and
>> the small number of times this needs to be done, am just looking for
>> greater understanding.
>> 
>> Cheers,
>> 
>> Kieron.
>> 
>> On Sat, May 26, 2012 at 8:18 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> 
>>> Thanks! I've pushed a change that should solve the problem; let me know
>>> if it still doesn't work.
>>> 
>>> At Sat, 26 May 2012 05:45:52 -0600, Kieron Hardy wrote:
>>>> So it seems that for some reason (Older Dell laptop, ATI video, Windows 7
>>>> using generic drivers) the Windows system call to return the list of
>>>> monitors is returning them to Racket in a different order (primary
>>> display
>>>> monitor last) than expected (primary display monitor first).
>>>> 
>>>> The code for get-all-screen-rects (in
>>>> collects/mred/private/wx/win32/frame.rkt) assumes monitor 0 is the
>>> primary
>>>> display monitor and is the first item in the list returned by
>>>> EnumDisplayDevices. My tests show that at least sometimes the primary
>>>> display monitor is not the first item in the list (also noted on SO at
>>>> 
>>> http://stackoverflow.com/questions/2600255/how-can-i-retrieve-monitor-information
>>>> ).
>>>> 
>>>> An alternative solution to getting monitor information would be to use
>>>> GetMonitorInfo passing a MONITORINFO or MONITORINFOEX structure for each
>>> of
>>>> the values in the range 0 .. GetSystemMetrics (SM_CMONITORS) and used in
>>>> Racket perhaps sorted by the monitor name returned in the szDevice field
>>> of
>>>> the MONITORINFOEX structure.
>>>> 
>>>> If Racket needs to designate monitor 0 as the primary monitor then
>>>> get-all-screen-rects must enumerate the display monitors and then perform
>>>> some processing to sort them so that the primary monitor is returned as
>>> the
>>>> first item in the list.
>>>> 
>>>> Cheers,
>>>> 
>>>> Kieron.
>>>> ____________________
>>>>  Racket Users list:
>>>>  http://lists.racket-lang.org/users
>>> 


Posted on the users mailing list.