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

@ -33,7 +33,7 @@ _open_browser_help_cb(void *data EINA_UNUSED, void *obj EINA_UNUSED)
e_widget_list_object_append(list, object, 1, 1, 0.5)
struct _Config_vdesk *
get_vdesk(Eina_List * vdesks, int x, int y, unsigned int zone_num)
get_vdesk(Eina_List *vdesks, int x, int y, unsigned int zone_num)
{
Eina_List *l;
@ -57,7 +57,7 @@ get_vdesk(Eina_List * vdesks, int x, int y, unsigned int zone_num)
*
*/
static void *
_create_data(E_Config_Dialog * cfd EINA_UNUSED)
_create_data(E_Config_Dialog *cfd EINA_UNUSED)
{
E_Config_Dialog_Data *cfdata;
Eina_List *l;
@ -92,14 +92,14 @@ _create_data(E_Config_Dialog * cfd EINA_UNUSED)
}
static void
_free_data(E_Config_Dialog * cfd EINA_UNUSED, E_Config_Dialog_Data * cfdata)
_free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{
eina_list_free(cfdata->config.vdesks);
free(cfdata);
}
static void
_fill_zone_config(E_Zone * zone, E_Config_Dialog_Data * cfdata)
_fill_zone_config(E_Zone *zone, E_Config_Dialog_Data *cfdata)
{
Evas *evas;
int i;
@ -147,7 +147,7 @@ _fill_zone_config(E_Zone * zone, E_Config_Dialog_Data * cfdata)
}
static void
_cb_zone_change(void *data, Evas_Object * obj EINA_UNUSED)
_cb_zone_change(void *data, Evas_Object *obj EINA_UNUSED)
{
int n;
E_Config_Dialog_Data *cfdata = data;
@ -164,8 +164,8 @@ _cb_zone_change(void *data, Evas_Object * obj EINA_UNUSED)
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
E_Config_Dialog_Data * cfdata)
_basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas,
E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *oc, *of, *slider;
E_Comp *comp;
@ -222,8 +222,8 @@ _basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
LIST_ADD(o, of);
of = e_widget_label_add(evas, _("Padding between windows"));
LIST_ADD(o,of);
slider = e_widget_slider_add(evas, 1,0, ("%1.0f px"), 0.0, TILING_MAX_PADDING,
LIST_ADD(o, of);
slider = e_widget_slider_add(evas, 1, 0, ("%1.0f px"), 0.0, TILING_MAX_PADDING,
1.0, 0, NULL, &cfdata->config.window_padding, 150);
LIST_ADD(o, slider);
@ -235,8 +235,8 @@ _basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
}
static int
_basic_apply_data(E_Config_Dialog * cfd EINA_UNUSED,
E_Config_Dialog_Data * cfdata)
_basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
E_Config_Dialog_Data *cfdata)
{
struct _Config_vdesk *vd;
Eina_List *l;
@ -317,7 +317,7 @@ _basic_apply_data(E_Config_Dialog * cfd EINA_UNUSED,
}
E_Config_Dialog *
e_int_config_tiling_module(E_Comp * comp, const char *params EINA_UNUSED)
e_int_config_tiling_module(E_Comp *comp, const char *params EINA_UNUSED)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
@ -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

@ -22,8 +22,8 @@ typedef struct Client_Extra
const char *bordername;
} orig;
int last_frame_adjustment; // FIXME: Hack for frame resize bug.
Eina_Bool floating:1;
Eina_Bool tiled:1;
Eina_Bool floating : 1;
Eina_Bool tiled : 1;
} Client_Extra;
typedef struct _Instance
@ -41,9 +41,9 @@ struct tiling_g tiling_g = {
.log_domain = -1,
};
static void _add_client(E_Client * ec);
static void _remove_client(E_Client * ec);
static void _foreach_desk(void (*func) (E_Desk * desk));
static void _add_client(E_Client *ec);
static void _remove_client(E_Client *ec);
static void _foreach_desk(void (*func)(E_Desk *desk));
/* Func Proto Requirements for Gadcon */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
@ -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 =
@ -112,7 +114,7 @@ get_current_desk(void)
}
static Tiling_Info *
_initialize_tinfo(const E_Desk * desk)
_initialize_tinfo(const E_Desk *desk)
{
Tiling_Info *tinfo;
@ -127,7 +129,7 @@ _initialize_tinfo(const E_Desk * desk)
}
static void
check_tinfo(const E_Desk * desk)
check_tinfo(const E_Desk *desk)
{
if (!_G.tinfo || _G.tinfo->desk != desk)
{
@ -147,14 +149,14 @@ check_tinfo(const E_Desk * desk)
}
static Eina_Bool
desk_should_tile_check(const E_Desk * desk)
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
is_ignored_window(const Client_Extra * extra)
is_ignored_window(const Client_Extra *extra)
{
if (extra->client->sticky || extra->floating)
return true;
@ -163,7 +165,7 @@ is_ignored_window(const Client_Extra * extra)
}
static int
is_tilable(const E_Client * ec)
is_tilable(const E_Client *ec)
{
if (ec->icccm.min_h == ec->icccm.max_h && ec->icccm.max_h > 0)
return false;
@ -190,7 +192,7 @@ is_tilable(const E_Client * ec)
}
static void
change_window_border(E_Client * ec, const char *bordername)
change_window_border(E_Client *ec, const char *bordername)
{
eina_stringshare_replace(&ec->bordername, bordername);
ec->border.changed = true;
@ -201,7 +203,7 @@ change_window_border(E_Client * ec, const char *bordername)
}
static Eina_Bool
_info_hash_update(const Eina_Hash * hash EINA_UNUSED,
_info_hash_update(const Eina_Hash *hash EINA_UNUSED,
const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
{
Tiling_Info *tinfo = data;
@ -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;
}
@ -226,7 +229,7 @@ e_tiling_update_conf(void)
}
static void
_e_client_move_resize(E_Client * ec, int x, int y, int w, int h)
_e_client_move_resize(E_Client *ec, int x, int y, int w, int h)
{
Client_Extra *extra;
@ -244,7 +247,7 @@ _e_client_move_resize(E_Client * ec, int x, int y, int w, int h)
}
static void
_e_client_unmaximize(E_Client * ec, E_Maximize max)
_e_client_unmaximize(E_Client *ec, E_Maximize max)
{
DBG("%p -> %s", ec,
(max & E_MAXIMIZE_DIRECTION) ==
@ -255,7 +258,7 @@ _e_client_unmaximize(E_Client * ec, E_Maximize max)
}
static void
_restore_client(E_Client * ec)
_restore_client(E_Client *ec)
{
Client_Extra *extra;
@ -279,7 +282,7 @@ _restore_client(E_Client * ec)
}
static Client_Extra *
_get_or_create_client_extra(E_Client * ec)
_get_or_create_client_extra(E_Client *ec)
{
Client_Extra *extra;
@ -289,23 +292,32 @@ _get_or_create_client_extra(E_Client * ec)
extra = E_NEW(Client_Extra, 1);
*extra = (Client_Extra)
{
.client = ec,.expected =
.client = ec, .expected =
{
.x = ec->x,.y = ec->y,.w = ec->w,.h = ec->h,}
,.orig =
.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,}
,.maximized = ec->maximized,.bordername =
eina_stringshare_add(ec->bordername),}
,};
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
}
, .maximized = ec->maximized, .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);
@ -315,7 +327,7 @@ _get_or_create_client_extra(E_Client * ec)
}
void
tiling_e_client_move_resize_extra(E_Client * ec, int x, int y, int w, int h)
tiling_e_client_move_resize_extra(E_Client *ec, int x, int y, int w, int h)
{
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
@ -327,13 +339,14 @@ 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);
}
static Client_Extra *
tiling_entry_func(E_Client * ec)
tiling_entry_func(E_Client *ec)
{
if (!ec)
return NULL;
@ -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;
}
@ -428,7 +442,7 @@ change_desk_conf(struct _Config_vdesk *newconf)
/* Reorganize windows {{{ */
static void
_add_client(E_Client * ec)
_add_client(E_Client *ec)
{
/* Should I need to check that the client is not already added? */
if (!ec)
@ -495,7 +509,7 @@ _add_client(E_Client * ec)
}
static void
_remove_client(E_Client * ec)
_remove_client(E_Client *ec)
{
if (!ec)
return;
@ -539,7 +553,7 @@ _remove_client(E_Client * ec)
/* Toggle Floating {{{ */
static void
toggle_floating(E_Client * ec)
toggle_floating(E_Client *ec)
{
Client_Extra *extra = tiling_entry_func(ec);
@ -555,14 +569,15 @@ toggle_floating(E_Client * ec)
{
_restore_client(ec);
_remove_client(ec);
} else
}
else
{
_add_client(ec);
}
}
static void
_e_mod_action_toggle_floating_cb(E_Object * obj EINA_UNUSED,
_e_mod_action_toggle_floating_cb(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
toggle_floating(e_client_focused_get());
@ -571,9 +586,9 @@ _e_mod_action_toggle_floating_cb(E_Object * obj EINA_UNUSED,
static E_Client *_go_mouse_client = NULL;
static void
_e_mod_action_swap_window_go_mouse(E_Object * obj EINA_UNUSED,
_e_mod_action_swap_window_go_mouse(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED,
E_Binding_Event_Mouse_Button * ev EINA_UNUSED)
E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
{
E_Client *ec = e_client_under_pointer_get(get_current_desk(), NULL);
@ -589,9 +604,9 @@ _e_mod_action_swap_window_go_mouse(E_Object * obj EINA_UNUSED,
}
static void
_e_mod_action_swap_window_end_mouse(E_Object * obj EINA_UNUSED,
_e_mod_action_swap_window_end_mouse(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED,
E_Binding_Event_Mouse_Button * ev EINA_UNUSED)
E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
{
E_Client *ec = e_client_under_pointer_get(get_current_desk(), NULL);
E_Client *first_ec = _go_mouse_client;
@ -632,8 +647,8 @@ _e_mod_action_swap_window_end_mouse(E_Object * obj EINA_UNUSED,
}
static void
_e_mod_menu_border_cb(void *data, E_Menu * m EINA_UNUSED,
E_Menu_Item * mi EINA_UNUSED)
_e_mod_menu_border_cb(void *data, E_Menu *m EINA_UNUSED,
E_Menu_Item *mi EINA_UNUSED)
{
E_Client *ec = data;
@ -672,28 +687,28 @@ _action_swap(int cross_edge)
}
static void
_e_mod_action_move_left_cb(E_Object * obj EINA_UNUSED,
_e_mod_action_move_left_cb(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
_action_swap(TILING_WINDOW_TREE_EDGE_LEFT);
}
static void
_e_mod_action_move_right_cb(E_Object * obj EINA_UNUSED,
_e_mod_action_move_right_cb(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
_action_swap(TILING_WINDOW_TREE_EDGE_RIGHT);
}
static void
_e_mod_action_move_up_cb(E_Object * obj EINA_UNUSED,
_e_mod_action_move_up_cb(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
_action_swap(TILING_WINDOW_TREE_EDGE_TOP);
}
static void
_e_mod_action_move_down_cb(E_Object * obj EINA_UNUSED,
_e_mod_action_move_down_cb(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
_action_swap(TILING_WINDOW_TREE_EDGE_BOTTOM);
@ -723,7 +738,7 @@ _tiling_split_type_next(void)
}
static void
_e_mod_action_toggle_split_mode(E_Object * obj EINA_UNUSED,
_e_mod_action_toggle_split_mode(E_Object *obj EINA_UNUSED,
const char *params EINA_UNUSED)
{
E_Desk *desk;
@ -742,7 +757,7 @@ _e_mod_action_toggle_split_mode(E_Object * obj EINA_UNUSED,
/* Hooks {{{ */
static void
_move_or_resize(E_Client * ec)
_move_or_resize(E_Client *ec)
{
Client_Extra *extra = tiling_entry_func(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;
}
@ -783,11 +797,11 @@ _move_or_resize(E_Client * ec)
if (abs(extra->expected.w - ec->w) >= 1)
{
w_diff = ((double) ec->w) / extra->expected.w;
w_diff = ((double)ec->w) / extra->expected.w;
}
if (abs(extra->expected.h - ec->h) >= 1)
{
h_diff = ((double) ec->h) / extra->expected.h;
h_diff = ((double)ec->h) / extra->expected.h;
}
switch (ec->resize_mode)
{
@ -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;
}
@ -820,7 +837,7 @@ _move_or_resize(E_Client * ec)
}
static void
_resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
_resize_begin_hook(void *data EINA_UNUSED, E_Client *ec)
{
Client_Extra *extra = tiling_entry_func(ec);
@ -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;
}
@ -917,7 +946,7 @@ _resize_begin_hook(void *data EINA_UNUSED, E_Client * ec)
static Eina_Bool
_resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
E_Client *ec = event->ec;
@ -927,7 +956,7 @@ _resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
}
static Eina_Bool
_move_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client * event)
_move_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client *event)
{
E_Client *ec = event->ec;
Client_Extra *extra = tiling_entry_func(ec);
@ -948,7 +977,7 @@ _move_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client * event)
}
static Eina_Bool
_add_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client * event)
_add_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client *event)
{
E_Client *ec = event->ec;
@ -959,7 +988,7 @@ _add_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client * event)
static Eina_Bool
_remove_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
E_Client *ec = event->ec;
@ -981,7 +1010,7 @@ _remove_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
static bool
_iconify_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
E_Client *ec = event->ec;
@ -997,7 +1026,7 @@ _iconify_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
static bool
_uniconify_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
E_Client *ec = event->ec;
@ -1010,7 +1039,7 @@ _uniconify_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
}
static void
toggle_sticky(E_Client * ec)
toggle_sticky(E_Client *ec)
{
Client_Extra *extra = tiling_entry_func(ec);
@ -1024,7 +1053,8 @@ toggle_sticky(E_Client * ec)
{
_restore_client(ec);
_remove_client(ec);
} else
}
else
{
_add_client(ec);
}
@ -1032,7 +1062,7 @@ toggle_sticky(E_Client * ec)
static Eina_Bool
_stick_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
toggle_sticky(event->ec);
return true;
@ -1040,7 +1070,7 @@ _stick_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
static Eina_Bool
_unstick_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client * event)
E_Event_Client *event)
{
toggle_sticky(event->ec);
return true;
@ -1066,7 +1096,7 @@ _desk_before_show_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
static bool
_desk_set_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Client_Desk_Set * ev)
E_Event_Client_Desk_Set *ev)
{
DBG("%p: from (%d,%d) to (%d,%d)", ev->ec, ev->desk->x, ev->desk->y,
ev->ec->desk->x, ev->ec->desk->y);
@ -1089,7 +1119,7 @@ _desk_set_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
}
static void
_compositor_resize_hook_desk_reapply(E_Desk * desk)
_compositor_resize_hook_desk_reapply(E_Desk *desk)
{
check_tinfo(desk);
if (!desk_should_tile_check(desk))
@ -1100,7 +1130,7 @@ _compositor_resize_hook_desk_reapply(E_Desk * desk)
static bool
_compositor_resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
E_Event_Compositor_Resize * ev EINA_UNUSED)
E_Event_Compositor_Resize *ev EINA_UNUSED)
{
_foreach_desk(_compositor_resize_hook_desk_reapply);
@ -1108,7 +1138,7 @@ _compositor_resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
}
static void
_bd_hook(void *d EINA_UNUSED, E_Client * ec)
_bd_hook(void *d EINA_UNUSED, E_Client *ec)
{
E_Menu_Item *mi;
E_Menu *m;
@ -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;
@ -1171,7 +1202,7 @@ EAPI E_Module_Api e_modapi = {
};
EAPI void *
e_modapi_init(E_Module * m)
e_modapi_init(E_Module *m)
{
E_Desk *desk;
Eina_List *l;
@ -1192,7 +1223,7 @@ e_modapi_init(E_Module * m)
#define HANDLER(_h, _e, _f) \
_h = ecore_event_handler_add(E_EVENT_##_e, \
(Ecore_Event_Handler_Cb) _f, \
(Ecore_Event_Handler_Cb)_f, \
NULL);
e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _resize_begin_hook, NULL);
@ -1317,7 +1348,7 @@ e_modapi_init(E_Module * m)
}
static void
_disable_desk(E_Desk * desk)
_disable_desk(E_Desk *desk)
{
check_tinfo(desk);
if (!_G.tinfo->conf)
@ -1346,7 +1377,7 @@ _disable_all_tiling(void)
}
static void
_foreach_desk(void (*func) (E_Desk * desk))
_foreach_desk(void (*func)(E_Desk *desk))
{
const Eina_List *l, *ll;
E_Comp *comp;
@ -1372,7 +1403,7 @@ _foreach_desk(void (*func) (E_Desk * desk))
}
EAPI int
e_modapi_shutdown(E_Module * m EINA_UNUSED)
e_modapi_shutdown(E_Module *m EINA_UNUSED)
{
e_gadcon_provider_unregister(&_gc_class);
@ -1443,7 +1474,7 @@ e_modapi_shutdown(E_Module * m EINA_UNUSED)
}
EAPI int
e_modapi_save(E_Module * m EINA_UNUSED)
e_modapi_save(E_Module *m EINA_UNUSED)
{
e_config_domain_save("module.tiling", _G.config_edd, tiling_g.config);
@ -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.");
}
@ -1583,7 +1617,7 @@ _gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
{
Evas_Object *o;
o = edje_object_add (evas);
o = edje_object_add(evas);
edje_object_file_set(o, _G.edj_path, "icon");
return o;
}
@ -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

@ -67,22 +67,22 @@ struct _E_Config_Dialog_Data
Evas *evas;
};
E_Config_Dialog *e_int_config_tiling_module(E_Comp * comp, const char *params);
E_Config_Dialog *e_int_config_tiling_module(E_Comp *comp, const char *params);
EAPI extern E_Module_Api e_modapi;
EAPI void *e_modapi_init(E_Module * m);
EAPI int e_modapi_shutdown(E_Module * m);
EAPI int e_modapi_save(E_Module * m);
EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);
void change_desk_conf(struct _Config_vdesk *newconf);
void e_tiling_update_conf(void);
struct _Config_vdesk *get_vdesk(Eina_List * vdesks, int x, int y,
struct _Config_vdesk *get_vdesk(Eina_List *vdesks, int x, int y,
unsigned int zone_num);
void tiling_e_client_move_resize_extra(E_Client * ec, int x, int y, int w,
void tiling_e_client_move_resize_extra(E_Client *ec, int x, int y, int w,
int h);
# define EINA_LIST_IS_IN(_list, _el) \
(eina_list_data_find(_list, _el) == _el)

View File

@ -4,7 +4,7 @@
#include "e_mod_tiling.h"
void
tiling_window_tree_walk(Window_Tree * root, void (*func) (void *))
tiling_window_tree_walk(Window_Tree *root, void (*func)(void *))
{
Eina_Inlist *itr_safe;
Window_Tree *itr;
@ -20,13 +20,13 @@ tiling_window_tree_walk(Window_Tree * root, void (*func) (void *))
}
void
tiling_window_tree_free(Window_Tree * root)
tiling_window_tree_free(Window_Tree *root)
{
tiling_window_tree_walk(root, free);
}
static void
_tiling_window_tree_split_add(Window_Tree * parent, Window_Tree * new_node)
_tiling_window_tree_split_add(Window_Tree *parent, Window_Tree *new_node)
{
/* Make a new node for the parent client and split the weights in half. */
Window_Tree *new_parent_client = calloc(1, sizeof(*new_node));
@ -45,7 +45,7 @@ _tiling_window_tree_split_add(Window_Tree * parent, Window_Tree * new_node)
}
static void
_tiling_window_tree_parent_add(Window_Tree * parent, Window_Tree * new_node)
_tiling_window_tree_parent_add(Window_Tree *parent, Window_Tree *new_node)
{
/* Adjust existing children's weights */
Window_Tree *itr;
@ -66,7 +66,7 @@ _tiling_window_tree_parent_add(Window_Tree * parent, Window_Tree * new_node)
}
static int
_tiling_window_tree_split_type_get(Window_Tree * node)
_tiling_window_tree_split_type_get(Window_Tree *node)
{
int ret = 0;
@ -80,8 +80,8 @@ _tiling_window_tree_split_type_get(Window_Tree * node)
}
Window_Tree *
tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
E_Client * client, Tiling_Split_Type split_type)
tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
E_Client *client, Tiling_Split_Type split_type)
{
Window_Tree *new_node = calloc(1, sizeof(*new_node));
@ -91,17 +91,19 @@ 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);
if ((parent_split_type != split_type) && (parent->children))
{
parent = (Window_Tree *) parent->children;
parent = (Window_Tree *)parent->children;
}
}
@ -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);
@ -138,13 +143,14 @@ tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
}
Window_Tree *
tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
tiling_window_tree_remove(Window_Tree *root, Window_Tree *item)
{
if (root == 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;
@ -232,7 +242,7 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
}
Window_Tree *
tiling_window_tree_client_find(Window_Tree * root, E_Client * client)
tiling_window_tree_client_find(Window_Tree *root, E_Client *client)
{
Window_Tree *itr;
@ -255,7 +265,7 @@ 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,
_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)
{
Window_Tree *itr;
@ -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)
{
@ -292,11 +303,11 @@ _tiling_window_tree_level_apply(Window_Tree * root, Evas_Coord x, Evas_Coord y,
}
/* Adjust the last item's weight in case weight < 1.0 */
((Window_Tree *) root->children->last)->weight += 1.0 - total_weight;
((Window_Tree *)root->children->last)->weight += 1.0 - total_weight;
}
void
tiling_window_tree_apply(Window_Tree * root, Evas_Coord x, Evas_Coord y,
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,
@ -304,38 +315,39 @@ tiling_window_tree_apply(Window_Tree * root, Evas_Coord x, Evas_Coord y,
}
static Window_Tree *
_inlist_next(Window_Tree * it)
_inlist_next(Window_Tree *it)
{
return (Window_Tree *) EINA_INLIST_GET(it)->next;
return (Window_Tree *)EINA_INLIST_GET(it)->next;
}
static Window_Tree *
_inlist_prev(Window_Tree * it)
_inlist_prev(Window_Tree *it)
{
return (Window_Tree *) EINA_INLIST_GET(it)->prev;
return (Window_Tree *)EINA_INLIST_GET(it)->prev;
}
static Eina_Bool
_tiling_window_tree_node_resize_direction(Window_Tree * node,
Window_Tree * parent, double dir_diff, int dir)
_tiling_window_tree_node_resize_direction(Window_Tree *node,
Window_Tree *parent, double dir_diff, int dir)
{
double weight = 0.0;
double weight_diff;
Window_Tree *children_start;
Window_Tree *itr;
Window_Tree *(*itr_func) (Window_Tree *);
Window_Tree *(*itr_func)(Window_Tree *);
if (dir > 0)
{
itr_func = _inlist_prev;
children_start = (Window_Tree *) parent->children->last;
} else
children_start = (Window_Tree *)parent->children->last;
}
else
{
itr_func = _inlist_next;
children_start = (Window_Tree *) parent->children;
children_start = (Window_Tree *)parent->children;
}
itr = (Window_Tree *) children_start;
itr = (Window_Tree *)children_start;
while (itr != node)
{
weight += itr->weight;
@ -369,7 +381,7 @@ _tiling_window_tree_node_resize_direction(Window_Tree * node,
}
Eina_Bool
tiling_window_tree_node_resize(Window_Tree * node, int w_dir, double w_diff,
tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff,
int h_dir, double h_diff)
{
Window_Tree *parent = node->parent;
@ -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;
@ -417,7 +430,7 @@ tiling_window_tree_node_resize(Window_Tree * node, int w_dir, double w_diff,
}
int
_tiling_window_tree_edges_get_helper(Window_Tree * node,
_tiling_window_tree_edges_get_helper(Window_Tree *node,
Tiling_Split_Type split_type, Eina_Bool gave_up_this,
Eina_Bool gave_up_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,
@ -461,7 +476,7 @@ _tiling_window_tree_edges_get_helper(Window_Tree * node,
}
int
tiling_window_tree_edges_get(Window_Tree * node)
tiling_window_tree_edges_get(Window_Tree *node)
{
Tiling_Split_Type split_type = _tiling_window_tree_split_type_get(node);
@ -486,7 +501,7 @@ static struct _Node_Move_Context
CNODE->client->x, CNODE->client->w, node->client->x, node->client->w)
static void
_tiling_window_tree_node_move_if_match_set(Window_Tree * node, Evas_Coord cx,
_tiling_window_tree_node_move_if_match_set(Window_Tree *node, Evas_Coord cx,
Evas_Coord cw, Evas_Coord ox, Evas_Coord ow)
{
Evas_Coord leftx, rightx;
@ -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;
}
@ -540,7 +559,7 @@ _tiling_window_tree_node_move_walker(void *_node)
#undef IF_MATCH_SET_TB
void
tiling_window_tree_node_move(Window_Tree * node, int cross_edge)
tiling_window_tree_node_move(Window_Tree *node, int cross_edge)
{
Window_Tree *root = node;
@ -569,7 +588,7 @@ tiling_window_tree_node_move(Window_Tree * node, int cross_edge)
/* End Node move. */
void
tiling_window_tree_dump(Window_Tree * root, int level)
tiling_window_tree_dump(Window_Tree *root, int level)
{
int i;
@ -593,3 +612,4 @@ tiling_window_tree_dump(Window_Tree * root, int level)
tiling_window_tree_dump(itr, level + 1);
}
}

View File

@ -29,25 +29,25 @@ struct _Window_Tree
# define TILING_WINDOW_TREE_EDGE_TOP (1 << 2)
# define TILING_WINDOW_TREE_EDGE_BOTTOM (1 << 3)
int tiling_window_tree_edges_get(Window_Tree * node);
int tiling_window_tree_edges_get(Window_Tree *node);
void tiling_window_tree_free(Window_Tree * root);
void tiling_window_tree_walk(Window_Tree * root, void (*func) (void *));
void tiling_window_tree_free(Window_Tree *root);
void tiling_window_tree_walk(Window_Tree *root, void (*func)(void *));
Window_Tree *tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
E_Client * client, Tiling_Split_Type split_type);
Window_Tree *tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
E_Client *client, Tiling_Split_Type split_type);
Window_Tree *tiling_window_tree_remove(Window_Tree * root, Window_Tree * item);
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);
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,
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_node_resize(Window_Tree * node, int w_dir,
Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir,
double w_diff, int h_dir, double h_diff);
void tiling_window_tree_node_move(Window_Tree * node, int cross_edge);
void tiling_window_tree_node_move(Window_Tree *node, int cross_edge);
#endif