Tiling2: Fixed formattign, again.

Fixes T919.
This commit is contained in:
Tom Hacohen 2014-02-10 09:27:57 +00:00
parent 92b0d0171c
commit f4a7b6512a
5 changed files with 897 additions and 843 deletions

View File

@ -340,3 +340,4 @@ e_int_config_tiling_module(E_Comp * comp, const char *params EINA_UNUSED)
"windows/tiling", buf, 0, v, NULL);
return cfd;
}

View File

@ -55,6 +55,7 @@ _tiling_cb_menu_configure(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_
// FIXME here need to be some checks and return ?
e_int_config_tiling_module(NULL, NULL);
}
static const char *_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas);
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
@ -86,7 +87,8 @@ static struct tiling_mod_main_g
Tiling_Split_Type split_type;
} _G =
{
.split_type = TILING_SPLIT_HORIZONTAL,};
.split_type = TILING_SPLIT_HORIZONTAL,
};
/* Define the class and gadcon functions this module provides */
static const E_Gadcon_Client_Class _gc_class =
@ -150,7 +152,7 @@ static Eina_Bool
desk_should_tile_check(const E_Desk *desk)
{
check_tinfo(desk);
return (_G.tinfo && _G.tinfo->conf && _G.tinfo->conf->nb_stacks);
return _G.tinfo && _G.tinfo->conf && _G.tinfo->conf->nb_stacks;
}
static int
@ -211,7 +213,8 @@ _info_hash_update(const Eina_Hash * hash EINA_UNUSED,
tinfo->conf =
get_vdesk(tiling_g.config->vdesks, tinfo->desk->x, tinfo->desk->y,
tinfo->desk->zone->num);
} else
}
else
{
tinfo->conf = NULL;
}
@ -291,21 +294,30 @@ _get_or_create_client_extra(E_Client * ec)
{
.client = ec, .expected =
{
.x = ec->x,.y = ec->y,.w = ec->w,.h = ec->h,}
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
}
, .orig =
{
.geom =
{
.x = ec->x,.y = ec->y,.w = ec->w,.h = ec->h,}
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
}
, .maximized = ec->maximized, .bordername =
eina_stringshare_add(ec->bordername),}
,};
eina_stringshare_add(ec->bordername),
}
,
};
eina_hash_direct_add(_G.client_extras, &extra->client, extra);
} else
}
else
{
extra->expected = (geom_t)
{
.x = ec->x,.y = ec->y,.w = ec->w,.h = ec->h,};
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
};
extra->orig.geom = extra->expected;
extra->orig.maximized = ec->maximized;
eina_stringshare_replace(&extra->orig.bordername, ec->bordername);
@ -327,7 +339,8 @@ tiling_e_client_move_resize_extra(E_Client * ec, int x, int y, int w, int h)
extra->expected = (geom_t)
{
.x = x,.y = y,.w = w,.h = h,};
.x = x, .y = y, .w = w, .h = h,
};
_e_client_move_resize(ec, x, y, w, h);
}
@ -405,7 +418,8 @@ change_desk_conf(struct _Config_vdesk *newconf)
if (_G.tinfo->conf)
{
old_nb_stacks = _G.tinfo->conf->nb_stacks;
} else
}
else
{
newconf->nb_stacks = 0;
}
@ -555,7 +569,8 @@ toggle_floating(E_Client * ec)
{
_restore_client(ec);
_remove_client(ec);
} else
}
else
{
_add_client(ec);
}
@ -757,7 +772,6 @@ _move_or_resize(E_Client * ec)
if ((ec->x == extra->expected.x) && (ec->y == extra->expected.y) &&
(ec->w == extra->expected.w) && (ec->h == extra->expected.h))
{
return;
}
@ -795,14 +809,17 @@ _move_or_resize(E_Client * ec)
case E_POINTER_RESIZE_BL:
w_dir = -1;
break;
case E_POINTER_RESIZE_T:
case E_POINTER_RESIZE_TR:
h_dir = -1;
break;
case E_POINTER_RESIZE_TL:
w_dir = -1;
h_dir = -1;
break;
default:
break;
}
@ -849,12 +866,15 @@ _resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
case E_POINTER_RESIZE_L:
ec->resize_mode = E_POINTER_RESIZE_NONE;
break;
case E_POINTER_RESIZE_TL:
ec->resize_mode = E_POINTER_RESIZE_T;
break;
case E_POINTER_RESIZE_BL:
ec->resize_mode = E_POINTER_RESIZE_B;
break;
default:
break;
}
@ -866,12 +886,15 @@ _resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
case E_POINTER_RESIZE_R:
ec->resize_mode = E_POINTER_RESIZE_NONE;
break;
case E_POINTER_RESIZE_TR:
ec->resize_mode = E_POINTER_RESIZE_T;
break;
case E_POINTER_RESIZE_BR:
ec->resize_mode = E_POINTER_RESIZE_B;
break;
default:
break;
}
@ -883,12 +906,15 @@ _resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
case E_POINTER_RESIZE_T:
ec->resize_mode = E_POINTER_RESIZE_NONE;
break;
case E_POINTER_RESIZE_TL:
ec->resize_mode = E_POINTER_RESIZE_L;
break;
case E_POINTER_RESIZE_TR:
ec->resize_mode = E_POINTER_RESIZE_R;
break;
default:
break;
}
@ -900,12 +926,15 @@ _resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
case E_POINTER_RESIZE_B:
ec->resize_mode = E_POINTER_RESIZE_NONE;
break;
case E_POINTER_RESIZE_BL:
ec->resize_mode = E_POINTER_RESIZE_L;
break;
case E_POINTER_RESIZE_BR:
ec->resize_mode = E_POINTER_RESIZE_R;
break;
default:
break;
}
@ -1024,7 +1053,8 @@ toggle_sticky(E_Client * ec)
{
_restore_client(ec);
_remove_client(ec);
} else
}
else
{
_add_client(ec);
}
@ -1126,7 +1156,8 @@ _bd_hook(void *d EINA_UNUSED, E_Client * ec)
}
/* position menu item just before the last separator */
EINA_LIST_REVERSE_FOREACH(m->items, l, mi) if (mi->separator)
EINA_LIST_REVERSE_FOREACH(m->items, l, mi)
if (mi->separator)
break;
if ((!mi) || (!mi->separator))
return;
@ -1463,12 +1494,15 @@ _gadget_icon_set(Instance *inst)
case TILING_SPLIT_HORIZONTAL:
edje_object_signal_emit(inst->gadget, "tiling,mode,horizontal", "e");
break;
case TILING_SPLIT_VERTICAL:
edje_object_signal_emit(inst->gadget, "tiling,mode,vertical", "e");
break;
case TILING_SPLIT_FLOAT:
edje_object_signal_emit(inst->gadget, "tiling,mode,floating", "e");
break;
default:
ERR("Unknown split type.");
}
@ -1600,5 +1634,4 @@ _gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
return _current_gad_id = eina_stringshare_add(buf);
}
/* }}} */

View File

@ -91,11 +91,13 @@ tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
if (split_type > TILING_SPLIT_VERTICAL)
{
return root;
} else if (!root)
}
else if (!root)
{
new_node->weight = 1.0;
return new_node;
} else if (!parent)
}
else if (!parent)
{
parent = root;
parent_split_type = _tiling_window_tree_split_type_get(parent);
@ -112,18 +114,21 @@ tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
if (parent->children)
{
_tiling_window_tree_parent_add(parent, new_node);
} else
}
else
{
_tiling_window_tree_split_add(parent, new_node);
}
} else
}
else
{
Window_Tree *grand_parent = parent->parent;
if (grand_parent && grand_parent->children)
{
_tiling_window_tree_parent_add(grand_parent, new_node);
} else
}
else
{
root = calloc(1, sizeof(*root));
_tiling_window_tree_split_add(parent, new_node);
@ -144,7 +149,8 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
{
free(item);
return NULL;
} else if (!item->client)
}
else if (!item->client)
{
ERR("Tried deleting node %p that doesn't have a client.", item);
return root;
@ -171,13 +177,15 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
free(item);
free(root);
return NULL;
} else if (!item_keep->children)
}
else if (!item_keep->children)
{
parent->client = item_keep->client;
parent->children = NULL;
free(item_keep);
} else
}
else
{
if (grand_parent)
{
@ -202,7 +210,8 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
EINA_INLIST_GET(parent));
free(parent);
}
} else
}
else
{
/* This is fine, as this is a child of the root so we allow
* two levels. */
@ -212,7 +221,8 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
parent->children =
eina_inlist_remove(parent->children, EINA_INLIST_GET(item));
}
} else
}
else
{
Window_Tree *itr;
float weight = 1.0 - item->weight;
@ -279,7 +289,8 @@ _tiling_window_tree_level_apply(Window_Tree * root, Evas_Coord x, Evas_Coord y,
_tiling_window_tree_level_apply(itr, x, y, itw, h, level + 1, padding);
x += itw;
}
} else if (split_type == TILING_SPLIT_VERTICAL)
}
else if (split_type == TILING_SPLIT_VERTICAL)
{
EINA_INLIST_FOREACH(root->children, itr)
{
@ -329,7 +340,8 @@ _tiling_window_tree_node_resize_direction(Window_Tree * node,
{
itr_func = _inlist_prev;
children_start = (Window_Tree *)parent->children->last;
} else
}
else
{
itr_func = _inlist_next;
children_start = (Window_Tree *)parent->children;
@ -389,7 +401,8 @@ tiling_window_tree_node_resize(Window_Tree * node, int w_dir, double w_diff,
{
w_parent = parent;
h_parent = grand_parent;
} else
}
else
{
w_parent = grand_parent;
h_parent = parent;
@ -427,10 +440,12 @@ _tiling_window_tree_edges_get_helper(Window_Tree * node,
if (!node->parent)
{
return ret;
} else if (gave_up_this && gave_up_parent)
}
else if (gave_up_this && gave_up_parent)
{
return 0;
} else if (gave_up_this)
}
else if (gave_up_this)
{
/* Mixed the gave_up vals on purpose, we do it on every call. */
return _tiling_window_tree_edges_get_helper(node->parent, !split_type,
@ -518,18 +533,22 @@ _tiling_window_tree_node_move_walker(void *_node)
if ((node->client->x + node->client->w) == CNODE->client->x)
IF_MATCH_SET_LR(node);
break;
case TILING_WINDOW_TREE_EDGE_RIGHT:
if (node->client->x == (CNODE->client->x + CNODE->client->w))
IF_MATCH_SET_LR(node);
break;
case TILING_WINDOW_TREE_EDGE_TOP:
if ((node->client->y + node->client->h) == CNODE->client->y)
IF_MATCH_SET_TB(node);
break;
case TILING_WINDOW_TREE_EDGE_BOTTOM:
if (node->client->y == (CNODE->client->y + CNODE->client->h))
IF_MATCH_SET_TB(node);
break;
default:
break;
}
@ -593,3 +612,4 @@ tiling_window_tree_dump(Window_Tree * root, int level)
tiling_window_tree_dump(itr, level + 1);
}
}