Grabbing focus between widgets is accomplished via gtk_widget_grab_focus(). The widget will need to have the
GTK_CAN_FOCUS
flag set, however. (we should probably do this for the canvas)
OK, I'll investigate the grabs mechanism. Maybe if the fix is simple it
will
go into this version.
I've taken care of the latter half in desktop.c now (setting the CAN_FOCUS widget flag).
I guess what remains is just determining when it would be appropriate to call gtk_widget_grab_focus() on the canvas widget.
I cannot make it work. I added
gtk_widget_grab_focus (&(dtw->canvas->widget));
into sp_desktop_widget_new in desktop.c. For debugging, I also added
gtk_signal_connect (GTK_OBJECT (&(dtw->canvas->widget)), "event", GTK_SIGNAL_FUNC (sp_canvas_event_handler), &(dtw->canvas->widget));
and put some debug output into sp_canvas_event_handler. With or without the grab, it looks like the canvas widget gets keypresses, but does not pass them on to the event context. That is, it does pass it to the event context but only when the mouse is within the canvas.
Maybe we need to grab focus on the event context, not on the canvas? But how to do that? I think the event context is not a GTK widget.
_________________________________________________________________ Shop online for kids� toys by age group, price range, and toy category at MSN Shopping. No waiting for a clerk to help you! http://shopping.msn.com