Re: [directfb-users] Problems in GdkWindow Events with Gtk - DirectFb backend



Hi Mike,

Below is the code snippet which i am trying.
In this code i am not getting events on child GdkWindow.


#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <directfb.h>

GdkFilterReturn child_handle_event( void *event1, GdkEvent *event2,
gpointer userdata )
{
	printf("child_handle_event\n");
	DFBWindowEvent *event = (DFBWindowEvent*)event1;
	printf(" event->type %x \n",event->type);

	switch (event->type)
		{
		case DWET_GOTFOCUS:
		printf("DWET_GOTFOCUS\n");
		break;

		case DWET_BUTTONDOWN:
		printf("DWET_BUTTONDOWN\n");
		break;

		case DWET_BUTTONUP:
		printf("DWET_BUTTONUP\n");
		break;

		case DWET_ENTER:
		printf("DWET_ENTER\n");
		break;

		case DWET_LEAVE:
		printf("DWET_LEAVE\n");
		break;

		case DWET_MOTION:
		printf("DWET_MOTION\n");
		break;

		case DWET_KEYDOWN:
		printf("DWET_KEYDOWN\n");
		break;

		case DWET_KEYUP:
		printf("DWET_KEYUP\n");
		break;

		default:
		printf("default event %x \n", event->type);
		break;

		}

	return GDK_FILTER_REMOVE;
}

int main(int argc, char* argv[])
{

	GdkWindow *parent, *child;
	GdkWindowAttr attr;

	gtk_init(&argc, &argv);

	attr.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK |
	GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK |
	GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |GDK_KEY_RELEASE_MASK|
GDK_ENTER_NOTIFY_MASK| GDK_LEAVE_NOTIFY_MASK;

	attr.x = 100;
	attr.y = 100;
	attr.width = 800;
	attr.height = 600;
	attr.window_type = GDK_WINDOW_TOPLEVEL;
	attr.wclass = GDK_INPUT_OUTPUT;
	parent = gdk_window_new (NULL, &attr, GDK_WA_X | GDK_WA_Y);
//	gdk_window_add_filter (parent, child_handle_event, NULL);

	attr.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK |
	GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK |
	GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |GDK_KEY_RELEASE_MASK|
GDK_ENTER_NOTIFY_MASK| GDK_LEAVE_NOTIFY_MASK;

	attr.x = 200;
	attr.y = 200;
	attr.width = 400;
	attr.height = 300;
	attr.window_type = GDK_WINDOW_CHILD;
	attr.wclass = GDK_INPUT_OUTPUT;

	child = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y);

	gdk_window_add_filter (child, child_handle_event, NULL);
	gdk_window_show (child);
	gdk_window_show (parent);
	gtk_main();	
	return 0;
}


Thanks,
Sreenivas


On Dec 4, 2007 11:18 PM, Mike Emmel <mike emmel gmail com> wrote:
> Child windows are virtual DirectFB right now only supports top level
> windows as real DFB windows.
>
> Can you send the code snippet your using to create the child.
> I'd check to see if the window actually got focus. This looks like a
> focus problem to me.
>
>
>
> On Dec 4, 2007 6:23 AM, Sreenivas Chowdary <sreenivas pachva gmail com> wrote:
> > Hi Denis,
> >
> > Thank you for the patch which u sent.
> > With this patch i can able to get events on GdkWindow which was
> > created as GDK_WINDOW_TOPLEVEL.
> > If i create a GdkWindow with GDK_WINDOW_CHILD then events are not coming.
> > Do you have any idea about this?
> >
> > Thanks & Regards
> > Sreenivas
> >
> > On Dec 3, 2007 11:18 PM, Denis Oliver Kropp <dok directfb org> wrote:
> > > Sreenivas Chowdary wrote:
> > > > Yeah Even i am getting events on GtkWidget in half way like
> > > > expose-event, keypress-event and key-release event and remaining
> > > > events like button-press-event , button-release-event etc.. or not
> > > > getting.
> > >
> > > Either it has always been broken or something changed in Gdk or it broke in GdkDirectFB.
> > >
> > > I just looked into the Gdk Backends and saw that the filters are not applied at all
> > > in the DirectFB Backend.
> > >
> > > Please try the attached patch.
> > >
> > > --
> > > Best regards,
> > >   Denis Oliver Kropp
> > >
> > > .------------------------------------------.
> > > | DirectFB - Hardware accelerated graphics |
> > > | http://www.directfb.org/                 |
> > > "------------------------------------------"
> > >
> > _______________________________________________
> > gtk-devel-list mailing list
> > gtk-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> >
>


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