typedef unsigned int BoardSize;
BoardSize boardSize;
Boolean chessProgram;
-int initialSquareSize;
int minX, minY; // [HGM] placement: volatile limits on upper-left corner
int smallLayout = 0, tinyLayout = 0,
// h += marginH + a.height + 1;
gtk_window_resize(GTK_WINDOW(shellWidget), w, 10);
DoEvents();
- gtk_widget_set_size_request(optList[W_BOARD].handle, 100, 100); // liberate board again
+ if(!appData.fixedSize) gtk_widget_set_size_request(optList[W_BOARD].handle, 100, 100); // liberate board again
}
int
}
if ((chessDir = (char *) getenv("CHESSDIR")) == NULL) {
- chessDir = ".";
+ static char dirName[MSG_SIZ];
+ getcwd(dirName, MSG_SIZ);
+ chessDir = dirName;
} else {
if (chdir(chessDir) != 0) {
fprintf(stderr, _("%s: can't cd to CHESSDIR: "), programName);
menuBarWidget = optList[W_MENU].handle;
dropMenu = optList[W_DROP].handle;
titleWidget = optList[optList[W_TITLE].type != Skip ? W_TITLE : W_SMALL].handle;
+ DelayedDrag(); // fake configure event (i3wm tiling window manager fails to send one after initial resize)
#ifdef TODO_GTK
formWidget = XtParent(boardWidget);
XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
{
GtkAllocation a;
int sqx, sqy, i, w, h, lg = lineGap;
- static int first = 1;
-// DisplayBothClocks();
- if(wp->width == wpMain.width && wp->height == wpMain.height && !first) return; // not sized
+ if(wp->width == wpMain.width && wp->height == wpMain.height) return; // not sized
gtk_widget_get_allocation(optList[W_DROP+1].handle, &a); // table that should contain everything
w = a.width; h = a.height;
gtk_widget_get_allocation(shellWidget, &a);
if(sqx == oldSqx + 1 && lg == lineGap + 1) sqx = oldSqx, squareSize = 0; // prevent oscillations, force resize by kludge
}
for(h=0; sizeDefaults[h+1].name && sizeDefaults[h].squareSize*8 > sqx*BOARD_WIDTH; h++) {}
- if(initialSquareSize != sizeDefaults[h].squareSize) { // boardSize changed
+ if(initialSquareSize != sizeDefaults[h].squareSize && !appData.fixedSize) { // boardSize changed
initialSquareSize = sizeDefaults[h].squareSize; // used for saving font
ChangeFont(1, &appData.clockFont, CLOCK_FONT, initialSquareSize, CLOCK_FONT_NAME, 2*(sizeDefaults[h].clockFontPxlSize+1)/3);
ChangeFont(1, &appData.font, MESSAGE_FONT, initialSquareSize, DEFAULT_FONT_NAME, sizeDefaults[h].coordFontPxlSize);
}
}
#endif
- if(sqx != squareSize && !first) {
+ if(sqx != squareSize && !appData.fixedSize) {
squareSize = sqx; // adopt new square size
CreatePNGPieces(appData.pieceDirectory); // make newly scaled pieces
InitDrawingSizes(0, 0); // creates grid etc.
h = BOARD_HEIGHT * (squareSize + lineGap) + lineGap;
if(optList[W_BOARD].max > w) optList[W_BOARD].max = w;
if(optList[W_BOARD].value > h) optList[W_BOARD].value = h;
- first = appData.fixedSize;
if(twoBoards && shellUp[DummyDlg]) {
SlavePopUp(); dualOptions[3].max = 0; DoEvents(); // calls SlaveResize, kludge to force assigning new canvas
partnerUp = !partnerUp; flipView = !flipView;
static int twoLines = -1;
GtkWidget *w = (GtkWidget *) opt->handle;
GdkColor col;
- char *markup, two = (appData.logoSize != 0);
+ char buf[MSG_SIZ], *p, *markup, two = (appData.logoSize != 0);
char bgcolor[10];
char fgcolor[10];
+ if(highlight > 1) { // kludge to force message printing
+ highlight &= 1;
+ snprintf(buf, MSG_SIZ, " %s", color);
+ } else if (appData.clockMode) {
+ snprintf(buf, MSG_SIZ, "%s:_%s", color, TimeString(timer));
+ } else {
+ snprintf(buf, MSG_SIZ, "%s ", color);
+ }
+
if (highlight) {
strcpy(bgcolor, "black");
strcpy(fgcolor, "white");
gdk_color_parse( bgcolor, &col );
gtk_widget_modify_bg(gtk_widget_get_parent(opt->handle), GTK_STATE_NORMAL, &col);
- if (appData.clockMode) {
- markup = g_markup_printf_escaped("<span font=\"%s\" background=\"%s\" foreground=\"%s\">%s:%s%s</span>", appData.clockFont,
- bgcolor, fgcolor, color, two ? "\n" : " ", TimeString(timer));
-// markup = g_markup_printf_escaped("<span size=\"xx-large\" weight=\"heavy\" background=\"%s\" foreground=\"%s\">%s:%s%s</span>",
-// bgcolor, fgcolor, color, appData.logoSize && !partnerUp ? "\n" : " ", TimeString(timer));
- } else {
- markup = g_markup_printf_escaped("<span font=\"%s\" background=\"%s\" foreground=\"%s\">%s </span>", appData.clockFont,
- bgcolor, fgcolor, color);
-// markup = g_markup_printf_escaped("<span size=\"xx-large\" weight=\"heavy\" background=\"%s\" foreground=\"%s\">%s </span>",
-// bgcolor, fgcolor, color);
- }
+ p = strchr(buf, '_'); if(p) *p = (two ? '\n' : ' ');
+ markup = g_markup_printf_escaped("<span font=\"%s\" background=\"%s\" foreground=\"%s\">%s</span>", appData.clockFont,
+ bgcolor, fgcolor, buf);
gtk_label_set_markup(GTK_LABEL(w), markup);
g_free(markup);
channel = g_io_channel_unix_new(is->fd);
g_io_channel_set_close_on_unref (channel, TRUE);
- is->sid = g_io_add_watch(channel, G_IO_IN,(GIOFunc) DoInputCallback, is);
+ is->sid = g_io_add_watch(channel, G_IO_IN|G_IO_HUP,(GIOFunc) DoInputCallback, is);
is->closure = closure;
return (InputSourceRef) is;