emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x-display-pixel-width/height inconsistency


From: YAMAMOTO Mitsuharu
Subject: Re: x-display-pixel-width/height inconsistency
Date: Fri, 10 May 2013 17:55:28 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Fri, 10 May 2013 11:41:38 +0300, Eli Zaretskii <address@hidden> said:

>> If not properly synchronized, use of other data structures such as
>> a simple linked list does not solve the problem either (you can't
>> even count the number of monitors without explicit synchronization
>> by mutex).

> You can count monitors with EnumDisplayMonitors if you pass to the
> callback a pointer to a static int variable, which the callback will
> increment.  You can then allocate an array of a suitable size and
> call EnumDisplayMonitors again, this time filling the array with
> HMONITOR handles, one at a time.  This makes sure we don't cons and
> don't otherwise allocate memory inside a callback.

Of course, that is another way (and GDK does similar).  But not just
counting as you described in the previous mail.  And (another) person
would say why you call EnumDisplayMonitors twice whereas one call
suffices if you use some appropriate data structure (and why you use a
pointer to a static int variable rather than that to an automatic int
variable), if I proposed such a code first.

                                     YAMAMOTO Mitsuharu
                                address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]