2005-11-18 18:54:58 +03:00
|
|
|
/*
|
2006-01-20 17:20:24 +03:00
|
|
|
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
2005-11-18 18:54:58 +03:00
|
|
|
* See LICENSE file for license details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
2006-05-02 01:32:04 +04:00
|
|
|
#include <X11/Xlocale.h>
|
2005-11-18 18:54:58 +03:00
|
|
|
|
2006-03-23 13:34:00 +03:00
|
|
|
#define BLITZ_FONT "fixed"
|
2006-05-19 20:20:26 +04:00
|
|
|
#define BLITZ_FOCUSCOLORS "#ffffff #335577 #447799"
|
|
|
|
#define BLITZ_SELCOLORS "#ffffff #112233 #224466"
|
2006-03-23 13:34:00 +03:00
|
|
|
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
|
2005-11-18 18:54:58 +03:00
|
|
|
|
2006-05-17 13:59:59 +04:00
|
|
|
/*
|
2006-05-10 17:33:53 +04:00
|
|
|
#ifdef X_HAVE_UTF8_STRING
|
|
|
|
#define Xi18nTextPropertyToTextList Xutf8TextPropertyToTextList
|
|
|
|
#define Xi18nDrawString Xutf8DrawString
|
|
|
|
#define Xi18nTextExtents Xutf8TextExtents
|
|
|
|
#else
|
2006-05-17 13:59:59 +04:00
|
|
|
*/
|
2006-05-10 17:33:53 +04:00
|
|
|
#define Xi18nTextPropertyToTextList XmbTextPropertyToTextList
|
|
|
|
#define Xi18nDrawString XmbDrawString
|
|
|
|
#define Xi18nTextExtents XmbTextExtents
|
2006-05-17 13:59:59 +04:00
|
|
|
/*
|
2006-05-10 17:33:53 +04:00
|
|
|
#endif
|
2006-05-17 13:59:59 +04:00
|
|
|
*/
|
2006-05-10 17:33:53 +04:00
|
|
|
|
2005-11-18 18:54:58 +03:00
|
|
|
typedef enum {
|
|
|
|
CENTER, WEST, NWEST, NORTH, NEAST, EAST,
|
|
|
|
SEAST, SOUTH, SWEST
|
2006-04-23 22:00:47 +04:00
|
|
|
} BlitzAlign;
|
2005-11-18 18:54:58 +03:00
|
|
|
|
2006-02-02 18:44:45 +03:00
|
|
|
typedef struct {
|
2005-12-05 01:45:59 +03:00
|
|
|
unsigned long bg;
|
|
|
|
unsigned long fg;
|
|
|
|
unsigned long border;
|
2006-04-23 22:00:47 +04:00
|
|
|
} BlitzColor;
|
2006-02-02 18:44:45 +03:00
|
|
|
|
|
|
|
typedef struct {
|
2006-04-24 01:32:36 +04:00
|
|
|
XFontStruct *xfont;
|
2006-04-24 03:01:49 +04:00
|
|
|
XFontSet set;
|
2006-05-02 01:32:04 +04:00
|
|
|
int ascent;
|
|
|
|
int descent;
|
2006-04-23 22:00:47 +04:00
|
|
|
} BlitzFont;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BlitzAlign align;
|
2006-02-02 18:44:45 +03:00
|
|
|
Drawable drawable;
|
|
|
|
GC gc;
|
2006-04-23 22:00:47 +04:00
|
|
|
BlitzColor color;
|
|
|
|
BlitzFont font;
|
2006-03-23 13:34:00 +03:00
|
|
|
XRectangle rect; /* relative rect */
|
|
|
|
XRectangle *notch; /* relative notch rect */
|
2005-12-05 01:45:59 +03:00
|
|
|
char *data;
|
2006-04-23 22:00:47 +04:00
|
|
|
} BlitzDraw;
|
|
|
|
|
|
|
|
/* font.c */
|
2006-04-25 15:33:30 +04:00
|
|
|
unsigned int blitz_textwidth(Display *dpy, BlitzFont *font, char *text);
|
2006-04-23 22:00:47 +04:00
|
|
|
void blitz_loadfont(Display *dpy, BlitzFont *font, char *fontstr);
|
|
|
|
|
|
|
|
/* color.c */
|
|
|
|
int blitz_loadcolor(Display *dpy, BlitzColor *c, int mon, char *colstr);
|
2005-11-18 18:54:58 +03:00
|
|
|
|
|
|
|
/* draw.c */
|
2006-04-23 22:00:47 +04:00
|
|
|
void blitz_drawlabel(Display *dpy, BlitzDraw *d);
|
|
|
|
void blitz_drawborder(Display *dpy, BlitzDraw *d);
|
2005-11-18 18:54:58 +03:00
|
|
|
|
|
|
|
/* geometry.c */
|
2006-04-23 22:00:47 +04:00
|
|
|
BlitzAlign blitz_align_of_rect(XRectangle *rect, int x, int y);
|
|
|
|
int blitz_strtoalign(BlitzAlign *result, char *val);
|
2006-03-10 20:22:48 +03:00
|
|
|
int blitz_strtorect(XRectangle *root, XRectangle *r, char *val);
|
|
|
|
Bool blitz_ispointinrect(int x, int y, XRectangle *r);
|
|
|
|
int blitz_distance(XRectangle *origin, XRectangle *target);
|
2005-12-16 04:59:27 +03:00
|
|
|
void blitz_getbasegeometry(unsigned int size, unsigned int *cols, unsigned int *rows);
|