tiling - ignore min size for layout of tree to avoid insta-floats

so some clients just cant tile due to min size and this leads to
really bad results so pass the problem back to the user to go resize
them up to fit. this probably needs far more extensive layout logic.
the data struct is a tree but perhaps it needs to flatten out into a
table to make layouting more sane. but that's the future. for now be
less bad today.
This commit is contained in:
Carsten Haitzler 2019-08-10 10:57:09 +01:00
parent e11eb90231
commit a172d930da
3 changed files with 28 additions and 16 deletions

View File

@ -479,7 +479,8 @@ _reapply_tree(void)
if (zw > 0 && zh > 0)
tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh,
tiling_g.config->window_padding);
tiling_g.config->window_padding,
EINA_FALSE);
else
ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh);
}

View File

@ -296,20 +296,20 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
Tiling_Split_Type split_type = level % 2;
double total_weight = 0.0;
root->space.x = x;
root->space.y = y;
root->space.w = w - padding;
root->space.h = h - padding;
if (root->client)
{
if (!e_object_is_del(E_OBJECT(root->client)))
{
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);
}
(root->client->icccm.min_h > (h - padding)))
*floaters = eina_list_append(*floaters, root->client);
tiling_e_client_move_resize_extra(root->client, x, y,
w - padding, h - padding);
}
return;
}
@ -341,9 +341,10 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
((Window_Tree *)(void *)root->children->last)->weight += 1.0 - total_weight;
}
void
Eina_Bool
tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
Evas_Coord w, Evas_Coord h, Evas_Coord padding)
Evas_Coord w, Evas_Coord h, Evas_Coord padding,
Eina_Bool force_float)
{
Eina_List *floaters = NULL;
E_Client *ec;
@ -354,10 +355,16 @@ tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
h -= padding;
_tiling_window_tree_level_apply(root, x, y, w, h, 0, padding, &floaters);
EINA_LIST_FREE(floaters, ec)
if (floaters)
{
tiling_e_client_does_not_fit(ec);
// some clients failed to properly fit and maybe SHOULD float
EINA_LIST_FREE(floaters, ec)
{
if (force_float) tiling_e_client_does_not_fit(ec);
}
return EINA_FALSE;
}
return EINA_TRUE;
}
static Window_Tree *

View File

@ -21,6 +21,9 @@ struct _Window_Tree
/* FIXME: client is falid iff children is null. Sholud enforce it. */
Eina_Inlist *children; /* Window_Tree * type */
E_Client *client;
struct {
int x, y, w, h;
} space;
double weight;
};
@ -52,8 +55,9 @@ Window_Tree *tiling_window_tree_remove(Window_Tree *root, Window_Tree *item);
Window_Tree *tiling_window_tree_client_find(Window_Tree *root,
E_Client *client);
void tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
Evas_Coord w, Evas_Coord h, Evas_Coord padding);
Eina_Bool tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
Evas_Coord w, Evas_Coord h, Evas_Coord padding,
Eina_Bool force_float);
Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir,
double w_diff, int h_dir, double h_diff);