fixed Issue 282 : second try
git-svn-id: http://tint2.googlecode.com/svn/trunk@527 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
3eb1b736e3
commit
9feef39d6f
4 changed files with 45 additions and 26 deletions
|
@ -163,7 +163,7 @@ void init_panel()
|
||||||
p->area.panel = p;
|
p->area.panel = p;
|
||||||
p->area.on_screen = 1;
|
p->area.on_screen = 1;
|
||||||
p->area.resize = 1;
|
p->area.resize = 1;
|
||||||
p->area.size_mode = SIZE_BY_CONTENT;
|
p->area.size_mode = SIZE_BY_LAYOUT;
|
||||||
p->area._resize = resize_panel;
|
p->area._resize = resize_panel;
|
||||||
p->g_taskbar.area.parent = p;
|
p->g_taskbar.area.parent = p;
|
||||||
p->g_taskbar.area.panel = p;
|
p->g_taskbar.area.panel = p;
|
||||||
|
|
|
@ -170,8 +170,9 @@ void *server_get_property (Window win, Atom at, Atom type, int *num_results)
|
||||||
|
|
||||||
result = XGetWindowProperty(server.dsp, win, at, 0, 0x7fffffff, False, type, &type_ret, &format_ret, &nitems_ret, &bafter_ret, &prop_value);
|
result = XGetWindowProperty(server.dsp, win, at, 0, 0x7fffffff, False, type, &type_ret, &format_ret, &nitems_ret, &bafter_ret, &prop_value);
|
||||||
|
|
||||||
/* Send back resultcount */
|
// Send back resultcount
|
||||||
if (num_results) *num_results = nitems_ret;
|
// it look some version of gcc doesn't do the cast. so we force it.
|
||||||
|
if (num_results) *num_results = (int)nitems_ret;
|
||||||
|
|
||||||
if (result == Success && prop_value) return prop_value;
|
if (result == Success && prop_value) return prop_value;
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
|
@ -221,7 +221,7 @@ void get_icon (Task *tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &i);
|
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &i);
|
||||||
if (data && i) {
|
if (data) {
|
||||||
// get ARGB icon
|
// get ARGB icon
|
||||||
int w, h;
|
int w, h;
|
||||||
long *tmp_data;
|
long *tmp_data;
|
||||||
|
|
|
@ -31,25 +31,38 @@
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/************************************************************
|
||||||
// TODO : layering & drawing loop
|
* Layering & drawing loop of tint2
|
||||||
1) browse tree and resize SIZE_BY_CONTENT node
|
*
|
||||||
- children node are resized before its parent
|
* Areas in tint2 are similar to widgets in a GUI.
|
||||||
- if 'size' changed then 'resize = 1' on the parent
|
* Areas (task, clock, systray, taskbar,...) are nodes in a tree.
|
||||||
2) browse tree and resize SIZE_BY_LAYOUT node
|
* The position of each Area is defined by parent's position and brothers on the left.
|
||||||
- parent node is resized before its children
|
*
|
||||||
- if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT
|
* !!! This design is experimental and not yet complete !!!!!!!!!!!!!
|
||||||
3) calculate posx of all objects
|
*
|
||||||
4) redraw needed objects
|
* 1) browse tree and resize SIZE_BY_CONTENT node
|
||||||
*/
|
* - children node are resized before its parent
|
||||||
|
* - if 'size' changed then 'resize = 1' on the parent
|
||||||
|
* 2) browse tree and resize SIZE_BY_LAYOUT node
|
||||||
|
* - parent node is resized before its children
|
||||||
|
* - if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT
|
||||||
|
* 3) calculate posx of all objects
|
||||||
|
* - parent's position is calculated before children's position
|
||||||
|
* 4) redraw needed objects
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
void size_by_content (Area *a);
|
||||||
|
void size_by_layout (Area *a);
|
||||||
|
|
||||||
|
|
||||||
void refresh (Area *a)
|
void refresh (Area *a)
|
||||||
{
|
{
|
||||||
// don't draw and resize hide objects
|
// don't draw and resize hide objects
|
||||||
if (!a->on_screen) return;
|
if (!a->on_screen) return;
|
||||||
|
|
||||||
size(a);
|
//size(a);
|
||||||
//size_by_content(a);
|
size_by_content(a);
|
||||||
|
size_by_layout(a);
|
||||||
|
|
||||||
// don't draw transparent objects (without foreground and without background)
|
// don't draw transparent objects (without foreground and without background)
|
||||||
if (a->redraw) {
|
if (a->redraw) {
|
||||||
|
@ -93,7 +106,7 @@ void size (Area *a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// browse tree and resize SIZE_BY_CONTENT node
|
|
||||||
void size_by_content (Area *a)
|
void size_by_content (Area *a)
|
||||||
{
|
{
|
||||||
// children node are resized before its parent
|
// children node are resized before its parent
|
||||||
|
@ -106,27 +119,32 @@ void size_by_content (Area *a)
|
||||||
a->resize = 0;
|
a->resize = 0;
|
||||||
|
|
||||||
// if 'size' changed then 'resize = 1' on the parent
|
// if 'size' changed then 'resize = 1' on the parent
|
||||||
a->_resize(a);
|
if (a->_resize) {
|
||||||
((Area*)a->parent)->resize = 1;
|
a->_resize(a);
|
||||||
|
((Area*)a->parent)->resize = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// browse tree and resize SIZE_BY_LAYOUT node
|
|
||||||
void size_by_layout (Area *a)
|
void size_by_layout (Area *a)
|
||||||
{
|
{
|
||||||
// parent node is resized before its children
|
// parent node is resized before its children
|
||||||
|
|
||||||
// calculate current area's size
|
// calculate current area's size
|
||||||
|
GSList *l;
|
||||||
if (a->resize && a->size_mode == SIZE_BY_LAYOUT) {
|
if (a->resize && a->size_mode == SIZE_BY_LAYOUT) {
|
||||||
a->resize = 0;
|
a->resize = 0;
|
||||||
|
|
||||||
// if 'size' changed then 'resize = 1' on the parent
|
// if 'size' changed then 'resize = 1' on childs with SIZE_BY_LAYOUT
|
||||||
//if (a->_resize(a))
|
if (a->_resize) {
|
||||||
//a->parent->resize = 1;
|
a->_resize(a);
|
||||||
|
for (l = a->list; l ; l = l->next) {
|
||||||
|
if (((Area*)l->data)->size_mode == SIZE_BY_LAYOUT)
|
||||||
|
((Area*)l->data)->resize = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *l;
|
|
||||||
for (l = a->list; l ; l = l->next)
|
for (l = a->list; l ; l = l->next)
|
||||||
size_by_layout(l->data);
|
size_by_layout(l->data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue