mirror of
https://github.com/HEYAHONG/PDCurses.git
synced 2025-05-08 13:36:23 +08:00
Assume HAVE_XPM (part 1); convert default icons to xpm. This fixes the
non-display of the default icons in Ubuntu. Should investigate more...
This commit is contained in:
parent
bb87f9d95a
commit
5471eb94a4
@ -1,14 +0,0 @@
|
||||
#define icon32_width 32
|
||||
#define icon32_height 32
|
||||
static unsigned char icon32_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xfc, 0x30, 0x00, 0x00, 0xfc, 0x31, 0x00, 0x00, 0x8c, 0x33, 0x00,
|
||||
0x00, 0x0c, 0x33, 0x00, 0x00, 0x0c, 0x33, 0x00, 0x00, 0x8c, 0x33, 0x00,
|
||||
0x00, 0xcc, 0x39, 0x00, 0x00, 0xec, 0x3c, 0x00, 0x00, 0x7c, 0x3e, 0x00,
|
||||
0x00, 0x3c, 0x37, 0x00, 0x00, 0x9c, 0x33, 0x00, 0x00, 0xcc, 0x31, 0x00,
|
||||
0x00, 0xcc, 0x30, 0x00, 0x00, 0xcc, 0x30, 0x00, 0x00, 0xcc, 0x31, 0x00,
|
||||
0x00, 0x8c, 0x3f, 0x00, 0x00, 0x0c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4c, 0x2a, 0xc6, 0x18, 0x52, 0x5a, 0x29, 0x25,
|
||||
0x42, 0x0a, 0x21, 0x05, 0x42, 0x0a, 0xe6, 0x18, 0x42, 0x0a, 0x28, 0x20,
|
||||
0x52, 0x0a, 0x29, 0x25, 0x8c, 0x09, 0xc6, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
42
common/icon32.xpm
Normal file
42
common/icon32.xpm
Normal file
@ -0,0 +1,42 @@
|
||||
/* XPM */
|
||||
static char *icon32[] = {
|
||||
/* width height ncolors chars_per_pixel */
|
||||
"32 32 3 1",
|
||||
/* colors */
|
||||
" c #000",
|
||||
". c #FFF",
|
||||
"X c None",
|
||||
/* pixels */
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
".......... .... ..........",
|
||||
".......... ... ..........",
|
||||
".......... ... .. ..........",
|
||||
".......... .... .. ..........",
|
||||
".......... .... .. ..........",
|
||||
".......... ... .. ..........",
|
||||
".......... .. .. ..........",
|
||||
".......... . .. ..........",
|
||||
".......... .. ..........",
|
||||
".......... .. . ..........",
|
||||
".......... .. .. ..........",
|
||||
".......... .. ... ..........",
|
||||
".......... .. .... ..........",
|
||||
".......... .. .... ..........",
|
||||
".......... .. ... ..........",
|
||||
".......... ... ..........",
|
||||
".......... .... ..........",
|
||||
"................................",
|
||||
"................................",
|
||||
".. .. .. . . ... ... ... ...",
|
||||
". .. . .. . . . .. . .. . .. ..",
|
||||
". .... .. . .... .... .. . .....",
|
||||
". .... .. . ..... .. ... ...",
|
||||
". .... .. . ....... . ....... ..",
|
||||
". .. . .. . .... .. . .. . .. ..",
|
||||
".. ... .. ..... ... ... ...",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................"
|
||||
};
|
@ -1,46 +0,0 @@
|
||||
#define icon64_width 64
|
||||
#define icon64_height 64
|
||||
static unsigned char icon64_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff,
|
||||
0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xc1, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0xff, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff,
|
||||
0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0xc7, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80,
|
||||
0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0,
|
||||
0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc3, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0xf0, 0xe3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8,
|
||||
0xf1, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfc, 0xf8, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x7e, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
|
||||
0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0xff, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x8f, 0xdf, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc7,
|
||||
0xcf, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe3, 0xc7, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0xf1, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0,
|
||||
0xc1, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xc0, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78,
|
||||
0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8,
|
||||
0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xff, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0,
|
||||
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0xff, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x50, 0x1e,
|
||||
0x7c, 0xf0, 0xe0, 0x03, 0x60, 0x26, 0x50, 0x33, 0xc6, 0x98, 0x31, 0x06,
|
||||
0x30, 0x2c, 0xd0, 0x61, 0x83, 0x0d, 0x1b, 0x0c, 0x10, 0x28, 0xd0, 0x40,
|
||||
0x01, 0x05, 0x0a, 0x08, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08,
|
||||
0x10, 0x20, 0x50, 0x00, 0x03, 0x04, 0x1a, 0x00, 0x10, 0x20, 0x50, 0x00,
|
||||
0x06, 0x04, 0x32, 0x00, 0x10, 0x20, 0x50, 0x00, 0x7c, 0xfc, 0xe3, 0x03,
|
||||
0x10, 0x20, 0x50, 0x00, 0xc0, 0x04, 0x00, 0x06, 0x10, 0x20, 0x50, 0x00,
|
||||
0x80, 0x05, 0x00, 0x0c, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08,
|
||||
0x10, 0x28, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, 0x30, 0x6c, 0x58, 0x00,
|
||||
0x83, 0x0d, 0x1b, 0x0c, 0x60, 0xc6, 0x4c, 0x00, 0xc6, 0x98, 0x31, 0x06,
|
||||
0xc0, 0x83, 0x47, 0x00, 0x7c, 0xf0, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
74
common/icon64.xpm
Normal file
74
common/icon64.xpm
Normal file
@ -0,0 +1,74 @@
|
||||
/* XPM */
|
||||
static char *icon64[] = {
|
||||
/* width height ncolors chars_per_pixel */
|
||||
"64 64 3 1",
|
||||
/* colors */
|
||||
" c #000",
|
||||
". c #FFF",
|
||||
"X c None",
|
||||
/* pixels */
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
".................... ...... ......................",
|
||||
".................... ..... ......................",
|
||||
".................... .... ......................",
|
||||
".................... .... ......................",
|
||||
".................... ...... ... ......................",
|
||||
".................... ....... ... ......................",
|
||||
".................... ....... ... ......................",
|
||||
".................... ....... ... ......................",
|
||||
".................... ....... ... ......................",
|
||||
".................... ...... ... ......................",
|
||||
".................... ..... .... ......................",
|
||||
".................... .... ... ......................",
|
||||
".................... ... ... ......................",
|
||||
".................... .. ... ......................",
|
||||
".................... . ... ......................",
|
||||
".................... ... ......................",
|
||||
".................... ... ......................",
|
||||
".................... ... . ......................",
|
||||
".................... ... .. ......................",
|
||||
".................... ... ... ......................",
|
||||
".................... ... .... ......................",
|
||||
".................... .... ..... ......................",
|
||||
".................... ... ...... ......................",
|
||||
".................... ... ....... ......................",
|
||||
".................... ... ....... ......................",
|
||||
".................... ... ....... ......................",
|
||||
".................... ... ....... ......................",
|
||||
".................... ... ...... ......................",
|
||||
".................... .... ......................",
|
||||
".................... .... ......................",
|
||||
".................... ..... ......................",
|
||||
".................... ...... ......................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"...... ... ...... . .. ..... ..... ..... ......",
|
||||
"..... .. .. ...... . . .. ... ... ... .. ... ... .....",
|
||||
".... .... . ...... . .... . ..... . .... . ..... ....",
|
||||
".... ...... . ...... . ...... . ....... . ...... . ....... ....",
|
||||
".... ........ ...... . ......... ....... . ...... . ....... ....",
|
||||
".... ........ ...... . ......... ........ ...... . ...........",
|
||||
".... ........ ...... . .......... ....... ...... .. ..........",
|
||||
".... ........ ...... . ........... ... ... ......",
|
||||
".... ........ ...... . ............... .. .............. .....",
|
||||
".... ........ ...... . ................ . ............... ....",
|
||||
".... ........ ...... . ......... ....... . ...... . ....... ....",
|
||||
".... ...... . ...... . ......... ....... . ...... . ....... ....",
|
||||
".... .... . .... . ......... ..... . .... . ..... ....",
|
||||
"..... .. ... .. .. .......... ... ... .. ... ... .....",
|
||||
"...... ..... ... ........... ..... ..... ......",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................",
|
||||
"................................................................"
|
||||
};
|
@ -101,9 +101,7 @@ typedef struct
|
||||
XFontStruct *italicFont;
|
||||
XFontStruct *boldFont;
|
||||
char *bitmap;
|
||||
#ifdef HAVE_XPM_H
|
||||
char *pixmap;
|
||||
#endif
|
||||
char *composeKey;
|
||||
Cursor pointer;
|
||||
int shmmin;
|
||||
|
62
x11/x11.c
62
x11/x11.c
@ -10,9 +10,7 @@
|
||||
# include <Sunkeysym.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XPM_H
|
||||
# include <xpm.h>
|
||||
#endif
|
||||
#include <xpm.h>
|
||||
|
||||
#if defined PDC_XIM
|
||||
# include <Xlocale.h>
|
||||
@ -46,8 +44,8 @@ XCursesAppData xc_app_data;
|
||||
|
||||
/* Default icons for XCurses applications. */
|
||||
|
||||
#include "../common/icon64.xbm"
|
||||
#include "../common/icon32.xbm"
|
||||
#include "../common/icon64.xpm"
|
||||
#include "../common/icon32.xpm"
|
||||
|
||||
static void _selection_off(void);
|
||||
static void _display_cursor(int, int, int, int);
|
||||
@ -219,9 +217,7 @@ static int font_height, font_width, font_ascent, font_descent,
|
||||
window_width, window_height;
|
||||
static int resize_window_width = 0, resize_window_height = 0;
|
||||
static char *bitmap_file = NULL;
|
||||
#ifdef HAVE_XPM_H
|
||||
static char *pixmap_file = NULL;
|
||||
#endif
|
||||
static KeySym keysym = 0;
|
||||
|
||||
static int state_mask[8] =
|
||||
@ -247,10 +243,8 @@ static unsigned long tmpsel_length = 0;
|
||||
static int selection_start_x = 0, selection_start_y = 0,
|
||||
selection_end_x = 0, selection_end_y = 0;
|
||||
static Pixmap icon_bitmap;
|
||||
#ifdef HAVE_XPM_H
|
||||
static Pixmap icon_pixmap;
|
||||
static Pixmap icon_pixmap_mask;
|
||||
#endif
|
||||
static bool visible_cursor = FALSE;
|
||||
static bool window_entered = TRUE;
|
||||
static char *program_name;
|
||||
@ -334,9 +328,7 @@ static XtResource app_resources[] =
|
||||
RFONT(boldFont, BoldFont, DEFBFONT),
|
||||
|
||||
RSTRING(bitmap, Bitmap),
|
||||
#ifdef HAVE_XPM_H
|
||||
RSTRING(pixmap, Pixmap),
|
||||
#endif
|
||||
RSTRINGP(composeKey, ComposeKey, "Multi_key"),
|
||||
|
||||
RCURSOR(pointer, Pointer, xterm),
|
||||
@ -378,9 +370,7 @@ static XrmOptionDescRec options[] =
|
||||
{
|
||||
COPT(lines), COPT(cols), COPT(normalFont), COPT(italicFont),
|
||||
COPT(boldFont), COPT(bitmap),
|
||||
#ifdef HAVE_XPM_H
|
||||
COPT(pixmap),
|
||||
#endif
|
||||
COPT(pointer), COPT(shmmin), COPT(composeKey), COPT(clickPeriod),
|
||||
COPT(doubleClickPeriod), COPT(scrollbarWidth),
|
||||
COPT(pointerForeColor), COPT(pointerBackColor),
|
||||
@ -888,30 +878,29 @@ static void _get_icon(void)
|
||||
icon_size[i].width_inc, icon_size[i].height_inc));
|
||||
}
|
||||
|
||||
if (max_width >= icon64_width && max_height >= icon64_height)
|
||||
if (max_width >= 64 && max_height >= 64)
|
||||
{
|
||||
icon_bitmap_width = icon64_width;
|
||||
icon_bitmap_height = icon64_height;
|
||||
bitmap_bits = (unsigned char *)icon64_bits;
|
||||
XpmCreatePixmapFromData(XtDisplay(topLevel),
|
||||
RootWindowOfScreen(XtScreen(topLevel)),
|
||||
icon64, &icon_pixmap, &icon_pixmap_mask, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_bitmap_width = icon32_width;
|
||||
icon_bitmap_height = icon32_height;
|
||||
bitmap_bits = (unsigned char *)icon32_bits;
|
||||
XpmCreatePixmapFromData(XtDisplay(topLevel),
|
||||
RootWindowOfScreen(XtScreen(topLevel)),
|
||||
icon32, &icon_pixmap, &icon_pixmap_mask, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
else /* use small icon */
|
||||
{
|
||||
icon_bitmap_width = icon32_width;
|
||||
icon_bitmap_height = icon32_height;
|
||||
bitmap_bits = (unsigned char *)icon32_bits;
|
||||
XpmCreatePixmapFromData(XtDisplay(topLevel),
|
||||
RootWindowOfScreen(XtScreen(topLevel)),
|
||||
icon32, &icon_pixmap, &icon_pixmap_mask, NULL);
|
||||
}
|
||||
|
||||
XFree(icon_size);
|
||||
|
||||
#ifdef HAVE_XPM_H
|
||||
if (xc_app_data.pixmap && xc_app_data.pixmap[0]) /* supplied pixmap */
|
||||
{
|
||||
XpmReadFileToPixmap(XtDisplay(topLevel),
|
||||
@ -920,7 +909,6 @@ static void _get_icon(void)
|
||||
&icon_pixmap, &icon_pixmap_mask, NULL);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (xc_app_data.bitmap && xc_app_data.bitmap[0]) /* supplied bitmap */
|
||||
{
|
||||
@ -946,10 +934,6 @@ static void _get_icon(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
icon_bitmap = XCreateBitmapFromData(XtDisplay(topLevel),
|
||||
RootWindowOfScreen(XtScreen(topLevel)),
|
||||
(char *)bitmap_bits, icon_bitmap_width, icon_bitmap_height);
|
||||
}
|
||||
|
||||
static void _draw_border(void)
|
||||
@ -2394,14 +2378,12 @@ static void _exit_process(int rc, int sig, char *msg)
|
||||
free(bitmap_file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XPM_H
|
||||
if (pixmap_file)
|
||||
{
|
||||
XFreePixmap(XCURSESDISPLAY, icon_pixmap);
|
||||
XFreePixmap(XCURSESDISPLAY, icon_pixmap_mask);
|
||||
free(pixmap_file);
|
||||
}
|
||||
#endif
|
||||
XFreeGC(XCURSESDISPLAY, normal_gc);
|
||||
XFreeGC(XCURSESDISPLAY, italic_gc);
|
||||
XFreeGC(XCURSESDISPLAY, bold_gc);
|
||||
@ -3059,19 +3041,11 @@ int XCursesSetupX(int argc, char *argv[])
|
||||
|
||||
_get_icon();
|
||||
|
||||
#ifdef HAVE_XPM_H
|
||||
if (xc_app_data.pixmap && xc_app_data.pixmap[0])
|
||||
XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight,
|
||||
minheight, XtNbaseWidth, xc_app_data.borderWidth * 2,
|
||||
XtNbaseHeight, xc_app_data.borderWidth * 2,
|
||||
XtNiconPixmap, icon_pixmap,
|
||||
XtNiconMask, icon_pixmap_mask, NULL);
|
||||
else
|
||||
#endif
|
||||
XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight,
|
||||
minheight, XtNbaseWidth, xc_app_data.borderWidth * 2,
|
||||
XtNbaseHeight, xc_app_data.borderWidth * 2,
|
||||
XtNiconPixmap, icon_bitmap, NULL);
|
||||
XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight,
|
||||
minheight, XtNbaseWidth, xc_app_data.borderWidth * 2,
|
||||
XtNbaseHeight, xc_app_data.borderWidth * 2,
|
||||
XtNiconPixmap, icon_pixmap,
|
||||
XtNiconMask, icon_pixmap_mask, NULL);
|
||||
|
||||
/* Create a BOX widget in which to draw */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user