I figured it all out, and wrote it up in an article here:
http://www.rutski89.com/dynamic/journal.html?name=gtkwidget

Sleepiness was already hitting hard while banging away at the
keyboard, so please do let me know if you see any mistakes.

-Patrick


On Fri, Aug 21, 2009 at 3:58 AM, Patrick M. Rutkowski<rutsk...@gmail.com> wrote:
> Actually, I just figured it out a few moments ago. Adding the
> following to realize() beings to fix things:
>
> GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
>
> I start to get keyboard events and such.
>
> However, there's another problem now! Even with GTK_CAN_FOCUS, I still
> don't get GDK_MOTION_NOTIFY events, or even mouse button press events.
>
> Here's another test case to instated illustrate that problem. This
> time, "IT WORKS!" only prints if the event is somehow mouse related:
>
> http://www.rutski89.com/static/mouse_test.c
>
> See if you can get that one to print, I can't
> -Patrick
>
>
> On Fri, Aug 21, 2009 at 3:34 AM, Brian J. Tarricone<bj...@cornell.edu> wrote:
>> On 08/20/2009 10:27 PM, Patrick M. Rutkowski wrote:
>>> I've written a test case that anybody can compile and run:
>>> http://www.rutski89.com/static/event_test.c
>>>
>>> It contains the following line of code in the any_event() function:
>>> printf("IT WORKS!\n");
>>>
>>> That currently does not get printed.
>>>
>>> If you can get the test case to print that line of text, you will have
>>> solved my problem.
>>
>> I can, but probably not in the way you want.  I think one of two things
>> is going on:
>>
>> 1.  GtkWidget just doesn't handle events and subclassing it will take
>> more work than just subclassing realize() to get it to receive events.
>>
>> 2.  You're missing something in your realize() method, though I'm not
>> sure what.
>>
>> If I make your Foo class into a subclass of GtkEventBox instead of
>> GtkWidget, and then remove your realize() implementation (so it uses
>> GtkEventBox's impl), then it prints "IT WORKS!" as you'd expect.
>> Perhaps perusing gtkeventbox.c might help you figure out what else is
>> needed if you really want to just subclass GtkWidget.
>>
>>        -brian
>> _______________________________________________
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to