wmbutton: wmbutton.h and wmb_libs.c code clean
This patch is a code clean patch: - Removes spaces and tabs at end of line. - Remove curly brackets not needed. - Change spaces by tabs. - Add spaces after and before operators. - Removes spaces not needed. - Better code style. - Added void as function argument.
This commit is contained in:
parent
cc68392ccb
commit
1400c7f7a6
2 changed files with 603 additions and 573 deletions
|
@ -15,7 +15,6 @@
|
|||
#include <string.h>
|
||||
#include "wmbutton.h"
|
||||
|
||||
|
||||
/****** ToolTip Globals ***********************************************/
|
||||
|
||||
static struct timeval _tStart;
|
||||
|
@ -29,7 +28,8 @@ GC _gcMono= 0;
|
|||
Window _wTooltip;
|
||||
|
||||
/****** Parse Command Line ********************************************/
|
||||
void parseargs(int argc, char **argv) {
|
||||
void parseargs(int argc, char **argv)
|
||||
{
|
||||
int current;
|
||||
char *Home = getenv("HOME");
|
||||
|
||||
|
@ -71,16 +71,16 @@ void parseargs(int argc, char **argv) {
|
|||
|
||||
if (!Config.configfile) {
|
||||
if (Home != NULL) {
|
||||
Config.configfile = malloc(
|
||||
strlen(Home) + strlen(CONFFILENAME) + 1);
|
||||
Config.configfile = malloc(strlen(Home) +
|
||||
strlen(CONFFILENAME) + 1);
|
||||
sprintf(Config.configfile, "%s%s", Home, CONFFILENAME);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Config.buttonfile) {
|
||||
if (Home != NULL) {
|
||||
Config.buttonfile = malloc(
|
||||
strlen(Home) + strlen(BUTTONFILENAME) + 1);
|
||||
Config.buttonfile = malloc(strlen(Home) +
|
||||
strlen(BUTTONFILENAME) + 1);
|
||||
sprintf(Config.buttonfile, "%s%s", Home, BUTTONFILENAME);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ void parseargs(int argc, char **argv) {
|
|||
}
|
||||
|
||||
/****** Show Usage Information ****************************************/
|
||||
void show_usage() {
|
||||
void show_usage(void)
|
||||
{
|
||||
extern char *app_name;
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
@ -121,12 +122,12 @@ void show_usage() {
|
|||
fprintf(stderr, "-n Turn off tooltips.\n");
|
||||
fprintf(stderr, "\n");
|
||||
exit(0);
|
||||
}/***********************************************************************/
|
||||
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
||||
/****** Error Handler Routine *****************************************/
|
||||
void err_mess(int err, char *str) {
|
||||
|
||||
void err_mess(int err, char *str)
|
||||
{
|
||||
switch (err) {
|
||||
case FAILDISP:
|
||||
fprintf(stderr, "Fail: XOpenDisplay for %s\n", str);
|
||||
|
@ -165,34 +166,38 @@ void err_mess(int err, char *str) {
|
|||
fprintf(stderr, "Fail: %s\n", str);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
}/***********************************************************************/
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* RunAppN(int app)
|
||||
*
|
||||
* Run the command given in the configuration file 'configfile'
|
||||
***********************************************************************/
|
||||
void RunAppN( int app ) {
|
||||
void RunAppN(int app)
|
||||
{
|
||||
char *cmndstr;
|
||||
extern struct Config_t Config;
|
||||
|
||||
cmndstr = Parse(app); // Get command to pass to system
|
||||
cmndstr = Parse(app); /* Get command to pass to system */
|
||||
|
||||
if (Config.Verbose) fprintf(stderr, "Command String: %s", cmndstr);
|
||||
if (Config.Verbose)
|
||||
fprintf(stderr, "Command String: %s", cmndstr);
|
||||
|
||||
if (cmndstr != NULL) {
|
||||
system(cmndstr); // if there's a command, run it
|
||||
system(cmndstr); /* if there's a command, run it */
|
||||
free(cmndstr);
|
||||
}
|
||||
}/***********************************************************************/
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* Parse(int app)
|
||||
*
|
||||
* Parses the file 'configfile' for command to execute.
|
||||
***********************************************************************/
|
||||
char *Parse(int app) {
|
||||
char *Parse(int app)
|
||||
{
|
||||
FILE *fp;
|
||||
char Buf[BUFFER_SIZE];
|
||||
char *Ptr;
|
||||
|
@ -211,15 +216,19 @@ char *Parse(int app) {
|
|||
if (!Ptr)
|
||||
return Ptr;
|
||||
|
||||
Ptr = strchr(Buf, '\t'); // find first tab
|
||||
if (Ptr == NULL) Ptr = strchr(Buf, ' '); // or space charater
|
||||
if (Ptr == NULL) return(NULL);
|
||||
Ptr++;
|
||||
Ptr = strchr(Buf, '\t'); /* find first tab */
|
||||
if (Ptr == NULL)
|
||||
Ptr = strchr(Buf, ' '); /* or space charater */
|
||||
|
||||
if (Ptr == NULL)
|
||||
return(NULL);
|
||||
|
||||
Ptr++;
|
||||
Ptr = strdup(Ptr);
|
||||
|
||||
return(Ptr);
|
||||
}/**********************************************************************/
|
||||
return Ptr;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* initTime
|
||||
|
@ -227,19 +236,20 @@ char *Parse(int app) {
|
|||
* Copyright (c) 2001 Bruno Essmann <essmann@users.sourceforge.net>
|
||||
***********************************************************************/
|
||||
|
||||
void initTime () {
|
||||
void initTime(void)
|
||||
{
|
||||
extern struct Config_t Config;
|
||||
|
||||
if (Config.Verbose) {
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[ ] initializing time\n");
|
||||
}
|
||||
|
||||
gettimeofday(&_tStart, NULL);
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
long currentTimeMillis () {
|
||||
struct timeval tNow;
|
||||
struct timeval tElapsed;
|
||||
long currentTimeMillis(void)
|
||||
{
|
||||
struct timeval tNow, tElapsed;
|
||||
|
||||
gettimeofday(&tNow, NULL);
|
||||
|
||||
|
@ -247,18 +257,19 @@ long currentTimeMillis () {
|
|||
tNow.tv_usec += 1000000;
|
||||
tNow.tv_sec--;
|
||||
}
|
||||
|
||||
tElapsed.tv_sec = tNow.tv_sec - _tStart.tv_sec;
|
||||
tElapsed.tv_usec = tNow.tv_usec - _tStart.tv_usec;
|
||||
return (tElapsed.tv_sec * 1000) + (tElapsed.tv_usec / 1000);
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void getWindowOrigin (Window w, int* nX, int* nY) {
|
||||
void getWindowOrigin(Window w, int *nX, int *nY)
|
||||
{
|
||||
extern Display *display;
|
||||
Window wWindow, wParent, wRoot;
|
||||
Window* wChildren;
|
||||
unsigned int nChildren;
|
||||
unsigned int ww, wh, wb, wd;
|
||||
unsigned int nChildren, ww, wh, wb, wd;
|
||||
int wx, wy;
|
||||
|
||||
wParent = w;
|
||||
|
@ -273,32 +284,36 @@ void getWindowOrigin (Window w, int* nX, int* nY) {
|
|||
} while (wParent != wRoot);
|
||||
|
||||
if (XGetGeometry(display, wWindow, &wRoot, &wx, &wy, &ww, &wh, &wb, &wd)) {
|
||||
if (nX) {
|
||||
if (nX)
|
||||
*nX = wx;
|
||||
}
|
||||
if (nY) {
|
||||
|
||||
if (nY)
|
||||
*nY = wy;
|
||||
}
|
||||
}
|
||||
}/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* getButtonLocation
|
||||
*
|
||||
* compute location for each button's tooltip (not perfect)
|
||||
***********************************************************************/
|
||||
void getButtonLocation (int nButton, int* nLocationX, int* nLocationY) {
|
||||
void getButtonLocation (int nButton, int *nLocationX, int *nLocationY)
|
||||
{
|
||||
*nLocationX = 0;
|
||||
*nLocationY = 8;
|
||||
|
||||
while (nButton > BUTTON_COLS) {
|
||||
*nLocationY += BUTTON_SIZE;
|
||||
nButton -= BUTTON_COLS;
|
||||
}
|
||||
|
||||
while (nButton > 0) {
|
||||
*nLocationX += BUTTON_SIZE - 1;
|
||||
nButton--;
|
||||
}
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
/* SkipWord & SkipSpaces: utility functions for getNicenedString */
|
||||
char *SkipWord(char *Text) {
|
||||
|
@ -307,6 +322,7 @@ char *SkipWord(char *Text) {
|
|||
while ((*Result != ' ') && (*Result != '\t') &&
|
||||
(*Result != '\n') && (*Result != 0x00))
|
||||
Result++;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -315,6 +331,7 @@ char *SkipSpaces(char *Text) {
|
|||
|
||||
while ((*Result == ' ') || (*Result == '\t') || (*Result == '\n'))
|
||||
Result++;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -325,13 +342,9 @@ char *SkipSpaces(char *Text) {
|
|||
* - cut if too long
|
||||
* - remove parameters, whitespace and the '&'...
|
||||
***********************************************************************/
|
||||
char* getNicenedString (char *old, int andAddSeparator) {
|
||||
char *WorkStr;
|
||||
char *WorkStrEnd;
|
||||
char *StartPtr;
|
||||
char *EndPtr;
|
||||
|
||||
char *RetStr;
|
||||
char *getNicenedString(char *old, int andAddSeparator)
|
||||
{
|
||||
char *WorkStr, *WorkStrEnd, *StartPtr, *EndPtr, *RetStr;
|
||||
|
||||
if (!old) {
|
||||
if (andAddSeparator)
|
||||
|
@ -340,7 +353,7 @@ char* getNicenedString (char *old, int andAddSeparator) {
|
|||
return strdup("--");
|
||||
}
|
||||
|
||||
RetStr = malloc(strlen(old) + 3 + 1); // 3 for Seperator
|
||||
RetStr = malloc(strlen(old) + 3 + 1); /* 3 for Seperator */
|
||||
*RetStr = 0x00;
|
||||
|
||||
WorkStr = strdup(old);
|
||||
|
@ -362,9 +375,8 @@ char* getNicenedString (char *old, int andAddSeparator) {
|
|||
|
||||
free(WorkStr);
|
||||
|
||||
if (andAddSeparator) {
|
||||
if (andAddSeparator)
|
||||
strcat(RetStr, "| ");
|
||||
}
|
||||
|
||||
return RetStr;
|
||||
}
|
||||
|
@ -374,14 +386,14 @@ char* getNicenedString (char *old, int andAddSeparator) {
|
|||
*
|
||||
*returns the 1..3 application names / commands to be shown in tooltip
|
||||
***********************************************************************/
|
||||
char* getButtonAppNames (int nButton) {
|
||||
char *str = NULL;
|
||||
char *tmp1,*tmp2;
|
||||
char *getButtonAppNames(int nButton)
|
||||
{
|
||||
char *tmp1, *tmp2, *str = NULL;
|
||||
|
||||
if (!( nButton < 0 || nButton > 9 )) {
|
||||
|
||||
// FIXME: _Might_ overflow, but it's unlikely.
|
||||
// Perhaps one should fix this sometime ;)
|
||||
/* FIXME: _Might_ overflow, but it's unlikely.
|
||||
* Perhaps one should fix this sometime ;) */
|
||||
str = (char*) calloc (sizeof(char), BUFFER_SIZE);
|
||||
|
||||
tmp1 = Parse(nButton + LMASK);
|
||||
|
@ -403,15 +415,19 @@ char* getButtonAppNames (int nButton) {
|
|||
free(tmp2);
|
||||
}
|
||||
|
||||
return(str);
|
||||
}/**********************************************************************/
|
||||
return str;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
int hasTooltipSupport () {
|
||||
int hasTooltipSupport(void)
|
||||
{
|
||||
return !Config.bTooltipDisable;
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
void showTooltip (int nButton, int nMouseX, int nMouseY) {
|
||||
void showTooltip (int nButton, int nMouseX, int nMouseY)
|
||||
{
|
||||
Pixmap pixmap, mask;
|
||||
int nMainWinX, nMainWinY;
|
||||
int nButtonX = 0, nButtonY = 0, nButtonWidth = 0, nButtonHeight = 0;
|
||||
|
@ -423,19 +439,16 @@ void showTooltip (int nButton, int nMouseX, int nMouseY) {
|
|||
extern Display *display;
|
||||
extern GC gc;
|
||||
|
||||
if (Config.bTooltipDisable || nButton == -1) {
|
||||
if (Config.bTooltipDisable || nButton == -1)
|
||||
return;
|
||||
}
|
||||
if (_bTooltip) {
|
||||
|
||||
if (_bTooltip)
|
||||
hideTooltip();
|
||||
}
|
||||
|
||||
|
||||
if (Config.Verbose) {
|
||||
fprintf(stdout, "[%8ld] showing tooltip for button %d at %d, %d\n",
|
||||
currentTimeMillis(),
|
||||
nButton, nMouseX, nMouseY);
|
||||
}
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout,
|
||||
"[%8ld] showing tooltip for button %d at %d, %d\n",
|
||||
currentTimeMillis(), nButton, nMouseX, nMouseY);
|
||||
|
||||
szText = getButtonAppNames(nButton);
|
||||
if(!szText)
|
||||
|
@ -445,16 +458,15 @@ void showTooltip (int nButton, int nMouseX, int nMouseY) {
|
|||
|
||||
nWidth = XTextWidth(_fTooltip, szText, strlen(szText)) + 16;
|
||||
nHeight = _nFontHeight + 4;
|
||||
if (nHeight < 16) {
|
||||
if (nHeight < 16)
|
||||
nHeight = 16;
|
||||
}
|
||||
if (nWidth < nHeight) {
|
||||
|
||||
if (nWidth < nHeight)
|
||||
nWidth = nHeight;
|
||||
}
|
||||
if (Config.Verbose) {
|
||||
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[%8ld] tooltip size: %d, %d\n",
|
||||
currentTimeMillis(), nWidth, nHeight);
|
||||
}
|
||||
|
||||
getWindowOrigin(iconwin, &nMainWinX, &nMainWinY);
|
||||
getButtonLocation(nButton, &nButtonX, &nButtonY);
|
||||
|
@ -466,16 +478,15 @@ void showTooltip (int nButton, int nMouseX, int nMouseY) {
|
|||
if (nButtonX + nWidth > _nScreenWidth) {
|
||||
nSide = TOOLTIP_RIGHT;
|
||||
nX = nButtonX - nWidth + nButtonWidth / 2;
|
||||
if (nX < 0) {
|
||||
if (nX < 0)
|
||||
nX = 0;
|
||||
}
|
||||
} else {
|
||||
nSide = TOOLTIP_LEFT;
|
||||
nX = nButtonX + nButtonWidth / 2;
|
||||
}
|
||||
if (nX + nWidth > _nScreenWidth) {
|
||||
|
||||
if (nX + nWidth > _nScreenWidth)
|
||||
nX = _nScreenWidth - nWidth;
|
||||
}
|
||||
|
||||
if (nButtonY - (nHeight + TOOLTIP_SPACE) < 0) {
|
||||
nSide |= TOOLTIP_TOP;
|
||||
|
@ -505,32 +516,38 @@ void showTooltip (int nButton, int nMouseX, int nMouseY) {
|
|||
XFreePixmap(display, pixmap);
|
||||
|
||||
free(szText);
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
void hideTooltip () {
|
||||
void hideTooltip(void)
|
||||
{
|
||||
extern struct Config_t Config;
|
||||
extern Display *display;
|
||||
|
||||
if (Config.bTooltipDisable) {
|
||||
if (Config.bTooltipDisable)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_bTooltip) {
|
||||
if (Config.Verbose) {
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[%8ld] hiding tooltip\n", currentTimeMillis());
|
||||
}
|
||||
|
||||
XUnmapWindow(display, _wTooltip);
|
||||
_bTooltip = 0;
|
||||
}
|
||||
}/**********************************************************************/
|
||||
|
||||
int hasTooltip () {
|
||||
if (Config.bTooltipDisable) {
|
||||
return 0;
|
||||
}
|
||||
return _bTooltip;
|
||||
}/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
void initTooltip () {
|
||||
int hasTooltip(void)
|
||||
{
|
||||
if (Config.bTooltipDisable)
|
||||
return 0;
|
||||
|
||||
return _bTooltip;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
void initTooltip(void)
|
||||
{
|
||||
XSetWindowAttributes attribs;
|
||||
unsigned long vmask;
|
||||
extern Display *display;
|
||||
|
@ -539,16 +556,15 @@ void initTooltip () {
|
|||
extern Window rootwin, win;
|
||||
|
||||
if (Config.bTooltipDisable) {
|
||||
if (Config.Verbose) {
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[%8ld] initializing tooltips (disabled)\n",
|
||||
currentTimeMillis());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (Config.Verbose) {
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[%8ld] initializing tooltips\n", currentTimeMillis());
|
||||
}
|
||||
|
||||
_fTooltip = XLoadQueryFont(display, Config.szTooltipFont);
|
||||
if (!_fTooltip) {
|
||||
fprintf(stderr, "%s: couldn't allocate font '%s'.\n", app_name, Config.szTooltipFont);
|
||||
|
@ -556,11 +572,12 @@ void initTooltip () {
|
|||
fprintf(stderr, "%s: Use option -F <font>\n", app_name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
_nFontHeight = _fTooltip->ascent + _fTooltip->descent;
|
||||
_nFontY = _fTooltip->ascent;
|
||||
_nScreenWidth = WidthOfScreen(ScreenOfDisplay(display, screen));
|
||||
_nScreenHeight = HeightOfScreen(ScreenOfDisplay(display, screen));
|
||||
if (Config.Verbose) {
|
||||
if (Config.Verbose)
|
||||
fprintf(stdout, "[%8ld] configuring tooltip font:\n" \
|
||||
"[%8ld] - '%s'\n" \
|
||||
"[%8ld] - font-height= %d, font-ascent= %d\n" \
|
||||
|
@ -569,7 +586,6 @@ void initTooltip () {
|
|||
currentTimeMillis(), Config.szTooltipFont,
|
||||
currentTimeMillis(), _nFontHeight, _nFontY,
|
||||
currentTimeMillis(), _nScreenWidth, _nScreenHeight);
|
||||
}
|
||||
|
||||
vmask = CWSaveUnder | CWOverrideRedirect | CWBorderPixel;
|
||||
attribs.save_under = True;
|
||||
|
@ -578,26 +594,32 @@ void initTooltip () {
|
|||
_wTooltip = XCreateWindow(display, rootwin, 1, 1, 10, 10, 1,
|
||||
CopyFromParent, CopyFromParent,
|
||||
CopyFromParent, vmask, &attribs);
|
||||
|
||||
if (win == 0) {
|
||||
fprintf(stderr, "Cannot create tooltip window.\n");
|
||||
exit(-1);
|
||||
}
|
||||
}/**********************************************************************/
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
void destroyTooltip () {
|
||||
void destroyTooltip(void)
|
||||
{
|
||||
extern Display *display;
|
||||
|
||||
if (Config.bTooltipDisable) {
|
||||
if (Config.bTooltipDisable)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gcMono) {
|
||||
XFreeGC(display, _gcMono);
|
||||
_gcMono = 0;
|
||||
}
|
||||
XDestroyWindow(display, _wTooltip);
|
||||
}/**********************************************************************/
|
||||
|
||||
void drawTooltipBalloon (Pixmap pix, GC gc, int x, int y, int w, int h, int side) {
|
||||
XDestroyWindow(display, _wTooltip);
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
void drawTooltipBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side)
|
||||
{
|
||||
extern Display *display;
|
||||
int rad = h * 3 / 10;
|
||||
XPoint pt[3];
|
||||
|
@ -620,6 +642,7 @@ void drawTooltipBalloon (Pixmap pix, GC gc, int x, int y, int w, int h, int side
|
|||
pt[1].y = y-TOOLTIP_SPACE;
|
||||
pt[2].y = y;
|
||||
}
|
||||
|
||||
if (side & TOOLTIP_RIGHT) {
|
||||
pt[0].x = x + w - h + 2 * h / 16;
|
||||
pt[1].x = x + w - h + 11 * h / 16;
|
||||
|
@ -629,40 +652,42 @@ void drawTooltipBalloon (Pixmap pix, GC gc, int x, int y, int w, int h, int side
|
|||
pt[1].x = x + h - 11 * h /16;
|
||||
pt[2].x = x + h - 7 * h /16;
|
||||
}
|
||||
XFillPolygon(display, pix, gc, pt, 3, Convex, CoordModeOrigin);
|
||||
}/**********************************************************************/
|
||||
|
||||
Pixmap createTooltipPixmap (int width, int height, int side, Pixmap *mask) {
|
||||
XFillPolygon(display, pix, gc, pt, 3, Convex, CoordModeOrigin);
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
Pixmap createTooltipPixmap(int width, int height, int side, Pixmap *mask)
|
||||
{
|
||||
extern Display *display;
|
||||
extern GC gc;
|
||||
extern Pixel bg_pixel, fg_pixel;
|
||||
extern int depth;
|
||||
extern Window rootwin;
|
||||
Pixmap bitmap;
|
||||
Pixmap pixmap;
|
||||
Pixmap bitmap, pixmap;
|
||||
int x, y;
|
||||
|
||||
bitmap = XCreatePixmap(display, rootwin,
|
||||
width+TOOLTIP_SPACE, height+TOOLTIP_SPACE, 1);
|
||||
|
||||
if (!_gcMono) {
|
||||
if (!_gcMono)
|
||||
_gcMono = XCreateGC(display, bitmap, 0, NULL);
|
||||
}
|
||||
|
||||
XSetForeground(display, _gcMono, 0);
|
||||
XFillRectangle(display, bitmap, _gcMono, 0, 0,
|
||||
width+TOOLTIP_SPACE, height+TOOLTIP_SPACE);
|
||||
|
||||
pixmap = XCreatePixmap(display, rootwin,
|
||||
width+TOOLTIP_SPACE, height+TOOLTIP_SPACE, depth);
|
||||
pixmap = XCreatePixmap(display, rootwin, width+TOOLTIP_SPACE,
|
||||
height+TOOLTIP_SPACE, depth);
|
||||
XSetForeground(display, gc, Config.bTooltipSwapColors ? fg_pixel : bg_pixel);
|
||||
XFillRectangle(display, pixmap, gc, 0, 0,
|
||||
width+TOOLTIP_SPACE, height+TOOLTIP_SPACE);
|
||||
XFillRectangle(display, pixmap, gc, 0, 0, width+TOOLTIP_SPACE,
|
||||
height+TOOLTIP_SPACE);
|
||||
|
||||
if (side & TOOLTIP_BOTTOM) {
|
||||
if (side & TOOLTIP_BOTTOM)
|
||||
y = 0;
|
||||
} else {
|
||||
else
|
||||
y = TOOLTIP_SPACE;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
|
||||
XSetForeground(display, _gcMono, 1);
|
||||
|
@ -673,7 +698,8 @@ Pixmap createTooltipPixmap (int width, int height, int side, Pixmap *mask) {
|
|||
*mask = bitmap;
|
||||
|
||||
return pixmap;
|
||||
}/***********************************************************************/
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -681,11 +707,15 @@ Pixmap createTooltipPixmap (int width, int height, int side, Pixmap *mask) {
|
|||
*
|
||||
* Everyone else has one of these... Can't hurt to throw it in.
|
||||
***********************************************************************/
|
||||
int flush_expose(Window w) {
|
||||
int flush_expose(Window w)
|
||||
{
|
||||
extern Display *display;
|
||||
XEvent dummy;
|
||||
int i = 0;
|
||||
|
||||
while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) i++;
|
||||
return(i);
|
||||
}/***********************************************************************/
|
||||
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
|
||||
i++;
|
||||
|
||||
return i;
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
|
|
@ -78,27 +78,27 @@ struct Config_t {
|
|||
};
|
||||
|
||||
/****** Function Prototyes *******************************************/
|
||||
void RunAppN(int app); // function to run app N as found in conf file
|
||||
char *Parse(int app); // parse data in config file
|
||||
void RunAppN(int app); /* function to run app N as found in conf file */
|
||||
char *Parse(int app); /* parse data in config file */
|
||||
void parseargs(int argc, char **argv);
|
||||
char *readln(FILE *fp); // read line from file, return pointer to it
|
||||
void err_mess(int err, char *str); // Error Handling Routine
|
||||
void show_usage(void); // show usage message to stderr
|
||||
char *readln(FILE *fp); /* read line from file, return pointer to it */
|
||||
void err_mess(int err, char *str); /* Error Handling Routine */
|
||||
void show_usage(void); /* show usage message to stderr */
|
||||
int flush_expose(Window w);
|
||||
|
||||
|
||||
/****** Tooltip Function Prototypes **********************************/
|
||||
void initTooltip();
|
||||
void destroyTooltip ();
|
||||
int hasTooltipSupport ();
|
||||
void destroyTooltip(void);
|
||||
int hasTooltipSupport(void);
|
||||
void showTooltip(int nButton, int nMouseX, int nMouseY);
|
||||
void hideTooltip ();
|
||||
int hasTooltip ();
|
||||
void hideTooltip(void);
|
||||
int hasTooltip(void);
|
||||
void drawTooltipBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side);
|
||||
Pixmap createTooltipPixmap(int width, int height, int side, Pixmap *mask);
|
||||
|
||||
void initTime ();
|
||||
long currentTimeMillis ();
|
||||
void initTime(void);
|
||||
long currentTimeMillis(void);
|
||||
void getWindowOrigin(Window w, int *nX, int *nY);
|
||||
void getButtonLocation(int nButton, int *nLocationX, int *nLocationY);
|
||||
char *getButtonAppNames(int nButton);
|
||||
|
|
Loading…
Reference in a new issue