[1/3] winex11: Select for XRandR screen change events and implement an event handler.

Alexandre Julliard julliard at winehq.org
Fri May 10 10:11:04 CDT 2013


Sam Edwards <cfsworks at gmail.com> writes:

> On 05/09/2013 12:36 PM, Alexandre Julliard wrote:
>> It's okay only because you are not actually calling it ;-)
> Yeah, I don't call it until patch 2 in the series. This patch just
> introduces it without calling it, which does cause a warning. (I hope
> this doesn't violate the "atomic patches" rule.)

It does, you can't add dead code (or warnings for that matter).

>> But no, you can't select for events on the gdi display; actually I don't
>> think you want to do it this way at all.
> So gdi_display should not receive events? I'm guessing this has
> something to do with the fact that Wine opens one Xlib Display per
> thread, so the XRandR resize events need to be pulled down on one of
> the thread-local X connections, rather than the master
> gdi_display. (I'm still not sure why Wine does it this way. Are
> certain versions of Xlib not thread-safe?)

Most window events need to be handled in the thread that owns the
window. Pulling them from a global connection in a different thread
would only cause extra context switches and potential deadlocks.

>> Handling external resizes
>> should be done in the desktop process, and most likely involves the
>> wineserver too.
> The event handler does call X11DRV_resize_desktop, which messages the
> desktop process with the new size. But, I can see how it would be
> cleaner to put the event checker in the same process as well, since
> that way the XRandR resize doesn't have to get processed once for
> every process on the system.
>
> How would this involve the wineserver, though? It looks like we
> already have the infrastructure for synchronizing screen_width and
> screen_height changes from one process to another.

Not really, only the process that triggered the change gets properly
updated at the moment. The Mac driver tries to do it by broadcasting a
message, but that doesn't update processes that currently don't own a
window. There are also race conditions, and various issues with window
surfaces and DCE regions. Resizing the desktop is a tricky problem.

As far as XRandr is concerned, at this point you could probably simply
cache the mode and don't bother to update except when the app triggers a
change, since that's what we do for the rest of the desktop parameters
anyway.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list