Obviously if 4.8.n exists, 4.8.n-1 must be buggy and any 4.7.x must be obsolete. We don't step up the numbers just because we like counting...sje wrote:The xboard in use is the one distributed by MacPorts which is version 4.7.3. This is only slightly behind version 4.8.0-2 which is distributed by Debian. Both are built for X11. Are these obsolete? If so, then someone should report this to MacPorts and Debian.
The important difference between 4.7 and 4.8 is that in 4.8 we declared the GTK build to be stable and the preferred build. We did report that to Debian, and I though that they do supply the GTK build now as binary package, (and that this in fact is the reason for the '-2' suffix). Don't know about MAcPorts, don't even know what it is...
The source tar ball contains sources of both WinBoard and XBoard. I guess the Linux people don't like that, and consider all the stuff only needed for building XBoard as a bug.BTW, there is a slight problem with the Debian xboard package: https://lintian.debian.org/tags/source- ... -file.html
This is a bit weird, as this version should only differ in the use of the front-end, which is used in all modes, not only in ICS mode. If there are any problems, they should be minor, and easy to solve.The Gtkosx xboard has problems, particularly for Mac users who are trying to connect an engine to an ICS. These problems are unlikely to be resolved until there is sufficient testing by an xboard maintainer and documenter who has a Mac and who is trying to connect an engine to an ICS. In the interim, end users would save much time if the suggested addendum were added to the xboard documentation.
If any time is to be spent of XBoard for Mac, I prefer to spend it on fixing those problems, rather than creating documentation for obsolete versions, which is a step backwards, and probably more work...
So far I am only aware of two problems: spurious invocations, and unfavorale choice of accelerator keystrokes that clash with standard editing keystrokes. As to the invocations, the existing logic might indeed be in error, although I don't see yet how this could lead to multiple invocations:
Code: Select all
#ifdef OSXAPP
static char clickedFile[MSG_SIZ];
static int suppress;
static gboolean
StartNewXBoard(GtkosxApplication *app, gchar *path, gpointer user_data)
{ // handler of OSX OpenFile signal, which sends us the filename of clicked file or first argument
if(suppress) { // we just started XBoard without arguments
strncpy(clickedFile, path, MSG_SIZ); // remember file name, but otherwise ignore
} else { // we are running something presumably useful
char buf[MSG_SIZ];
snprintf(buf, MSG_SIZ, "open -n -a "xboard" --args "%s"", path);
system(buf); // start new instance on this file
}
return TRUE;
}
GtkosxApplication *theApp;
#endif
int
main (int argc, char **argv)
{
int i, clockFontPxlSize, coordFontPxlSize, fontPxlSize;
int boardWidth, w, h; //, boardHeight;
char *p;
int forceMono = False;
srandom(time(0)); // [HGM] book: make random truly random
setbuf(stdout, NULL);
setbuf(stderr, NULL);
debugFP = stderr;
if(argc > 1 && (!strcmp(argv[1], "-v" ) || !strcmp(argv[1], "--version" ))) {
printf("%s version %s\n\n configure options: %s\n", PACKAGE_NAME, PACKAGE_VERSION, CONFIGURE_OPTIONS);
exit(0);
}
if(argc > 1 && !strcmp(argv[1], "--help" )) {
PrintOptions();
exit(0);
}
/* set up GTK */
gtk_init (&argc, &argv);
#ifdef OSXAPP
{ // prepare to catch OX OpenFile signal, which will tell us the clicked file
char *path = gtkosx_application_get_bundle_path();
#ifdef ENABLE_NLS
char *res_path = gtkosx_application_get_resource_path();
snprintf(localeDir, MSG_SIZ, "%s/share/locale", res_path); // redefine locale dir for OSX bundle
#endif
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
snprintf(masterSettings, MSG_SIZ, "%s/Contents/Resources/etc/xboard.conf", path);
snprintf(dataDir, MSG_SIZ, "%s/Contents/Resources/share/xboard", path);
snprintf(svgDir, MSG_SIZ, "%s/themes/default", dataDir);
suppress = (argc == 1 || argc > 1 && argv[1][00] != '-'); // OSX sends signal even if name was already argv[1]!
g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL);
g_signal_connect(theApp, "NSApplicationWillTerminate", G_CALLBACK(ExitEvent), NULL);
// we must call application ready before we can get the signal,
// and supply a (dummy) menu bar before that, to avoid problems with dual apples in it
gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(gtk_menu_bar_new()));
gtkosx_application_ready(theApp);
if(argc == 1) { // called without args: OSX open-file signal might follow
static char *fakeArgv[3] = {NULL, clickedFile, NULL};
usleep(10000); // wait 10 msec (and hope this is long enough).
while(gtk_events_pending())
gtk_main_iteration(); // process all events that came in upto now
suppress = 0; // future open-file signals should start new instance
if(clickedFile[0]) { // we were sent an open-file signal with filename!
fakeArgv[0] = argv[0];
argc = 2; argv = fakeArgv; // fake that we were called as "xboard filename"
}
}
}
#endif
At startup XBoard waits some msec, and then starts checking whether an OpenFile signal has arrived, if it expects one. It only does this when 'suppress' was set, so that when the signal did arrive, the command line accompanying it will have been saved, and can be used to repair its own argv. After that, suppress is reset, so that future OpenFile signals will force forking off a new instance with those arguments.
There are two scenarios that could lead to spurious instances: either OS X sends an OpenFile signal when XBoard did not expect it, because it already was invoked with a non-empty command line. Or it could be that it was invoked without command line, and the command line was sent after it timed out waiting for it. The originally started instance would then remain without arguments, and the arguments intended for it would go to a newly forked-off instance.
We should be able to figure out which is the case by putting in some printf statements to a log file. If the OpenFile signal comes late, we just should wait longer for it during startup. But you cannot wait forever if you are not sure that it is going to come. The problem is that the user could have invoked XBoard without arguments, so that absense of arguments is no sure indication that OS X will send the true command line with an OpenFile signal.