gtk_widget_grab_focus sets scrollbar adjustments to 0



Hi

I have a drawingarea inside a scrolled window for which I'd like to grab
the focus so the user can use keyboard inputs but I want to do it
without changing the scrolled window position. What I'm finding is the
gtk_widget_grab_focus call on the drawable results in the scrolled
window adjustments being set to zero.

This is the traceback:

#4  0x000000386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0
#5  0x00007ffff757686a in gtk_adjustment_value_changed ()
    at /lib64/libgtk-3.so.0
#6  0x00007ffff75d22c8 in gtk_container_real_set_focus_child ()
    at /lib64/libgtk-3.so.0
#7  0x000000386a01301b in g_cclosure_marshal_VOID__OBJECTv ()
    at /lib64/libgobject-2.0.so.0
#8  0x000000386a00ff64 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0
#9  0x000000386a029b60 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#10 0x000000386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0
#11 0x00007ffff77b2138 in gtk_widget_real_grab_focus () at /lib64/libgtk-3.so.0
#12 0x000000386a00ff64 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0
#13 0x000000386a029b60 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#14 0x000000386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0
#15 0x00007ffff77b09da in gtk_widget_grab_focus () at /lib64/libgtk-3.so.0

I can see the code in gtk_container_real_set_focus_child calling
gtk_adjustment_clamp_page but don't understand why and I don't see any
way to stop it from doing it.

My workaround for the moment is to get the adjustment values before the
grab and set them again after but this is seems a bit of a hack.

Cheers,



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