forked from enlightenment/enlightenment
parent
92b0d0171c
commit
f4a7b6512a
|
@ -6,9 +6,9 @@ typedef struct _E_Widget_Smart_Data E_Widget_Smart_Data;
|
||||||
struct _E_Widget_Smart_Data
|
struct _E_Widget_Smart_Data
|
||||||
{
|
{
|
||||||
Evas_Object *parent_obj;
|
Evas_Object *parent_obj;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
Evas_Coord minw, minh;
|
Evas_Coord minw, minh;
|
||||||
Eina_List *subobjs;
|
Eina_List *subobjs;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -33,20 +33,20 @@ _open_browser_help_cb(void *data EINA_UNUSED, void *obj EINA_UNUSED)
|
||||||
e_widget_list_object_append(list, object, 1, 1, 0.5)
|
e_widget_list_object_append(list, object, 1, 1, 0.5)
|
||||||
|
|
||||||
struct _Config_vdesk *
|
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;
|
Eina_List *l;
|
||||||
|
|
||||||
for (l = vdesks; l; l = l->next)
|
for (l = vdesks; l; l = l->next)
|
||||||
{
|
{
|
||||||
struct _Config_vdesk *vd = l->data;
|
struct _Config_vdesk *vd = l->data;
|
||||||
|
|
||||||
if (!vd)
|
if (!vd)
|
||||||
continue;
|
continue;
|
||||||
if (vd->nb_stacks < 0 || vd->nb_stacks > 1)
|
if (vd->nb_stacks < 0 || vd->nb_stacks > 1)
|
||||||
vd->nb_stacks = 0;
|
vd->nb_stacks = 0;
|
||||||
if (vd->x == x && vd->y == y && vd->zone_num == zone_num)
|
if (vd->x == x && vd->y == y && vd->zone_num == zone_num)
|
||||||
return vd;
|
return vd;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -57,7 +57,7 @@ get_vdesk(Eina_List * vdesks, int x, int y, unsigned int zone_num)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
_create_data(E_Config_Dialog * cfd EINA_UNUSED)
|
_create_data(E_Config_Dialog *cfd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata;
|
E_Config_Dialog_Data *cfdata;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
@ -73,33 +73,33 @@ _create_data(E_Config_Dialog * cfd EINA_UNUSED)
|
||||||
|
|
||||||
for (l = tiling_g.config->vdesks; l; l = l->next)
|
for (l = tiling_g.config->vdesks; l; l = l->next)
|
||||||
{
|
{
|
||||||
struct _Config_vdesk *vd = l->data, *newvd;
|
struct _Config_vdesk *vd = l->data, *newvd;
|
||||||
|
|
||||||
if (!vd)
|
if (!vd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newvd = E_NEW(struct _Config_vdesk, 1);
|
newvd = E_NEW(struct _Config_vdesk, 1);
|
||||||
|
|
||||||
newvd->x = vd->x;
|
newvd->x = vd->x;
|
||||||
newvd->y = vd->y;
|
newvd->y = vd->y;
|
||||||
newvd->zone_num = vd->zone_num;
|
newvd->zone_num = vd->zone_num;
|
||||||
newvd->nb_stacks = vd->nb_stacks;
|
newvd->nb_stacks = vd->nb_stacks;
|
||||||
|
|
||||||
EINA_LIST_APPEND(cfdata->config.vdesks, newvd);
|
EINA_LIST_APPEND(cfdata->config.vdesks, newvd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
eina_list_free(cfdata->config.vdesks);
|
||||||
free(cfdata);
|
free(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
Evas *evas;
|
||||||
int i;
|
int i;
|
||||||
|
@ -113,33 +113,33 @@ _fill_zone_config(E_Zone * zone, E_Config_Dialog_Data * cfdata)
|
||||||
|
|
||||||
for (i = 0; i < zone->desk_y_count * zone->desk_x_count; i++)
|
for (i = 0; i < zone->desk_y_count * zone->desk_x_count; i++)
|
||||||
{
|
{
|
||||||
E_Desk *desk = zone->desks[i];
|
E_Desk *desk = zone->desks[i];
|
||||||
struct _Config_vdesk *vd;
|
struct _Config_vdesk *vd;
|
||||||
Evas_Object *list, *checkbox;
|
Evas_Object *list, *checkbox;
|
||||||
|
|
||||||
if (!desk)
|
if (!desk)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
vd = get_vdesk(cfdata->config.vdesks, desk->x, desk->y, zone->num);
|
vd = get_vdesk(cfdata->config.vdesks, desk->x, desk->y, zone->num);
|
||||||
if (!vd)
|
if (!vd)
|
||||||
{
|
{
|
||||||
vd = E_NEW(struct _Config_vdesk, 1);
|
vd = E_NEW(struct _Config_vdesk, 1);
|
||||||
|
|
||||||
vd->x = desk->x;
|
vd->x = desk->x;
|
||||||
vd->y = desk->y;
|
vd->y = desk->y;
|
||||||
vd->zone_num = zone->num;
|
vd->zone_num = zone->num;
|
||||||
vd->nb_stacks = 0;
|
vd->nb_stacks = 0;
|
||||||
|
|
||||||
EINA_LIST_APPEND(cfdata->config.vdesks, vd);
|
EINA_LIST_APPEND(cfdata->config.vdesks, vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = e_widget_list_add(evas, false, true);
|
list = e_widget_list_add(evas, false, true);
|
||||||
|
|
||||||
LIST_ADD(list, e_widget_label_add(evas, desk->name));
|
LIST_ADD(list, e_widget_label_add(evas, desk->name));
|
||||||
checkbox = e_widget_check_add(evas, "", &vd->nb_stacks);
|
checkbox = e_widget_check_add(evas, "", &vd->nb_stacks);
|
||||||
LIST_ADD(list, checkbox);
|
LIST_ADD(list, checkbox);
|
||||||
|
|
||||||
LIST_ADD(cfdata->o_desklist, list);
|
LIST_ADD(cfdata->o_desklist, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the correct sizes of desklist and scrollframe */
|
/* Get the correct sizes of desklist and scrollframe */
|
||||||
|
@ -147,25 +147,25 @@ _fill_zone_config(E_Zone * zone, E_Config_Dialog_Data * cfdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_zone_change(void *data, Evas_Object * obj EINA_UNUSED)
|
_cb_zone_change(void *data, Evas_Object *obj EINA_UNUSED)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
E_Config_Dialog_Data *cfdata = data;
|
E_Config_Dialog_Data *cfdata = data;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
|
||||||
if (!cfdata || !cfdata->o_zonelist)
|
if (!cfdata || !cfdata->o_zonelist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
n = e_widget_ilist_selected_get(cfdata->o_zonelist);
|
n = e_widget_ilist_selected_get(cfdata->o_zonelist);
|
||||||
zone = e_widget_ilist_nth_data_get(cfdata->o_zonelist, n);
|
zone = e_widget_ilist_nth_data_get(cfdata->o_zonelist, n);
|
||||||
if (!zone)
|
if (!zone)
|
||||||
return;
|
return;
|
||||||
_fill_zone_config(zone, cfdata);
|
_fill_zone_config(zone, cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
|
_basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas,
|
||||||
E_Config_Dialog_Data * cfdata)
|
E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *oc, *of, *slider;
|
Evas_Object *o, *oc, *of, *slider;
|
||||||
E_Comp *comp;
|
E_Comp *comp;
|
||||||
|
@ -179,11 +179,11 @@ _basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
|
||||||
/* General settings */
|
/* General settings */
|
||||||
of = e_widget_framelist_add(evas, _("General"), 0);
|
of = e_widget_framelist_add(evas, _("General"), 0);
|
||||||
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
||||||
_("Show window titles"), &cfdata->config.show_titles));
|
_("Show window titles"), &cfdata->config.show_titles));
|
||||||
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
||||||
_("Tile dialog windows"), &cfdata->config.tile_dialogs));
|
_("Tile dialog windows"), &cfdata->config.tile_dialogs));
|
||||||
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
e_widget_framelist_object_append(of, e_widget_check_add(evas,
|
||||||
_("Enable floating split-mode"), &cfdata->config.have_floating_mode));
|
_("Enable floating split-mode"), &cfdata->config.have_floating_mode));
|
||||||
|
|
||||||
LIST_ADD(o, of);
|
LIST_ADD(o, of);
|
||||||
|
|
||||||
|
@ -200,10 +200,10 @@ _basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
|
||||||
e_widget_on_change_hook_set(cfdata->o_zonelist, _cb_zone_change, cfdata);
|
e_widget_on_change_hook_set(cfdata->o_zonelist, _cb_zone_change, cfdata);
|
||||||
for (l = comp->zones; l; l = l->next)
|
for (l = comp->zones; l; l = l->next)
|
||||||
{
|
{
|
||||||
if (!(zone = l->data))
|
if (!(zone = l->data))
|
||||||
continue;
|
continue;
|
||||||
e_widget_ilist_append(cfdata->o_zonelist, NULL, zone->name, NULL, zone,
|
e_widget_ilist_append(cfdata->o_zonelist, NULL, zone->name, NULL, zone,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
e_widget_ilist_go(cfdata->o_zonelist);
|
e_widget_ilist_go(cfdata->o_zonelist);
|
||||||
e_widget_ilist_thaw(cfdata->o_zonelist);
|
e_widget_ilist_thaw(cfdata->o_zonelist);
|
||||||
|
@ -222,21 +222,21 @@ _basic_create_widgets(E_Config_Dialog * cfd EINA_UNUSED, Evas * evas,
|
||||||
LIST_ADD(o, of);
|
LIST_ADD(o, of);
|
||||||
|
|
||||||
of = e_widget_label_add(evas, _("Padding between windows"));
|
of = e_widget_label_add(evas, _("Padding between windows"));
|
||||||
LIST_ADD(o,of);
|
LIST_ADD(o, of);
|
||||||
slider = e_widget_slider_add(evas, 1,0, ("%1.0f px"), 0.0, TILING_MAX_PADDING,
|
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);
|
1.0, 0, NULL, &cfdata->config.window_padding, 150);
|
||||||
LIST_ADD(o, slider);
|
LIST_ADD(o, slider);
|
||||||
|
|
||||||
oc = e_widget_button_add(evas, _("Help"), "help", _open_browser_help_cb,
|
oc = e_widget_button_add(evas, _("Help"), "help", _open_browser_help_cb,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
LIST_ADD(o, oc);
|
LIST_ADD(o, oc);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_basic_apply_data(E_Config_Dialog * cfd EINA_UNUSED,
|
_basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
|
||||||
E_Config_Dialog_Data * cfdata)
|
E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
struct _Config_vdesk *vd;
|
struct _Config_vdesk *vd;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
@ -249,64 +249,64 @@ _basic_apply_data(E_Config_Dialog * cfd EINA_UNUSED,
|
||||||
/* Check if the layout for one of the vdesks has changed */
|
/* Check if the layout for one of the vdesks has changed */
|
||||||
for (l = tiling_g.config->vdesks; l; l = l->next)
|
for (l = tiling_g.config->vdesks; l; l = l->next)
|
||||||
{
|
{
|
||||||
struct _Config_vdesk *newvd;
|
struct _Config_vdesk *newvd;
|
||||||
|
|
||||||
vd = l->data;
|
vd = l->data;
|
||||||
|
|
||||||
if (!vd)
|
if (!vd)
|
||||||
continue;
|
continue;
|
||||||
if (!(newvd =
|
if (!(newvd =
|
||||||
get_vdesk(cfdata->config.vdesks, vd->x, vd->y, vd->zone_num)))
|
get_vdesk(cfdata->config.vdesks, vd->x, vd->y, vd->zone_num)))
|
||||||
{
|
{
|
||||||
change_desk_conf(vd);
|
change_desk_conf(vd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newvd->nb_stacks != vd->nb_stacks)
|
if (newvd->nb_stacks != vd->nb_stacks)
|
||||||
{
|
{
|
||||||
DBG("number of columns for (%d, %d, %d) changed from %d" " to %d",
|
DBG("number of columns for (%d, %d, %d) changed from %d" " to %d",
|
||||||
vd->x, vd->y, vd->zone_num, vd->nb_stacks, newvd->nb_stacks);
|
vd->x, vd->y, vd->zone_num, vd->nb_stacks, newvd->nb_stacks);
|
||||||
change_desk_conf(newvd);
|
change_desk_conf(newvd);
|
||||||
free(vd);
|
free(vd);
|
||||||
l->data = NULL;
|
l->data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = cfdata->config.vdesks; l; l = l->next)
|
for (l = cfdata->config.vdesks; l; l = l->next)
|
||||||
{
|
{
|
||||||
vd = l->data;
|
vd = l->data;
|
||||||
|
|
||||||
if (!vd)
|
if (!vd)
|
||||||
continue;
|
continue;
|
||||||
if (!get_vdesk(tiling_g.config->vdesks, vd->x, vd->y, vd->zone_num))
|
if (!get_vdesk(tiling_g.config->vdesks, vd->x, vd->y, vd->zone_num))
|
||||||
{
|
{
|
||||||
change_desk_conf(vd);
|
change_desk_conf(vd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(tiling_g.config->vdesks, vd)
|
EINA_LIST_FREE(tiling_g.config->vdesks, vd)
|
||||||
{
|
{
|
||||||
free(vd);
|
free(vd);
|
||||||
}
|
}
|
||||||
tiling_g.config->vdesks = NULL;
|
tiling_g.config->vdesks = NULL;
|
||||||
|
|
||||||
for (l = cfdata->config.vdesks; l; l = l->next)
|
for (l = cfdata->config.vdesks; l; l = l->next)
|
||||||
{
|
{
|
||||||
struct _Config_vdesk *newvd;
|
struct _Config_vdesk *newvd;
|
||||||
|
|
||||||
vd = l->data;
|
vd = l->data;
|
||||||
if (!vd)
|
if (!vd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newvd = E_NEW(struct _Config_vdesk, 1);
|
newvd = E_NEW(struct _Config_vdesk, 1);
|
||||||
|
|
||||||
newvd->x = vd->x;
|
newvd->x = vd->x;
|
||||||
newvd->y = vd->y;
|
newvd->y = vd->y;
|
||||||
newvd->zone_num = vd->zone_num;
|
newvd->zone_num = vd->zone_num;
|
||||||
newvd->nb_stacks = vd->nb_stacks;
|
newvd->nb_stacks = vd->nb_stacks;
|
||||||
|
|
||||||
EINA_LIST_APPEND(tiling_g.config->vdesks, newvd);
|
EINA_LIST_APPEND(tiling_g.config->vdesks, newvd);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_tiling_update_conf();
|
e_tiling_update_conf();
|
||||||
|
@ -317,14 +317,14 @@ _basic_apply_data(E_Config_Dialog * cfd EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
E_Config_Dialog *
|
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 *cfd;
|
||||||
E_Config_Dialog_View *v;
|
E_Config_Dialog_View *v;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
if (e_config_dialog_find("E", "windows/tiling"))
|
if (e_config_dialog_find("E", "windows/tiling"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
v = E_NEW(E_Config_Dialog_View, 1);
|
v = E_NEW(E_Config_Dialog_View, 1);
|
||||||
|
|
||||||
|
@ -334,9 +334,10 @@ e_int_config_tiling_module(E_Comp * comp, const char *params EINA_UNUSED)
|
||||||
v->basic.create_widgets = _basic_create_widgets;
|
v->basic.create_widgets = _basic_create_widgets;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-tiling.edj",
|
snprintf(buf, sizeof(buf), "%s/e-module-tiling.edj",
|
||||||
e_module_dir_get(tiling_g.module));
|
e_module_dir_get(tiling_g.module));
|
||||||
cfd =
|
cfd =
|
||||||
e_config_dialog_new(comp, _("Tiling Configuration"), "E",
|
e_config_dialog_new(comp, _("Tiling Configuration"), "E",
|
||||||
"windows/tiling", buf, 0, v, NULL);
|
"windows/tiling", buf, 0, v, NULL);
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,17 +9,17 @@
|
||||||
|
|
||||||
# include "window_tree.h"
|
# include "window_tree.h"
|
||||||
|
|
||||||
typedef struct _Config Config;
|
typedef struct _Config Config;
|
||||||
typedef struct _Tiling_Info Tiling_Info;
|
typedef struct _Tiling_Info Tiling_Info;
|
||||||
|
|
||||||
struct tiling_g
|
struct tiling_g
|
||||||
{
|
{
|
||||||
E_Module *module;
|
E_Module *module;
|
||||||
Config *config;
|
Config *config;
|
||||||
int log_domain;
|
int log_domain;
|
||||||
|
|
||||||
Eina_List *gadget_instances;
|
Eina_List *gadget_instances;
|
||||||
int gadget_number;
|
int gadget_number;
|
||||||
};
|
};
|
||||||
extern struct tiling_g tiling_g;
|
extern struct tiling_g tiling_g;
|
||||||
|
|
||||||
|
@ -32,17 +32,17 @@ extern struct tiling_g tiling_g;
|
||||||
|
|
||||||
struct _Config_vdesk
|
struct _Config_vdesk
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned int zone_num;
|
unsigned int zone_num;
|
||||||
int nb_stacks;
|
int nb_stacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
int window_padding;
|
int window_padding;
|
||||||
int tile_dialogs;
|
int tile_dialogs;
|
||||||
int show_titles;
|
int show_titles;
|
||||||
int have_floating_mode;
|
int have_floating_mode;
|
||||||
Eina_List *vdesks;
|
Eina_List *vdesks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,45 +51,45 @@ struct _Tiling_Info
|
||||||
/* The desk for which this _Tiling_Info is used. Needed because (for
|
/* The desk for which this _Tiling_Info is used. Needed because (for
|
||||||
* example) on e restart all desks are shown on all zones but no change
|
* example) on e restart all desks are shown on all zones but no change
|
||||||
* events are triggered */
|
* events are triggered */
|
||||||
const E_Desk *desk;
|
const E_Desk *desk;
|
||||||
|
|
||||||
struct _Config_vdesk *conf;
|
struct _Config_vdesk *conf;
|
||||||
|
|
||||||
Window_Tree *tree;
|
Window_Tree *tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _E_Config_Dialog_Data
|
struct _E_Config_Dialog_Data
|
||||||
{
|
{
|
||||||
struct _Config config;
|
struct _Config config;
|
||||||
Evas_Object *o_zonelist;
|
Evas_Object *o_zonelist;
|
||||||
Evas_Object *o_desklist;
|
Evas_Object *o_desklist;
|
||||||
Evas_Object *osf;
|
Evas_Object *osf;
|
||||||
Evas *evas;
|
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 extern E_Module_Api e_modapi;
|
||||||
|
|
||||||
EAPI void *e_modapi_init(E_Module * m);
|
EAPI void *e_modapi_init(E_Module *m);
|
||||||
EAPI int e_modapi_shutdown(E_Module * m);
|
EAPI int e_modapi_shutdown(E_Module *m);
|
||||||
EAPI int e_modapi_save(E_Module * m);
|
EAPI int e_modapi_save(E_Module *m);
|
||||||
|
|
||||||
void change_desk_conf(struct _Config_vdesk *newconf);
|
void change_desk_conf(struct _Config_vdesk *newconf);
|
||||||
|
|
||||||
void e_tiling_update_conf(void);
|
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);
|
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);
|
int h);
|
||||||
# define EINA_LIST_IS_IN(_list, _el) \
|
# define EINA_LIST_IS_IN(_list, _el) \
|
||||||
(eina_list_data_find(_list, _el) == _el)
|
(eina_list_data_find(_list, _el) == _el)
|
||||||
# define EINA_LIST_APPEND(_list, _el) \
|
# define EINA_LIST_APPEND(_list, _el) \
|
||||||
_list = eina_list_append(_list, _el)
|
_list = eina_list_append(_list, _el)
|
||||||
# define EINA_LIST_REMOVE(_list, _el) \
|
# define EINA_LIST_REMOVE(_list, _el) \
|
||||||
_list = eina_list_remove(_list, _el)
|
_list = eina_list_remove(_list, _el)
|
||||||
|
|
||||||
# define _TILE_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
# define _TILE_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
# define _TILE_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
# define _TILE_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
|
@ -4,29 +4,29 @@
|
||||||
#include "e_mod_tiling.h"
|
#include "e_mod_tiling.h"
|
||||||
|
|
||||||
void
|
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;
|
Eina_Inlist *itr_safe;
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EINA_INLIST_FOREACH_SAFE(root->children, itr_safe, itr)
|
EINA_INLIST_FOREACH_SAFE(root->children, itr_safe, itr)
|
||||||
{
|
{
|
||||||
tiling_window_tree_walk(itr, func);
|
tiling_window_tree_walk(itr, func);
|
||||||
}
|
}
|
||||||
func(root);
|
func(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tiling_window_tree_free(Window_Tree * root)
|
tiling_window_tree_free(Window_Tree *root)
|
||||||
{
|
{
|
||||||
tiling_window_tree_walk(root, free);
|
tiling_window_tree_walk(root, free);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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. */
|
/* Make a new node for the parent client and split the weights in half. */
|
||||||
Window_Tree *new_parent_client = calloc(1, sizeof(*new_node));
|
Window_Tree *new_parent_client = calloc(1, sizeof(*new_node));
|
||||||
|
@ -39,13 +39,13 @@ _tiling_window_tree_split_add(Window_Tree * parent, Window_Tree * new_node)
|
||||||
new_node->weight = 0.5;
|
new_node->weight = 0.5;
|
||||||
|
|
||||||
parent->children =
|
parent->children =
|
||||||
eina_inlist_append(parent->children, EINA_INLIST_GET(new_parent_client));
|
eina_inlist_append(parent->children, EINA_INLIST_GET(new_parent_client));
|
||||||
parent->children =
|
parent->children =
|
||||||
eina_inlist_append(parent->children, EINA_INLIST_GET(new_node));
|
eina_inlist_append(parent->children, EINA_INLIST_GET(new_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 */
|
/* Adjust existing children's weights */
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
|
@ -57,31 +57,31 @@ _tiling_window_tree_parent_add(Window_Tree * parent, Window_Tree * new_node)
|
||||||
|
|
||||||
weight *= children_count;
|
weight *= children_count;
|
||||||
EINA_INLIST_FOREACH(parent->children, itr)
|
EINA_INLIST_FOREACH(parent->children, itr)
|
||||||
{
|
{
|
||||||
itr->weight *= weight;
|
itr->weight *= weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->children =
|
parent->children =
|
||||||
eina_inlist_append(parent->children, EINA_INLIST_GET(new_node));
|
eina_inlist_append(parent->children, EINA_INLIST_GET(new_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_tiling_window_tree_split_type_get(Window_Tree * node)
|
_tiling_window_tree_split_type_get(Window_Tree *node)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
while (node->parent)
|
while (node->parent)
|
||||||
{
|
{
|
||||||
ret++;
|
ret++;
|
||||||
node = node->parent;
|
node = node->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret % 2;
|
return ret % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window_Tree *
|
Window_Tree *
|
||||||
tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
|
tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
|
||||||
E_Client * client, Tiling_Split_Type split_type)
|
E_Client *client, Tiling_Split_Type split_type)
|
||||||
{
|
{
|
||||||
Window_Tree *new_node = calloc(1, sizeof(*new_node));
|
Window_Tree *new_node = calloc(1, sizeof(*new_node));
|
||||||
|
|
||||||
|
@ -90,64 +90,70 @@ tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
|
||||||
|
|
||||||
if (split_type > TILING_SPLIT_VERTICAL)
|
if (split_type > TILING_SPLIT_VERTICAL)
|
||||||
{
|
{
|
||||||
return root;
|
return root;
|
||||||
} else if (!root)
|
}
|
||||||
|
else if (!root)
|
||||||
{
|
{
|
||||||
new_node->weight = 1.0;
|
new_node->weight = 1.0;
|
||||||
return new_node;
|
return new_node;
|
||||||
} else if (!parent)
|
}
|
||||||
|
else if (!parent)
|
||||||
{
|
{
|
||||||
parent = root;
|
parent = root;
|
||||||
parent_split_type = _tiling_window_tree_split_type_get(parent);
|
parent_split_type = _tiling_window_tree_split_type_get(parent);
|
||||||
if ((parent_split_type != split_type) && (parent->children))
|
if ((parent_split_type != split_type) && (parent->children))
|
||||||
{
|
{
|
||||||
parent = (Window_Tree *) parent->children;
|
parent = (Window_Tree *)parent->children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_split_type = _tiling_window_tree_split_type_get(parent);
|
parent_split_type = _tiling_window_tree_split_type_get(parent);
|
||||||
|
|
||||||
if (parent_split_type == split_type)
|
if (parent_split_type == split_type)
|
||||||
{
|
{
|
||||||
if (parent->children)
|
if (parent->children)
|
||||||
{
|
{
|
||||||
_tiling_window_tree_parent_add(parent, new_node);
|
_tiling_window_tree_parent_add(parent, new_node);
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
_tiling_window_tree_split_add(parent, new_node);
|
{
|
||||||
}
|
_tiling_window_tree_split_add(parent, new_node);
|
||||||
} else
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Window_Tree *grand_parent = parent->parent;
|
Window_Tree *grand_parent = parent->parent;
|
||||||
|
|
||||||
if (grand_parent && grand_parent->children)
|
if (grand_parent && grand_parent->children)
|
||||||
{
|
{
|
||||||
_tiling_window_tree_parent_add(grand_parent, new_node);
|
_tiling_window_tree_parent_add(grand_parent, new_node);
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
root = calloc(1, sizeof(*root));
|
{
|
||||||
_tiling_window_tree_split_add(parent, new_node);
|
root = calloc(1, sizeof(*root));
|
||||||
root->weight = 1.0;
|
_tiling_window_tree_split_add(parent, new_node);
|
||||||
root->children =
|
root->weight = 1.0;
|
||||||
eina_inlist_append(root->children, EINA_INLIST_GET(parent));
|
root->children =
|
||||||
parent->parent = root;
|
eina_inlist_append(root->children, EINA_INLIST_GET(parent));
|
||||||
}
|
parent->parent = root;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window_Tree *
|
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)
|
if (root == item)
|
||||||
{
|
{
|
||||||
free(item);
|
free(item);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (!item->client)
|
}
|
||||||
|
else if (!item->client)
|
||||||
{
|
{
|
||||||
ERR("Tried deleting node %p that doesn't have a client.", item);
|
ERR("Tried deleting node %p that doesn't have a client.", item);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window_Tree *parent = item->parent;
|
Window_Tree *parent = item->parent;
|
||||||
|
@ -155,76 +161,80 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
|
||||||
|
|
||||||
if (children_count <= 2)
|
if (children_count <= 2)
|
||||||
{
|
{
|
||||||
Window_Tree *grand_parent = parent->parent;
|
Window_Tree *grand_parent = parent->parent;
|
||||||
Window_Tree *item_keep = NULL;
|
Window_Tree *item_keep = NULL;
|
||||||
|
|
||||||
/* Adjust existing children's weights */
|
/* Adjust existing children's weights */
|
||||||
EINA_INLIST_FOREACH(parent->children, item_keep)
|
EINA_INLIST_FOREACH(parent->children, item_keep)
|
||||||
{
|
{
|
||||||
if (item_keep != item)
|
if (item_keep != item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item_keep)
|
if (!item_keep)
|
||||||
{
|
{
|
||||||
/* Special case of deleting the last vertical split item. */
|
/* Special case of deleting the last vertical split item. */
|
||||||
free(item);
|
free(item);
|
||||||
free(root);
|
free(root);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (!item_keep->children)
|
}
|
||||||
{
|
else if (!item_keep->children)
|
||||||
parent->client = item_keep->client;
|
{
|
||||||
parent->children = NULL;
|
parent->client = item_keep->client;
|
||||||
|
parent->children = NULL;
|
||||||
|
|
||||||
free(item_keep);
|
free(item_keep);
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
if (grand_parent)
|
{
|
||||||
{
|
if (grand_parent)
|
||||||
/* Update the children's parent. */
|
{
|
||||||
{
|
/* Update the children's parent. */
|
||||||
Eina_Inlist *itr_safe;
|
{
|
||||||
Window_Tree *itr;
|
Eina_Inlist *itr_safe;
|
||||||
|
Window_Tree *itr;
|
||||||
|
|
||||||
EINA_INLIST_FOREACH_SAFE(item_keep->children, itr_safe,
|
EINA_INLIST_FOREACH_SAFE(item_keep->children, itr_safe,
|
||||||
itr)
|
itr)
|
||||||
{
|
{
|
||||||
/* We are prepending to double-reverse the order. */
|
/* We are prepending to double-reverse the order. */
|
||||||
grand_parent->children =
|
grand_parent->children =
|
||||||
eina_inlist_prepend_relative(grand_parent->children,
|
eina_inlist_prepend_relative(grand_parent->children,
|
||||||
EINA_INLIST_GET(itr), EINA_INLIST_GET(parent));
|
EINA_INLIST_GET(itr), EINA_INLIST_GET(parent));
|
||||||
itr->weight *= parent->weight;
|
itr->weight *= parent->weight;
|
||||||
itr->parent = grand_parent;
|
itr->parent = grand_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
grand_parent->children =
|
grand_parent->children =
|
||||||
eina_inlist_remove(grand_parent->children,
|
eina_inlist_remove(grand_parent->children,
|
||||||
EINA_INLIST_GET(parent));
|
EINA_INLIST_GET(parent));
|
||||||
free(parent);
|
free(parent);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
/* This is fine, as this is a child of the root so we allow
|
{
|
||||||
* two levels. */
|
/* This is fine, as this is a child of the root so we allow
|
||||||
item_keep->weight = 1.0;
|
* two levels. */
|
||||||
}
|
item_keep->weight = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
parent->children =
|
parent->children =
|
||||||
eina_inlist_remove(parent->children, EINA_INLIST_GET(item));
|
eina_inlist_remove(parent->children, EINA_INLIST_GET(item));
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
float weight = 1.0 - item->weight;
|
float weight = 1.0 - item->weight;
|
||||||
|
|
||||||
parent->children =
|
parent->children =
|
||||||
eina_inlist_remove(parent->children, EINA_INLIST_GET(item));
|
eina_inlist_remove(parent->children, EINA_INLIST_GET(item));
|
||||||
|
|
||||||
/* Adjust existing children's weights */
|
/* Adjust existing children's weights */
|
||||||
EINA_INLIST_FOREACH(parent->children, itr)
|
EINA_INLIST_FOREACH(parent->children, itr)
|
||||||
{
|
{
|
||||||
itr->weight /= weight;
|
itr->weight /= weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(item);
|
free(item);
|
||||||
|
@ -232,31 +242,31 @@ tiling_window_tree_remove(Window_Tree * root, Window_Tree * item)
|
||||||
}
|
}
|
||||||
|
|
||||||
Window_Tree *
|
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;
|
Window_Tree *itr;
|
||||||
|
|
||||||
if (!client)
|
if (!client)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!root || (root->client == client))
|
if (!root || (root->client == client))
|
||||||
return root;
|
return root;
|
||||||
|
|
||||||
EINA_INLIST_FOREACH(root->children, itr)
|
EINA_INLIST_FOREACH(root->children, itr)
|
||||||
{
|
{
|
||||||
Window_Tree *ret;
|
Window_Tree *ret;
|
||||||
|
|
||||||
ret = tiling_window_tree_client_find(itr, client);
|
ret = tiling_window_tree_client_find(itr, client);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
Evas_Coord w, Evas_Coord h, int level, Evas_Coord padding)
|
||||||
{
|
{
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
Tiling_Split_Type split_type = level % 2;
|
Tiling_Split_Type split_type = level % 2;
|
||||||
|
@ -264,95 +274,97 @@ _tiling_window_tree_level_apply(Window_Tree * root, Evas_Coord x, Evas_Coord y,
|
||||||
|
|
||||||
if (root->client)
|
if (root->client)
|
||||||
{
|
{
|
||||||
tiling_e_client_move_resize_extra(root->client, x, y,
|
tiling_e_client_move_resize_extra(root->client, x, y,
|
||||||
w - padding, h - padding);
|
w - padding, h - padding);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (split_type == TILING_SPLIT_HORIZONTAL)
|
if (split_type == TILING_SPLIT_HORIZONTAL)
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(root->children, itr)
|
EINA_INLIST_FOREACH(root->children, itr)
|
||||||
{
|
{
|
||||||
Evas_Coord itw = w * itr->weight;
|
Evas_Coord itw = w * itr->weight;
|
||||||
|
|
||||||
total_weight += 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);
|
||||||
x += itw;
|
x += itw;
|
||||||
}
|
}
|
||||||
} else if (split_type == TILING_SPLIT_VERTICAL)
|
}
|
||||||
|
else if (split_type == TILING_SPLIT_VERTICAL)
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(root->children, itr)
|
EINA_INLIST_FOREACH(root->children, itr)
|
||||||
{
|
{
|
||||||
Evas_Coord ith = h * itr->weight;
|
Evas_Coord ith = h * itr->weight;
|
||||||
|
|
||||||
total_weight += 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);
|
||||||
y += ith;
|
y += ith;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust the last item's weight in case weight < 1.0 */
|
/* 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
|
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)
|
Evas_Coord w, Evas_Coord h, Evas_Coord padding)
|
||||||
{
|
{
|
||||||
_tiling_window_tree_level_apply(root, x + padding, y + padding,
|
_tiling_window_tree_level_apply(root, x + padding, y + padding,
|
||||||
w - padding, h - padding, 0, padding);
|
w - padding, h - padding, 0, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window_Tree *
|
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 *
|
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
|
static Eina_Bool
|
||||||
_tiling_window_tree_node_resize_direction(Window_Tree * node,
|
_tiling_window_tree_node_resize_direction(Window_Tree *node,
|
||||||
Window_Tree * parent, double dir_diff, int dir)
|
Window_Tree *parent, double dir_diff, int dir)
|
||||||
{
|
{
|
||||||
double weight = 0.0;
|
double weight = 0.0;
|
||||||
double weight_diff;
|
double weight_diff;
|
||||||
Window_Tree *children_start;
|
Window_Tree *children_start;
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
Window_Tree *(*itr_func) (Window_Tree *);
|
Window_Tree *(*itr_func)(Window_Tree *);
|
||||||
|
|
||||||
if (dir > 0)
|
if (dir > 0)
|
||||||
{
|
{
|
||||||
itr_func = _inlist_prev;
|
itr_func = _inlist_prev;
|
||||||
children_start = (Window_Tree *) parent->children->last;
|
children_start = (Window_Tree *)parent->children->last;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
itr_func = _inlist_next;
|
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)
|
while (itr != node)
|
||||||
{
|
{
|
||||||
weight += itr->weight;
|
weight += itr->weight;
|
||||||
|
|
||||||
itr = itr_func(itr);
|
itr = itr_func(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's at the edge, try the grandpa of the parent. */
|
/* If it's at the edge, try the grandpa of the parent. */
|
||||||
if (weight == 0.0)
|
if (weight == 0.0)
|
||||||
{
|
{
|
||||||
if (parent->parent && parent->parent->parent)
|
if (parent->parent && parent->parent->parent)
|
||||||
{
|
{
|
||||||
return _tiling_window_tree_node_resize_direction(parent->parent,
|
return _tiling_window_tree_node_resize_direction(parent->parent,
|
||||||
parent->parent->parent, 1.0 + ((dir_diff - 1.) * node->weight),
|
parent->parent->parent, 1.0 + ((dir_diff - 1.) * node->weight),
|
||||||
dir);
|
dir);
|
||||||
}
|
}
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
weight_diff = itr->weight;
|
weight_diff = itr->weight;
|
||||||
|
@ -362,15 +374,15 @@ _tiling_window_tree_node_resize_direction(Window_Tree * node,
|
||||||
|
|
||||||
for (itr = children_start; itr != node; itr = itr_func(itr))
|
for (itr = children_start; itr != node; itr = itr_func(itr))
|
||||||
{
|
{
|
||||||
itr->weight += itr->weight * weight_diff;
|
itr->weight += itr->weight * weight_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
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)
|
int h_dir, double h_diff)
|
||||||
{
|
{
|
||||||
Window_Tree *parent = node->parent;
|
Window_Tree *parent = node->parent;
|
||||||
Window_Tree *w_parent, *h_parent;
|
Window_Tree *w_parent, *h_parent;
|
||||||
|
@ -378,95 +390,98 @@ tiling_window_tree_node_resize(Window_Tree * node, int w_dir, double w_diff,
|
||||||
|
|
||||||
/* If we have no parent, means we need to be full screen anyway. */
|
/* If we have no parent, means we need to be full screen anyway. */
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
Window_Tree *grand_parent = parent->parent;
|
Window_Tree *grand_parent = parent->parent;
|
||||||
Tiling_Split_Type parent_split_type =
|
Tiling_Split_Type parent_split_type =
|
||||||
_tiling_window_tree_split_type_get(parent);
|
_tiling_window_tree_split_type_get(parent);
|
||||||
|
|
||||||
/* w_diff related changes. */
|
/* w_diff related changes. */
|
||||||
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
|
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
|
||||||
{
|
{
|
||||||
w_parent = parent;
|
w_parent = parent;
|
||||||
h_parent = grand_parent;
|
h_parent = grand_parent;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
w_parent = grand_parent;
|
w_parent = grand_parent;
|
||||||
h_parent = parent;
|
h_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((h_diff != 1.0) && h_parent)
|
if ((h_diff != 1.0) && h_parent)
|
||||||
{
|
{
|
||||||
Window_Tree *tmp_node = (h_parent == parent) ? node : parent;
|
Window_Tree *tmp_node = (h_parent == parent) ? node : parent;
|
||||||
|
|
||||||
ret = ret ||
|
ret = ret ||
|
||||||
_tiling_window_tree_node_resize_direction(tmp_node, h_parent,
|
_tiling_window_tree_node_resize_direction(tmp_node, h_parent,
|
||||||
h_diff, h_dir);
|
h_diff, h_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((w_diff != 1.0) && w_parent)
|
if ((w_diff != 1.0) && w_parent)
|
||||||
{
|
{
|
||||||
Window_Tree *tmp_node = (w_parent == parent) ? node : parent;
|
Window_Tree *tmp_node = (w_parent == parent) ? node : parent;
|
||||||
|
|
||||||
ret = ret ||
|
ret = ret ||
|
||||||
_tiling_window_tree_node_resize_direction(tmp_node, w_parent,
|
_tiling_window_tree_node_resize_direction(tmp_node, w_parent,
|
||||||
w_diff, w_dir);
|
w_diff, w_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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,
|
Tiling_Split_Type split_type, Eina_Bool gave_up_this,
|
||||||
Eina_Bool gave_up_parent)
|
Eina_Bool gave_up_parent)
|
||||||
{
|
{
|
||||||
int ret =
|
int ret =
|
||||||
TILING_WINDOW_TREE_EDGE_LEFT | TILING_WINDOW_TREE_EDGE_RIGHT |
|
TILING_WINDOW_TREE_EDGE_LEFT | TILING_WINDOW_TREE_EDGE_RIGHT |
|
||||||
TILING_WINDOW_TREE_EDGE_TOP | TILING_WINDOW_TREE_EDGE_BOTTOM;
|
TILING_WINDOW_TREE_EDGE_TOP | TILING_WINDOW_TREE_EDGE_BOTTOM;
|
||||||
if (!node->parent)
|
if (!node->parent)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
} else if (gave_up_this && gave_up_parent)
|
}
|
||||||
|
else if (gave_up_this && gave_up_parent)
|
||||||
{
|
{
|
||||||
return 0;
|
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. */
|
/* Mixed the gave_up vals on purpose, we do it on every call. */
|
||||||
return _tiling_window_tree_edges_get_helper(node->parent, !split_type,
|
return _tiling_window_tree_edges_get_helper(node->parent, !split_type,
|
||||||
gave_up_parent, gave_up_this);
|
gave_up_parent, gave_up_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EINA_INLIST_GET(node)->prev)
|
if (EINA_INLIST_GET(node)->prev)
|
||||||
{
|
{
|
||||||
gave_up_this = EINA_TRUE;
|
gave_up_this = EINA_TRUE;
|
||||||
ret ^=
|
ret ^=
|
||||||
(split_type ==
|
(split_type ==
|
||||||
TILING_SPLIT_HORIZONTAL) ? TILING_WINDOW_TREE_EDGE_LEFT :
|
TILING_SPLIT_HORIZONTAL) ? TILING_WINDOW_TREE_EDGE_LEFT :
|
||||||
TILING_WINDOW_TREE_EDGE_TOP;
|
TILING_WINDOW_TREE_EDGE_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EINA_INLIST_GET(node)->next)
|
if (EINA_INLIST_GET(node)->next)
|
||||||
{
|
{
|
||||||
gave_up_this = EINA_TRUE;
|
gave_up_this = EINA_TRUE;
|
||||||
ret ^=
|
ret ^=
|
||||||
(split_type ==
|
(split_type ==
|
||||||
TILING_SPLIT_HORIZONTAL) ? TILING_WINDOW_TREE_EDGE_RIGHT :
|
TILING_SPLIT_HORIZONTAL) ? TILING_WINDOW_TREE_EDGE_RIGHT :
|
||||||
TILING_WINDOW_TREE_EDGE_BOTTOM;
|
TILING_WINDOW_TREE_EDGE_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mixed the gave_up vals on purpose, we do it on every call. */
|
/* Mixed the gave_up vals on purpose, we do it on every call. */
|
||||||
return ret & _tiling_window_tree_edges_get_helper(node->parent, !split_type,
|
return ret & _tiling_window_tree_edges_get_helper(node->parent, !split_type,
|
||||||
gave_up_parent, gave_up_this);
|
gave_up_parent, gave_up_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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);
|
Tiling_Split_Type split_type = _tiling_window_tree_split_type_get(node);
|
||||||
|
|
||||||
return _tiling_window_tree_edges_get_helper(node, !split_type, EINA_FALSE,
|
return _tiling_window_tree_edges_get_helper(node, !split_type, EINA_FALSE,
|
||||||
EINA_FALSE);
|
EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Node move */
|
/* Node move */
|
||||||
|
@ -474,20 +489,20 @@ static struct _Node_Move_Context
|
||||||
{
|
{
|
||||||
Window_Tree *node;
|
Window_Tree *node;
|
||||||
Window_Tree *ret;
|
Window_Tree *ret;
|
||||||
int cross_edge;
|
int cross_edge;
|
||||||
int best_match;
|
int best_match;
|
||||||
} _node_move_ctx;
|
} _node_move_ctx;
|
||||||
|
|
||||||
#define CNODE (_node_move_ctx.node)
|
#define CNODE (_node_move_ctx.node)
|
||||||
|
|
||||||
#define IF_MATCH_SET_LR(node) _tiling_window_tree_node_move_if_match_set(node, \
|
#define IF_MATCH_SET_LR(node) _tiling_window_tree_node_move_if_match_set(node, \
|
||||||
CNODE->client->y, CNODE->client->h, node->client->y, node->client->h)
|
CNODE->client->y, CNODE->client->h, node->client->y, node->client->h)
|
||||||
#define IF_MATCH_SET_TB(node) _tiling_window_tree_node_move_if_match_set(node, \
|
#define IF_MATCH_SET_TB(node) _tiling_window_tree_node_move_if_match_set(node, \
|
||||||
CNODE->client->x, CNODE->client->w, node->client->x, node->client->w)
|
CNODE->client->x, CNODE->client->w, node->client->x, node->client->w)
|
||||||
|
|
||||||
static void
|
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 cw, Evas_Coord ox, Evas_Coord ow)
|
||||||
{
|
{
|
||||||
Evas_Coord leftx, rightx;
|
Evas_Coord leftx, rightx;
|
||||||
int match;
|
int match;
|
||||||
|
@ -498,8 +513,8 @@ _tiling_window_tree_node_move_if_match_set(Window_Tree * node, Evas_Coord cx,
|
||||||
|
|
||||||
if (match > _node_move_ctx.best_match)
|
if (match > _node_move_ctx.best_match)
|
||||||
{
|
{
|
||||||
_node_move_ctx.best_match = match;
|
_node_move_ctx.best_match = match;
|
||||||
_node_move_ctx.ret = node;
|
_node_move_ctx.ret = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,28 +525,32 @@ _tiling_window_tree_node_move_walker(void *_node)
|
||||||
|
|
||||||
/* We are only interested in nodes with clients. */
|
/* We are only interested in nodes with clients. */
|
||||||
if (!node->client)
|
if (!node->client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (_node_move_ctx.cross_edge)
|
switch (_node_move_ctx.cross_edge)
|
||||||
{
|
{
|
||||||
case TILING_WINDOW_TREE_EDGE_LEFT:
|
case TILING_WINDOW_TREE_EDGE_LEFT:
|
||||||
if ((node->client->x + node->client->w) == CNODE->client->x)
|
if ((node->client->x + node->client->w) == CNODE->client->x)
|
||||||
IF_MATCH_SET_LR(node);
|
IF_MATCH_SET_LR(node);
|
||||||
break;
|
break;
|
||||||
case TILING_WINDOW_TREE_EDGE_RIGHT:
|
|
||||||
if (node->client->x == (CNODE->client->x + CNODE->client->w))
|
case TILING_WINDOW_TREE_EDGE_RIGHT:
|
||||||
IF_MATCH_SET_LR(node);
|
if (node->client->x == (CNODE->client->x + CNODE->client->w))
|
||||||
break;
|
IF_MATCH_SET_LR(node);
|
||||||
case TILING_WINDOW_TREE_EDGE_TOP:
|
break;
|
||||||
if ((node->client->y + node->client->h) == CNODE->client->y)
|
|
||||||
IF_MATCH_SET_TB(node);
|
case TILING_WINDOW_TREE_EDGE_TOP:
|
||||||
break;
|
if ((node->client->y + node->client->h) == CNODE->client->y)
|
||||||
case TILING_WINDOW_TREE_EDGE_BOTTOM:
|
IF_MATCH_SET_TB(node);
|
||||||
if (node->client->y == (CNODE->client->y + CNODE->client->h))
|
break;
|
||||||
IF_MATCH_SET_TB(node);
|
|
||||||
break;
|
case TILING_WINDOW_TREE_EDGE_BOTTOM:
|
||||||
default:
|
if (node->client->y == (CNODE->client->y + CNODE->client->h))
|
||||||
break;
|
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
|
#undef IF_MATCH_SET_TB
|
||||||
|
|
||||||
void
|
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;
|
Window_Tree *root = node;
|
||||||
|
|
||||||
|
@ -548,7 +567,7 @@ tiling_window_tree_node_move(Window_Tree * node, int cross_edge)
|
||||||
* is very easy to implement. */
|
* is very easy to implement. */
|
||||||
|
|
||||||
while (root->parent)
|
while (root->parent)
|
||||||
root = root->parent;
|
root = root->parent;
|
||||||
|
|
||||||
_node_move_ctx.node = node;
|
_node_move_ctx.node = node;
|
||||||
_node_move_ctx.cross_edge = cross_edge;
|
_node_move_ctx.cross_edge = cross_edge;
|
||||||
|
@ -559,37 +578,38 @@ tiling_window_tree_node_move(Window_Tree * node, int cross_edge)
|
||||||
|
|
||||||
if (_node_move_ctx.ret)
|
if (_node_move_ctx.ret)
|
||||||
{
|
{
|
||||||
E_Client *ec = node->client;
|
E_Client *ec = node->client;
|
||||||
|
|
||||||
node->client = _node_move_ctx.ret->client;
|
node->client = _node_move_ctx.ret->client;
|
||||||
_node_move_ctx.ret->client = ec;
|
_node_move_ctx.ret->client = ec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End Node move. */
|
/* End Node move. */
|
||||||
|
|
||||||
void
|
void
|
||||||
tiling_window_tree_dump(Window_Tree * root, int level)
|
tiling_window_tree_dump(Window_Tree *root, int level)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < level; i++)
|
for (i = 0; i < level; i++)
|
||||||
printf(" ");
|
printf(" ");
|
||||||
|
|
||||||
if (root->children)
|
if (root->children)
|
||||||
printf("\\-");
|
printf("\\-");
|
||||||
else
|
else
|
||||||
printf("|-");
|
printf("|-");
|
||||||
|
|
||||||
printf("%f (%p)\n", root->weight, root->client);
|
printf("%f (%p)\n", root->weight, root->client);
|
||||||
|
|
||||||
Window_Tree *itr;
|
Window_Tree *itr;
|
||||||
|
|
||||||
EINA_INLIST_FOREACH(root->children, itr)
|
EINA_INLIST_FOREACH(root->children, itr)
|
||||||
{
|
{
|
||||||
tiling_window_tree_dump(itr, level + 1);
|
tiling_window_tree_dump(itr, level + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,35 +19,35 @@ struct _Window_Tree
|
||||||
EINA_INLIST;
|
EINA_INLIST;
|
||||||
Window_Tree *parent;
|
Window_Tree *parent;
|
||||||
/* FIXME: client is falid iff children is null. Sholud enforce it. */
|
/* FIXME: client is falid iff children is null. Sholud enforce it. */
|
||||||
Eina_Inlist *children; /* Window_Tree * type */
|
Eina_Inlist *children; /* Window_Tree * type */
|
||||||
E_Client *client;
|
E_Client *client;
|
||||||
double weight;
|
double weight;
|
||||||
};
|
};
|
||||||
|
|
||||||
# define TILING_WINDOW_TREE_EDGE_LEFT (1 << 0)
|
# define TILING_WINDOW_TREE_EDGE_LEFT (1 << 0)
|
||||||
# define TILING_WINDOW_TREE_EDGE_RIGHT (1 << 1)
|
# define TILING_WINDOW_TREE_EDGE_RIGHT (1 << 1)
|
||||||
# define TILING_WINDOW_TREE_EDGE_TOP (1 << 2)
|
# define TILING_WINDOW_TREE_EDGE_TOP (1 << 2)
|
||||||
# define TILING_WINDOW_TREE_EDGE_BOTTOM (1 << 3)
|
# 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_free(Window_Tree *root);
|
||||||
void tiling_window_tree_walk(Window_Tree * root, void (*func) (void *));
|
void tiling_window_tree_walk(Window_Tree *root, void (*func)(void *));
|
||||||
|
|
||||||
Window_Tree *tiling_window_tree_add(Window_Tree * root, Window_Tree * parent,
|
Window_Tree *tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
|
||||||
E_Client * client, Tiling_Split_Type split_type);
|
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,
|
Window_Tree *tiling_window_tree_client_find(Window_Tree *root,
|
||||||
E_Client * client);
|
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);
|
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);
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue