Re: GtkSocket ...
- From: Owen Taylor <otaylor redhat com>
- To: Michael Meeks <mmeeks gnu org>
- Cc: Tim Janik <timj gtk org>, gtk-devel-list gnome org
- Subject: Re: GtkSocket ...
- Date: 01 Aug 2000 19:24:22 -0400
Michael Meeks <michael@helixcode.com> writes:
> Hi all,
>
> This bug was recently fixed in Bonobo Plug/Socket, it
> caused fatal BadMatch errors; be good to fix Gtk too. Problem
> solved by Peter Williams and Ettore Perazolli.
>
> This will fix the intermitent BadMatch bug that crops up every so
> often. The problem was that we were trying to set the focus to the
> parent window, which was not guaranteed to be mapped and viewable.
>
> The first few lines of our focus_out_event are now something like
> this:
>
> {
> GtkWidget *toplevel;
> BonoboSocket *socket;
> XWindowAttributes attr;
>
> g_return_val_if_fail (BONOBO_IS_SOCKET (widget), FALSE);
> socket = BONOBO_SOCKET (widget);
>
> toplevel = gtk_widget_get_ancestor (widget,
> gtk_window_get_type());
> XGetWindowAttributes (GDK_DISPLAY (), GDK_WINDOW_XWINDOW
> (toplevel->window), &attr);
>
> /* FIXME: can we just check the return value of
> * XGetWindowAttributes? */
> if (toplevel && attr.map_state == IsViewable)
Why create a race condition? The window manager could unmap the parent
of the window between the check and the unmap.
The correct thing to do in a case like this is do
gdk_error_trap_push() OPERATATION gdk_flush() gdk_error_trap_pop()
around the operation.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]