2001-07-30 09:59:37 -07:00
|
|
|
#ifndef E_DESKTOPS_H
|
|
|
|
#define E_DESKTOPS_H
|
|
|
|
|
|
|
|
#include "e.h"
|
2001-07-30 18:12:02 -07:00
|
|
|
#include "view.h"
|
|
|
|
#include "border.h"
|
Alright, I spent some time now reading e17's code. Here's what
I've changed, this is big, so read this carefully :)
* I've added debugging macros for messages and function call
tracing. Usage:
D("Creating item %i %i %i\n", x, y, z);
Define DEBUG to use the D macro.
D_ENTER;
D_RETURN;
D_RETURN_(x);
These are for call tracing. Use D_RETURN_(x) when returning
something from a function. Define DEBUG_NEST to use this.
* added iconbar header file to Makefile.am
* added proper new()/cleanup() calls for E_Delayed_Action;
* I've completely rewritten the object and observer handling. Bye
bye macros, this was nasty. It'll be hard enough to avoid leaks
with usecounting in C. We now basically have the same system as gtk.
There's a clear separation of observer and object code now.
An E_Object by itself has nothing to do with observing or being
observed, therefore, there are now E_Observers and E_Observees
that are derived from E_Object. IMPORTANT: The cleanup system now
reflects the reference count system, therefore, all ..._free()
calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling
now is as follows:
- The cleanup functions clean up everything that is contained in
a struct, but NOT the struct itself. Instead of the final
free() call, they call the destructor of the base class. The
calls will walk up the hierarchy and clean up what's contained in
every struct, and the final e_object_cleanup() will free the
structure itself. E_Delayed_Action is a good example.
- The only calls that influence the reference count are
e_object_ref() and e_object_unref(). If you need to do things
before an object gets destroyed, you can query the use count using
e_object_get_usecount() and check if it's equal to 1. So this:
OBJ_UNREF(b);
OBJ_IF_FREE(b)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
OBJ_FREE(b);
}
now is this:
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
}
e_object_unref(E_OBJECT(b));
object.h and observer.h are completely commented, it shouldn't be
too hard to understand. This'll need to be documented in the manual
anyway.
* E_Objects are now used in lots of places where void* were used as
pointers to objects before, especially in the actions code. This is
obviously better, as it will generate compiler warnings when people
want to pass things to functions that expect E_Objects. This could
probably be more restrictive.
* Added typedefs for the function prototypes in E_Action_Impl. Those
fat signatures were just painful to read in the function
declarations/implementations.
* I've also tried to give parameters more useful names. Calling an
object "o" is a lot of fun when you want to grep for it.
* Included is also Graham's latest menu.c patch. Sorry for the
delay, Graham.
* I've added checks to the menu code that make sure that menus
don't pop up when they're empty (which resulted in a little useless
rectangle).
I guess that's it for now. Sorry if I broke anything, but this was
necessary imho.
SVN revision: 5605
2001-11-02 09:07:52 -08:00
|
|
|
#include "object.h"
|
2001-07-30 18:12:02 -07:00
|
|
|
|
|
|
|
#ifndef E_DESKTOPS_TYPEDEF
|
|
|
|
#define E_DESKTOPS_TYPEDEF
|
|
|
|
typedef struct _E_Desktop E_Desktop;
|
|
|
|
#endif
|
2001-07-30 09:59:37 -07:00
|
|
|
|
|
|
|
struct _E_Desktop
|
|
|
|
{
|
Alright, I spent some time now reading e17's code. Here's what
I've changed, this is big, so read this carefully :)
* I've added debugging macros for messages and function call
tracing. Usage:
D("Creating item %i %i %i\n", x, y, z);
Define DEBUG to use the D macro.
D_ENTER;
D_RETURN;
D_RETURN_(x);
These are for call tracing. Use D_RETURN_(x) when returning
something from a function. Define DEBUG_NEST to use this.
* added iconbar header file to Makefile.am
* added proper new()/cleanup() calls for E_Delayed_Action;
* I've completely rewritten the object and observer handling. Bye
bye macros, this was nasty. It'll be hard enough to avoid leaks
with usecounting in C. We now basically have the same system as gtk.
There's a clear separation of observer and object code now.
An E_Object by itself has nothing to do with observing or being
observed, therefore, there are now E_Observers and E_Observees
that are derived from E_Object. IMPORTANT: The cleanup system now
reflects the reference count system, therefore, all ..._free()
calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling
now is as follows:
- The cleanup functions clean up everything that is contained in
a struct, but NOT the struct itself. Instead of the final
free() call, they call the destructor of the base class. The
calls will walk up the hierarchy and clean up what's contained in
every struct, and the final e_object_cleanup() will free the
structure itself. E_Delayed_Action is a good example.
- The only calls that influence the reference count are
e_object_ref() and e_object_unref(). If you need to do things
before an object gets destroyed, you can query the use count using
e_object_get_usecount() and check if it's equal to 1. So this:
OBJ_UNREF(b);
OBJ_IF_FREE(b)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
OBJ_FREE(b);
}
now is this:
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
}
e_object_unref(E_OBJECT(b));
object.h and observer.h are completely commented, it shouldn't be
too hard to understand. This'll need to be documented in the manual
anyway.
* E_Objects are now used in lots of places where void* were used as
pointers to objects before, especially in the actions code. This is
obviously better, as it will generate compiler warnings when people
want to pass things to functions that expect E_Objects. This could
probably be more restrictive.
* Added typedefs for the function prototypes in E_Action_Impl. Those
fat signatures were just painful to read in the function
declarations/implementations.
* I've also tried to give parameters more useful names. Calling an
object "o" is a lot of fun when you want to grep for it.
* Included is also Graham's latest menu.c patch. Sorry for the
delay, Graham.
* I've added checks to the menu code that make sure that menus
don't pop up when they're empty (which resulted in a little useless
rectangle).
I guess that's it for now. Sorry if I broke anything, but this was
necessary imho.
SVN revision: 5605
2001-11-02 09:07:52 -08:00
|
|
|
E_Object o;
|
2001-07-30 09:59:37 -07:00
|
|
|
|
|
|
|
char *name;
|
|
|
|
char *dir;
|
|
|
|
struct {
|
|
|
|
Window main;
|
|
|
|
Window container;
|
|
|
|
} win;
|
|
|
|
int x, y;
|
|
|
|
struct {
|
|
|
|
int w, h;
|
|
|
|
} real, virt;
|
|
|
|
Evas_List windows;
|
2001-10-04 20:19:11 -07:00
|
|
|
struct {
|
|
|
|
int desk;
|
|
|
|
struct {
|
|
|
|
int x, y;
|
|
|
|
} area;
|
|
|
|
} desk;
|
2002-01-03 20:18:38 -08:00
|
|
|
E_View *view;
|
2001-07-30 09:59:37 -07:00
|
|
|
int changed;
|
|
|
|
};
|
|
|
|
|
2001-11-01 15:54:48 -08:00
|
|
|
/**
|
|
|
|
* e_desktops_init - Initializes desktop handling.
|
|
|
|
*
|
|
|
|
* This function creates the necessary windows for desktop handling,
|
|
|
|
* and makes sure they're visible and lowered. It does not handle
|
|
|
|
* the loading of background graphics information. It also makes
|
|
|
|
* sure E rregisters itself as being compatible to GNOME, KDE etc.
|
|
|
|
*/
|
2001-07-30 09:59:37 -07:00
|
|
|
void e_desktops_init(void);
|
2001-11-01 15:54:48 -08:00
|
|
|
|
2001-07-30 09:59:37 -07:00
|
|
|
void e_desktops_scroll(E_Desktop *desk, int dx, int dy);
|
|
|
|
void e_desktops_free(E_Desktop *desk);
|
2001-11-03 01:07:40 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* e_desktops_init_file_display - Loads desktop graphics information
|
|
|
|
* @desk: The desktop for which the graphics are loaded
|
|
|
|
*
|
|
|
|
* This function loads the desktop's graphics from the user's desktop
|
|
|
|
* file definition, which lives in ~/.e/desktop/default/.e_background.bg.db.
|
|
|
|
*/
|
2001-07-30 09:59:37 -07:00
|
|
|
void e_desktops_init_file_display(E_Desktop *desk);
|
2001-11-03 01:07:40 -08:00
|
|
|
|
2001-07-30 09:59:37 -07:00
|
|
|
E_Desktop *e_desktops_new(void);
|
|
|
|
void e_desktops_add_border(E_Desktop *d, E_Border *b);
|
|
|
|
void e_desktops_del_border(E_Desktop *d, E_Border *b);
|
|
|
|
void e_desktops_delete(E_Desktop *d);
|
|
|
|
void e_desktops_show(E_Desktop *d);
|
|
|
|
void e_desktops_hide(E_Desktop *d);
|
2001-11-03 01:07:40 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* e_desktops_get_num - Returns number of desktops.
|
|
|
|
*/
|
2001-07-30 09:59:37 -07:00
|
|
|
int e_desktops_get_num(void);
|
2001-11-03 01:07:40 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* e_desktops_get - Returns nth desktop
|
|
|
|
* @d: The number of the desktop to get
|
|
|
|
*
|
|
|
|
* The desktops are stored in a linked list. This function
|
|
|
|
* returns the nth of those desktops, NULL if no desktop
|
|
|
|
* was found at that index.
|
|
|
|
*/
|
2001-07-30 09:59:37 -07:00
|
|
|
E_Desktop *e_desktops_get(int d);
|
2001-11-03 01:07:40 -08:00
|
|
|
|
2001-07-30 09:59:37 -07:00
|
|
|
int e_desktops_get_current(void);
|
2001-10-04 20:19:11 -07:00
|
|
|
void e_desktops_goto_desk(int d);
|
|
|
|
void e_desktops_goto(int d, int ax, int ay);
|
2001-07-30 09:59:37 -07:00
|
|
|
|
|
|
|
#endif
|