1999-08-17 18:12:47 -07:00
|
|
|
/* pixmap.h -- Eterm pixmap module header file
|
|
|
|
*
|
|
|
|
* This file is original work by Michael Jennings <mej@eterm.org> and
|
|
|
|
* Tuomo Venalainen <vendu@cc.hut.fi>. This file, and any other file
|
|
|
|
* bearing this same message or a similar one, is distributed under
|
|
|
|
* the GNU Public License (GPL) as outlined in the COPYING file.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997, Michael Jennings and Tuomo Venalainen
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
1999-08-17 16:01:18 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PIXMAP_H
|
|
|
|
# define _PIXMAP_H
|
|
|
|
|
|
|
|
#include <X11/Xatom.h>
|
1999-08-17 18:12:47 -07:00
|
|
|
#include <Imlib.h>
|
|
|
|
|
|
|
|
/************ Macros and Definitions ************/
|
|
|
|
#ifdef PIXMAP_SUPPORT
|
|
|
|
# define background_is_image() (images[image_bg].current && images[image_bg].current->iml && images[image_bg].current->iml->im)
|
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw
bug with transparency that several people pointed out. While I was
at it, I also cleaned up a lot of other related stuff. Three-state
images should be a lot more robust now.
Then again, some stuff may be broken entirely from this, so let me
know. :-)
For one thing, the various image modes should work as expected now.
You can allow and disallow modes for the various widgets. The
fallback mode is "solid" now, rather than "image," so you can cause
a certain widget to refuse to use an image if you want to. If you
specify an image without specifying a "mode" line that allows the
"image" mode, your image will not appear. <-- READ THIS TWICE! I
had to go back and fix all the theme files because of this, so you
will need to remove your current theme directory and allow Eterm's
"make install" to put the new ones in place; otherwise, everything
will go back to being solid colors. =]
Anytime something changes this drastically, there are bound to be
problems. Let me know if you find any of them. :)
SVN revision: 348
1999-09-20 18:16:46 -07:00
|
|
|
# define background_is_trans() (images[image_bg].mode & MODE_TRANS)
|
1999-09-29 13:38:29 -07:00
|
|
|
# define background_is_viewport() (images[image_bg].mode & MODE_VIEWPORT)
|
|
|
|
# define background_is_auto() (images[image_bg].mode & MODE_AUTO)
|
|
|
|
# define background_is_pixmap() (background_is_image() || background_is_trans() || background_is_viewport() || background_is_auto())
|
1999-08-17 18:12:47 -07:00
|
|
|
# define delete_simage(simg) do { \
|
|
|
|
Imlib_free_pixmap(imlib_id, (simg)->pmap->pixmap); \
|
|
|
|
Imlib_destroy_image(imlib_id, (simg)->iml->im); \
|
|
|
|
(simg)->pmap->pixmap = None; (simg)->iml->im = NULL; \
|
|
|
|
} while (0)
|
|
|
|
# define CONVERT_SHADE(s) (0xff - (((s) * 0xff) / 100))
|
|
|
|
# define CONVERT_TINT_RED(t) (((t) & 0xff0000) >> 16)
|
|
|
|
# define CONVERT_TINT_GREEN(t) (((t) & 0x00ff00) >> 8)
|
|
|
|
# define CONVERT_TINT_BLUE(t) ((t) & 0x0000ff)
|
|
|
|
#else
|
1999-09-20 16:57:57 -07:00
|
|
|
# define background_is_image() ((int)0)
|
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw
bug with transparency that several people pointed out. While I was
at it, I also cleaned up a lot of other related stuff. Three-state
images should be a lot more robust now.
Then again, some stuff may be broken entirely from this, so let me
know. :-)
For one thing, the various image modes should work as expected now.
You can allow and disallow modes for the various widgets. The
fallback mode is "solid" now, rather than "image," so you can cause
a certain widget to refuse to use an image if you want to. If you
specify an image without specifying a "mode" line that allows the
"image" mode, your image will not appear. <-- READ THIS TWICE! I
had to go back and fix all the theme files because of this, so you
will need to remove your current theme directory and allow Eterm's
"make install" to put the new ones in place; otherwise, everything
will go back to being solid colors. =]
Anytime something changes this drastically, there are bound to be
problems. Let me know if you find any of them. :)
SVN revision: 348
1999-09-20 18:16:46 -07:00
|
|
|
# define background_is_trans() ((int)0)
|
|
|
|
# define background_is_pixmap() ((int)0)
|
1999-08-17 18:12:47 -07:00
|
|
|
# define delete_simage(simg) ((void)0)
|
|
|
|
#endif
|
|
|
|
#define PIXMAP_EXT NULL
|
|
|
|
/* '[', 2*4 + 2*3 digits + 3 delimiters, ']'. -vendu */
|
|
|
|
#define GEOM_LEN 19
|
|
|
|
|
|
|
|
enum {
|
|
|
|
image_bg,
|
|
|
|
image_up,
|
|
|
|
image_down,
|
|
|
|
image_left,
|
|
|
|
image_right,
|
|
|
|
#ifdef PIXMAP_SCROLLBAR
|
|
|
|
image_sb,
|
|
|
|
image_sa,
|
|
|
|
#endif
|
|
|
|
#ifdef PIXMAP_MENUBAR
|
|
|
|
image_menu,
|
|
|
|
image_submenu,
|
|
|
|
#endif
|
|
|
|
image_max
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Image manipulation operations */
|
|
|
|
#define OP_NONE 0x00
|
|
|
|
#define OP_TILE 0x01
|
|
|
|
#define OP_HSCALE 0x02
|
|
|
|
#define OP_VSCALE 0x04
|
|
|
|
#define OP_PROPSCALE 0x08
|
|
|
|
#define OP_SCALE (OP_HSCALE | OP_VSCALE)
|
|
|
|
|
|
|
|
/* Image modes */
|
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw
bug with transparency that several people pointed out. While I was
at it, I also cleaned up a lot of other related stuff. Three-state
images should be a lot more robust now.
Then again, some stuff may be broken entirely from this, so let me
know. :-)
For one thing, the various image modes should work as expected now.
You can allow and disallow modes for the various widgets. The
fallback mode is "solid" now, rather than "image," so you can cause
a certain widget to refuse to use an image if you want to. If you
specify an image without specifying a "mode" line that allows the
"image" mode, your image will not appear. <-- READ THIS TWICE! I
had to go back and fix all the theme files because of this, so you
will need to remove your current theme directory and allow Eterm's
"make install" to put the new ones in place; otherwise, everything
will go back to being solid colors. =]
Anytime something changes this drastically, there are bound to be
problems. Let me know if you find any of them. :)
SVN revision: 348
1999-09-20 18:16:46 -07:00
|
|
|
#define MODE_SOLID 0x00
|
|
|
|
#define MODE_IMAGE 0x01
|
|
|
|
#define MODE_TRANS 0x02
|
|
|
|
#define MODE_VIEWPORT 0x04
|
|
|
|
#define MODE_AUTO 0x08
|
|
|
|
#define MODE_MASK 0x0f
|
|
|
|
#define ALLOW_SOLID 0x00
|
|
|
|
#define ALLOW_IMAGE 0x10
|
|
|
|
#define ALLOW_TRANS 0x20
|
|
|
|
#define ALLOW_VIEWPORT 0x40
|
|
|
|
#define ALLOW_AUTO 0x80
|
|
|
|
#define ALLOW_MASK 0xf0
|
|
|
|
|
|
|
|
/* Helper macros */
|
|
|
|
#define FOREACH_IMAGE(x) do {unsigned char idx; for (idx = 0; idx < image_max; idx++) { x } } while (0)
|
|
|
|
#define redraw_all_images() do {render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); \
|
|
|
|
scr_touch(); scrollbar_show(0);} while (0)
|
|
|
|
#define image_set_mode(which, bit) do {images[which].mode &= ~(MODE_MASK); images[which].mode |= (bit);} while (0)
|
|
|
|
#define image_allow_mode(which, bit) (images[which].mode |= (bit))
|
|
|
|
#define image_disallow_mode(which, bit) (images[which].mode &= ~(bit))
|
|
|
|
#define image_mode_is(which, bit) (images[which].mode & (bit))
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
/* Elements of an simage to be reset */
|
|
|
|
#define RESET_NONE (0UL)
|
|
|
|
#define RESET_IMLIB_MOD (1UL << 0)
|
|
|
|
#define RESET_IMLIB_RMOD (1UL << 1)
|
|
|
|
#define RESET_IMLIB_GMOD (1UL << 2)
|
|
|
|
#define RESET_IMLIB_BMOD (1UL << 3)
|
|
|
|
#define RESET_ALL_TINT (RESET_IMLIB_RMOD | RESET_IMLIB_GMOD | RESET_IMLIB_BMOD)
|
|
|
|
#define RESET_ALL_MOD (RESET_IMLIB_MOD | RESET_IMLIB_RMOD | RESET_IMLIB_GMOD | RESET_IMLIB_BMOD)
|
|
|
|
#define RESET_IMLIB_BORDER (1UL << 4)
|
|
|
|
#define RESET_IMLIB_IM (1UL << 5)
|
|
|
|
#define RESET_ALL_IMLIB (RESET_ALL_MOD | RESET_IMLIB_BORDER | RESET_IMLIB_IM)
|
|
|
|
#define RESET_PMAP_GEOM (1UL << 6)
|
|
|
|
#define RESET_PMAP_PIXMAP (1UL << 7)
|
|
|
|
#define RESET_PMAP_MASK (1UL << 8)
|
|
|
|
#define RESET_ALL_PMAP (RESET_PMAP_GEOM | RESET_PMAP_PIXMAP | RESET_PMAP_MASK)
|
|
|
|
#define RESET_ALL (RESET_ALL_IMLIB | RESET_ALL_PMAP)
|
|
|
|
|
|
|
|
/************ Structures ************/
|
1999-08-17 16:01:18 -07:00
|
|
|
typedef struct {
|
1999-08-17 18:12:47 -07:00
|
|
|
unsigned short op;
|
|
|
|
short w, h, x, y;
|
|
|
|
Pixmap pixmap;
|
|
|
|
Pixmap mask;
|
1999-08-17 16:01:18 -07:00
|
|
|
} pixmap_t;
|
|
|
|
typedef struct {
|
1999-08-17 18:12:47 -07:00
|
|
|
ImlibBorder *edges;
|
|
|
|
unsigned char up;
|
|
|
|
} bevel_t;
|
|
|
|
typedef struct {
|
|
|
|
ImlibImage *im;
|
|
|
|
ImlibBorder *border, *pad;
|
|
|
|
bevel_t *bevel;
|
|
|
|
ImlibColorModifier *mod, *rmod, *gmod, *bmod;
|
|
|
|
short last_w, last_h;
|
1999-08-17 16:01:18 -07:00
|
|
|
} imlib_t;
|
1999-08-17 18:12:47 -07:00
|
|
|
typedef struct {
|
|
|
|
pixmap_t *pmap;
|
|
|
|
imlib_t *iml;
|
|
|
|
} simage_t;
|
|
|
|
typedef struct {
|
|
|
|
Window win;
|
|
|
|
unsigned char mode;
|
|
|
|
simage_t *norm, *selected, *clicked, *current;
|
|
|
|
} image_t;
|
1999-08-17 16:01:18 -07:00
|
|
|
typedef short renderop_t;
|
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
/************ Variables ************/
|
|
|
|
extern image_t images[image_max];
|
|
|
|
extern ImlibData *imlib_id;
|
|
|
|
extern Pixmap desktop_pixmap, viewport_pixmap;
|
1999-08-17 16:01:18 -07:00
|
|
|
extern Window desktop_window;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
/************ Function Prototypes ************/
|
|
|
|
_XFUNCPROTOBEGIN
|
|
|
|
|
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw
bug with transparency that several people pointed out. While I was
at it, I also cleaned up a lot of other related stuff. Three-state
images should be a lot more robust now.
Then again, some stuff may be broken entirely from this, so let me
know. :-)
For one thing, the various image modes should work as expected now.
You can allow and disallow modes for the various widgets. The
fallback mode is "solid" now, rather than "image," so you can cause
a certain widget to refuse to use an image if you want to. If you
specify an image without specifying a "mode" line that allows the
"image" mode, your image will not appear. <-- READ THIS TWICE! I
had to go back and fix all the theme files because of this, so you
will need to remove your current theme directory and allow Eterm's
"make install" to put the new ones in place; otherwise, everything
will go back to being solid colors. =]
Anytime something changes this drastically, there are bound to be
problems. Let me know if you find any of them. :)
SVN revision: 348
1999-09-20 18:16:46 -07:00
|
|
|
extern const char *get_image_type(unsigned short);
|
1999-08-17 18:12:47 -07:00
|
|
|
extern unsigned short parse_pixmap_ops(char *);
|
|
|
|
extern unsigned short set_pixmap_scale(const char *, pixmap_t *);
|
|
|
|
extern void reset_simage(simage_t *, unsigned long);
|
1999-09-23 16:27:16 -07:00
|
|
|
extern void paste_simage(simage_t *, unsigned char, Window, unsigned short, unsigned short, unsigned short, unsigned short);
|
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw
bug with transparency that several people pointed out. While I was
at it, I also cleaned up a lot of other related stuff. Three-state
images should be a lot more robust now.
Then again, some stuff may be broken entirely from this, so let me
know. :-)
For one thing, the various image modes should work as expected now.
You can allow and disallow modes for the various widgets. The
fallback mode is "solid" now, rather than "image," so you can cause
a certain widget to refuse to use an image if you want to. If you
specify an image without specifying a "mode" line that allows the
"image" mode, your image will not appear. <-- READ THIS TWICE! I
had to go back and fix all the theme files because of this, so you
will need to remove your current theme directory and allow Eterm's
"make install" to put the new ones in place; otherwise, everything
will go back to being solid colors. =]
Anytime something changes this drastically, there are bound to be
problems. Let me know if you find any of them. :)
SVN revision: 348
1999-09-20 18:16:46 -07:00
|
|
|
extern void redraw_image(unsigned char);
|
|
|
|
extern void render_simage(simage_t *, Window, unsigned short, unsigned short, unsigned char, renderop_t);
|
1999-08-17 18:12:47 -07:00
|
|
|
#ifdef USE_POSIX_THREADS
|
|
|
|
extern void init_bg_pixmap_thread(void *);
|
|
|
|
#endif
|
|
|
|
extern const char *search_path(const char *, const char *, const char *);
|
|
|
|
extern unsigned short load_image(const char *, short);
|
|
|
|
extern void free_desktop_pixmap(void);
|
|
|
|
#ifdef PIXMAP_OFFSET
|
|
|
|
extern unsigned char need_colormod(void);
|
|
|
|
extern void colormod_trans(Pixmap, GC, unsigned short, unsigned short);
|
|
|
|
extern Window get_desktop_window(void);
|
|
|
|
extern Pixmap get_desktop_pixmap(void);
|
|
|
|
#endif
|
1999-09-23 16:27:16 -07:00
|
|
|
extern void shaped_window_apply_mask(Drawable, Pixmap);
|
1999-08-17 16:01:18 -07:00
|
|
|
extern void set_icon_pixmap(char *, XWMHints *);
|
1999-08-17 18:12:47 -07:00
|
|
|
#ifdef USE_EFFECTS
|
|
|
|
extern int fade_in(ImlibImage *, int);
|
|
|
|
extern int fade_out(ImlibImage *, int);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_XFUNCPROTOEND
|
1999-08-17 16:01:18 -07:00
|
|
|
|
|
|
|
#endif /* _PIXMAP_H */
|