On Sat, 2003-12-06 at 18:41, bulia byak wrote:
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));
Well, grab_focus() isn't like a window "grabbing" focus; gtk_widget_grab_focus() is the normal mechanism for widgets handing focus off to one another.
_new() likely isn't the time to call it, because its effect is not persistent.
So it would need to be called e.g. when the canvas widget is clicked or moused over or something like that.
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.
Hmm. Thinking about it, I _believe_ (I will have to double-check) that events are actually passed to the event context by the enclosing EventBox (GtkDesktopWidget is a descendant of GtkEventBox).
-mental