fixed some bug with rendering engine
git-svn-id: http://tint2.googlecode.com/svn/trunk@566 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
60590bf1ac
commit
c569722617
3 changed files with 41 additions and 29 deletions
|
@ -306,6 +306,7 @@ int resize_panel(void *obj)
|
||||||
{
|
{
|
||||||
int ret = resize_by_layout(obj);
|
int ret = resize_by_layout(obj);
|
||||||
|
|
||||||
|
//printf("resize_panel\n");
|
||||||
if (panel_mode != MULTI_DESKTOP) {
|
if (panel_mode != MULTI_DESKTOP) {
|
||||||
// propagate width/height on hidden taskbar
|
// propagate width/height on hidden taskbar
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
|
@ -522,7 +523,6 @@ void set_panel_background(Panel *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// redraw panel's object
|
// redraw panel's object
|
||||||
//p->area.redraw = 1;
|
|
||||||
GSList *l0;
|
GSList *l0;
|
||||||
Area *a;
|
Area *a;
|
||||||
for (l0 = p->area.list; l0 ; l0 = l0->next) {
|
for (l0 = p->area.list; l0 ; l0 = l0->next) {
|
||||||
|
|
|
@ -261,6 +261,12 @@ void task_refresh_tasklist ()
|
||||||
|
|
||||||
int resize_taskbar(void *obj)
|
int resize_taskbar(void *obj)
|
||||||
{
|
{
|
||||||
|
//int ret = resize_by_layout(obj);
|
||||||
|
// on_changed
|
||||||
|
// taskbar->text_width = pixel_width - panel->g_task.text_posx - panel->g_task.area.bg->border.width - panel->g_task.area.paddingx;
|
||||||
|
//taskbar->text_width = taskbar->area.width - (2 * panel->g_taskbar.area.paddingy) - panel->g_task.text_posx - panel->g_task.area.bg->border.width - panel->g_task.area.paddingx;
|
||||||
|
//return ret;
|
||||||
|
|
||||||
Taskbar *taskbar = (Taskbar*)obj;
|
Taskbar *taskbar = (Taskbar*)obj;
|
||||||
Panel *panel = (Panel*)taskbar->area.panel;
|
Panel *panel = (Panel*)taskbar->area.panel;
|
||||||
Task *tsk;
|
Task *tsk;
|
||||||
|
@ -273,7 +279,7 @@ int resize_taskbar(void *obj)
|
||||||
|
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
int pixel_width, modulo_width=0;
|
int pixel_width, modulo_width=0;
|
||||||
int taskbar_width;
|
int taskbar_width, old_width;
|
||||||
|
|
||||||
// new task width for 'desktop'
|
// new task width for 'desktop'
|
||||||
task_count = g_slist_length(taskbar->area.list);
|
task_count = g_slist_length(taskbar->area.list);
|
||||||
|
@ -297,17 +303,19 @@ int resize_taskbar(void *obj)
|
||||||
for (l = taskbar->area.list; l ; l = l->next) {
|
for (l = taskbar->area.list; l ; l = l->next) {
|
||||||
tsk = l->data;
|
tsk = l->data;
|
||||||
if (!tsk->area.on_screen) continue;
|
if (!tsk->area.on_screen) continue;
|
||||||
|
old_width = tsk->area.width;
|
||||||
tsk->area.width = pixel_width;
|
tsk->area.width = pixel_width;
|
||||||
|
|
||||||
if (modulo_width) {
|
if (modulo_width) {
|
||||||
tsk->area.width++;
|
tsk->area.width++;
|
||||||
modulo_width--;
|
modulo_width--;
|
||||||
}
|
}
|
||||||
|
if (tsk->area.width != old_width)
|
||||||
|
tsk->area.on_changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int pixel_height, modulo_height=0;
|
int pixel_height, modulo_height=0;
|
||||||
int taskbar_height;
|
int taskbar_height, old_height;
|
||||||
|
|
||||||
// new task width for 'desktop'
|
// new task width for 'desktop'
|
||||||
task_count = g_slist_length(taskbar->area.list);
|
task_count = g_slist_length(taskbar->area.list);
|
||||||
|
@ -331,12 +339,14 @@ int resize_taskbar(void *obj)
|
||||||
for (l = taskbar->area.list; l ; l = l->next) {
|
for (l = taskbar->area.list; l ; l = l->next) {
|
||||||
tsk = l->data;
|
tsk = l->data;
|
||||||
if (!tsk->area.on_screen) continue;
|
if (!tsk->area.on_screen) continue;
|
||||||
|
old_height = tsk->area.height;
|
||||||
tsk->area.height = pixel_height;
|
tsk->area.height = pixel_height;
|
||||||
|
|
||||||
if (modulo_height) {
|
if (modulo_height) {
|
||||||
tsk->area.height++;
|
tsk->area.height++;
|
||||||
modulo_height--;
|
modulo_height--;
|
||||||
}
|
}
|
||||||
|
if (tsk->area.height != old_height)
|
||||||
|
tsk->area.on_changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
* - if 'size' changed then 'resize = 1' on the parent
|
* - if 'size' changed then 'resize = 1' on the parent
|
||||||
* 2) browse tree SIZE_BY_LAYOUT and POSITION
|
* 2) browse tree SIZE_BY_LAYOUT and POSITION
|
||||||
* - resize SIZE_BY_LAYOUT node : parent is resized before children
|
* - resize SIZE_BY_LAYOUT node : parent is resized before children
|
||||||
* - if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT
|
|
||||||
* - calculate position (posx,posy) : parent is calculated before children
|
* - calculate position (posx,posy) : parent is calculated before children
|
||||||
* - if 'position' changed then 'redraw = 1'
|
* - if 'position' changed then 'redraw = 1'
|
||||||
* 3) browse tree REDRAW
|
* 3) browse tree REDRAW
|
||||||
|
@ -122,10 +121,9 @@ void size_by_content (Area *a)
|
||||||
|
|
||||||
if (a->_resize) {
|
if (a->_resize) {
|
||||||
if (a->_resize(a)) {
|
if (a->_resize(a)) {
|
||||||
// 'size' changed => 'resize = 1' on the parent and redraw object
|
// 'size' changed => 'resize = 1' on the parent
|
||||||
((Area*)a->parent)->resize = 1;
|
((Area*)a->parent)->resize = 1;
|
||||||
a->on_changed = 1;
|
a->on_changed = 1;
|
||||||
a->redraw = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,13 +142,12 @@ void size_by_layout (Area *a, int pos, int level)
|
||||||
a->resize = 0;
|
a->resize = 0;
|
||||||
|
|
||||||
if (a->_resize) {
|
if (a->_resize) {
|
||||||
if (a->_resize(a)) {
|
a->_resize(a);
|
||||||
// if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT
|
// resize childs with SIZE_BY_LAYOUT
|
||||||
a->on_changed = 1;
|
for (l = a->list; l ; l = l->next) {
|
||||||
for (l = a->list; l ; l = l->next) {
|
Area *child = ((Area*)l->data);
|
||||||
if (((Area*)l->data)->size_mode == SIZE_BY_LAYOUT)
|
if (child->size_mode == SIZE_BY_LAYOUT && child->list)
|
||||||
((Area*)l->data)->resize = 1;
|
child->resize = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +165,6 @@ void size_by_layout (Area *a, int pos, int level)
|
||||||
// pos changed => redraw
|
// pos changed => redraw
|
||||||
child->posx = pos;
|
child->posx = pos;
|
||||||
child->on_changed = 1;
|
child->on_changed = 1;
|
||||||
child->redraw = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -176,21 +172,24 @@ void size_by_layout (Area *a, int pos, int level)
|
||||||
// pos changed => redraw
|
// pos changed => redraw
|
||||||
child->posy = pos;
|
child->posy = pos;
|
||||||
child->on_changed = 1;
|
child->on_changed = 1;
|
||||||
child->redraw = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("level %d, object %d, pos %d\n", level, i, pos);
|
|
||||||
|
|
||||||
|
//printf("level %d, object %d, pos %d\n", level, i, pos);
|
||||||
size_by_layout(child, pos, level+1);
|
size_by_layout(child, pos, level+1);
|
||||||
|
|
||||||
if (panel_horizontal)
|
if (panel_horizontal)
|
||||||
pos += child->width + a->paddingx;
|
pos += child->width + a->paddingx;
|
||||||
else
|
else
|
||||||
pos += child->height + a->paddingx;
|
pos += child->height + a->paddingx;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a->on_changed) {
|
||||||
|
// pos/size changed
|
||||||
|
a->redraw = 1;
|
||||||
|
if (a->_on_change_layout)
|
||||||
|
a->_on_change_layout (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->on_changed && a->_on_change_layout)
|
|
||||||
a->_on_change_layout (a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,10 +202,9 @@ void refresh (Area *a)
|
||||||
if (a->redraw) {
|
if (a->redraw) {
|
||||||
a->redraw = 0;
|
a->redraw = 0;
|
||||||
// force redraw of child
|
// force redraw of child
|
||||||
GSList *l;
|
//GSList *l;
|
||||||
for (l = a->list ; l ; l = l->next)
|
//for (l = a->list ; l ; l = l->next)
|
||||||
((Area*)l->data)->redraw = 1;
|
//((Area*)l->data)->redraw = 1;
|
||||||
// set_redraw(l->data);
|
|
||||||
|
|
||||||
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
||||||
draw(a);
|
draw(a);
|
||||||
|
@ -245,7 +243,7 @@ int resize_by_layout(void *obj)
|
||||||
size -= ((nb_by_content+nb_by_layout-1) * a->paddingx);
|
size -= ((nb_by_content+nb_by_layout-1) * a->paddingx);
|
||||||
//printf("resize_panel : size_panel %d, size_layout %d\n", panel->area.width, size);
|
//printf("resize_panel : size_panel %d, size_layout %d\n", panel->area.width, size);
|
||||||
|
|
||||||
int width=0, modulo=0;
|
int width=0, modulo=0, old_width;
|
||||||
if (nb_by_layout) {
|
if (nb_by_layout) {
|
||||||
width = size / nb_by_layout;
|
width = size / nb_by_layout;
|
||||||
modulo = size % nb_by_layout;
|
modulo = size % nb_by_layout;
|
||||||
|
@ -255,12 +253,14 @@ int resize_by_layout(void *obj)
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->list ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
||||||
|
old_width = child->width;
|
||||||
child->width = width;
|
child->width = width;
|
||||||
child->resize = 1;
|
|
||||||
if (modulo) {
|
if (modulo) {
|
||||||
child->width++;
|
child->width++;
|
||||||
modulo--;
|
modulo--;
|
||||||
}
|
}
|
||||||
|
if (child->width != old_width)
|
||||||
|
child->on_changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ int resize_by_layout(void *obj)
|
||||||
if (nb_by_content+nb_by_layout)
|
if (nb_by_content+nb_by_layout)
|
||||||
size -= ((nb_by_content+nb_by_layout-1) * a->paddingx);
|
size -= ((nb_by_content+nb_by_layout-1) * a->paddingx);
|
||||||
|
|
||||||
int height=0, modulo=0;
|
int height=0, modulo=0, old_height;
|
||||||
if (nb_by_layout) {
|
if (nb_by_layout) {
|
||||||
height = size / nb_by_layout;
|
height = size / nb_by_layout;
|
||||||
modulo = size % nb_by_layout;
|
modulo = size % nb_by_layout;
|
||||||
|
@ -290,12 +290,14 @@ int resize_by_layout(void *obj)
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->list ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
||||||
|
old_height = child->height;
|
||||||
child->height = height;
|
child->height = height;
|
||||||
child->resize = 1;
|
|
||||||
if (modulo) {
|
if (modulo) {
|
||||||
child->height++;
|
child->height++;
|
||||||
modulo--;
|
modulo--;
|
||||||
}
|
}
|
||||||
|
if (child->height != old_height)
|
||||||
|
child->on_changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue