forked from enlightenment/enlightenment
Tiling: Respect min size hints (set to floating if doesn't fit).
This fix floats all the windows that don't fit because of their min size restrictions. It can be made better, at the moment it is very simple. An example broken case would be the following: Assume we have 3 windows, A, B and C. B and C both hand a min width of half the screen. First we create A, then B. Everything works as they share the screen, but when we add C, both B's and C's restrictions "fail" so they are both set to float although in reality, floating C is enough. This can be fixed by doing a live scan of the tree every time a window is floated, though it's not essential at the moment. Fixes T952.
This commit is contained in:
parent
63b5da69f0
commit
37462c7cb7
|
@ -703,6 +703,12 @@ toggle_floating(E_Client *ec)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
tiling_e_client_does_not_fit(E_Client *ec)
|
||||
{
|
||||
toggle_floating(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_action_toggle_floating_cb(E_Object *obj EINA_UNUSED,
|
||||
const char *params EINA_UNUSED)
|
||||
|
|
|
@ -84,6 +84,7 @@ struct _Config_vdesk *get_vdesk(Eina_List *vdesks, int x, int y,
|
|||
|
||||
void tiling_e_client_move_resize_extra(E_Client *ec, int x, int y, int w,
|
||||
int h);
|
||||
void tiling_e_client_does_not_fit(E_Client *ec);
|
||||
# define EINA_LIST_IS_IN(_list, _el) \
|
||||
(eina_list_data_find(_list, _el) == _el)
|
||||
# define EINA_LIST_APPEND(_list, _el) \
|
||||
|
|
|
@ -269,7 +269,8 @@ tiling_window_tree_client_find(Window_Tree *root, E_Client *client)
|
|||
|
||||
void
|
||||
_tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
||||
Evas_Coord w, Evas_Coord h, int level, Evas_Coord padding)
|
||||
Evas_Coord w, Evas_Coord h, int level, Evas_Coord padding,
|
||||
Eina_List **floaters)
|
||||
{
|
||||
Window_Tree *itr;
|
||||
Tiling_Split_Type split_type = level % 2;
|
||||
|
@ -278,8 +279,18 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
|||
if (root->client)
|
||||
{
|
||||
if (!e_object_is_del(E_OBJECT(root->client)))
|
||||
tiling_e_client_move_resize_extra(root->client, x, y,
|
||||
w - padding, h - padding);
|
||||
{
|
||||
if ((root->client->icccm.min_w > (w - padding)) ||
|
||||
(root->client->icccm.min_h > (h - padding)))
|
||||
{
|
||||
*floaters = eina_list_append(*floaters, root->client);
|
||||
}
|
||||
else
|
||||
{
|
||||
tiling_e_client_move_resize_extra(root->client, x, y,
|
||||
w - padding, h - padding);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -290,7 +301,7 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
|||
Evas_Coord itw = w * itr->weight;
|
||||
|
||||
total_weight += itr->weight;
|
||||
_tiling_window_tree_level_apply(itr, x, y, itw, h, level + 1, padding);
|
||||
_tiling_window_tree_level_apply(itr, x, y, itw, h, level + 1, padding, floaters);
|
||||
x += itw;
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +312,7 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
|||
Evas_Coord ith = h * itr->weight;
|
||||
|
||||
total_weight += itr->weight;
|
||||
_tiling_window_tree_level_apply(itr, x, y, w, ith, level + 1, padding);
|
||||
_tiling_window_tree_level_apply(itr, x, y, w, ith, level + 1, padding, floaters);
|
||||
y += ith;
|
||||
}
|
||||
}
|
||||
|
@ -314,8 +325,19 @@ void
|
|||
tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
||||
Evas_Coord w, Evas_Coord h, Evas_Coord padding)
|
||||
{
|
||||
_tiling_window_tree_level_apply(root, x + padding, y + padding,
|
||||
w - padding, h - padding, 0, padding);
|
||||
Eina_List *floaters = NULL;
|
||||
E_Client *ec;
|
||||
|
||||
x += padding;
|
||||
y += padding;
|
||||
w -= padding;
|
||||
h -= padding;
|
||||
_tiling_window_tree_level_apply(root, x, y, w, h, 0, padding, &floaters);
|
||||
|
||||
EINA_LIST_FREE(floaters, ec)
|
||||
{
|
||||
tiling_e_client_does_not_fit(ec);
|
||||
}
|
||||
}
|
||||
|
||||
static Window_Tree *
|
||||
|
|
Loading…
Reference in New Issue