Thu Dec 09 20:49:42 GMT 1999

(gilbertt)

Hrm. If nobody minds... I've added:

Window Epplet_create_window_borderless(int w,int h,char *title, char vertical);

In case anyone fancies a borderless window. Or two. For displaying things. In
windows. Without borders. For whatever reason. Erm. I'll stop now.


SVN revision: 1564
This commit is contained in:
Tom Gilbert 1999-12-09 15:40:08 +00:00
parent da3b9ce0d6
commit ad8c5fe782
4 changed files with 150 additions and 128 deletions

View File

@ -1495,3 +1495,16 @@ Thu Dec 9 14:29:50 EST 1999
The Mountbox reacts to left and right cursor keys now. Also added a Jazz drive
image for piercer <piercer13@home.com>. Config dialog coming soon.
-------------------------------------------------------------------------------
Thu Dec 09 20:49:42 GMT 1999
(gilbertt)
Hrm. If nobody minds... I've added:
Window Epplet_create_window_borderless(int w,int h,char *title, char vertical);
In case anyone fancies a borderless window. Or two. For displaying things. In
windows. Without borders. For whatever reason. Erm. I'll stop now.

View File

@ -8,15 +8,15 @@
#include <sys/wait.h>
typedef struct epplet_window
{
Window win;
int w;
int h;
char win_vert;
Pixmap bg_pmap;
Pixmap bg_mask;
Pixmap bg_bg;
}
{
Window win;
int w;
int h;
char win_vert;
Pixmap bg_pmap;
Pixmap bg_mask;
Pixmap bg_bg;
}
EppWindow;
typedef EppWindow *Epplet_window;
@ -75,11 +75,11 @@ static void (*buttonrelease_func) (void *data, Window win, int x, int y,
int b) = NULL;
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 (*keyrelease_func) (void *data, Window win, char *key) =
NULL;
NULL;
static void (*enter_func) (void *data, Window win) = NULL;
static void (*leave_func) (void *data, Window win) = NULL;
static void (*focusin_func) (void *data, Window win) = NULL;
@ -95,35 +95,39 @@ static void Epplet_register_window(Epplet_window win);
static void Epplet_unregister_window(Epplet_window win);
static void Epplet_window_destroy_children(Epplet_window win);
static Epplet_window Epplet_window_get_from_Window(Window win);
static Window Epplet_internal_create_window(int w, int h,
char *title, char vertical,
char decorate);
#define MWM_HINTS_DECORATIONS (1L << 1)
typedef struct _mwmhints
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
}
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
}
MWMHints;
struct _etimer
{
char *name;
void (*func) (void *data);
void *data;
double in;
char just_added;
ETimer *next;
};
{
char *name;
void (*func) (void *data);
void *data;
double in;
char just_added;
ETimer *next;
};
#define ESYNC ECommsSend("nop");free(ECommsWaitForMessage());
/* The structures for the config file management ... */
typedef struct _configdict
{
ConfigItem *entries;
int num_entries;
}
{
ConfigItem *entries;
int num_entries;
}
ConfigDict;
static ConfigDict *config_dict = NULL;
@ -196,11 +200,11 @@ typedef enum gad_type
GadType;
typedef struct gad_general
{
GadType type;
char visible;
Epplet_window parent;
}
{
GadType type;
char visible;
Epplet_window parent;
}
GadGeneral;
void
@ -373,8 +377,9 @@ Epplet_Init(char *name,
sigaction(SIGCHLD, &sa, (struct sigaction *)0);
}
Window
Epplet_create_window(int w, int h, char *title, char vertical)
static Window
Epplet_internal_create_window(int w, int h, char *title, char vertical,
char decorate)
{
XSetWindowAttributes attr;
Atom a;
@ -409,7 +414,7 @@ Epplet_create_window(int w, int h, char *title, char vertical)
/* set hints? */
mwm.flags = MWM_HINTS_DECORATIONS;
mwm.functions = 0;
mwm.decorations = 1;
mwm.decorations = decorate;
mwm.inputMode = 0;
mwm.status = 0;
a = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
@ -467,12 +472,22 @@ Epplet_create_window(int w, int h, char *title, char vertical)
return ret->win;
}
Window Epplet_create_window(int w, int h, char *title, char vertical)
{
return Epplet_internal_create_window(w, h, title, vertical, 1);
}
Window Epplet_create_window_borderless(int w, int h, char *title, char vertical)
{
return Epplet_internal_create_window(w, h, title, vertical, 0);
}
Window
Epplet_create_window_config(int w, int h, char *title,
void (*ok_func) (void *data),
void *ok_data, void (*apply_func) (void *data),
void *apply_data,
void (*cancel_func) (void *data), void *cancel_data)
void (*cancel_func) (void *data), void *cancel_data)
{
Window ret;
Epplet_gadget ok_btn, apply_btn, cancel_btn;
@ -615,28 +630,27 @@ Epplet_window_push_context(Window newwin)
return;
if (
((window_stack
=
realloc(window_stack,
sizeof(Epplet_window) * (window_stack_pos + 1))) == NULL))
((window_stack
=
realloc(window_stack,
sizeof(Epplet_window) * (window_stack_pos + 1))) == NULL))
exit(1);
window_stack[window_stack_pos] = win;
window_stack_pos++;
context_win = win;
}
Window
Epplet_window_pop_context(void)
Window Epplet_window_pop_context(void)
{
Epplet_window ret;
window_stack_pos--;
ret = window_stack[window_stack_pos];
if (
((window_stack
=
realloc(window_stack,
sizeof(Epplet_window) * (window_stack_pos))) == NULL))
((window_stack
=
realloc(window_stack,
sizeof(Epplet_window) * (window_stack_pos))) == NULL))
exit(1);
/* Window stack pos == 0 corresponds to the main epplet window */
if (window_stack_pos < 1)
@ -789,8 +803,7 @@ Epplet_unremember(void)
ESYNC;
}
Window
Epplet_get_main_window(void)
Window Epplet_get_main_window(void)
{
return mainwin->win;
}
@ -911,8 +924,8 @@ Epplet_textclass_get_size(char *iclass, int *w, int *h, char *txt)
void
Epplet_register_expose_handler(void (*func)
(void *data, Window win, int x, int y, int w,
int h), void *data)
(void *data, Window win, int x, int y, int w,
int h), void *data)
{
expose_data = data;
expose_func = func;
@ -920,8 +933,8 @@ Epplet_register_expose_handler(void (*func)
void
Epplet_register_move_resize_handler(void (*func)
(void *data, Window win, int x, int y,
int w, int h), void *data)
(void *data, Window win, int x, int y,
int w, int h), void *data)
{
moveresize_data = data;
moveresize_func = func;
@ -929,8 +942,8 @@ Epplet_register_move_resize_handler(void (*func)
void
Epplet_register_button_press_handler(void (*func)
(void *data, Window win, int x, int y,
int b), void *data)
(void *data, Window win, int x, int y,
int b), void *data)
{
buttonpress_data = data;
buttonpress_func = func;
@ -938,8 +951,8 @@ Epplet_register_button_press_handler(void (*func)
void
Epplet_register_button_release_handler(void (*func)
(void *data, Window win, int x, int y,
int b), void *data)
(void *data, Window win, int x, int y,
int b), void *data)
{
buttonrelease_data = data;
buttonrelease_func = func;
@ -947,7 +960,7 @@ Epplet_register_button_release_handler(void (*func)
void
Epplet_register_key_press_handler(void (*func)
(void *data, Window win, char *key),
(void *data, Window win, char *key),
void *data)
{
keypress_data = data;
@ -956,7 +969,7 @@ Epplet_register_key_press_handler(void (*func)
void
Epplet_register_key_release_handler(void (*func)
(void *data, Window win, char *key),
(void *data, Window win, char *key),
void *data)
{
keyrelease_data = data;
@ -965,7 +978,7 @@ Epplet_register_key_release_handler(void (*func)
void
Epplet_register_mouse_motion_handler(void (*func)
(void *data, Window win, int x, int y),
(void *data, Window win, int x, int y),
void *data)
{
mousemotion_data = data;
@ -974,7 +987,7 @@ Epplet_register_mouse_motion_handler(void (*func)
void
Epplet_register_mouse_enter_handler(void (*func)
(void *data, Window win), void *data)
(void *data, Window win), void *data)
{
enter_data = data;
enter_func = func;
@ -982,7 +995,7 @@ Epplet_register_mouse_enter_handler(void (*func)
void
Epplet_register_mouse_leave_handler(void (*func)
(void *data, Window win), void *data)
(void *data, Window win), void *data)
{
leave_data = data;
leave_func = func;
@ -990,7 +1003,7 @@ Epplet_register_mouse_leave_handler(void (*func)
void
Epplet_register_focus_in_handler(void (*func)
(void *data, Window win), void *data)
(void *data, Window win), void *data)
{
focusin_data = data;
focusin_func = func;
@ -998,7 +1011,7 @@ Epplet_register_focus_in_handler(void (*func)
void
Epplet_register_focus_out_handler(void (*func)
(void *data, Window win), void *data)
(void *data, Window win), void *data)
{
focusout_data = data;
focusout_func = func;
@ -1006,7 +1019,7 @@ Epplet_register_focus_out_handler(void (*func)
void
Epplet_register_delete_event_handler(int (*func)
(void *data, Window win), void *data)
(void *data, Window win), void *data)
{
delete_data = data;
delete_func = func;
@ -1014,7 +1027,7 @@ Epplet_register_delete_event_handler(int (*func)
void
Epplet_register_event_handler(void (*func)
(void *data, XEvent * ev), void *data)
(void *data, XEvent * ev), void *data)
{
event_data = data;
event_func = func;
@ -1397,10 +1410,10 @@ Epplet_prune_events(XEvent * ev, int num)
/* any reason to remember the window properties? */
for (i = 0; i < num; i++)
if (
((ev[i].type == ConfigureNotify)
&& (ev->xconfigure.window == mainwin->win))
|| ((ev[i].type == PropertyNotify)
&& (ev->xproperty.window == mainwin->win)))
((ev[i].type == ConfigureNotify)
&& (ev->xconfigure.window == mainwin->win))
|| ((ev[i].type == PropertyNotify)
&& (ev->xproperty.window == mainwin->win)))
Epplet_remember();
}
@ -2203,7 +2216,7 @@ Epplet_gadget
Epplet_create_button(char *label, char *image, int x, int y,
int w, int h, char *std, Window parent,
Epplet_gadget pop_parent,
void (*func) (void *data), void *data)
void (*func) (void *data), void *data)
{
GadButton *g;
XSetWindowAttributes attr;
@ -2282,10 +2295,9 @@ Epplet_create_std_button(char *std, int x, int y,
}
/* A cut down version for image-only buttons */
Epplet_gadget
Epplet_gadget
Epplet_create_image_button(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,
data);
@ -2415,7 +2427,7 @@ GadToggleButton;
Epplet_gadget
Epplet_create_togglebutton(char *label, char *image, int x,
int y, int w, int h, int *val,
void (*func) (void *data), void *data)
void (*func) (void *data), void *data)
{
GadToggleButton *g;
XSetWindowAttributes attr;
@ -2543,8 +2555,7 @@ typedef struct
}
GadDrawingArea;
Epplet_gadget
Epplet_create_drawingarea(int x, int y, int w, int h)
Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h)
{
GadDrawingArea *g;
XSetWindowAttributes attr;
@ -2612,7 +2623,7 @@ GadHSlider;
Epplet_gadget
Epplet_create_hslider(int x, int y, int len, int min, int max,
int step, int jump, int *val,
void (*func) (void *data), void *data)
void (*func) (void *data), void *data)
{
GadHSlider *g;
XSetWindowAttributes attr;
@ -2685,7 +2696,7 @@ Epplet_draw_hslider(Epplet_gadget eg)
}
Epplet_imageclass_apply("EPPLET_HSLIDER_BASE", "normal", g->win);
XMoveWindow(disp, g->win_knob,
g->x + ((g->w - 8) * (*(g->val))) / (g->max - g->min + 1), g->y);
g->x + ((g->w - 8) * (*(g->val))) / (g->max - g->min + 1), g->y);
Epplet_imageclass_apply("EPPLET_HSLIDER_KNOB", state, g->win_knob);
}
@ -2708,7 +2719,7 @@ GadVSlider;
Epplet_gadget
Epplet_create_vslider(int x, int y, int len, int min, int max,
int step, int jump, int *val,
void (*func) (void *data), void *data)
void (*func) (void *data), void *data)
{
GadVSlider *g;
XSetWindowAttributes attr;
@ -2781,7 +2792,7 @@ Epplet_draw_vslider(Epplet_gadget eg)
}
Epplet_imageclass_apply("EPPLET_VSLIDER_BASE", "normal", g->win);
XMoveWindow(disp, g->win_knob,
g->x, g->y + ((g->h - 8) * (*(g->val))) / (g->max - g->min + 1));
g->x, g->y + ((g->h - 8) * (*(g->val))) / (g->max - g->min + 1));
Epplet_imageclass_apply("EPPLET_VSLIDER_KNOB", state, g->win_knob);
}
@ -2796,8 +2807,7 @@ typedef struct
}
GadHBar;
Epplet_gadget
Epplet_create_hbar(int x, int y, int w, int h, char dir, int *val)
Epplet_gadget Epplet_create_hbar(int x, int y, int w, int h, char dir, int *val)
{
GadHBar *g;
XSetWindowAttributes attr;
@ -2866,8 +2876,7 @@ typedef struct
}
GadVBar;
Epplet_gadget
Epplet_create_vbar(int x, int y, int w, int h, char dir, int *val)
Epplet_gadget Epplet_create_vbar(int x, int y, int w, int h, char dir, int *val)
{
GadHBar *g;
XSetWindowAttributes attr;
@ -2933,8 +2942,7 @@ typedef struct
}
GadImage;
Epplet_gadget
Epplet_create_image(int x, int y, int w, int h, char *image)
Epplet_gadget Epplet_create_image(int x, int y, int w, int h, char *image)
{
GadImage *g;
@ -3003,8 +3011,7 @@ typedef struct
}
GadLabel;
Epplet_gadget
Epplet_create_label(int x, int y, char *label, char size)
Epplet_gadget Epplet_create_label(int x, int y, char *label, char size)
{
GadLabel *g;
@ -3138,34 +3145,33 @@ GadPopEntry;
typedef struct _gadpopupbutton GadPopupButton;
typedef struct
{
GadGeneral general;
int x, y, w, h;
Epplet_gadget popbutton;
int entry_num;
GadPopEntry *entry;
Window win;
char changed;
}
{
GadGeneral general;
int x, y, w, h;
Epplet_gadget popbutton;
int entry_num;
GadPopEntry *entry;
Window win;
char changed;
}
GadPopup;
struct _gadpopupbutton
{
GadGeneral general;
int x, y, w, h;
char *label;
char *image;
char hilited;
char clicked;
Epplet_gadget popup;
char popped;
char *std;
Window win;
Pixmap pmap, mask;
};
{
GadGeneral general;
int x, y, w, h;
char *label;
char *image;
char hilited;
char clicked;
Epplet_gadget popup;
char popped;
char *std;
Window win;
Pixmap pmap, mask;
};
Epplet_gadget
Epplet_create_popup(void)
Epplet_gadget Epplet_create_popup(void)
{
GadPopup *g;
XSetWindowAttributes attr;
@ -3201,7 +3207,7 @@ Epplet_create_popup(void)
void
Epplet_add_popup_entry(Epplet_gadget gadget, char *label, char *pixmap,
void (*func) (void *data), void *data)
void (*func) (void *data), void *data)
{
GadPopup *g;
@ -3586,7 +3592,8 @@ Epplet_move_image(Epplet_gadget gadget, int x, int y)
}
void
Epplet_move_change_image(Epplet_gadget gadget, int x, int y, int w, int h, char *image)
Epplet_move_change_image(Epplet_gadget gadget, int x, int y, int w, int h,
char *image)
{
GadImage *g;
GadGeneral *gg;
@ -3625,8 +3632,7 @@ Epplet_change_label(Epplet_gadget gadget, char *label)
Epplet_draw_label(gadget, 0);
}
Window
Epplet_get_drawingarea_window(Epplet_gadget gadget)
Window Epplet_get_drawingarea_window(Epplet_gadget gadget)
{
GadDrawingArea *g;
@ -4085,10 +4091,10 @@ Epplet_background_properties(char vertical, Window newwin)
if (vertical)
Epplet_imageclass_get_pixmaps("EPPLET_BACKGROUND_VERTICAL", "normal",
&win->bg_bg, &win->bg_mask, win->w, win->h);
&win->bg_bg, &win->bg_mask, win->w, win->h);
else
Epplet_imageclass_get_pixmaps("EPPLET_BACKGROUND_HORIZONTAL", "normal",
&win->bg_bg, &win->bg_mask, win->w, win->h);
&win->bg_bg, &win->bg_mask, win->w, win->h);
win->bg_pmap = XCreatePixmap(disp, win->win, win->w, win->h, id->x.depth);
gc = XCreateGC(disp, win->bg_pmap, 0, &gcv);
@ -4692,8 +4698,7 @@ Epplet_draw_outline(Window win, int x, int y, int w, int h, int r, int g, int b)
XFreeGC(disp, gc);
}
RGB_buf
Epplet_make_rgb_buf(int w, int h)
RGB_buf Epplet_make_rgb_buf(int w, int h)
{
RGB_buf buf;
unsigned char *data;
@ -4791,7 +4796,7 @@ Epplet_destroy_spawned_command(int pid)
void
Epplet_register_child_handler(void (*func)
(void *data, int pid, int exit_code), void *data)
(void *data, int pid, int exit_code), void *data)
{
child_data = data;
child_func = func;
@ -4951,7 +4956,7 @@ Epplet_find_instance(char *name)
continue;
}
pid = getpid();
write(fd, &pid, sizeof(pid_t)); /* Not sure how best to deal with write errors here */
write(fd, &pid, sizeof(pid_t)); /* Not sure how best to deal with write errors here */
close(fd);
/* If we made it here, we've just written the lock file and saved it. We have our instance
* number, so exit the loop. */
@ -4994,10 +4999,13 @@ Epplet_add_config(char *key, char *value)
}
else
{
config_dict->entries = realloc(config_dict->entries, sizeof(ConfigItem) * (config_dict->num_entries + 1));
config_dict->entries =
realloc(config_dict->entries,
sizeof(ConfigItem) * (config_dict->num_entries + 1));
}
config_dict->entries[config_dict->num_entries].key = strdup(key);
config_dict->entries[config_dict->num_entries].value = (value ? strdup(value) : strdup(""));
config_dict->entries[config_dict->num_entries].value =
(value ? strdup(value) : strdup(""));
config_dict->num_entries++;
}

View File

@ -357,6 +357,7 @@ void Epplet_change_label(Epplet_gadget gadget, char *label);
/* Create a window of width w, height h, with title title, using the themes
* vertical (1), or horizontal (0) background */
Window Epplet_create_window(int w,int h,char *title, char vertical);
Window Epplet_create_window_borderless(int w,int h,char *title, char vertical);
/* Create a config window, of width w, height h, with title title, using the
* functions listed for ok, apply and cancel. If you specify any of the

View File

@ -1,7 +1,7 @@
dnl# $Id$
AC_INIT(api/epplet.c)
AM_INIT_AUTOMAKE(Epplets, 0.5)
AM_INIT_AUTOMAKE(Epplets, 0.6)
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
if test ! -z "${CFLAGS}" -o ! -z "${CCOPTS}"; then