From gtk-app-devel Mon Apr 02 19:32:35 2007 From: Mike Melanson Date: Mon, 02 Apr 2007 19:32:35 +0000 To: gtk-app-devel Subject: Re: Can A Drawable Canvas Receive Key Events? Message-Id: <46115A53.8030408 () multimedia ! cx> X-MARC-Message: https://marc.info/?l=gtk-app-devel&m=117554220922966 Mike Melanson wrote: > I found that when I put a big text widget inside the XEmbed'ed GtkPlug > container instead of a big drawable canvas, it was able to receive > focus. Digging into the GTK source code, I noticed that it calls > gtk_widget_grab_focus() when it receives a button press event. So I did > the same for my canvas widget when the user clicks in it, and it seems > to work. The widget retains focus until the user clicks outside of the > window. I missed a crucial step here. You also need to specify that the ordinarily non-focusable widget can receive focus by setting its "can-focus" property: GTK_WIDGET_SET_FLAGS (GTK_WIDGET(my_widget), GTK_CAN_FOCUS); -- -Mike Melanson _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list