Thu Jul 6 23:56:54 PDT 2000 Michael Jennings <mej@eterm.org>

I think I've finally fixed all those XPolyText8() errors with pixmap
	support disabled.  Solid color mode buttonbars seem to work now also.


SVN revision: 2907
This commit is contained in:
Michael Jennings 2000-07-07 06:41:12 +00:00
parent 2319bab108
commit b05a37a6af
7 changed files with 78 additions and 26 deletions

View File

@ -3782,3 +3782,9 @@ Wed Jul 5 20:48:10 PDT 2000 Michael Jennings <mej@eterm.org>
Dammit. I missed an occurance of XA_COMPOUND_TEXT().
-------------------------------------------------------------------------------
Thu Jul 6 23:56:54 PDT 2000 Michael Jennings <mej@eterm.org>
I think I've finally fixed all those XPolyText8() errors with pixmap
support disabled. Solid color mode buttonbars seem to work now also.
-------------------------------------------------------------------------------

View File

@ -143,6 +143,7 @@ dnl# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(atexit _exit unsetenv setutent seteuid memmove putenv strsep setresuid setresgid memmem usleep snprintf)
dps_snprintf_oflow()
AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm", , $SUBLIBS)
dnl# Check for the need for -lutil on BSD systems
AC_CHECK_FUNC(login,
@ -295,8 +296,7 @@ AC_ARG_WITH(imlib,
USE_IMLIB=1
)
if test $USE_IMLIB -eq 1 ; then
AC_CHECK_LIB(m, pow, GRLIBS="-lm", , $SUBLIBS $X_LIBS $GRLIBS)
AC_CHECK_LIB(dl, dlopen, GRLIBS="-ldl $GRLIBS", , $SUBLIBS $X_LIBS $GRLIBS)
AC_CHECK_LIB(dl, dlopen, GRLIBS="-ldl", , $SUBLIBS $X_LIBS $GRLIBS)
AC_CHECK_LIB(ttf, TT_Init_FreeType, GRLIBS="-lttf $GRLIBS", , $SUBLIBS $X_LIBS $GRLIBS)
AC_CHECK_LIB(Imlib2, imlib_create_image,
GRLIBS="-lImlib2 $GRLIBS"

View File

@ -56,6 +56,9 @@ draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_
{
D_BBAR(("Writing string \"%s\" (length %lu) onto drawable 0x%08x at %d, %d\n", str, len, d, x, y));
REQUIRE(bbar != NULL);
REQUIRE(d != None);
REQUIRE(gc != None);
#ifdef MULTI_CHARSET
if (bbar->fontset)
@ -64,7 +67,6 @@ draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_
#endif
XDrawString(Xdisplay, d, gc, x, y, str, len);
return;
bbar = NULL;
}
buttonbar_t *
@ -274,14 +276,30 @@ unsigned short
bbar_calc_height(buttonbar_t *bbar)
{
button_t *b;
Imlib_Border *bbord = images[image_bbar].norm->iml->border, *bord = images[image_button].norm->iml->border;
Imlib_Border *bbord, *bord;
D_BBAR(("bbar_calc_height(%8p): fascent == %d, fdescent == %d, h == %d\n", bbar, bbar->fascent, bbar->fdescent, bbar->h));
if (image_mode_is(image_bbar, MODE_MASK)) {
bbord = images[image_bbar].norm->iml->border;
} else if (images[image_bbar].norm->iml->bevel) {
bbord = images[image_bbar].norm->iml->bevel->edges;
} else {
bbord = NULL;
}
if (image_mode_is(image_button, MODE_MASK)) {
bord = images[image_button].norm->iml->border;
} else if (images[image_button].norm->iml->bevel) {
bord = images[image_button].norm->iml->bevel->edges;
} else {
bord = NULL;
}
bbar->h = bbar->fascent + bbar->fdescent + 1;
if (bord) {
bbar->h += bord->top + bord->bottom;
}
for (b = bbar->buttons; b; b = b->next) {
if (b->h != bbar->h) {
b->h = bbar->h;
@ -321,10 +339,18 @@ bbar_calc_positions(buttonbar_t *bbar)
{
button_t *b;
unsigned short x, y;
Imlib_Border *border = images[image_bbar].norm->iml->border;
Imlib_Border *border;
D_BBAR(("bbar == %8p\n", bbar));
if (image_mode_is(image_bbar, MODE_MASK)) {
border = images[image_bbar].norm->iml->border;
} else if (images[image_bbar].norm->iml->bevel) {
border = images[image_bbar].norm->iml->bevel->edges;
} else {
border = NULL;
}
y = ((border) ? (border->top) : 0);
if (bbar->buttons) {
x = ((border) ? (border->left) : 0) + MENU_HGAP;
@ -351,12 +377,20 @@ bbar_calc_positions(buttonbar_t *bbar)
void
button_calc_size(buttonbar_t *bbar, button_t *button)
{
Imlib_Border *bord = images[image_button].norm->iml->border;
Imlib_Border *bord;
int ascent, descent, direction;
XCharStruct chars;
D_BBAR(("button_calc_size(%8p, %8p): XTextExtents(%8p, %s, %d, ...)\n", bbar, button, bbar->font, button->text, button->len));
if (image_mode_is(image_button, MODE_MASK)) {
bord = images[image_button].norm->iml->border;
} else if (images[image_button].norm->iml->bevel) {
bord = images[image_button].norm->iml->bevel->edges;
} else {
bord = NULL;
}
button->w = 0;
if (button->len) {
XTextExtents(bbar->font, button->text, button->len, &direction, &ascent, &descent, &chars);
@ -401,10 +435,19 @@ button_calc_size(buttonbar_t *bbar, button_t *button)
void
button_calc_rel_coords(buttonbar_t *bbar, button_t *button)
{
Imlib_Border *bord = images[image_button].norm->iml->border;
Imlib_Border *bord;
D_BBAR(("bbar == %8p, button == %8p\n", bbar, button));
if (image_mode_is(image_button, MODE_MASK)) {
bord = images[image_button].norm->iml->border;
} else if (images[image_button].norm->iml->bevel) {
bord = images[image_button].norm->iml->bevel->edges;
} else {
bord = NULL;
}
#ifdef PIXMAP_SUPPORT
if (button->icon) {
unsigned short b = 0;
@ -418,6 +461,8 @@ button_calc_rel_coords(buttonbar_t *bbar, button_t *button)
}
button->icon_x = button->x + ((bord) ? (bord->left) : 0);
}
#endif
if (button->len) {
button->text_x = button->x + ((button->icon_w) ? (button->icon_w + MENU_HGAP) : 0) + ((bord) ? (bord->left) : (0));
button->text_y = button->y + button->h - ((bord) ? (bord->bottom) : (0)) - bbar->fdescent;
@ -645,6 +690,10 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
}
break;
case ACTION_FUNCTION:
if (!press) {
}
break;
default:
break;
}
@ -744,6 +793,7 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
} else {
render_simage(images[image_bbar].current, bbar->win, bbar->w, bbar->h, image_bbar, RENDER_FORCE_PIXMAP);
bbar->bg = images[image_bbar].current->pmap->pixmap;
REQUIRE(bbar->bg != None);
}
XSetForeground(Xdisplay, bbar->gc, images[image_bbar].current->fg);
for (button = bbar->buttons; button; button = button->next) {

View File

@ -58,16 +58,14 @@ extern void shade_ximage_15_mmx(void *data, int bpl, int w, int h, int rm, int g
extern void shade_ximage_16_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
extern void shade_ximage_32_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
#ifdef PIXMAP_SUPPORT
static Imlib_Border bord_none = { 0, 0, 0, 0 };
static colormod_t cmod_none = { 256, 256, 256 };
# ifdef PIXMAP_OFFSET
Pixmap desktop_pixmap = None, viewport_pixmap = None;
Pixmap buffer_pixmap = None;
#ifdef PIXMAP_OFFSET
Pixmap desktop_pixmap = None, viewport_pixmap = None;
Window desktop_window = None;
unsigned char desktop_pixmap_is_mine = 0;
# endif
#endif
image_t images[image_max] =
@ -800,6 +798,7 @@ redraw_images_by_mode(unsigned char mode) {
scrollbar_draw(IMAGE_STATE_CURRENT, mode);
}
}
#endif /* PIXMAP_SUPPORT */
static void
copy_buffer_pixmap(unsigned char mode, unsigned long fill, unsigned short width, unsigned short height)
@ -849,14 +848,17 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
ASSERT(simg != NULL);
ASSERT(simg->iml != NULL);
ASSERT(simg->pmap != NULL);
REQUIRE(win != None);
D_PIXMAP(("Rendering simg->iml->im %8p (%s) at %hux%hu onto window 0x%08x\n", simg->iml->im, get_image_type(which), width, height, win));
D_PIXMAP(("Image mode is 0x%02x\n", images[which].mode));
#ifdef PIXMAP_SUPPORT
if ((which == image_bg) && image_mode_is(image_bg, MODE_VIEWPORT)) {
width = scr->width;
height = scr->height;
}
#endif
if (!(width) || !(height))
return;
@ -869,6 +871,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
buffer_pixmap = None;
}
#ifdef PIXMAP_SUPPORT
if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO)) {
char buff[255];
const char *iclass, *state;
@ -1115,6 +1118,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
reset_simage(simg, RESET_ALL_SIMG);
}
}
#endif
/* Fall back to solid mode if all else fails. */
if (!image_mode_is(which, MODE_MASK)) {
@ -1145,6 +1149,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
return;
}
#ifdef PIXMAP_SUPPORT
const char *
search_path(const char *pathlist, const char *file, const char *ext)
{
@ -1544,6 +1549,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
int real_depth = 0;
D_PIXMAP(("colormod_trans(p == 0x%08x, gc, w == %hu, h == %hu) called.\n", p, w, h));
REQUIRE(p != None);
if (iml->mod) {
shade = iml->mod->brightness;
@ -1909,7 +1915,8 @@ shaped_window_apply_mask(Drawable d, Pixmap mask)
static signed char have_shape = -1;
REQUIRE(d != None && mask != None);
REQUIRE(d != None);
REQUIRE(mask != None);
D_PIXMAP(("shaped_window_apply_mask(d [0x%08x], mask [0x%08x]) called.\n", d, mask));

View File

@ -207,7 +207,6 @@ extern Window desktop_window;
/************ Function Prototypes ************/
#ifndef PIXMAP_SUPPORT
# define render_simage(s, win, w, h, which, r) NOP
# define free_simage(s) NOP
# define create_simage() ((simage_t *) NULL)
# define load_image(f, s) ((unsigned char) 0)
@ -237,7 +236,9 @@ extern Pixmap create_viewport_pixmap(simage_t *, Drawable, int, int, unsigned sh
extern void paste_simage(simage_t *, unsigned char, Drawable, unsigned short, unsigned short, unsigned short, unsigned short);
extern void redraw_image(unsigned char);
extern void redraw_images_by_mode(unsigned char);
#endif
extern void render_simage(simage_t *, Window, unsigned short, unsigned short, unsigned char, renderop_t);
#ifdef PIXMAP_SUPPORT
extern const char *search_path(const char *, const char *, const char *);
extern unsigned char load_image(const char *, simage_t *);
extern void free_desktop_pixmap(void);

View File

@ -41,9 +41,7 @@ static const char cvs_ident[] = "$Id$";
#include "screen.h"
#include "scrollbar.h"
#include "options.h"
#ifdef PIXMAP_SUPPORT
# include "pixmap.h"
#endif
#include "pixmap.h"
#include "profile.h"
#include "term.h"
@ -1022,7 +1020,6 @@ scr_erase_screen(int mode)
long gcmask;
XGCValues gcvalue;
Pixmap pmap = None;
#ifdef PIXMAP_SUPPORT
Drawable draw_buffer;
if (buffer_pixmap) {
@ -1031,7 +1028,6 @@ scr_erase_screen(int mode)
} else {
draw_buffer = TermWin.vt;
}
#endif
D_SCREEN(("scr_erase_screen(%d) at screen row: %d\n", mode, screen.row));
REFRESH_ZERO_SCROLLBACK;
@ -1615,9 +1611,7 @@ scr_refresh(int type)
Pixmap pmap = images[image_bg].current->pmap->pixmap;
int (*draw_string) (), (*draw_image_string) ();
register int low_x = 99999, low_y = 99999, high_x = 0, high_y = 0;
#ifdef PIXMAP_SUPPORT
Drawable draw_buffer;
#endif
#ifndef NO_BOLDFONT
int bfont = 0; /* we've changed font to bold font */
#endif
@ -1643,13 +1637,11 @@ scr_refresh(int type)
if (type == NO_REFRESH)
return;
#ifdef PIXMAP_SUPPORT
if (buffer_pixmap) {
draw_buffer = buffer_pixmap;
} else {
draw_buffer = TermWin.vt;
}
#endif
row_offset = TermWin.saveLines - TermWin.view_start;
fprop = TermWin.fprop;

View File

@ -42,10 +42,6 @@
* CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
* ERASE_ROWS : set <num> rows starting from row <row> to the foreground color
*/
#ifndef PIXMAP_SUPPORT
# define buffer_pixmap (0)
# define draw_buffer (TermWin.vt)
#endif
#define CLEAR_ROWS(row, num) do {if (buffer_pixmap) {XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, Col2Pixel(0), Row2Pixel(row), TermWin.width, Height2Pixel(num), \
Col2Pixel(0), Row2Pixel(row));} XClearArea(Xdisplay, TermWin.vt, Col2Pixel(0), Row2Pixel(row), TermWin.width, Height2Pixel(num), 0);} while (0)
#define CLEAR_CHARS(x, y, num) ((buffer_pixmap) \