-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtmixer.h
138 lines (114 loc) · 4.12 KB
/
gtmixer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <stdlib.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <gtk/gtk.h>
#include "uthash.h"
#include <sys/types.h>
#include <sys/soundcard.h>
#include <libgen.h>
#include "dtrace.h"
#ifndef DEBUG
#define DEBUG 0
#endif
#ifndef GIT_VERSION
#define GIT_VERSION "0"
#endif
#define VER "1.0.2"
#define gettext(x) (x)
#define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0
#define DPRINT(fmt, ...) do { if (DEBUG || debug) fprintf(stderr, "[DEBUG] [%s:%d] %s(): " fmt, __FILE__, \
__LINE__, __func__, __VA_ARGS__); } while (0)
#define MAXMIXUNIT 100
#define SHAREPATH "/usr/local/share/gtmixer/"
#define CONFIGFILE "/.gtmixerrc"
#define DEFAULTDEV "/dev/mixer"
#define DEFAULTFONT "Sans 8"
#define PANEL_Y_SIZE 25
#define TRAY_VOLMUTE "/usr/local/share/gtmixer/icons/tray/1.png"
#define TRAY_DEMUTE "/usr/local/share/gtmixer/icons/tray/2.png"
#define TRAY_INMUTE "/usr/local/share/gtmixer/icons/tray/3.png"
#define VOLSET "/usr/local/share/gtmixer/icons/tray/273.png"
#define PCMSET "/usr/local/share/gtmixer/icons/tray/431.png"
#define PHONESET "/usr/local/share/gtmixer/icons/tray/430.png"
#define MAXDEVLEN 100
#define MAXFONTLEN 100
#define MAXDIRNAME 255
#define MAXMIXERKEY 30
int sndunit, sndunitnw, volstate, pcmstate;
int mixstate[MAXMIXUNIT];
unsigned short debug;
struct
{
char directory[MAXDIRNAME]; /* store the config path */
char device[MAXDEVLEN]; /* device for output sound (/dev/mixer) */
int fp; /* front panel unit output */
int punit; /* phonehead unit output */
int ounit; /* primary sound output unit */
GdkColor ncolor; /* declare colour for form */
gchar nfont[MAXFONTLEN]; /* declare font for form */
int phonesysctl; /* switch to head phone via sysctl(8) */
} fconfig; /* global config struct */
struct mixerhash {
char name[MAXMIXERKEY]; /* mixer value (vol, pcm, etc.) as the key */
int id;
UT_hash_handle hh; /* makes this structure hashable */
};
GtkWidget* checkphone;
GtkWidget* menu;
GtkWidget* menuItemView;
GtkWidget* menuItemMix;
GtkWidget* menuItemSet;
GtkWidget* Separator1;
GtkWidget* menuItemExit;
GtkWidget* hscaleVol;
GtkWidget* hscalePcm;
GtkWidget* mixer_hscale[MAXMIXUNIT];
GtkWidget* devEntry;
GtkWidget* FPEntry;
GtkWidget* phoneEntry;
GtkWidget* phoneCb;
GtkWidget* outEntry;
GtkWidget* ColorSelect;
GtkWidget* FontSelect;
GtkWidget* settings_window;
GtkWidget* mixer_window;
GtkWidget* window;
GtkWidget* dialog;
GtkStatusIcon* trayIcon;
GtkBuilder* builder;
GtkWidget* app;
static gchar *labels[5] = {
"Head Phones enable",
"<span size='small'>Baby bath</span>",
"<span color='Blue' size='small'>Max</span>",
"<span color='Red' size='small'>Silence</span>",
"<span color='Green' size='small'>Base</span>"
};
void usage(int devmask, int recmask);
int gui_init();
void gui_loop();
void print_version(char *myname);
void set_app_font (const char *fontname);
int get_mixer_state(char * mixprm);
void get_mixer_state_all ();
void get_mixer_unit ();
void clear_mixer_hash ();
int set_mixer_state(char * mixprm, int st);
void on_popup_clicked (GtkButton*, GtkWidget*);
void on_popup_clicked (GtkButton*, GtkWidget*);
void on_focus_out (GtkWidget* window);
void checkphone_toogle_signal(GtkWidget *widget, gpointer window);
gboolean * TimerFunc (gpointer);
void cb_digits_scale_vol(GtkWidget *widget, gpointer window);
void cb_digits_scale_pcm(GtkWidget *widget, gpointer window);
gboolean on_popup_window_event(GtkWidget*, GdkEventExpose*);
int get_mixer_unit_by_name(const char *mixname);
static void destroy (GtkWidget *window, gpointer data);
static void trayIconActivated(GObject *trayicon, gpointer window);
static void trayView(GtkMenuItem *item, gpointer window);
static void trayExit(GtkMenuItem *item, gpointer user_data);
static void trayIconPopup(GtkStatusIcon *status_icon, guint button, guint32 activate_time, gpointer popUpMenu);
static int res_name(const char *name, int mask);
static void print_recsrc(int recsrc, int recmask, int sflag);
int handler(void* user, const char* section, const char* name, const char* value);