Re: Re:Help replacing GtkDrawingArea with GtkLayout



On Mon, 2014-03-03 at 16:38 +0001, Bernhard Schuster wrote:
On Mon, Mar 3, 2014 at 5:26 PM, Richard Shann
<richard rshann plus com> wrote:
On Mon, 2014-03-03 at 16:49 +0100, Stefan Salewski wrote: 
        On Mon, 2014-03-03 at 15:17 +0000, Richard Shann wrote: > I
        have constructed the following minimal example, Yes indeed,
        https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-events >This function must 
be called while a widget is unrealized.
Thank you for giving this some thought. I think it is not the case
however that the gtk_widget_show_all() call causes the "widget to be
realized" in gtk-speak, it just sets a flag on the widget to say it
should be visible (I am guessing). I think I have just made a
breakthrough with my problem however - setting the configure-event
signal handler on the parent GtkWindow widget instead of the
GtkLayout window it contains causes it to fire off. I have tried
this with the scroll-event too and that works. Why this should be
different from the case where I use a GtkDrawingArea I have no idea,
but it looks like I am cooking with gas!

Either - I strongly recommend to stick to


    gdk_window_add_events (win, GDK_STRUCTURE_MASK);


which does not have any dependency on widget/window realization. (I
found myself in that very same pit some time ago).

The docs indicate that this may be set anyway:

"The ::configure-event signal will be emitted when the size, position or
stacking of the widget's window has changed. 
To receive this signal, the GdkWindow associated to the widget needs to
enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask
automatically for all new windows."

Once I moved the signal handler attachment upwards in the widget
hierarchy it sprang into life without any explicit setting of the
GdkWindow mask.

Richard




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