From: H.G. Muller Date: Mon, 10 Mar 2014 20:15:30 +0000 (+0100) Subject: Fix width of menu bar X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=336aafa3deed7607b7e4e3f40852fa42bee8104f Fix width of menu bar The truncated name might not have been terminated with '\0'. TinyLayout now specifies the number of characters kept in the menu names. In the OS X version truncating is never needed, as the menu bar is at the top of the screen, independent of board size. --- diff --git a/gtk/xboard.h b/gtk/xboard.h index 89dcaf7..400f75c 100644 --- a/gtk/xboard.h +++ b/gtk/xboard.h @@ -92,10 +92,10 @@ typedef struct { { "Moderate", 58, 3, 34, 12, 14, 1, 0, 768 }, \ { "Average", 54, 2, 30, 11, 12, 1, 0, 600 }, \ { "Middling", 49, 2, 24, 10, 12, 1, 0, 600 }, \ - { "Mediocre", 45, 2, 20, 10, 12, 1, 1, 600 }, \ - { "Small", 40, 2, 20, 10, 12, 1, 1, 480 }, \ - { "Slim", 37, 2, 20, 10, 12, 1, 1, 480 }, \ - { "Petite", 33, 1, 15, 9, 11, 1, 1, 480 }, \ + { "Mediocre", 45, 2, 20, 10, 12, 1, 4, 600 }, \ + { "Small", 40, 2, 20, 10, 12, 1, 3, 480 }, \ + { "Slim", 37, 2, 20, 10, 12, 1, 3, 480 }, \ + { "Petite", 33, 1, 15, 9, 11, 1, 2, 480 }, \ { "Dinky", 29, 1, 15, 9, 11, 1, 1, 480 }, \ { "Teeny", 25, 1, 12, 8, 11, 1, 1, 480 }, \ { "Tiny", 21, 1, 12, 8, 11, 1, 1, 0 }, \ diff --git a/gtk/xoptions.c b/gtk/xoptions.c index c089c9e..6c77841 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -1549,7 +1549,9 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width); case DropDown: top--; msg = _(option[i].name); // write name on the menu button - if(tinyLayout) { strncpy(def, msg, 1); msg = def; } +#ifndef __APPLE__ + if(tinyLayout) { strcpy(def, msg); def[tinyLayout] = NULLCHAR; msg = def; } // clip menu text to keep menu bar small +#endif // XtSetArg(args[j], XtNmenuName, XtNewString(option[i].name)); j++; // XtSetArg(args[j], XtNlabel, msg); j++; option[i].handle = (void*)