Making object/widget out of a GdkWindow
- From: Jonas Aaberg <cja gmx de>
- To: gtk-app-devel-list gnome org
- Subject: Making object/widget out of a GdkWindow
- Date: Thu, 3 Apr 2003 10:40:53 +0200
Hi,
I'm trying to write a pager(for enlightenment) in gtk+.
I want to register events such as GDK_STRUCTURE_MASK,
GDK_PROPERTY_CHANGE_MASK and GDK_SUBSTRUCTURE_MASK that happends
in the root window and its children.
I managed to do that using only GDK functions, (See code at the
end of the mail.) but I would like to be able to use functions
like:
g_signal_connect(G_OBJECT(root_win), "substructure_event",
G_CALLBACK(substructure_event_func),NULL);
And the ofcourse use gtk_main(), instead of having a loop with
gdk_events_pending() as in the attached code.
So my question, how do I create an object/widget out of a
GdkWindow that I can connect signals to?
Please CC me, because I'm not on the mailing list.
Thanks!
Jonas
--
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
int main(int argc, char **argv)
{
GdkWindow *root_win;
GdkEvent *event;
gtk_init(&argc, &argv);
root_win =
gdk_window_foreign_new((GdkNativeWindow)gdk_x11_get_default_root_xwindow());
gdk_window_set_events(root_win,
GDK_EXPOSURE_MASK|GDK_STRUCTURE_MASK|GDK_PROPERTY_CHANGE_MASK|
GDK_SUBSTRUCTURE_MASK);
while(1){
while(gdk_events_pending()){
event = gdk_event_get();
if(event){
switch(event->type){
case GDK_PROPERTY_NOTIFY:
printf("property\n");
break;
case GDK_MAP:
printf("map\n");
break;
case GDK_UNMAP:
printf("unmap\n");
break;
case GDK_NOTHING:
break;
default:
printf("unknown! (%d)\n", event->type);
break;
}
}
}
}
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]