From: H.G. Muller Date: Sun, 21 Oct 2012 21:04:49 +0000 (+0200) Subject: Add task-bar icon X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=92726464971bdf08bd865bb331ac6ad295c9ce03;p=xboard.git Add task-bar icon Funny enough it was necessary to swap the two svg icons to make this work! --- diff --git a/svg/icon_black.svg b/svg/icon_black.svg index b969e5e..0656cd8 100644 --- a/svg/icon_black.svg +++ b/svg/icon_black.svg @@ -34,8 +34,8 @@ id="rect2827" style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + id="BlackKnight" + style="stroke-width:1px" /> diff --git a/svg/icon_white.svg b/svg/icon_white.svg index 0656cd8..b969e5e 100644 --- a/svg/icon_white.svg +++ b/svg/icon_white.svg @@ -34,8 +34,8 @@ id="rect2827" style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + id="rect2946" + style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> diff --git a/xboard.c b/xboard.c index 68dd7ca..0ac3a44 100644 --- a/xboard.c +++ b/xboard.c @@ -254,6 +254,11 @@ char *layoutName; char installDir[] = "."; // [HGM] UCI: needed for UCI; probably needs run-time initializtion +/* pixbufs */ +static GdkPixbuf *mainwindowIcon=NULL; +static GdkPixbuf *WhiteIcon=NULL; +static GdkPixbuf *BlackIcon=NULL; + typedef unsigned int BoardSize; BoardSize boardSize; Boolean chessProgram; @@ -1298,18 +1303,13 @@ main (int argc, char **argv) InitMenuMarkers(); /* - * Create an icon. + * Create an icon. (Use two icons, to indicate whther it is white's or black's turn.) */ -#ifdef TODO_GTK - ReadBitmap(&wIconPixmap, "icon_white.bm", - icon_white_bits, icon_white_width, icon_white_height); - ReadBitmap(&bIconPixmap, "icon_black.bm", - icon_black_bits, icon_black_width, icon_black_height); - iconPixmap = wIconPixmap; - i = 0; - XtSetArg(args[i], XtNiconPixmap, iconPixmap); i++; - XtSetValues(shellWidget, args, i); -#endif + WhiteIcon = gdk_pixbuf_new_from_file(SVGDIR "/icon_white.svg", NULL); + BlackIcon = gdk_pixbuf_new_from_file(SVGDIR "/icon_black.svg", NULL); + mainwindowIcon = WhiteIcon; + gtk_window_set_icon(GTK_WINDOW(shellWidget), mainwindowIcon); + /* * Create a cursor for the board widget. @@ -2240,22 +2240,16 @@ DisplayTimerLabel (Option *opt, char *color, long timer, int highlight) g_free(markup); } -#ifdef TODO_GTK -static Pixmap *clockIcons[] = { &wIconPixmap, &bIconPixmap }; -#endif +static GdkPixbuf **clockIcons[] = { &WhiteIcon, &BlackIcon }; void SetClockIcon (int color) { -#ifdef TODO_GTK - Arg args[16]; - Pixmap pm = *clockIcons[color]; - if (iconPixmap != pm) { - iconPixmap = pm; - XtSetArg(args[0], XtNiconPixmap, iconPixmap); - XtSetValues(shellWidget, args, 1); + GdkPixbuf *pm = *clockIcons[color]; + if (mainwindowIcon != pm) { + mainwindowIcon = pm; + gtk_window_set_icon(GTK_WINDOW(shellWidget), mainwindowIcon); } -#endif } #define INPUT_SOURCE_BUF_SIZE 8192