Re: Bad portability by foreign_new_for_display



On Wed, Jan 26, 2011 at 5:32 PM, Hans Breuer <hans breuer org> wrote:
> At 26.01.2011 17:33, Benjamin Otte wrote:
>> Hans Breuer<hans<at>  breuer.org>  writes:
>>
>>>
>>> Current master has three occurences of
>>>
>>> #ifdef GDK_WINDOWING_X11
>>>     if (GDK_IS_X11_DISPLAY (display))
>>>
>>> followed by some
>>>       window = gdk_x11_window_lookup_for_display (display, ...);
>>>
>>> Only one was ported to win32 and currently none for OSX, leading
>>> to e.g. a crash during clipboard copy.
>>>
>>> Wouldn't it be better to add foreign_new_for_display() to
>>> the display vtable, rather than adding all these ifdefs?
>>>
>> I don't think that'd work very well, for 2 reasons:
>> 1) If it was a vtable entry, what argument would it take? gpointer? We
>> can't use
>> GdkNativeWindow like GTK2 does, because it's tyepdeffed based on backend
>> and we
>> can't do that in GTK3 with multiple backends.
> Correct, I've overlooked the suggested loss of GdkNativeWindow during the
> creation of backend specific foreign_new_for_display(), but I think using a
> gpointer and e.g. have the backend specifc delegates done _once_ in say
>
>  gdk_foreign_new_for_display(GdkDisplay *, gpointer native_window)
>
> would be better than doing this #ifdef stuff three times in Gtk alone. And
> also putting the burden on every other user of foreign_new_for_display()
>

>From my perspective GdkNativeWindow was an attempt to abstract
something that is explicitly backend-specific. Just not a good idea.


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