Commit Graph

18 Commits

Author SHA1 Message Date
Tom Gilbert eb5b17c67f Sat Dec 04 01:05:38 GMT 1999
(gilbertt)

So, say hello to Epplet_create_window_config.

It rules ;)

Here's the definition:

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);

You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).

The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.

I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.

Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.

Any feature suggestions, send 'em now :)


SVN revision: 1493
1999-12-03 20:56:49 +00:00
Tom Gilbert 48ce42038e Fri Dec 03 23:47:45 GMT 1999
(gilbertt)

Okay. Lots has changed. It was pretty inconsistant to have loads of
functions returning or requiring a "Window win" paramater, and mine dealing
with "Epplet_window" parameters. I had to lose one, so I lost the one which
caused no breakage. Mine :)

I still use Epplet_window internally to encapsulate data on a per-window
basis. However, all public functions deal with "Window win" again. Now
things are consistant. The Epplet_window type is now private and hidden.

To do this, I have implemented a little lookup function to relate
Epplet_windows to Windows, which should be more than adequate for our needs.

You can now declare a delete event handler for your whole epplet, although I
may change to per-window delete event handlers if people request it.

If you return 1 from the delete event handler, or don't supply one, or
supply NULL, the window will be destroyed for you, if you return 0, the
delete event will be ignored. Use this to do things like saying "hrm, those
two settings cannot coexist" or "that file does not exist" etc.

I'm nearly finished with the window functions now, and will next add
convenience wrappers such as Epplet_create_window_config(...) to add ok,
apply and save buttons and setup callbacks for you, and some other stuff
too.

I'd appreciate it if people would poke around and see what they think, I'm
new at this Xlib stuf...


SVN revision: 1490
1999-12-03 19:34:55 +00:00
Tom Gilbert 34f7e90373 Fri Dec 03 20:22:56 GMT 1999
(gilbertt)

Removed the int x, and int y properties for Epplet_create_window, as they
were pretty pointless, and I hate it when windows decide where they should
go ;)


SVN revision: 1487
1999-12-03 16:05:33 +00:00
Tom Gilbert aad5f10990 Fri Dec 03 20:11:23 GMT 1999
(gilbertt)

Right. You can now specify a "vertical" property for your new window. Works
the same as the vertical parameter in Epplet_init. Uses the same
imageclasses too.

I had a big headache debugging this, it just didn't seem to work, I knew
BrushedMetal (the theme I use) had a different (green) vertical pixmap, but
the windows always came up grey. Just when I was about to go mental, I found
this in epplet.cfg:

__ICLASS __BGN
  __NAME EPPLET_BACKGROUND_HORIZONTAL
  __NORMAL "epplets/images/bg.png"
  __EDGE_SCALING   2 2 2 2
__END

__ICLASS __BGN
  __NAME EPPLET_BACKGROUND_VERTICAL
  __NORMAL "epplets/images/bg.png"
  __EDGE_SCALING   2 2 2 2
__END

Gah. No wonder the images weren't changing!

Is there a reason for this? If not, could it be changed to:

__ICLASS __BGN
  __NAME EPPLET_BACKGROUND_HORIZONTAL
  __NORMAL "epplets/images/bg.png"
  __EDGE_SCALING   2 2 2 2
__END

__ICLASS __BGN
  __NAME EPPLET_BACKGROUND_VERTICAL
  __NORMAL "epplets/images/bg_v.png"
  __EDGE_SCALING   2 2 2 2
__END

Please?

Anyway, the vertical stuff works now, and probably did an hour ago, before I
went off chasing nonexistant bugs :)

I also tidied up some other stuff, and killed another global :)

See E-ScreenSave in cvs for an example, press the "lock" button to see it in
action :)


SVN revision: 1486
1999-12-03 15:59:17 +00:00
Tom Gilbert 137ade0aa3 Fri Dec 03 18:34:47 GMT 1999
(gilbertt)

Hrm. Bye bye hardcoding, hello malloc()ed context stack. Improved the test
app further.


SVN revision: 1484
1999-12-03 14:17:56 +00:00
Tom Gilbert 768eebf738 Fri Dec 03 17:20:15 GMT 1999
(gilbertt)

More config window stuff. Fixed a memleak, and now destroying an
Epplet_window also destroys any child gadgets attached to the window. I
think this works better, let me know otherwise.

I also cleaned up a couple of things, fixed adding buttons to new windows,
and improved the test epplet to be a better demo (E-ScreenSave right now).

I removed the Epplet_draw_window* functions, 'cos I don't need them :) What
I actually needed to do was fix Epplet_draw_image - so I have :)

Lots more to do tonight :)


SVN revision: 1483
1999-12-03 13:07:03 +00:00
Tom Gilbert ded180a361 Thu Dec 02 23:07:45 GMT 1999
(gilbertt)

Ok. More config window stuff.

Fun fun. I had to create a new type, Epplet_window to hold some window info,
and a stack to push and pop contexts for adding gadgets to different new
windows. This stuff works real well, and I am chuffed with it :)

The extra windows now redraw themselves on exposes, and new gadgets can be
added to them successfully. W00p.

I had to implement some new stuff, so please check nothing is broke (I am
not finished, but I don't want to commit code that breaks stuff).

Here are some details on the new stuff :)

---------------
PUBLIC STUFF

typedef struct epplet_window
{
    Window win;
    int w;
    int h;
    Pixmap bg_pmap;
    Pixmap bg_mask;
    Pixmap bg_bg;
}EppWindow;
typedef EppWindow *Epplet_window;

Epplet_window Epplet_create_window(int w,int h,int x,int y,char *title);
void Epplet_window_show(Epplet_window win);
void Epplet_window_hide(Epplet_window win);
void Epplet_window_destroy(Epplet_window win);
void Epplet_window_push_context(Epplet_window newwin);
Epplet_window Epplet_window_pop_context(void);
---------------
PRIVATE STUFF

static Epplet_window context_win;       /* Current context win */
static int          window_stack_pos;   /* For context changes */
static Epplet_window window_stack[20];  /* For context changes */
static Epplet_window mainwin;           /* Always the main epplet window */

static int          window_num = 0;     /* For window list */
static Epplet_window *windows = NULL;   /* List of windows to loop though */

/* For Keeping a list of windows owned by the epplet, to loop through and
 * do stuff with. */
static void         Epplet_register_window(Epplet_window win);
static void         Epplet_unregister_window(Epplet_window win);

/* Redraw all epplet windows (excluding the main epplet window) */
static void         Epplet_draw_windows(void);
/* Redraw window win */
static void         Epplet_draw_window(Epplet_window win);

/* Refresh window backgrounds on theme change */
static void Epplet_refresh_backgrounds(void);

-------------
I also added an item to GadGeneral so that I can find what window a gadget
was created on:

typedef struct gad_general
{
   GadType             type;
   char                visible;
   Epplet_window       parent;
}
GadGeneral;

-------------

Not to mention the reworking of code which draws or handles windows.

I have more tinkering to do in the event handling, to catch delete_events,
and to filter out mouseovers etc for separate windows. Tomorrow :)


SVN revision: 1478
1999-12-02 19:08:48 +00:00
Tom Gilbert 586fb5e90c A more useful test app.
SVN revision: 1474
1999-12-01 19:28:34 +00:00
Tom Gilbert 4d1ca43a00 Wed Dec 01 23:05:13 GMT 1999
(gilbertt)

api changes.

Ok. I have added some functions to the api, they are not yet perfect, but
they compile cleanly and don't create any problems. Don't use them yet
though, the api may change.

Window Epplet_create_window(int w,int h,int x,int y,char *title);
void Epplet_window_show(Window win);
void Epplet_window_hide(Window win);
void Epplet_window_destroy(Window win);
void Epplet_window_switch_context(Window newwin);
void Epplet_window_reset_context(void);

All of these functions are in place and work. I have yet to add code to
handle delete_events. At the moment, if you close the dialog window, the
epplet exits. This is clearly not intended ;) I'll fix it tomorrow, its late
here now.

You can even switch context and add widgets to your new window with no
problems ;)

Other things to fix tomorrow is the event handling stuff which assumes only
one window will be around...

I am currently using E-ScreenSave as my test epplet for this code, as I know
only about 2 people use it ;) Try it to see the code working.


SVN revision: 1472
1999-12-01 19:12:33 +00:00
Tom Gilbert 9ce2ad30c3 Tue Nov 30 17:48:31 GMT 1999
(gilbertt)

E-ScreenShoot.c E-SD.c E-ScreenSave.c

Urm. Should've done this before. Removed some duplication, and one omission
in my cloaking code. Silly really, most people won't notice any difference,
but I will :)


SVN revision: 1462
1999-11-30 14:45:32 +00:00
Tom Gilbert 6f5f6103ae Sun Nov 28 21:52:12 GMT 1999
(gilbertt)

Made the screensaver lock command configurable in E-ScreenSave.


SVN revision: 1430
1999-11-28 18:17:18 +00:00
Michael Jennings 89085f3eee Wed Nov 24 18:33:45 PST 1999
(KainX)

Major restructuring and cleanup.  I think the new standard should be pretty
self-explanatory, but let me know if you have any questions.  CVS developers,
PLEASE read epplets/Makefile.am carefully to see how it all works now.

Icons are stored in epplets/icons/ and are installed into
$EROOT/epplet_icons/.  All miscellaneous data files (including images) are
stored in epplets/<epplet name>-data/ and are installed into
$EROOT/epplet_data/<epplet name>/.  Also note that, if you're going to use the
same old aircut3.ttf and bg.png in your help section, add your epplet's name
to NEED_BG and NEED_FONT in epplets/Makefile.am.  Do NOT commit duplicates of
those two files.


SVN revision: 1394
1999-11-24 23:36:51 +00:00
Tom Gilbert 112d70f585 Tue Nov 23 21:32:21 GMT 1999
(gilbertt)

I am such a dufus.

Changed my epplets to actually save their config when you finish your X
session, instead of only when you click the close button.

How did I let this go unfixed???


SVN revision: 1381
1999-11-23 18:51:27 +00:00
Tom Gilbert 598354a379 Oops.
That won't do.


SVN revision: 1350
1999-11-20 19:38:49 +00:00
Tom Gilbert 87448696d2 Sat Nov 20 19:55:22 GMT 1999
(gilbertt)

Changed the Makefile.am to put epplet images in $EROOT/epplet_data.

I wanted to have epplet subdirs under this directory, but it really
complicated the Makefile, so I left it for now. It was easy for me the make
the changes with sed this way too ;)

Any stuff your app needs to install should go in epplet_data, preferably
with the filename prefixed with the name of your epplet.

Flame me if this bugs you...


SVN revision: 1345
1999-11-20 17:55:56 +00:00
Carsten Haitzler 39890b6ac4 make distcheck properly... :)
SVN revision: 1338
1999-11-19 23:01:40 +00:00
Tom Gilbert 2d7903c6ec That shouldn't happen
SVN revision: 1299
1999-11-14 00:45:48 +00:00
Tom Gilbert c5f91b508b Sat Nov 13 21:03:02 GMT 1999
(gilbertt)

Added E-ScreenSave. Will control xscreensaver, but currently just locks the
screen on demand.


SVN revision: 1296
1999-11-14 00:02:31 +00:00