ashishsony
ashishsony

Reputation: 2577

how to propagate gtk "configure-event" to custom gtkwidget

We have a specific scenarion in gtk based application, where there is a toplevel gtk window containing gtkwidgets which are actually webviews created by webkit.

Our use case is such that we need to fire a resize of the child widgets(webview) after hiding the toplevel gtkwindow because the application makes a transition from one scene to another. This ends up in a situation that the resize only happens when we show the toplevel window because the callback to resize the child widgets is registered with the size_allocate signal which only gets emmitted during the show call.

A workaround for this problem could be that we register the callback for the configure_event signal instead of the size_allocate because configure_event signal is emitted even if the window is in hidden state.(in case of size_allocate signal, the signal is scheduled to get emitted only on the next show call, so we have a graphics nuisance that the transition isnt seamless.) Now, the problem is that the configure_event is only emitted for the toplevel window and not for the child widgets.

We tested a simple gtk sample in which we created a toplevel window and a button. Following observations we can make out of it:

  1. if we do not register any callback for either the toplevel or the button, the button gets resized along with the toplevel.(gtk defaultly resizes all child widgets as per toplevel's resize)
  2. As soon as we register a configure_event callback for the toplevel window, and return true from it.. the child button stops resizing as the toplevel is resized.But when we return false from this callback, the button starts resizing along with the toplevel window.So there must be some event that gets propogated to the child button that does the auto resize of the button.

Now two questions:

  1. What is this event that gets propogated to the child widget which on returning false doesnt get to the widget?(we didnt get any callback for configure_event registered for the child button)

  2. As our case has a custom webview widget, it does not behave as the standard gtk button widget behaves for the configure_event.So the only way out is to know which event do we register for,register a callback for it and call a custom resize on the webview widget from that callback.

Upvotes: 1

Views: 1489

Answers (1)

drahnr
drahnr

Reputation: 6886

the return value of the callback matters. A TRUE has the meaning I handled this, do not propagte this event any further down the widget tree. A FALSE propagates the event further. It has nothing to do with any other event.

Upvotes: 0

Related Questions