Hi, and greetings to the developer force, beatifull work. The following is about compiling GTK targeting win32 binaries, but insiting in the use of a X11 backend.
> To fully explain my problem I guess a bit of background is necessary: > There is a product which compiles for a variety of platforms including but > not limited to linux, solaris, freebsd, windows. I have been working on > some user interface issues using gtk+. In general the aim of the exercise > is to generate an application that is an X client. Under the *NIX systems > this was no problem since the default binding of gtk+ is X11. The problem > arose when trying to port the software on Windows, where the default > binding is win32. Does anyone has experience with compiling gtk with x > support (I suppose Xlib will be necessary) on Windows? Solutions with both > MinGW and Cygwin are possible although the former is preferred. I've spent several weeks in this task and I have achieved results, I obtained a working version of gtk-demo that seems ok with a xming win32 X server. Its a very time consuming task at least to figure out how from scratch. I compiled the X11 libraries under MSYS, and cross compiled gtk+, pango and cairo in an ubuntu box. I needed to apply some hacks to the X11 source and also to gtk's. I have an sketchy draft in Spanish of the changes and procedure, but lack the time to try to push this changes in the due way (I am a auto*, CVS, bugzilla et al illiterate) If there's interest in the little changes done to get gtk-demo running I will discuss them here. I just discuss one of the changes. In gdk/x11/ In _gdk_events_init() one sees: > int connection_number = ConnectionNumber (display_x11->xdisplay); > GDK_NOTE (MISC, g_message ("connection number: %d", connection_number)); > > > source = display_x11->event_source = gdk_display_source_new (display); > display_source = (GdkDisplaySource*) source; g_source_set_priority > (source, GDK_PRIORITY_EVENTS); > > display_source->event_poll_fd.fd = connection_number; > display_source->event_poll_fd.events = G_IO_IN; basically here connection_number is the file descriptor of the socket of communication between X11 client and server. Now analyzing the gtk event loop you know, we enter in GLib realm and have the call tree: gtk-main g_main_loop_run g_main_context_iterate g_main_context_poll g_poll and in g_poll is where the external events of the app are waited, in a WaitForMultipleObjects call that accepts win32 HANDLEs instead of file descriptors of the runtime C library msvcrt. So my solution was to change: > display_source->event_poll_fd.fd = connection_number; by > display_event = CreateEventA(NULL, 0, 0, "DisplayEvent"); > WSAEventSelect(connection_number, display_event, FD_READ); > display_source->event_poll_fd.fd = display_event; Anyhow not all is like in heaven and I would thank a lot some help with the following problem. The symptoms are seen in a sample gtksocket & plug app: socket: int main(int argc, char **argv) { GtkWidget *window, *socket; gtk_init(&argc, &argv); window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ); socket = gtk_socket_new (); gtk_widget_show (socket); gtk_container_add (GTK_CONTAINER (window), socket); gtk_widget_realize (socket); g_print ("The ID of the sockets window is %d\n", gtk_socket_get_id ((GtkSocket *)socket)); gtk_widget_show_all ( window ); gtk_main(); return 0; } plug: int main(int argc, char **argv) { GtkWidget *plug; GtkWidget *entry; gtk_init(&argc, &argv); plug = gtk_plug_new(atoi(argv[1])); entry = gtk_entry_new(); gtk_container_add ( GTK_CONTAINER ( plug ), entry ); gtk_widget_show ( plug ); gtk_widget_show ( entry ); gtk_main(); } The app works well in linux and in windows with libgtk-win32.dll But when compiled against libgtk-x11.dll, while gtk-demo has a nice text input boxes, this app has time delays and unresponsivenes. I've put an 'x' to print after any event in g_poll, and I note that the mouse events, and the key-up and down events of shift, ctrl, and alt keys work ok both in plug and socket processes, but the other keypresses don't break the wait, and are queued and only processed until some timeout or mouse action. Thank you for your time.- Jesús López _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list