9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Added application-Icon for drawterm X11 GUI
@ 2007-07-16 14:29 Matthias Schmidt
  0 siblings, 0 replies; only message in thread
From: Matthias Schmidt @ 2007-07-16 14:29 UTC (permalink / raw)
  To: 9fans

Hi *,

i've added an application icon (glenda) to the X11 GUI of drawterm.

This shows an glenda thumbnail for drawterm under window systems like
GNOME, etc. I found this useful while working on XWindows.

cheers,

Matthias


> $ cat glenda.xbm 
> #define icon_bitmap_width 48
> #define icon_bitmap_height 48
> static unsigned short icon_bitmap_bits[] = {
>    0xffff, 0xffff, 0xffff, 0xffff, 0xffe9, 0xffff, 0x7fff, 0xffae, 0xffff,
>    0xffff, 0xffbe, 0xffff, 0x1fff, 0xff3f, 0xffff, 0xbfff, 0xfe6e, 0xffff,
>    0xbbff, 0xfcce, 0xffff, 0xffff, 0xf98c, 0xffff, 0xe5ff, 0xf31b, 0xffff,
>    0x87ff, 0xe617, 0xffff, 0x05ff, 0xdf37, 0xffff, 0x0fff, 0x7ffe, 0xffff,
>    0x1bff, 0xfffc, 0xfffa, 0x37ff, 0xfffc, 0xfffb, 0xd7ff, 0xfffc, 0xfff7,
>    0xcfff, 0xffff, 0xfff7, 0xcfff, 0xffff, 0xffef, 0xdfff, 0xffff, 0xffef,
>    0xafff, 0xffff, 0xffdf, 0xefff, 0xffff, 0xfff3, 0xdfff, 0xefff, 0xffd3,
>    0xdfff, 0xc7ff, 0xffdf, 0xefff, 0xefff, 0xffef, 0xcfff, 0xffff, 0xffcf,
>    0xdfff, 0xffff, 0xffd9, 0x9fff, 0x7fff, 0xffd0, 0xbfff, 0xffff, 0xffd7,
>    0x7fff, 0xbfff, 0xffd0, 0x3fff, 0x3fff, 0xffd9, 0x7fff, 0x3fff, 0xffcb,
>    0x3fff, 0xffff, 0xffdc, 0x3fff, 0xffff, 0xffdf, 0x3fff, 0xffff, 0xff9f,
>    0x3fff, 0xffff, 0xffdf, 0x8fff, 0xffff, 0xff9f, 0xa7ff, 0xffff, 0xffdf,
>    0xe3ff, 0xffff, 0xffcf, 0xe9ff, 0xffff, 0xffcf, 0xf1ff, 0xffff, 0xffef,
>    0xf3ff, 0xffff, 0xffe7, 0xf9ff, 0xffff, 0xffe7, 0x53ff, 0xffff, 0xffe1,
>    0x07ff, 0x7ffc, 0xffc6, 0x17ff, 0xeff0, 0xffee, 0xffff, 0xc781, 0xffe5,
>    0xffff, 0x8807, 0xffe0, 0xffff, 0x003f, 0xfff0, 0xffff, 0x1fff, 0xfffe };


> $ cat screen.diff 
> --- screen.c.SAVE       2007-07-07 21:46:04.000000000 +0200
> +++ screen.c    2007-07-09 09:56:22.000000000 +0200
> @@ -10,6 +10,7 @@
>  #include <X11/keysym.h>
>  
>  #include "keysym2ucs.h"
> +#include "glenda.xbm"
>  
>  /*
>   * alias defs for image types to overcome name conflicts
> @@ -287,6 +288,10 @@
>         XPixmapFormatValues *pfmt;
>         int n;
>   
> +    /* pixmap used to store the icon's image. */
> +    Pixmap icon_pixmap;
> +
> +
>         xscreenid = 0;
>         xdrawable = 0;
>  
> @@ -391,6 +396,13 @@
>         xdrawable = XCreateWindow(xdisplay, rootwin, 0, 0, xsize, ysize, 0, 
>                 xscreendepth, InputOutput, xvis, CWBackPixel|CWBorderPixel|CWColormap, &attrs);
>  
> +    /* load the given bitmap data and create an X pixmap containing it. */
> +    icon_pixmap = XCreateBitmapFromData(xdisplay,
> +                                        rootwin,
> +                                        (char *)icon_bitmap_bits,
> +                                        icon_bitmap_width,
> +                                        icon_bitmap_height);
> +
>         /*
>          * set up property as required by ICCCM
>          */
> @@ -403,9 +415,11 @@
>         normalhints.max_height = Dy(r);
>         normalhints.width = xsize;
>         normalhints.height = ysize;
> -       hints.flags = InputHint|StateHint;
> +       hints.flags = IconPixmapHint |InputHint|StateHint;
>         hints.input = 1;
>         hints.initial_state = NormalState;
> +    hints.icon_pixmap = icon_pixmap;
> +
>         classhints.res_name = "drawterm";
>         classhints.res_class = "Drawterm";
>         argv[0] = "drawterm";


-- 
Matthias Schmidt                Tel              : (++49) 6227 356 236
Sun Microsystems GmbH           Fax              : (++49) 6227 356 222
Altrottstr. 31                  Mobil            : (++49)  171 5767209
D-69190 Walldorf                



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-16 14:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 14:29 [9fans] Added application-Icon for drawterm X11 GUI Matthias Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).