wmusic: divide time once in `DrawTime`.
[dockapps.git] / wmmixer-alsa / wmmixer-alsa.h
blobec11894ed24e08563f0be77d6d0c4e55e9242318
1 #define NORMSIZE 64
2 #define ASTEPSIZE 56
3 #define NAME "wmmixer"
4 #define CLASS "WMMixer"
6 #define BACKCOLOR "#282828"
7 #define LEDCOLOR "LightSeaGreen"
9 #define CARD_NUM 0
10 #define MIXER_NUM 0
12 #define VERSION "0.6"
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <unistd.h>
18 #include <math.h>
20 #include <sys/asoundlib.h>
22 #include <X11/X.h>
23 #include <X11/Xlib.h>
24 #include <X11/Xutil.h>
25 #include <X11/Xproto.h>
26 #include <X11/xpm.h>
27 #include <X11/extensions/shape.h>
29 Pixmap pm_main;
30 Pixmap pm_tile;
31 Pixmap pm_disp;
32 Pixmap pm_mask;
33 Pixmap pm_icon;
35 #include "XPM/wmmixer.xpm"
36 #include "XPM/tile.xpm"
37 #include "XPM/icons.xpm"
39 int wmaker;
40 int ushape;
41 int astep;
42 char display[32];
43 char position[32];
44 int winsize;
46 char backcolor[32];
47 char ledcolor[32];
49 Atom _XA_GNUSTEP_WM_FUNC;
50 Atom deleteWin;
51 Display *d_display;
52 Window w_icon;
53 Window w_main;
54 Window w_root;
55 Window w_activewin;
57 GC gc_gc;
58 unsigned long color[4];
60 snd_mixer_t *mixer_handle;
61 snd_mixer_elements_t elements;
63 typedef struct elementinfoStruct {
64 snd_mixer_element_info_t info;
65 snd_mixer_element_t element;
66 int icon;
67 struct elementinfoStruct *next;
68 struct elementinfoStruct *prev;
69 } elementinfo;
71 elementinfo *element;
72 elementinfo *cure;
74 int curchannel;
75 int curleft;
76 int curright;
78 int btnstate;
79 #define BTNNEXT 1
80 #define BTNPREV 2
81 #define BTNREC 4
82 #define RPTINTERVAL 5
84 int rpttimer;
85 int dragging;
86 int count;
87 int channel[80];
89 void initXWin(int argc, char **argv);
90 void freeXWin();
91 void createWin(Window *win, int x, int y);
92 unsigned long getColor(char *colorname);
93 unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2);
94 void scanArgs(int argc, char **argv);
96 void checkVol(void);
97 void setVol(int left, int right);
98 void callbacks(void);
99 int convert_range(int val, int omin, int omax, int nmin, int nmax);
100 void pressEvent(XButtonEvent *xev);
101 void releaseEvent(XButtonEvent *xev);
102 void motionEvent(XMotionEvent *xev);
103 void repaint();
104 void update();
105 void drawLeft();
106 void drawRight();
107 void drawBtns(int btns);
108 void drawBtn(int x, int y, int w, int h, int down);
110 void init_mixer(void);
111 void init_elements(void);
112 elementinfo *add_element(void);