OSX Xboard 4.7.2 .app

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

I should point out that it worked before, using the GTK menu and my guess would be that it's a gtkmacintegration thing, somehow that part isn't being synced.

But I'll give it a try later to rule out the other possibility.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Sorry I haven't gotten around to take a look at this, I haven't touched xboard in about a week.
hgm wrote: What happens when you close such a window by clicking the window-close button rather than the menu item?

Unfortunately it has no effect on the tick. If the tick was already up, closing the window with the close buton will leave the tick up.
The new ICS/Chat Console can be popped up without clicking a menu item, by just starting to type to the board, in ICS mode.
Same thing, it has no bearing on the tick.

I think my assumption is right, that it's a gtkmacintegration thing. and that part is not being relayed to the menu.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

I gave the latest code a try, but hit an error with the new font stuff. Odd as it worked in linux

Code: Select all

  CC       gtk/xboard.o
gtk/xboard.c: In function 'InitializeFonts':
gtk/xboard.c:627:5: warning: implicit declaration of function 'InsertPxlSize' [-Wimplicit-function-declaration]
     appData.font = InsertPxlSize(appData.font, fontPxlSize);
     ^
gtk/xboard.c:627:18: warning: assignment makes pointer from integer without a cast [enabled by default]
     appData.font = InsertPxlSize(appData.font, fontPxlSize);
                  ^
gtk/xboard.c:628:23: warning: assignment makes pointer from integer without a cast [enabled by default]
     appData.clockFont = InsertPxlSize(appData.clockFont, clockFontPxlSize);
                       ^
gtk/xboard.c:629:23: warning: assignment makes pointer from integer without a cast [enabled by default]
     appData.coordFont = InsertPxlSize(appData.coordFont, coordFontPxlSize);
                       ^
gtk/xboard.c: At top level:
gtk/xboard.c:1231:1: error: conflicting types for 'InsertPxlSize'
 InsertPxlSize (char *pattern, int targetPxlSize)
 ^
gtk/xboard.c:627:20: note: previous implicit declaration of 'InsertPxlSize' was here
     appData.font = InsertPxlSize(appData.font, fontPxlSize);
                    ^
gtk/xboard.c: In function 'FindFont':
gtk/xboard.c:1342:36: warning: unused variable 'pxlSize' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
                                    ^
gtk/xboard.c:1342:31: warning: unused variable 'err' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
                               ^
gtk/xboard.c:1342:23: warning: unused variable 'minerr' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
                       ^
gtk/xboard.c:1342:15: warning: unused variable 'nfonts' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
               ^
gtk/xboard.c:1342:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
            ^
gtk/xboard.c:1342:9: warning: unused variable 'i' [-Wunused-variable]
     int i, j, nfonts, minerr, err, pxlSize;
         ^
gtk/xboard.c:1341:42: warning: unused variable 'scalableTail' [-Wunused-variable]
     char **fonts, *p, *best, *scalable, *scalableTail;
                                          ^
gtk/xboard.c:1341:31: warning: unused variable 'scalable' [-Wunused-variable]
     char **fonts, *p, *best, *scalable, *scalableTail;
                               ^
gtk/xboard.c:1341:24: warning: unused variable 'best' [-Wunused-variable]
     char **fonts, *p, *best, *scalable, *scalableTail;
                        ^
gtk/xboard.c:1341:12: warning: unused variable 'fonts' [-Wunused-variable]
     char **fonts, *p, *best, *scalable, *scalableTail;
            ^
I should make a text file list for you to keep track of all these issues. Or maybe just for my own sake. :lol:

I wish I could help more.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Ok thanks, now it compiles! :) Only now board resizing doesn't seem to work, it's stuck on the board size in the user conf
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

It wasn't so ich that it worked in Linux, but that it only worked with ENABLE_NLS on. The 'missing' declaration that caused the error in your case was within #ifdef ENABLE_NLS.

What do you mean by "sizing does not work"? When you start with -size 49 or -size 72, doesn't that make any difference?

xboard -size 33

now gives me this:

Image

I.e. the width of the window is now determined by the board width, because the menu names are shrunk to one letter. Before there was a large amount of white space next to the board, because the menu bar determined the width. The clock font is automatically made small enough to fit the time into the clock widgets.

The text in the message widget and the button bar still should be adapted; I have only implemented the -clockFont option. (The clocks had a non-standard font size anyway, and I only had to change that. But for message and buttons I should design a new mechanism, to distinguish them from ordinary labels and buttons in the dialogs. We don't want buttons in other dialogs to get small text on the buttons just because the board size is small. (At least, I supposethat... Of course this is exactly what the Xaw version does; there the fonts used in the dialogs and even the menus is controlled by the -messageFont option. But this was designed at a time when there hardly were any dialogs.)
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

ah that makes sense, never could get configure to enable nls on osx, doesn't really like macports for some reason even if I explicitly request it with --enable-nls. I could force it in the conf.h which seems to work just fine. Any reason I should?

I mean resizing via dragging the corner, the window moves around but then snaps back to the size xboard was launched with. not sure what is going on there. Probably has something to do with they way window drag/resizing before could never shrink horizontally below the size xboard is launched with. (not sure what you can do about that, but it is a little cumbersome)

Anyway resizing with the terminal I can see what I feared. Xboard will crash if too small. The new system will interfear with the OSX menubar. If we can avoid that code on the mac, it would be fine as the menubar is separate from the window anyway.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

forgot to post what that crash when launching too small looks like

Code: Select all

/Applications/Xboard/XBoard.app/Contents/MacOS/XBoard-bin -size 32
2014-03-10 09:05:28.122 XBoard-bin[13870:507] *** Assertion failure in -[_GNSMenuItem initWithTitle:action:keyEquivalent:], /SourceCache/AppKit/AppKit-1265.19/Menus.subproj/NSMenuItem.m:321
2014-03-10 09:05:28.123 XBoard-bin[13870:507] An uncaught exception was raised
2014-03-10 09:05:28.124 XBoard-bin[13870:507] Invalid parameter not satisfying: aString != nil
2014-03-10 09:05:28.124 XBoard-bin[13870:507] (
	0   CoreFoundation                      0x00007fff84cb525c __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x00007fff8808ae75 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff84cb5038 +[NSException raise:format:arguments:] + 104
	3   Foundation                          0x00007fff87a19d41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
	4   AppKit                              0x00007fff8658936f -[NSMenuItem initWithTitle:action:keyEquivalent:] + 140
	5   libgtkmacintegration.2.dylib        0x00000001003383ea -[_GNSMenuItem initWithTitle:aGClosure:andPointer:] + 64
	6   libgtkmacintegration.2.dylib        0x0000000100338b1b cocoa_menu_item_add_item + 578
	7   libgtkmacintegration.2.dylib        0x000000010033909c cocoa_menu_item_add_submenu + 806
	8   libgtkmacintegration.2.dylib        0x000000010033a978 gtkosx_application_set_menu_bar + 1737
	9   XBoard-bin                          0x000000010008c8c2 GenericPopUp + 10573
	10  XBoard-bin                          0x0000000100074aa9 BoardPopUp + 680
	11  XBoard-bin                          0x0000000100084ce3 main + 3802
	12  XBoard-bin                          0x0000000100006b4c start + 52
)
2014-03-10 09:05:28.125 XBoard-bin[13870:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff84cb525c __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x00007fff8808ae75 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff84cb5038 +[NSException raise:format:arguments:] + 104
	3   Foundation                          0x00007fff87a19d41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
	4   AppKit                              0x00007fff8658936f -[NSMenuItem initWithTitle:action:keyEquivalent:] + 140
	5   libgtkmacintegration.2.dylib        0x00000001003383ea -[_GNSMenuItem initWithTitle:aGClosure:andPointer:] + 64
	6   libgtkmacintegration.2.dylib        0x0000000100338b1b cocoa_menu_item_add_item + 578
	7   libgtkmacintegration.2.dylib        0x000000010033909c cocoa_menu_item_add_submenu + 806
	8   libgtkmacintegration.2.dylib        0x000000010033a978 gtkosx_application_set_menu_bar + 1737
	9   XBoard-bin                          0x000000010008c8c2 GenericPopUp + 10573
	10  XBoard-bin                          0x0000000100074aa9 BoardPopUp + 680
	11  XBoard-bin                          0x0000000100084ce3 main + 3802
	12  XBoard-bin                          0x0000000100006b4c start + 52
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

JoshPettus wrote:ah that makes sense, never could get configure to enable nls on osx, doesn't really like macports for some reason even if I explicitly request it with --enable-nls. I could force it in the conf.h which seems to work just fine. Any reason I should?
Without it only English would work, and none of the translations.
I mean resizing via dragging the corner, the window moves around but then snaps back to the size xboard was launched with. not sure what is going on there. Probably has something to do with they way window drag/resizing before could never shrink horizontally below the size xboard is launched with. (not sure what you can do about that, but it is a little cumbersome)
I seem to have broken that with one of my recent patches. The complaint was that when you switched to a variant with a different board format, the board could become too large for the screen. So I fixed it such that the board width is conserved in such a case, by rescaling the square size. But it seems this is now also triggered when rescaling after user sizing.
Anyway resizing with the terminal I can see what I feared. Xboard will crash if too small. The new system will interfear with the OSX menubar. If we can avoid that code on the mac, it would be fine as the menubar is separate from the window anyway.
Well, this should be easily fixed. There is no reason to alter the menu texts in OS X for small windows, so I will just put an #ifndef _APPLE around the new code that clips the text. I am not very happy with that patch yet anyway: to prevent the width from being dominated by the menu bar, I have to start clipping the texts already at pretty large square size (like 45), and then it clips it way more than needed. I guess it would be better to do more gradual clipping, where each square size leaves a different number of characters in the texts.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Ah ok,

I'm really not sure what to do as far as translations concerned. I'm assuming Xboard configures itself as the language of the host system at compile (If configure --enable-nls worked for me that is) I wouldn't know how to force it to compile a German version for instance. (Come to think of it, I notice in your screenshots you never seem to compile it in Dutch :). Do you do that for the benefit of international audiences?) I suppose I can't really make an xboard.app for every language, so I won't bother unless someone requests it. :(
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

It is not a compile-time thing. When compiled with NLS it will automatically select the language of the host system at startup, wherever you bring the binary. When you want to use another language with that same binary, you can set the LANG environment variable. Like

LANG=de_DE.utf8 xboard

would activate German, etc.