fixed bug : clock resize when date changed, number of desktop changed
git-svn-id: http://tint2.googlecode.com/svn/trunk@51 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
|
||||
void refresh (Area *a)
|
||||
{
|
||||
if (a->resize) {
|
||||
// resize can generate a redraw
|
||||
if (a->_resize)
|
||||
a->_resize(a);
|
||||
a->resize = 0;
|
||||
}
|
||||
|
||||
if (a->redraw) {
|
||||
//printf("draw pix\n");
|
||||
draw(a, 0);
|
||||
@@ -61,6 +68,16 @@ void set_redraw (Area *a)
|
||||
}
|
||||
|
||||
|
||||
void set_resize (Area *a)
|
||||
{
|
||||
a->resize = 1;
|
||||
|
||||
GSList *l;
|
||||
for (l = a->list ; l ; l = l->next)
|
||||
set_resize(l->data);
|
||||
}
|
||||
|
||||
|
||||
void draw (Area *a, int active)
|
||||
{
|
||||
Pixmap *pmap = (active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
|
||||
@@ -80,8 +97,8 @@ void draw (Area *a, int active)
|
||||
|
||||
draw_background (a, c, active);
|
||||
|
||||
if (a->draw_foreground)
|
||||
a->draw_foreground(a, c, active);
|
||||
if (a->_draw_foreground)
|
||||
a->_draw_foreground(a, c, active);
|
||||
|
||||
cairo_destroy (c);
|
||||
cairo_surface_destroy (cs);
|
||||
@@ -180,6 +197,8 @@ void free_area (Area *a)
|
||||
g_slist_free(a->list);
|
||||
a->list = 0;
|
||||
}
|
||||
if (a->pix.pmap) XFreePixmap (server.dsp, a->pix.pmap);
|
||||
if (a->pix_active.pmap) XFreePixmap (server.dsp, a->pix_active.pmap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,8 +60,6 @@ typedef struct
|
||||
} Pmap;
|
||||
|
||||
|
||||
// TODO: isoler 'draw' de 'refresh'
|
||||
// TODO: isoler les données locales des données communes aux freres
|
||||
typedef struct {
|
||||
// absolute coordinate in panel
|
||||
int posx, posy;
|
||||
@@ -72,6 +70,8 @@ typedef struct {
|
||||
// list of child : Area object
|
||||
GSList *list;
|
||||
|
||||
// need compute position and width
|
||||
int resize;
|
||||
// need redraw Pixmap
|
||||
int redraw;
|
||||
int use_active, is_active;
|
||||
@@ -84,9 +84,10 @@ typedef struct {
|
||||
void *panel;
|
||||
|
||||
// each object can overwrite following function
|
||||
void (*draw_foreground)(void *obj, cairo_t *c, int active);
|
||||
void (*add_child)(void *obj);
|
||||
int (*remove_child)(void *obj);
|
||||
void (*_draw_foreground)(void *obj, cairo_t *c, int active);
|
||||
void (*_resize)(void *obj);
|
||||
void (*_add_child)(void *obj);
|
||||
int (*_remove_child)(void *obj);
|
||||
} Area;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user