implememting KWindowSystem on Mac OSX
m.kruisselbrink at student.tue.nl
Mon Feb 11 12:08:05 GMT 2008
I've been working on implementing most of the KWindowSystem/KWindowInfo
methods on OSX, but while doing so I encountered one annoying thing. The
entire KWindowSystem API uses Qt's WId type to pass windows around.
However this has one major problem on OSX: a WId can only refer to a
window in the same application. Now I'm not sure what would be the
cleanest/best way to work arround this issue:
a. Keep the current API, but use some convention like when the highest
bit in a WId is set, it isn't really a WId, but another kind of id,
hoping real WId will never have that bit set. Given that a WId on OSX
really is a pointer, this might be a valid assumption, but of course it
could also break very easily.
b. Introduce a new type, for example KWId; on X11 this could just be
typedef-ed to WId I guess, but on OSX it would need to be something that
is not implicitly converted to from an int/long (what the current WId is
typedef-ed to). However I'm not sure yet how to change the KWindowSystem
API in such a way that it is both binary and source compatible on X11,
and preferably also source compatible on OSX. One problem would be that
it is not possible to provide overloads for WId and KWId when one is a
typedef for the other. Of course adding overloads is not possible for
those methods that only have WId in their return-type, so those would
have to get an additional name anyway. The same thing would probably be
true for signals. It's not possible to just change a signal parameter
from WId to KWId without breaking stuff, and having overloads for both
is also not possible.
Any comments, or have I missed something obvious that would make this
easier/nicer to implement?
More information about the kde-core-devel