|
From: <tim...@en...> - 2007-03-30 17:41:23
|
Dear Mojca, Joe, and all gnuplot enthusiasts, Here are some news about the availability of the wxt terminal for the MacOS platform. I have had the chance to get my hands on my MacBook and I have worked a little bit on the issues you got when trying to use the wxt terminal. To sum up where we were last time we talked about it: - building seems to be ok. The most painful part is to build recent enough (i.e. using Fink) glib, cairo, pango & wxWidgets. Fortunately, this is almost to be done the Unix way, 'configure; make; make install'. The exceptions are to disable features for cairo so that it doesn't ask for Freetype or fontconfig (useless here). - executing gnuplot and trying to use wxt, you successfully get plot windows, but those seem to be "dead". The mouse changes to a colorful pinwheel, the buttons on the top (close, minimize, maximize) are grayed out, and you cannot grab the window to move it. - from my researches, "bundling" is necessary, but it didn't seem to change anything when done on gnuplot. So, I've investigated regarding this problem: - bundling is indeed necessary. I wrote a sample wxWidgets app, and tried to launch it without bundling it. It doesn't get the focus. BUT the mouse cursor stays the same, and the buttons on the top bar do work. So it's not really the root of the problem with the wxt terminal. - I tried on the sample app what is the second most important aspect of the wxt implementation: putting the event loop in a separate thread. And bingo ! I get the same problem as with wxt... Although the separate thread and its event loop are running, the latter does not process the window events. It turns out that this is a limitation of Cocoa app (MacOS programming toolkit): "The main thread of the application is responsible for handling events. The main thread is the one blocked in the run method of NSApplication, usually invoked in an applications main function. " (http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/articles/CocoaSafety.html) I've searched for this "run" method in the wxWidgets code, but could not find it. MacOS development involves a mixture of layers called Foundation, Cocoa and Carbon (like GLib, Cairo, GTK and friends) and I'm afraid this 'run' method is in fact hidden somewhere else. Anyway, I tried to do as much initialization as I could in the separate thread, but it didn't work either. So there is one remaining thing to try, but this will involve more work on my part: changing the way wxt works on Unix and Mac and arrange it so that the main thread runs the event loop while the usual gnuplot command-line loop runs in the separate thread. The challenge is to do that only when wxt_init() is called, not before (doing it at startup time is easy, but I don't feel like it would be the right way). (note that on Windows we don't have this problem because the fake terminal already has the event loop and runs gnuplot command loop inside it) (as far as aquaterm is concerned, it has another design again, something like the X11 terminal: the GUI is in a different program with its own loop and talking with gnuplot through some interprocess communication mechanism) If some of you feel some inspiration regarding this issue, I would appreciate to listen to them ! Best regards, Timothée Lecomte |