[PATCH 1/2] winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.

Ken Thomases ken at codeweavers.com
Fri Nov 6 05:58:54 CST 2015

On Nov 6, 2015, at 5:24 AM, Huw Davies <huw at codeweavers.com> wrote:
> On Fri, Nov 06, 2015 at 11:17:26AM +0000, Huw Davies wrote:
>> On Fri, Nov 06, 2015 at 05:11:15AM -0600, Ken Thomases wrote:
>>> Hmm.  Does it work if you add #import <CoreVideo/CoreVideo.h>
>>> to the imports at the top of cocoa_window.m or, there are still issues, to cocoa_window.h?
>> It's a little less bad ;-/
>> gcc -m32 -c -o cocoa_window.o cocoa_window.m -I. -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
>>  -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wstrict-prototypes \
>>  -Wwrite-strings -Wpointer-arith -gdwarf-2 -fno-omit-frame-pointer -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
>> cocoa_window.m: In function ‘+[WineWindow createWindowWithFeatures:windowFrame:hwnd:queue:]’:
>> cocoa_window.m:690: error: request for member ‘autodisplay’ in something not a structure or union
> And I guess this explains why:
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/index.html#//apple_ref/occ/instp/NSWindow/autodisplay

Sort of, but not really.  The "autodisplay" property is not really new.  It's been around forever, but it used to be an "informal" property.  That is, there were just declarations of the getter and setter methods.  It has since been converted to a "declared" property using the @property syntax.  In some cases, the documentation erroneously indicates that the property dates from the conversion.

I have an old 10.6 SDK and it has -setAutodisplay: which is all that should be necessary for that assignment to work.  However, the compiler may be too old to understand that (although I'm sure I rely on that elsewhere in the Mac driver).

For that particular line, you can change "window.autodisplay = NO" to "[window setAutodisplay:NO]" and it should stop complaining.

Newer compilers also don't require method definitions (or declarations) to appear before they are used.  I can fix some of those warnings by reordering the code but it's probably not necessary for correct operation.

I also no longer get the "ISO C90 forbids mixed declarations and code" with my tools.  That may be a Clang vs. GCC thing.  We should maybe consider compiling Objective-C without that warning enabled, since we don't have the same compatibility concerns as other parts of Wine.

Anyway, if you don't mind testing the -setAutodisplay: change, I can submit a revised patch which will build and work even if there are more warnings than we might like.  Thanks, again.

> cocoa_window.m:1806: warning: ‘NSImage’ may not respond to ‘-drawInRect:’

This is a real issue that I was already aware of and will be fixing soon.


More information about the wine-devel mailing list