[vtkusers] Mac OS X x86_64 with Qt-4.5.x,vtk-5.3.x

Clinton Stimpson clinton at elemtech.com
Thu Nov 20 22:48:24 EST 2008


Sean McBride wrote:
> On 11/18/08 1:01 PM, Clinton Stimpson said:
>
>   
>> You could try implementing vtkCocoaRenderWindow::SetWindowInfo to 
>> something like this:
>>
>>  int tmp;
>>  sscanf(info "%i", &tmp);
>>    NSMutableDictionary* manager =
>>      reinterpret_cast<NSMutableDictionary *>(this->GetCocoaManager());
>>    [manager setObject:reinterpret_cast<id>(tmp)
>>                forKey:@"DisplayId"];
>>
>> I don't know if that sscanf thing is the right syntax for Obj-C.
>>     
>
> 'int' is no good, because in the 64 bit ABI, an 'int' is still 32 bit,
> but a pointer (like 'id') is 64 bit.  I suggest using NSUInteger because
> it is always the same size as a pointer (32 in 32bit and 64 in 64bit). 
> Likewise, %i should be %lu.
>   
Thanks for clarifying that.  I assume you'll have to add ifdefs or 
something since NSUInteger is new for the 10.5 SDK?
> Do I understand correctly that this API takes an ASCII string (of a
> base-10 number) that represents a pointer address?!?  That's strange,
> no?  This is likely to wreak havoc with Obj-C garbage collection...
Yes, its a string of a base 10 number which one can extract then 
reinterpret cast back to a native window system handle.
The vtkRenderWindow::SetWindowInfo() is called by the GTK, Qt, wx Python 
codes that interface with VTK.  Of the 3, it looks like Qt is the only 
one that optionally uses Cocoa now.

Clint





More information about the vtkusers mailing list