Indent tweaks, cleanups

This commit is contained in:
Kim Woelders 2021-08-26 20:13:56 +02:00
parent 9d0e6438db
commit 9cb4561227
26 changed files with 143 additions and 253 deletions

2
.indent.pro vendored
View File

@ -1 +1 @@
-i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80 -i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -brs -l80

View File

@ -20,8 +20,7 @@
#define CRSR_WDTH 2 #define CRSR_WDTH 2
typedef struct epplet_window typedef struct {
{
Window win; Window win;
int w; int w;
int h; int h;
@ -29,8 +28,7 @@ typedef struct epplet_window
Pixmap bg_pmap; Pixmap bg_pmap;
Pixmap bg_mask; Pixmap bg_mask;
Pixmap bg_bg; Pixmap bg_bg;
} } EppWindow;
EppWindow;
typedef EppWindow *Epplet_window; typedef EppWindow *Epplet_window;
EAPI Display *disp = NULL; EAPI Display *disp = NULL;
@ -80,27 +78,27 @@ static void *event_data = NULL;
static void *comms_data = NULL; static void *comms_data = NULL;
static void *child_data = NULL; static void *child_data = NULL;
static void (*expose_func) (void *data, Window win, int x, int y, int w, static void (*expose_func)(void *data, Window win, int x, int y, int w,
int h) = NULL; int h) = NULL;
static void (*moveresize_func) (void *data, Window win, int x, int y, static void (*moveresize_func)(void *data, Window win, int x, int y,
int w, int h) = NULL; int w, int h) = NULL;
static void (*buttonpress_func) (void *data, Window win, int x, int y, static void (*buttonpress_func)(void *data, Window win, int x, int y,
int b) = NULL; int b) = NULL;
static void (*buttonrelease_func) (void *data, Window win, int x, int y, static void (*buttonrelease_func)(void *data, Window win, int x, int y,
int b) = NULL; int b) = NULL;
static void (*mousemotion_func) (void *data, Window win, int x, int y) = static void (*mousemotion_func)(void *data, Window win, int x, int y) =
NULL; NULL;
static void (*keypress_func) (void *data, Window win, char *key) = NULL; static void (*keypress_func)(void *data, Window win, char *key) = NULL;
static void (*keyrelease_func) (void *data, Window win, char *key) = static void (*keyrelease_func)(void *data, Window win, char *key) =
NULL; NULL;
static void (*enter_func) (void *data, Window win) = NULL; static void (*enter_func)(void *data, Window win) = NULL;
static void (*leave_func) (void *data, Window win) = NULL; static void (*leave_func)(void *data, Window win) = NULL;
static void (*focusin_func) (void *data, Window win) = NULL; static void (*focusin_func)(void *data, Window win) = NULL;
static void (*focusout_func) (void *data, Window win) = NULL; static void (*focusout_func)(void *data, Window win) = NULL;
static int (*delete_func) (void *data, Window win) = NULL; static int (*delete_func)(void *data, Window win) = NULL;
static void (*event_func) (void *data, XEvent * ev) = NULL; static void (*event_func)(void *data, XEvent * ev) = NULL;
static void (*comms_func) (void *data, const char *s) = NULL; static void (*comms_func)(void *data, const char *s) = NULL;
static void (*child_func) (void *data, int pid, int exit_code) = NULL; static void (*child_func)(void *data, int pid, int exit_code) = NULL;
/* For Keeping a list of windows owned by the epplet, to loop through and /* For Keeping a list of windows owned by the epplet, to loop through and
* do stuff with. */ * do stuff with. */
@ -114,19 +112,17 @@ static Window Epplet_internal_create_window(int w, int h,
static void remember_stuff(void *data); static void remember_stuff(void *data);
#define MWM_HINTS_DECORATIONS (1L << 1) #define MWM_HINTS_DECORATIONS (1L << 1)
typedef struct _mwmhints typedef struct {
{
unsigned long flags; unsigned long flags;
unsigned long functions; unsigned long functions;
unsigned long decorations; unsigned long decorations;
long inputMode; long inputMode;
unsigned long status; unsigned long status;
} } MWMHints;
MWMHints;
struct _etimer struct _etimer {
{
char *name; char *name;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
double in; double in;
char just_added; char just_added;
@ -136,12 +132,10 @@ struct _etimer
#define ESYNC ECommsSend("nop");free(ECommsWaitForMessage()); #define ESYNC ECommsSend("nop");free(ECommsWaitForMessage());
/* The structures for the config file management ... */ /* The structures for the config file management ... */
typedef struct _configdict typedef struct {
{
ConfigItem *entries; ConfigItem *entries;
int num_entries; int num_entries;
} } ConfigDict;
ConfigDict;
static ConfigDict *config_dict = NULL; static ConfigDict *config_dict = NULL;
@ -187,13 +181,11 @@ static void Epplet_textbox_textsize(Epplet_gadget gadget, int *w,
int Epplet_textbox_spacesize(Epplet_gadget gadget); int Epplet_textbox_spacesize(Epplet_gadget gadget);
static void Epplet_find_instance(const char *name); static void Epplet_find_instance(const char *name);
typedef struct gad_general typedef struct {
{
GadType type; GadType type;
char visible; char visible;
Epplet_window parent; Epplet_window parent;
} } GadGeneral;
GadGeneral;
#define GADGET_GET_TYPE(gad) (((GadGeneral *) (gad))->type) #define GADGET_GET_TYPE(gad) (((GadGeneral *) (gad))->type)
#ifdef __GNUC__ #ifdef __GNUC__
@ -222,8 +214,7 @@ GadGeneral;
if (GADGET_GET_TYPE(gad) != (type)) return (rval);} while (0) if (GADGET_GET_TYPE(gad) != (type)) return (rval);} while (0)
#endif #endif
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -234,14 +225,12 @@ typedef struct
char pop; char pop;
Epplet_gadget pop_parent; Epplet_gadget pop_parent;
char *std; char *std;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Pixmap pmap, mask; Pixmap pmap, mask;
} } GadButton;
GadButton;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -251,14 +240,12 @@ typedef struct
char *contents; char *contents;
char hilited; char hilited;
char size; char size;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Pixmap pmap, mask; Pixmap pmap, mask;
} } GadTextBox;
GadTextBox;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -267,23 +254,19 @@ typedef struct
char hilited; char hilited;
char clicked; char clicked;
int *val; int *val;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Pixmap pmap, mask; Pixmap pmap, mask;
} } GadToggleButton;
GadToggleButton;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
Window win_in; Window win_in;
} } GadDrawingArea;
GadDrawingArea;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -292,14 +275,12 @@ typedef struct
char hilited; char hilited;
char clicked; char clicked;
int *val; int *val;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Window win_knob; Window win_knob;
} } GadHSlider;
GadHSlider;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -308,68 +289,55 @@ typedef struct
char hilited; char hilited;
char clicked; char clicked;
int *val; int *val;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Window win_knob; Window win_knob;
} } GadVSlider;
GadVSlider;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
int *val; int *val;
char dir; char dir;
Window win_in; Window win_in;
} } GadHBar;
GadHBar;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
int *val; int *val;
char dir; char dir;
Window win_in; Window win_in;
} } GadVBar;
GadVBar;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
int pw, ph; int pw, ph;
char *image; char *image;
} } GadImage;
GadImage;
typedef struct typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
char size; char size;
char *label; char *label;
} } GadLabel;
GadLabel;
typedef struct typedef struct {
{
char *label; char *label;
char *image; char *image;
int w, h; int w, h;
void (*func) (void *data); void (*func)(void *data);
void *data; void *data;
Epplet_gadget gadget; Epplet_gadget gadget;
} } GadPopEntry;
GadPopEntry;
typedef struct _gadpopupbutton GadPopupButton; typedef struct {
typedef struct
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -377,11 +345,9 @@ typedef struct
int entry_num; int entry_num;
GadPopEntry *entry; GadPopEntry *entry;
char changed; char changed;
} } GadPopup;
GadPopup;
struct _gadpopupbutton typedef struct {
{
GadGeneral general; GadGeneral general;
int x, y, w, h; int x, y, w, h;
Window win; Window win;
@ -393,7 +359,7 @@ struct _gadpopupbutton
char popped; char popped;
char *std; char *std;
Pixmap pmap, mask; Pixmap pmap, mask;
}; } GadPopupButton;
#if DEBUG_EVENTS #if DEBUG_EVENTS
static int static int
@ -705,10 +671,10 @@ Epplet_create_window_borderless(int w, int h, const char *title, char vertical)
Window Window
Epplet_create_window_config(int w, int h, const char *title, Epplet_create_window_config(int w, int h, const char *title,
void (*ok_func) (void *data), void (*ok_func)(void *data),
void *ok_data, void (*apply_func) (void *data), void *ok_data, void(*apply_func)(void *data),
void *apply_data, void *apply_data,
void (*cancel_func) (void *data), void *cancel_data) void(*cancel_func)(void *data), void *cancel_data)
{ {
Window ret; Window ret;
Epplet_gadget ok_btn, apply_btn, cancel_btn; Epplet_gadget ok_btn, apply_btn, cancel_btn;
@ -1242,15 +1208,14 @@ Epplet_register_delete_event_handler(int (*func)
} }
void void
Epplet_register_event_handler(void (*func) Epplet_register_event_handler(void (*func)(void *data, XEvent * ev), void *data)
(void *data, XEvent * ev), void *data)
{ {
event_data = data; event_data = data;
event_func = func; event_func = func;
} }
void void
Epplet_register_comms_handler(void (*func) (void *data, const char *s), Epplet_register_comms_handler(void (*func)(void *data, const char *s),
void *data) void *data)
{ {
comms_data = data; comms_data = data;
@ -1434,7 +1399,7 @@ Epplet_handle_event(XEvent * ev)
} }
void void
Epplet_timer(void (*func) (void *data), void *data, double in, Epplet_timer(void (*func)(void *data), void *data, double in,
const char *name) const char *name)
{ {
ETimer *et, *ptr, *pptr; ETimer *et, *ptr, *pptr;
@ -2017,7 +1982,6 @@ Epplet_del_gad(Epplet_gadget gadget)
} }
} }
} }
} }
int int
@ -2064,7 +2028,7 @@ Epplet_gadget_get_type(Epplet_gadget gad)
Epplet_gadget Epplet_gadget
Epplet_create_textbox(const char *image, const char *contents, int x, int y, Epplet_create_textbox(const char *image, const char *contents, int x, int y,
int w, int h, char size, void (*func) (void *data), int w, int h, char size, void (*func)(void *data),
void *data) void *data)
{ {
GadTextBox *g; GadTextBox *g;
@ -2650,7 +2614,7 @@ Epplet_gadget
Epplet_create_button(const char *label, const char *image, int x, int y, Epplet_create_button(const char *label, const char *image, int x, int y,
int w, int h, const char *std, Window parent, int w, int h, const char *std, Window parent,
Epplet_gadget pop_parent, Epplet_gadget pop_parent,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
GadButton *g; GadButton *g;
XSetWindowAttributes attr; XSetWindowAttributes attr;
@ -2713,7 +2677,7 @@ Epplet_create_button(const char *label, const char *image, int x, int y,
/* A cut down version for text-only buttons */ /* A cut down version for text-only buttons */
Epplet_gadget Epplet_gadget
Epplet_create_text_button(const char *label, int x, int y, Epplet_create_text_button(const char *label, int x, int y,
int w, int h, void (*func) (void *data), void *data) int w, int h, void (*func)(void *data), void *data)
{ {
return Epplet_create_button(label, NULL, x, y, w, h, NULL, 0, NULL, func, return Epplet_create_button(label, NULL, x, y, w, h, NULL, 0, NULL, func,
data); data);
@ -2722,7 +2686,7 @@ Epplet_create_text_button(const char *label, int x, int y,
/* A cut down version for stdimage-only buttons */ /* A cut down version for stdimage-only buttons */
Epplet_gadget Epplet_gadget
Epplet_create_std_button(const char *std, int x, int y, Epplet_create_std_button(const char *std, int x, int y,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
return Epplet_create_button(NULL, NULL, x, y, 12, 12, std, 0, NULL, func, return Epplet_create_button(NULL, NULL, x, y, 12, 12, std, 0, NULL, func,
data); data);
@ -2731,7 +2695,7 @@ Epplet_create_std_button(const char *std, int x, int y,
/* A cut down version for image-only buttons */ /* A cut down version for image-only buttons */
Epplet_gadget Epplet_gadget
Epplet_create_image_button(const char *image, int x, int y, Epplet_create_image_button(const char *image, int x, int y,
int w, int h, void (*func) (void *data), void *data) int w, int h, void (*func)(void *data), void *data)
{ {
return Epplet_create_button(NULL, image, x, y, w, h, NULL, 0, NULL, func, return Epplet_create_button(NULL, image, x, y, w, h, NULL, 0, NULL, func,
data); data);
@ -2883,7 +2847,7 @@ Epplet_draw_button(Epplet_gadget eg)
Epplet_gadget Epplet_gadget
Epplet_create_togglebutton(const char *label, const char *image, int x, Epplet_create_togglebutton(const char *label, const char *image, int x,
int y, int w, int h, int *val, int y, int w, int h, int *val,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
GadToggleButton *g; GadToggleButton *g;
XSetWindowAttributes attr; XSetWindowAttributes attr;
@ -3074,7 +3038,7 @@ Epplet_draw_drawingarea(Epplet_gadget eg)
Epplet_gadget Epplet_gadget
Epplet_create_hslider(int x, int y, int len, int min, int max, Epplet_create_hslider(int x, int y, int len, int min, int max,
int step, int jump, int *val, int step, int jump, int *val,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
GadHSlider *g; GadHSlider *g;
XSetWindowAttributes attr; XSetWindowAttributes attr;
@ -3153,7 +3117,7 @@ Epplet_draw_hslider(Epplet_gadget eg)
Epplet_gadget Epplet_gadget
Epplet_create_vslider(int x, int y, int len, int min, int max, Epplet_create_vslider(int x, int y, int len, int min, int max,
int step, int jump, int *val, int step, int jump, int *val,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
GadVSlider *g; GadVSlider *g;
XSetWindowAttributes attr; XSetWindowAttributes attr;
@ -3572,8 +3536,7 @@ Epplet_create_popup(void)
void void
Epplet_add_popup_entry(Epplet_gadget gadget, const char *label, Epplet_add_popup_entry(Epplet_gadget gadget, const char *label,
const char *pixmap, void (*func) (void *data), const char *pixmap, void (*func)(void *data), void *data)
void *data)
{ {
Epplet_add_sized_popup_entry(gadget, label, pixmap, -1, -1, func, data); Epplet_add_sized_popup_entry(gadget, label, pixmap, -1, -1, func, data);
} }
@ -3581,7 +3544,7 @@ Epplet_add_popup_entry(Epplet_gadget gadget, const char *label,
void void
Epplet_add_sized_popup_entry(Epplet_gadget gadget, const char *label, Epplet_add_sized_popup_entry(Epplet_gadget gadget, const char *label,
const char *pixmap, int w, int h, const char *pixmap, int w, int h,
void (*func) (void *data), void *data) void (*func)(void *data), void *data)
{ {
GadPopup *g; GadPopup *g;
@ -5647,7 +5610,6 @@ Epplet_load_config_file(const char *file)
Epplet_add_config(s2, s3); Epplet_add_config(s2, s3);
} }
fclose(f); fclose(f);
return;
} }
void void
@ -5664,7 +5626,6 @@ Epplet_load_config(void)
epplet_cfg_file = strdup(s); epplet_cfg_file = strdup(s);
Epplet_load_config_file(epplet_cfg_file); Epplet_load_config_file(epplet_cfg_file);
return;
} }
void void

View File

@ -43,20 +43,17 @@
/****************************************************************************/ /****************************************************************************/
typedef struct _etimer ETimer; typedef struct _etimer ETimer;
typedef void *Epplet_gadget; typedef void *Epplet_gadget;
typedef struct _rgb_buf
{
Imlib_Image *im;
}
*RGB_buf;
typedef struct _configitem typedef struct {
{ Imlib_Image *im;
} *RGB_buf;
typedef struct {
char *key; char *key;
char *value; char *value;
} } ConfigItem;
ConfigItem;
typedef enum gad_type typedef enum {
{
E_BUTTON, E_BUTTON,
E_DRAWINGAREA, E_DRAWINGAREA,
E_TEXTBOX, E_TEXTBOX,
@ -258,7 +255,7 @@ EAPI void Epplet_register_delete_event_handler(int (*func)
/* run function func and pass data data to it in in seconds (in is double */ /* run function func and pass data data to it in in seconds (in is double */
/* so you can for exmaple use 0.5 to have that function called in 0.5 */ /* so you can for exmaple use 0.5 to have that function called in 0.5 */
/* seconds from now ). You also attach the name to the timeout of name */ /* seconds from now ). You also attach the name to the timeout of name */
EAPI void Epplet_timer(void (*func) (void *data), void *data, EAPI void Epplet_timer(void (*func)(void *data), void *data,
double in, const char *name); double in, const char *name);
/* delete any timeout of name name in the queue. you should use unique */ /* delete any timeout of name name in the queue. you should use unique */
@ -289,23 +286,23 @@ EAPI Epplet_gadget Epplet_create_button(const char *label, const char *image,
int x, int y, int w, int h, int x, int y, int w, int h,
const char *std, Window parent, const char *std, Window parent,
Epplet_gadget pop_parent, Epplet_gadget pop_parent,
void (*func) (void *data), void *data); void (*func)(void *data), void *data);
/* A cut down version for text-only buttons */ /* A cut down version for text-only buttons */
EAPI Epplet_gadget Epplet_create_text_button(const char *label, int x, int y, EAPI Epplet_gadget Epplet_create_text_button(const char *label, int x, int y,
int w, int h, int w, int h,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* A cut down version for std-image-only buttons */ /* A cut down version for std-image-only buttons */
EAPI Epplet_gadget Epplet_create_std_button(const char *std, int x, int y, EAPI Epplet_gadget Epplet_create_std_button(const char *std, int x, int y,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* A cut down version for image-only buttons */ /* A cut down version for image-only buttons */
EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y, EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y,
int w, int h, int w, int h,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* create a textbox at coordinates (x, y), with 'image' as bg, 'contents' as /* create a textbox at coordinates (x, y), with 'image' as bg, 'contents' as
@ -315,8 +312,7 @@ EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y,
EAPI Epplet_gadget Epplet_create_textbox(const char *image, EAPI Epplet_gadget Epplet_create_textbox(const char *image,
const char *contents, int x, int y, const char *contents, int x, int y,
int w, int h, char size, int w, int h, char size,
void (*func) (void *data), void (*func)(void *data), void *data);
void *data);
/* Retrieve the current contents of the textbox */ /* Retrieve the current contents of the textbox */
EAPI const char *Epplet_textbox_contents(Epplet_gadget g); EAPI const char *Epplet_textbox_contents(Epplet_gadget g);
@ -340,14 +336,12 @@ EAPI Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h);
/* either side of the slider. whenever the slider changed func is called */ /* either side of the slider. whenever the slider changed func is called */
EAPI Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min, EAPI Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min,
int max, int step, int jump, int *val, int max, int step, int jump, int *val,
void (*func) (void *data), void (*func)(void *data), void *data);
void *data);
/* same as horizontal slider except vertical */ /* same as horizontal slider except vertical */
EAPI Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min, EAPI Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min,
int max, int step, int jump, int *val, int max, int step, int jump, int *val,
void (*func) (void *data), void (*func)(void *data), void *data);
void *data);
/* create a button (like normal buttons) except it toggles the value */ /* create a button (like normal buttons) except it toggles the value */
/* pointed to by val between 1 and 0. func is called whenever it changes */ /* pointed to by val between 1 and 0. func is called whenever it changes */
@ -355,7 +349,7 @@ EAPI Epplet_gadget Epplet_create_togglebutton(const char *label,
const char *image, const char *image,
int x, int y, int w, int h, int x, int y, int w, int h,
int *val, int *val,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* creates a button just like normal button except it pops up the popup */ /* creates a button just like normal button except it pops up the popup */
@ -374,14 +368,14 @@ EAPI Epplet_gadget Epplet_create_popup(void);
EAPI void Epplet_add_popup_entry(Epplet_gadget gadget, EAPI void Epplet_add_popup_entry(Epplet_gadget gadget,
const char *label, const char *label,
const char *pixmap, const char *pixmap,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* same as above, but specify a size */ /* same as above, but specify a size */
EAPI void Epplet_add_sized_popup_entry(Epplet_gadget gadget, EAPI void Epplet_add_sized_popup_entry(Epplet_gadget gadget,
const char *label, const char *label,
const char *pixmap, const char *pixmap,
int w, int h, int w, int h,
void (*func) (void *data), void (*func)(void *data),
void *data); void *data);
/* remove an entry from a popup gadget */ /* remove an entry from a popup gadget */
@ -501,12 +495,11 @@ EAPI Window Epplet_create_window_borderless(int w, int h,
* functions as null, the button won't be displayed. This means you can get * functions as null, the button won't be displayed. This means you can get
* just Ok and Cancel by supplying NULL for apply_cb. */ * just Ok and Cancel by supplying NULL for apply_cb. */
EAPI Window Epplet_create_window_config(int w, int h, const char *title, EAPI Window Epplet_create_window_config(int w, int h, const char *title,
void (*ok_func) (void *data), void (*ok_func)(void *data),
void *ok_data, void *ok_data,
void (*apply_func) (void *data), void (*apply_func)(void *data),
void *apply_data, void *apply_data,
void (*cancel_func) (void void (*cancel_func)(void *data),
*data),
void *cancel_data); void *cancel_data);
/* This is how you add gadgets to specific windows. When you create a /* This is how you add gadgets to specific windows. When you create a

View File

@ -222,7 +222,6 @@ CalcEphem(date, UT, c)
* Compute Earth-Moon distance * Compute Earth-Moon distance
*/ */
c->EarthMoonDistance = R; c->EarthMoonDistance = R;
} }
static double static double
@ -286,7 +285,6 @@ jd(ny, nm, nd, UT)
JD = B + C + D + day + 1720994.5; JD = B + C + D + day + 1720994.5;
return (JD); return (JD);
} }
static double static double
@ -364,7 +362,6 @@ Radec_to_Cart(ra, dec, r)
double ra, dec; /* RA and DEC */ double ra, dec; /* RA and DEC */
Vector *r; /* returns corresponding cartesian unit vector */ Vector *r; /* returns corresponding cartesian unit vector */
{ {
/* /*
* Convert ra/dec from degrees to radians * Convert ra/dec from degrees to radians
*/ */
@ -377,7 +374,6 @@ Radec_to_Cart(ra, dec, r)
r->x = cos(dec) * cos(ra); r->x = cos(dec) * cos(ra);
r->y = cos(dec) * sin(ra); r->y = cos(dec) * sin(ra);
r->z = sin(dec); r->z = sin(dec);
} }
int int

View File

@ -7,22 +7,19 @@
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
typedef struct Vector typedef struct {
{
double x; double x;
double y; double y;
double z; double z;
} Vector; } Vector;
typedef struct Position typedef struct {
{
double x; double x;
double y; double y;
double z; double z;
} Position; } Position;
typedef struct CTrans typedef struct {
{
double UT; /* Universal Time (in decimal hours) */ double UT; /* Universal Time (in decimal hours) */
int year; /* 2 digit year */ int year; /* 2 digit year */
int month; /* 2 digit month of year */ int month; /* 2 digit month of year */

View File

@ -54,7 +54,7 @@ out_cb(void *data __UNUSED__, Window w)
static Epplet_gadget static Epplet_gadget
epp_create_std_button(int x, int y, const char *std, epp_create_std_button(int x, int y, const char *std,
void (*func) (void *data), const void *data) void (*func)(void *data), const void *data)
{ {
return Epplet_create_button(NULL, NULL, x, y, 0, 0, std, 0, NULL, func, return Epplet_create_button(NULL, NULL, x, y, 0, 0, std, 0, NULL, func,
(void *)data); (void *)data);

View File

@ -276,7 +276,6 @@ apply_config(void)
Epplet_modify_config("show_total", buff); Epplet_modify_config("show_total", buff);
display_count(); display_count();
} }
} }
static void static void

View File

@ -156,7 +156,6 @@ empty_popup(void)
Epplet_modify_multi_config("Command", command_history, num_commands); Epplet_modify_multi_config("Command", command_history, num_commands);
Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL); Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL);
return;
} }
static void static void
@ -180,7 +179,6 @@ fill_popup(void)
Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL); Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL);
free(results); free(results);
return;
} }
static void static void

View File

@ -29,21 +29,14 @@
#define __BG_IMAGE "E-Mountbox-bg.png" #define __BG_IMAGE "E-Mountbox-bg.png"
#define __DEFAULT "E-Mountbox-blockdev.png" #define __DEFAULT "E-Mountbox-blockdev.png"
static struct static struct {
{
const char *key, *value; const char *key, *value;
} defaults[] = } defaults[] = {
{ {"BG_IMAGE", "E-Mountbox-bg.png"},
{ {"DEFAULT", "E-Mountbox-blockdev.png"},
"BG_IMAGE", "E-Mountbox-bg.png"}, {"EJECT_MODE", "2"},
{ {"DO_POLL", "1"},
"DEFAULT", "E-Mountbox-blockdev.png"}, {"POLLINTVAL", "5"}
{
"EJECT_MODE", "2"},
{
"DO_POLL", "1"},
{
"POLLINTVAL", "5"}
}; };
static const char *default_types[] = { static const char *default_types[] = {
@ -53,29 +46,24 @@ static const char *default_types[] = {
"jazz E-Mountbox-jazz.png" "jazz E-Mountbox-jazz.png"
}; };
typedef enum eject_mode typedef enum {
{
NO_EJECT, NO_EJECT,
MANUAL_EJECT, MANUAL_EJECT,
AUTO_EJECT AUTO_EJECT
} } EjectMode;
EjectMode;
typedef struct _tile Tile; typedef struct _tile Tile;
typedef struct _mountpointtype MountPointType; typedef struct _mountpointtype MountPointType;
typedef struct _mode Mode;
struct _mode typedef struct {
{
EjectMode eject_mode; EjectMode eject_mode;
int do_polling; int do_polling;
int polling_interval; int polling_interval;
int anim_mount; int anim_mount;
int show_buttons; int show_buttons;
}; } Mode;
struct _mountpointtype struct _mountpointtype {
{
char *key; char *key;
char *imagefile; char *imagefile;
Imlib_Image *image; Imlib_Image *image;
@ -83,16 +71,13 @@ struct _mountpointtype
MountPointType *prev; MountPointType *prev;
}; };
typedef struct _mountpoint typedef struct {
{
char *device; char *device;
char *path; char *path;
char mounted; char mounted;
} } MountPoint;
MountPoint;
struct _tile struct _tile {
{
Imlib_Image *image; Imlib_Image *image;
MountPoint *mountpoint; MountPoint *mountpoint;
Tile *prev; Tile *prev;
@ -770,7 +755,6 @@ IsTransparent(Imlib_Image * im, int x, int y)
static void static void
SetupMounts(void) SetupMounts(void)
{ {
/* first, parse /etc/fstab to see what user-mountable mountpoints we have */ /* first, parse /etc/fstab to see what user-mountable mountpoints we have */
if (!(ParseFstab())) if (!(ParseFstab()))
{ {
@ -969,7 +953,6 @@ static void
ModifyMountPointType(MountPointType * mpt, const char *key, ModifyMountPointType(MountPointType * mpt, const char *key,
const char *imagefile) const char *imagefile)
{ {
if (mpt) if (mpt)
{ {
if (key) if (key)

View File

@ -87,7 +87,7 @@ scroll_cddb_label(void *data)
Epplet_change_label(cddb_label, temp); Epplet_change_label(cddb_label, temp);
temp[MAX_LBL_LEN] = saved_char; temp[MAX_LBL_LEN] = saved_char;
saved_char = temp[0]; saved_char = temp[0];
memcpy(data, temp + 1, (size_t) length); memcpy(data, temp + 1, (size_t)length);
temp[length - 1] = saved_char; temp[length - 1] = saved_char;
} }
@ -409,7 +409,7 @@ update_cddb_tracks(void)
free(tracks); free(tracks);
tracks = (int *)calloc((size_t) DiscInfo.disc_total_tracks, sizeof(int)); tracks = (int *)calloc((size_t)DiscInfo.disc_total_tracks, sizeof(int));
/* Causes segfault... /* Causes segfault...
* if(tracks_popup != NULL) * if(tracks_popup != NULL)
@ -439,7 +439,7 @@ fake_cddb_tracks(void)
free(tracks); free(tracks);
tracks = (int *)calloc((size_t) DiscInfo.disc_total_tracks, sizeof(int)); tracks = (int *)calloc((size_t)DiscInfo.disc_total_tracks, sizeof(int));
tracks_popup = Epplet_create_popup(); tracks_popup = Epplet_create_popup();
@ -524,7 +524,7 @@ main(int argc, char **argv)
"EJECT" "EJECT"
}; };
int i; int i;
typedef void (*callback_func) (void *data); typedef void (*callback_func)(void *data);
callback_func button_funcs[] = { callback_func button_funcs[] = {
cb_close, play_cd, stop_cd, prev_track, next_track, cb_close, play_cd, stop_cd, prev_track, next_track,

View File

@ -7,8 +7,7 @@
Added ACPI power management support. Added ACPI power management support.
*/ */
typedef struct typedef struct {
{
char design_cap_unknown; char design_cap_unknown;
char last_full_unknown; char last_full_unknown;
char rate_unknown; char rate_unknown;

View File

@ -44,8 +44,7 @@ static const int cloak_delays[] = {
1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120
}; };
struct struct {
{
int fd; int fd;
int vol_l; int vol_l;
int vol_r; int vol_r;
@ -55,15 +54,13 @@ struct
static Epplet_gadget lbar, rbar, standby; static Epplet_gadget lbar, rbar, standby;
struct struct {
{
int cloak_anim; int cloak_anim;
int do_cloak; int do_cloak;
double cloak_delay; double cloak_delay;
double draw_interval; double draw_interval;
char *dir; char *dir;
} } opt;
opt;
/* RATE is sample rate (samples/sec) */ /* RATE is sample rate (samples/sec) */
#define BUFS 8 /* number of audio buffers (lag compensation) */ #define BUFS 8 /* number of audio buffers (lag compensation) */
@ -441,7 +438,6 @@ standby_cb(void *data __UNUSED__)
static void static void
create_epplet_layout(void) create_epplet_layout(void)
{ {
Epplet_gadget_show(btn_close = Epplet_create_button(NULL, NULL, Epplet_gadget_show(btn_close = Epplet_create_button(NULL, NULL,
2, 2, 0, 0, "CLOSE", 2, 2, 0, 0, "CLOSE",
0, NULL, cb_close, 0, NULL, cb_close,

View File

@ -43,8 +43,7 @@ static int save_delays[] = {
0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120, 300, 600 0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120, 300, 600
}; };
struct struct {
{
int quality; int quality;
int win; int win;
int beep; int beep;
@ -63,8 +62,7 @@ struct
char *file_type; char *file_type;
char *script; char *script;
char *lock_cmd; char *lock_cmd;
} } opt;
opt;
static Window confwin = 0; static Window confwin = 0;
static Epplet_gadget txt; static Epplet_gadget txt;

View File

@ -48,8 +48,7 @@ static const int shot_delays[] = {
0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120 0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120
}; };
struct struct {
{
int quality; int quality;
int win; int win;
int beep; int beep;
@ -78,8 +77,7 @@ struct
char *ftp_temp; char *ftp_temp;
char *ftp_dir; char *ftp_dir;
char *grabber; char *grabber;
} } opt;
opt;
static Window confwin = 0; static Window confwin = 0;
static Epplet_gadget txt_file_prefix; static Epplet_gadget txt_file_prefix;
@ -506,8 +504,6 @@ apply_config(void)
if (opt.ftp_temp) if (opt.ftp_temp)
free(opt.ftp_temp); free(opt.ftp_temp);
opt.ftp_temp = _Strdup(Epplet_textbox_contents(txt_ftp_temp)); opt.ftp_temp = _Strdup(Epplet_textbox_contents(txt_ftp_temp));
return;
} }
static void static void

View File

@ -99,7 +99,6 @@ ftp_init(int passive)
ftp_send(1, "pass"); ftp_send(1, "pass");
ftp_recv(); ftp_recv();
} }
return;
} }
void void

View File

@ -37,8 +37,7 @@
#define BEGMATCH(a, b) (!strncasecmp((a), (b), (sizeof(b) - 1))) #define BEGMATCH(a, b) (!strncasecmp((a), (b), (sizeof(b) - 1)))
#define NONULL(x) ((x) ? (x) : ("")) #define NONULL(x) ((x) ? (x) : (""))
typedef struct toolbutton_struct typedef struct {
{
Epplet_gadget gad; Epplet_gadget gad;
char *label, *image; char *label, *image;
unsigned short x, y, w, h; unsigned short x, y, w, h;
@ -46,8 +45,7 @@ typedef struct toolbutton_struct
char *prog; char *prog;
} toolbutton_t; } toolbutton_t;
typedef struct tool_config_struct typedef struct {
{
Epplet_gadget cfg_tb_prog, cfg_tb_label, Epplet_gadget cfg_tb_prog, cfg_tb_label,
cfg_tb_image, cfg_tb_x, cfg_tb_y, cfg_tb_w, cfg_tb_h, cfg_tb_popup; cfg_tb_image, cfg_tb_x, cfg_tb_y, cfg_tb_w, cfg_tb_h, cfg_tb_popup;
} tool_config_t; } tool_config_t;
@ -395,7 +393,6 @@ config_cb(void *data __UNUSED__)
for (i = 0, y = 20, x = 4; i < button_cnt; i++, y += 30, x = 4) for (i = 0, y = 20, x = 4; i < button_cnt; i++, y += 30, x = 4)
{ {
cfg_gads[i].cfg_tb_prog = cfg_gads[i].cfg_tb_prog =
Epplet_create_textbox(NULL, buttons[i].prog, x, y, 90, 20, 2, NULL, Epplet_create_textbox(NULL, buttons[i].prog, x, y, 90, 20, 2, NULL,
NULL); NULL);

View File

@ -36,15 +36,13 @@ static char *urllist[10] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
static int num_urls = 0; static int num_urls = 0;
struct struct {
{
char *str; char *str;
unsigned int len; unsigned int len;
unsigned int pos; unsigned int pos;
} dtext; } dtext;
struct struct {
{
int win; int win;
int save_urls; int save_urls;
int check_url_file; int check_url_file;
@ -56,8 +54,7 @@ struct
char *www_command; char *www_command;
char *ftp_command; char *ftp_command;
char *get_command; char *get_command;
} } opt;
opt;
static Window confwin = 0; static Window confwin = 0;
static Epplet_gadget txt_new_url_command; static Epplet_gadget txt_new_url_command;
@ -184,8 +181,6 @@ apply_config(void)
opt.get_command = _Strdup(Epplet_textbox_contents(txt_get_command)); opt.get_command = _Strdup(Epplet_textbox_contents(txt_get_command));
if (opt.check_url_file) if (opt.check_url_file)
Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER"); Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER");
return;
} }
static void static void

View File

@ -141,7 +141,6 @@ cb_timer(void *data __UNUSED__)
fpStat = fopen("/proc/net/wireless", "r"); fpStat = fopen("/proc/net/wireless", "r");
if (fpStat) if (fpStat)
{ {
fgets(s, sizeof(s), fpStat); fgets(s, sizeof(s), fpStat);
fgets(s, sizeof(s), fpStat); fgets(s, sizeof(s), fpStat);
fgets(s, sizeof(s), fpStat); fgets(s, sizeof(s), fpStat);

View File

@ -21,8 +21,7 @@ static Epplet_gadget vs_master, vs_pcm, vs_lin, vs_cda, b_close, b_help;
#define debug #define debug
#endif #endif
typedef struct _MIX_CHANNEL typedef struct {
{
int id; int id;
int value; int value;
} MIX_CHANNEL; } MIX_CHANNEL;

View File

@ -317,7 +317,6 @@ printf("Diff = %f\n", 360.0*frac((D+(DLAM-DLAMS)/ARC)/TwoPi));
return( 0.5*(1.0 - cos(D+(DLAM-DLAMS)/ARC)) ); return( 0.5*(1.0 - cos(D+(DLAM-DLAMS)/ARC)) );
*/ */
return (*AGE / 29.530589); return (*AGE / 29.530589);
} }
static double static double
@ -397,7 +396,6 @@ NewMoon(double ax, double bx, double cx)
int int
MiniMoon(double T, double *RA, double *DEC) MiniMoon(double T, double *RA, double *DEC)
{ {
double L0, L, LS, F, D, H, S, N, DL, CB, L_MOON, B_MOON, V, W, double L0, L, LS, F, D, H, S, N, DL, CB, L_MOON, B_MOON, V, W,
X, Y, Z, RHO; X, Y, Z, RHO;
double cosEPS, sinEPS, P2, ARC; double cosEPS, sinEPS, P2, ARC;

View File

@ -9,7 +9,6 @@ static Epplet_gadget prog1, prog2, prog3, prog4, tog, sl1, sl2, da, im;
static void static void
cb_timer(void *data __UNUSED__) cb_timer(void *data __UNUSED__)
{ {
val3++; val3++;
if (val3 > 100) if (val3 > 100)
val3 = 0; val3 = 0;

View File

@ -1398,7 +1398,6 @@ draw_text(void)
{ {
for (i = y; i < (y + 19); i++) for (i = y; i < (y + 19); i++)
{ {
if (x == 1) if (x == 1)
c = xpm1[i - y][j]; c = xpm1[i - y][j];
else if (x == 2) else if (x == 2)

View File

@ -910,7 +910,6 @@ draw_text(void)
} }
else else
{ {
for (i = y; i < (y + 19); i++) for (i = y; i < (y + 19); i++)
{ {
switch (enlighten[i - y][j]) switch (enlighten[i - y][j])

View File

@ -121,7 +121,7 @@ safe_realloc(void **p, size_t siz)
* increased if more space is required to fit the whole line. * increased if more space is required to fit the whole line.
*/ */
static char * static char *
read_rfc822_line(FILE * f, char *line, size_t * linelen) read_rfc822_line(FILE * f, char *line, size_t *linelen)
{ {
char *buf = line; char *buf = line;
char ch; char ch;
@ -253,7 +253,7 @@ is_from(const char *s, char *path, size_t pathlen)
} }
if (path) if (path)
{ {
len = (size_t) (p - s); len = (size_t)(p - s);
if (len + 1 > pathlen) if (len + 1 > pathlen)
len = pathlen - 1; len = pathlen - 1;
memcpy(path, s, len); memcpy(path, s, len);
@ -427,8 +427,7 @@ mbox_folder_count(char *path, int force)
file_mtime = 0; file_mtime = 0;
return 0; return 0;
} }
if (!force && ((size_t) s.st_size == file_size) if (!force && ((size_t)s.st_size == file_size) && (s.st_mtime == file_mtime))
&& (s.st_mtime == file_mtime))
{ {
D((" -> Mailbox unchanged.\n")); D((" -> Mailbox unchanged.\n"));
return 0; return 0;

View File

@ -40,7 +40,6 @@
char ** char **
net_get_devices(unsigned long *count) net_get_devices(unsigned long *count)
{ {
FILE *fp; FILE *fp;
char buff[256], **names = NULL, *s; char buff[256], **names = NULL, *s;
unsigned long i; unsigned long i;
@ -81,13 +80,11 @@ net_get_devices(unsigned long *count)
#else #else
return ((char **)NULL); return ((char **)NULL);
#endif #endif
} }
unsigned char unsigned char
net_get_bytes_inout(const char *device, double *in_bytes, double *out_bytes) net_get_bytes_inout(const char *device, double *in_bytes, double *out_bytes)
{ {
#ifdef __sun__ #ifdef __sun__
kstat_ctl_t *kc; kstat_ctl_t *kc;
kstat_t *ksp; kstat_t *ksp;
@ -180,7 +177,6 @@ net_get_bytes_inout(const char *device, double *in_bytes, double *out_bytes)
const char * const char *
net_strerror(unsigned char code) net_strerror(unsigned char code)
{ {
switch (code) switch (code)
{ {
case 0: case 0:
@ -210,7 +206,6 @@ net_strerror(unsigned char code)
double double
net_get_bytes_in(const char *device) net_get_bytes_in(const char *device)
{ {
double in_bytes = -1.0; double in_bytes = -1.0;
net_get_bytes_inout(device, &in_bytes, (double *)NULL); net_get_bytes_inout(device, &in_bytes, (double *)NULL);
@ -220,7 +215,6 @@ net_get_bytes_in(const char *device)
double double
net_get_bytes_out(const char *device) net_get_bytes_out(const char *device)
{ {
double out_bytes = -1.0; double out_bytes = -1.0;
net_get_bytes_inout(device, (double *)NULL, &out_bytes); net_get_bytes_inout(device, (double *)NULL, &out_bytes);

View File

@ -22,17 +22,14 @@
#define PROC_MEM_SIZE 6 #define PROC_MEM_SIZE 6
#define PROC_SWAP_SIZE 3 #define PROC_SWAP_SIZE 3
typedef struct _ProcInfo ProcInfo; typedef struct {
struct _ProcInfo
{
unsigned cpu[PROC_CPU_SIZE]; unsigned cpu[PROC_CPU_SIZE];
unsigned cpu_now[PROC_CPU_SIZE]; unsigned cpu_now[PROC_CPU_SIZE];
unsigned cpu_last[PROC_CPU_SIZE]; unsigned cpu_last[PROC_CPU_SIZE];
unsigned mem[PROC_MEM_SIZE]; unsigned mem[PROC_MEM_SIZE];
unsigned swap[PROC_SWAP_SIZE]; unsigned swap[PROC_SWAP_SIZE];
}; } ProcInfo;
void proc_read_cpu(ProcInfo *); void proc_read_cpu(ProcInfo *);
void proc_read_mem(ProcInfo *); void proc_read_mem(ProcInfo *);