Breakup code a little more to be better organized. Separates all border

functions into one file.



SVN revision: 44681
This commit is contained in:
Christopher Michael 2009-12-23 11:48:55 +00:00
parent 0e6ac0c058
commit 53b66b881c
6 changed files with 574 additions and 561 deletions

View File

@ -25,6 +25,8 @@ module_la_SOURCES = e_mod_main.h \
e_mod_layout.c \
e_mod_layout_illume.h \
e_mod_layout_illume.c \
e_mod_border.h \
e_mod_border.c \
e_kbd.h \
e_kbd.c \
e_mod_config.h \

View File

@ -0,0 +1,465 @@
#include "e.h"
#include "e_mod_border.h"
#include "e_mod_config.h"
#include "e_kbd.h"
//////////////////////////////////////////////////////////////////////////////
// :: Convenience routines to make it easy to write layout logic code ::
// activate a window - meant for main app and home app windows
void
e_mod_border_activate(E_Border *bd)
{
e_desk_show(bd->desk);
e_border_uniconify(bd);
e_border_raise(bd);
e_border_show(bd);
e_border_focus_set(bd, 1, 1);
}
// activate a window that isnt meant to get the focus - like panels, kbd etc.
void
e_mod_border_show(E_Border *bd)
{
e_desk_show(bd->desk);
e_border_uniconify(bd);
e_border_raise(bd);
e_border_show(bd);
}
// get a window away from being visile (but maintain it)
void
e_mod_border_deactivate(E_Border *bd)
{
e_border_iconify(bd);
}
// get window info - is this one a dialog?
Eina_Bool
e_mod_border_is_dialog(E_Border *bd)
{
int isdialog = 0, i;
if (bd->client.icccm.transient_for != 0) isdialog = 1;
if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
{
isdialog = 1;
if (bd->client.netwm.extra_types)
{
for (i = 0; i < bd->client.netwm.extra_types_num; i++)
{
if (bd->client.netwm.extra_types[i] ==
ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
if ((bd->client.netwm.extra_types[i] !=
ECORE_X_WINDOW_TYPE_DIALOG) &&
(bd->client.netwm.extra_types[i] !=
ECORE_X_WINDOW_TYPE_SPLASH))
{
return 0;
}
}
}
}
return isdialog;
}
// get window info - is this a vkbd window
Eina_Bool
e_mod_border_is_keyboard(E_Border *bd)
{
if (bd->client.vkbd.vkbd) return 1;
if (il_cfg->policy.vkbd.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.vkbd.title)))
return 1;
}
if (il_cfg->policy.vkbd.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
return 1;
}
if (il_cfg->policy.vkbd.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
return 1;
}
if ((bd->client.icccm.name) &&
((!strcmp(bd->client.icccm.name, "multitap-pad")))
&& (bd->client.netwm.state.skip_taskbar)
&& (bd->client.netwm.state.skip_pager))
return 1;
return 0;
}
// get window info - is it a bottom app panel window (eg qtopia softmenu)
Eina_Bool
e_mod_border_is_bottom_panel(E_Border *bd)
{
if (il_cfg->policy.softkey.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.softkey.title)))
return 1;
}
if (il_cfg->policy.softkey.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
return 1;
}
if (il_cfg->policy.softkey.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
return 1;
}
if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
(bd->client.qtopia.soft_menu)))
return 1;
return 0;
}
// get window info - is it a top shelf window
Eina_Bool
e_mod_border_is_top_shelf(E_Border *bd)
{
if (il_cfg->policy.indicator.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.indicator.title)))
return 1;
}
if (il_cfg->policy.indicator.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
return 1;
}
if (il_cfg->policy.indicator.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
return 1;
}
return 0;
}
// get window info - is it a mini app window
Eina_Bool
e_mod_border_is_mini_app(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it a notification window
Eina_Bool
e_mod_border_is_notification(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it a home window
Eina_Bool
e_mod_border_is_home(E_Border *bd)
{
if (il_cfg->policy.home.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.home.title)))
return 1;
}
if (il_cfg->policy.home.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.home.name)))
return 1;
}
if (il_cfg->policy.home.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.home.class)))
return 1;
}
return 0;
}
// get window info - is it side pane (left) window
Eina_Bool
e_mod_border_is_side_pane_left(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it side pane (right) window
Eina_Bool
e_mod_border_is_side_pane_right(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it overlay window (eg expose display of windows etc.)
Eina_Bool
e_mod_border_is_overlay(E_Border *bd)
{
// FIXME: detect
return 0;
}
Eina_Bool
e_mod_border_is_conformant(E_Border *bd)
{
if (strstr(bd->client.icccm.class, "config")) return EINA_FALSE;
return ecore_x_e_illume_conformant_get(bd->client.win);
}
Eina_List *
e_mod_border_valid_borders_get(E_Zone *zone)
{
Eina_List *bds, *l, *ret = NULL;
E_Border *bd;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (!bd) continue;
if (bd->zone != zone) continue;
if (e_mod_border_is_top_shelf(bd)) continue;
if (e_mod_border_is_bottom_panel(bd)) continue;
if (e_mod_border_is_keyboard(bd)) continue;
if (e_mod_border_is_dialog(bd)) continue;
ret = eina_list_append(ret, bd);
}
return ret;
}
E_Border *
e_mod_border_valid_border_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *ret = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (!bd) continue;
if (bd->zone != zone) continue;
if (e_mod_border_is_top_shelf(bd)) continue;
if (e_mod_border_is_bottom_panel(bd)) continue;
if (e_mod_border_is_keyboard(bd)) continue;
if (e_mod_border_is_dialog(bd)) continue;
ret = bd;
break;
}
return ret;
}
int
e_mod_border_valid_count_get(E_Zone *zone)
{
Eina_List *l;
int count;
l = e_mod_border_valid_borders_get(zone);
count = eina_list_count(l);
eina_list_free(l);
return count;
}
E_Border *
e_mod_border_at_xy_get(E_Zone *zone, int x, int y)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_mod_border_valid_borders_get(zone);
EINA_LIST_FOREACH(bds, l, bd)
{
if (((bd->fx.x == x) && (bd->fx.y == y)) ||
((bd->x == x) && (bd->y == y)))
{
b = bd;
break;
}
}
eina_list_free(bds);
return b;
}
E_Border *
e_mod_border_in_region_get(E_Zone *zone, int x, int y, int w, int h)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_mod_border_valid_borders_get(zone);
EINA_LIST_FOREACH(bds, l, bd)
{
if (E_INSIDE(bd->x, bd->fx.y, x, y, w, h))
{
b = bd;
break;
}
}
eina_list_free(bds);
return b;
}
E_Border *
e_mod_border_top_shelf_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (bd->zone != zone) continue;
if (!e_mod_border_is_top_shelf(bd)) continue;
b = bd;
break;
}
return b;
}
E_Border *
e_mod_border_bottom_panel_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (bd->zone != zone) continue;
if (!e_mod_border_is_bottom_panel(bd)) continue;
b = bd;
break;
}
return b;
}
void
e_mod_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y)
{
E_Border *bd;
if (!(bd = e_mod_border_top_shelf_get(zone))) return;
if (x) *x = bd->x;
if (y) *y = bd->y;
}
void
e_mod_border_top_shelf_size_get(E_Zone *zone, int *w, int *h)
{
E_Border *bd;
if (!(bd = e_mod_border_top_shelf_get(zone))) return;
if (w) *w = bd->w;
if (h) *h = bd->h;
}
void
e_mod_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y)
{
E_Border *bd;
if (!(bd = e_mod_border_bottom_panel_get(zone))) return;
if (x) *x = bd->x;
if (y) *y = bd->y;
}
void
e_mod_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h)
{
E_Border *bd;
if (!(bd = e_mod_border_bottom_panel_get(zone))) return;
if (w) *w = bd->w;
if (h) *h = bd->h;
}
void
e_mod_border_slide_to(E_Border *bd, int x, int y, Illume_Anim_Class aclass)
{
// FIXME: do
// 1. if an existing slide exists, use is current offset x,y as current border pos, new x,y as new pos and start slide again
}
void
e_mod_border_min_get(E_Border *bd, int *mw, int *mh)
{
if (mw)
{
if (bd->client.icccm.base_w > bd->client.icccm.min_w)
*mw = bd->client.icccm.base_w;
else
*mw = bd->client.icccm.min_w;
}
if (mh)
{
if (bd->client.icccm.base_h > bd->client.icccm.min_h)
*mh = bd->client.icccm.base_h;
else
*mh = bd->client.icccm.min_h;
}
}
void
e_mod_border_max_get(E_Border *bd, int *mw, int *mh)
{
if (mw)
{
if (bd->client.icccm.base_w > bd->client.icccm.max_w)
*mw = bd->client.icccm.base_w;
else
*mw = bd->client.icccm.max_w;
}
if (mh)
{
if (bd->client.icccm.base_h > bd->client.icccm.max_h)
*mh = bd->client.icccm.base_h;
else
*mh = bd->client.icccm.max_h;
}
}
void
e_mod_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
{
int ty, nx, ny, nw, nh;
if (!zone) return;
e_kbd_safe_app_region_get(zone, &nx, &ny, &nw, &nh);
e_mod_border_top_shelf_pos_get(zone, NULL, &ty);
if (nh >= zone->h) nh = (ny + ty);
if (x) *x = nx;
if (y) *y = ny;
if (w) *w = nw;
if (h) *h = nh;
}
void
e_mod_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
{
int ty, th, bh;
int nx, ny, nw, nh;
if (!zone) return;
e_kbd_safe_app_region_get(zone, &nx, NULL, &nw, &nh);
e_mod_border_top_shelf_pos_get(zone, NULL, &ty);
e_mod_border_top_shelf_size_get(zone, NULL, &th);
e_mod_border_bottom_panel_size_get(zone, NULL, &bh);
ny = (ty + th);
nh = (nh - ny - bh);
if (x) *x = nx;
if (y) *y = ny;
if (w) *w = nw;
if (h) *h = nh;
}

View File

@ -0,0 +1,49 @@
#ifndef E_MOD_BORDER_H
#define E_MOD_BORDER_H
typedef enum _Illume_Anim_Class
{
ILLUME_ANIM_APP,
ILLUME_ANIM_KEYBOARD,
ILLUME_ANIM_SHELF,
ILLUME_ANIM_DIALOG,
ILLUME_ANIM_OTHER
} Illume_Anim_Class;
void e_mod_border_activate(E_Border *bd);
void e_mod_border_show(E_Border *bd);
void e_mod_border_deactivate(E_Border *bd);
Eina_Bool e_mod_border_is_dialog(E_Border *bd);
Eina_Bool e_mod_border_is_keyboard(E_Border *bd);
Eina_Bool e_mod_border_is_bottom_panel(E_Border *bd);
Eina_Bool e_mod_border_is_top_shelf(E_Border *bd);
Eina_Bool e_mod_border_is_mini_app(E_Border *bd);
Eina_Bool e_mod_border_is_notification(E_Border *bd);
Eina_Bool e_mod_border_is_home(E_Border *bd);
Eina_Bool e_mod_border_is_side_pane_left(E_Border *bd);
Eina_Bool e_mod_border_is_side_pane_right(E_Border *bd);
Eina_Bool e_mod_border_is_overlay(E_Border *bd);
Eina_Bool e_mod_border_is_conformant(E_Border *bd);
Eina_List *e_mod_border_valid_borders_get(E_Zone *zone);
E_Border *e_mod_border_valid_border_get(E_Zone *zone);
int e_mod_border_valid_count_get(E_Zone *zone);
E_Border *e_mod_border_at_xy_get(E_Zone *zone, int x, int y);
E_Border *e_mod_border_in_region_get(E_Zone *zone, int x, int y, int w, int h);
E_Border *e_mod_border_keyboard_get(E_Zone *zone);
E_Border *e_mod_border_top_shelf_get(E_Zone *zone);
E_Border *e_mod_border_bottom_panel_get(E_Zone *zone);
void e_mod_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y);
void e_mod_border_top_shelf_size_get(E_Zone *zone, int *w, int *h);
void e_mod_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y);
void e_mod_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h);
void e_mod_border_slide_to(E_Border *bd, int x, int y, Illume_Anim_Class aclass);
void e_mod_border_min_get(E_Border *bd, int *mw, int *mh);
void e_mod_border_max_get(E_Border *bd, int *mw, int *mh);
void e_mod_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
void e_mod_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
#endif

View File

@ -1,9 +1,8 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_layout.h"
#include "e_mod_layout_illume.h"
#include "e_mod_config.h"
#include "e_kbd.h"
#include "e_mod_layout_illume.h"
#include "e_mod_border.h"
// internal calls
static void _e_mod_layout_cb_hook_container_layout(void *data, void *data2);
@ -23,7 +22,6 @@ static int _cb_event_client_message(void *data, int type, void *event);
static E_Border_Hook *hook1 = NULL;
static E_Border_Hook *hook2 = NULL;
static E_Border_Hook *hook3 = NULL;
static E_Border_Hook *hook4 = NULL;
static Eina_List *handlers = NULL;
void
@ -35,9 +33,7 @@ e_mod_layout_init(E_Module *m)
_e_mod_layout_cb_hook_post_fetch, NULL);
hook2 = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
_e_mod_layout_cb_hook_post_border_assign, NULL);
hook3 = e_border_hook_add(E_BORDER_HOOK_EVAL_END,
_e_mod_layout_cb_hook_end, NULL);
hook4 = e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
hook3 = e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
_e_mod_layout_cb_hook_container_layout, NULL);
handlers = eina_list_append
(handlers, ecore_event_handler_add
@ -77,11 +73,9 @@ e_mod_layout_shutdown(void)
if (hook1) e_border_hook_del(hook1);
if (hook2) e_border_hook_del(hook2);
if (hook3) e_border_hook_del(hook3);
if (hook4) e_border_hook_del(hook4);
hook1 = NULL;
hook2 = NULL;
hook3 = NULL;
hook4 = NULL;
EINA_LIST_FREE(handlers, handle)
ecore_event_handler_del(handle);
}
@ -112,467 +106,6 @@ illume_layout_modes_get(void)
return modes;
}
//////////////////////////////////////////////////////////////////////////////
// :: Convenience routines to make it easy to write layout logic code ::
// activate a window - meant for main app and home app windows
void
illume_border_activate(E_Border *bd)
{
e_desk_show(bd->desk);
e_border_uniconify(bd);
e_border_raise(bd);
e_border_show(bd);
e_border_focus_set(bd, 1, 1);
}
// activate a window that isnt meant to get the focus - like panels, kbd etc.
void
illume_border_show(E_Border *bd)
{
e_desk_show(bd->desk);
e_border_uniconify(bd);
e_border_raise(bd);
e_border_show(bd);
}
// get a window away from being visile (but maintain it)
void
illume_border_deactivate(E_Border *bd)
{
e_border_iconify(bd);
}
// get window info - is this one a dialog?
Eina_Bool
illume_border_is_dialog(E_Border *bd)
{
int isdialog = 0, i;
if (bd->client.icccm.transient_for != 0) isdialog = 1;
if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
{
isdialog = 1;
if (bd->client.netwm.extra_types)
{
for (i = 0; i < bd->client.netwm.extra_types_num; i++)
{
if (bd->client.netwm.extra_types[i] ==
ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
if ((bd->client.netwm.extra_types[i] !=
ECORE_X_WINDOW_TYPE_DIALOG) &&
(bd->client.netwm.extra_types[i] !=
ECORE_X_WINDOW_TYPE_SPLASH))
{
return 0;
}
}
}
}
return isdialog;
}
// get window info - is this a vkbd window
Eina_Bool
illume_border_is_keyboard(E_Border *bd)
{
if (bd->client.vkbd.vkbd) return 1;
if (il_cfg->policy.vkbd.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.vkbd.title)))
return 1;
}
if (il_cfg->policy.vkbd.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
return 1;
}
if (il_cfg->policy.vkbd.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
return 1;
}
if ((bd->client.icccm.name) &&
((!strcmp(bd->client.icccm.name, "multitap-pad")))
&& (bd->client.netwm.state.skip_taskbar)
&& (bd->client.netwm.state.skip_pager))
return 1;
return 0;
}
// get window info - is it a bottom app panel window (eg qtopia softmenu)
Eina_Bool
illume_border_is_bottom_panel(E_Border *bd)
{
if (il_cfg->policy.softkey.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.softkey.title)))
return 1;
}
if (il_cfg->policy.softkey.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
return 1;
}
if (il_cfg->policy.softkey.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
return 1;
}
if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
(bd->client.qtopia.soft_menu)))
return 1;
return 0;
}
// get window info - is it a top shelf window
Eina_Bool
illume_border_is_top_shelf(E_Border *bd)
{
if (il_cfg->policy.indicator.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.indicator.title)))
return 1;
}
if (il_cfg->policy.indicator.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
return 1;
}
if (il_cfg->policy.indicator.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
return 1;
}
return 0;
}
// get window info - is it a mini app window
Eina_Bool
illume_border_is_mini_app(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it a notification window
Eina_Bool
illume_border_is_notification(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it a home window
Eina_Bool
illume_border_is_home(E_Border *bd)
{
if (il_cfg->policy.home.match.title)
{
if ((bd->client.icccm.title) &&
(!strcmp(bd->client.icccm.title, il_cfg->policy.home.title)))
return 1;
}
if (il_cfg->policy.home.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name, il_cfg->policy.home.name)))
return 1;
}
if (il_cfg->policy.home.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class, il_cfg->policy.home.class)))
return 1;
}
return 0;
}
// get window info - is it side pane (left) window
Eina_Bool
illume_border_is_side_pane_left(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it side pane (right) window
Eina_Bool
illume_border_is_side_pane_right(E_Border *bd)
{
// FIXME: detect
return 0;
}
// get window info - is it overlay window (eg expose display of windows etc.)
Eina_Bool
illume_border_is_overlay(E_Border *bd)
{
// FIXME: detect
return 0;
}
Eina_Bool
illume_border_is_conformant(E_Border *bd)
{
if (strstr(bd->client.icccm.class, "config")) return EINA_FALSE;
return ecore_x_e_illume_conformant_get(bd->client.win);
}
Eina_List *
illume_border_valid_borders_get(E_Zone *zone)
{
Eina_List *bds, *l, *ret = NULL;
E_Border *bd;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (!bd) continue;
if (bd->zone != zone) continue;
if (illume_border_is_top_shelf(bd)) continue;
if (illume_border_is_bottom_panel(bd)) continue;
if (illume_border_is_keyboard(bd)) continue;
if (illume_border_is_dialog(bd)) continue;
ret = eina_list_append(ret, bd);
}
return ret;
}
E_Border *
illume_border_valid_border_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *ret = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (!bd) continue;
if (bd->zone != zone) continue;
if (illume_border_is_top_shelf(bd)) continue;
if (illume_border_is_bottom_panel(bd)) continue;
if (illume_border_is_keyboard(bd)) continue;
if (illume_border_is_dialog(bd)) continue;
ret = bd;
break;
}
return ret;
}
int
illume_border_valid_count_get(E_Zone *zone)
{
Eina_List *l;
int count;
l = illume_border_valid_borders_get(zone);
count = eina_list_count(l);
eina_list_free(l);
return count;
}
E_Border *
illume_border_at_xy_get(E_Zone *zone, int x, int y)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = illume_border_valid_borders_get(zone);
EINA_LIST_FOREACH(bds, l, bd)
{
if (((bd->fx.x == x) && (bd->fx.y == y)) ||
((bd->x == x) && (bd->y == y)))
{
b = bd;
break;
}
}
eina_list_free(bds);
return b;
}
E_Border *
illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = illume_border_valid_borders_get(zone);
EINA_LIST_FOREACH(bds, l, bd)
{
if (E_INSIDE(bd->x, bd->fx.y, x, y, w, h))
{
b = bd;
break;
}
}
eina_list_free(bds);
return b;
}
E_Border *
illume_border_top_shelf_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (bd->zone != zone) continue;
if (!illume_border_is_top_shelf(bd)) continue;
b = bd;
break;
}
return b;
}
E_Border *
illume_border_bottom_panel_get(E_Zone *zone)
{
Eina_List *bds, *l;
E_Border *bd, *b = NULL;
bds = e_border_client_list();
EINA_LIST_FOREACH(bds, l, bd)
{
if (bd->zone != zone) continue;
if (!illume_border_is_bottom_panel(bd)) continue;
b = bd;
break;
}
return b;
}
void
illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y)
{
E_Border *bd;
if (!(bd = illume_border_top_shelf_get(zone))) return;
if (x) *x = bd->x;
if (y) *y = bd->y;
}
void
illume_border_top_shelf_size_get(E_Zone *zone, int *w, int *h)
{
E_Border *bd;
if (!(bd = illume_border_top_shelf_get(zone))) return;
if (w) *w = bd->w;
if (h) *h = bd->h;
}
void
illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y)
{
E_Border *bd;
if (!(bd = illume_border_bottom_panel_get(zone))) return;
if (x) *x = bd->x;
if (y) *y = bd->y;
}
void
illume_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h)
{
E_Border *bd;
if (!(bd = illume_border_bottom_panel_get(zone))) return;
if (w) *w = bd->w;
if (h) *h = bd->h;
}
void
illume_border_slide_to(E_Border *bd, int x, int y, Illume_Anim_Class aclass)
{
// FIXME: do
// 1. if an existing slide exists, use is current offset x,y as current border pos, new x,y as new pos and start slide again
}
void
illume_border_min_get(E_Border *bd, int *mw, int *mh)
{
if (mw)
{
if (bd->client.icccm.base_w > bd->client.icccm.min_w)
*mw = bd->client.icccm.base_w;
else
*mw = bd->client.icccm.min_w;
}
if (mh)
{
if (bd->client.icccm.base_h > bd->client.icccm.min_h)
*mh = bd->client.icccm.base_h;
else
*mh = bd->client.icccm.min_h;
}
}
void
illume_border_max_get(E_Border *bd, int *mw, int *mh)
{
if (mw)
{
if (bd->client.icccm.base_w > bd->client.icccm.max_w)
*mw = bd->client.icccm.base_w;
else
*mw = bd->client.icccm.max_w;
}
if (mh)
{
if (bd->client.icccm.base_h > bd->client.icccm.max_h)
*mh = bd->client.icccm.base_h;
else
*mh = bd->client.icccm.max_h;
}
}
void
illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
{
int ty, nx, ny, nw, nh;
if (!zone) return;
e_kbd_safe_app_region_get(zone, &nx, &ny, &nw, &nh);
illume_border_top_shelf_pos_get(zone, NULL, &ty);
if (nh >= zone->h) nh = (ny + ty);
if (x) *x = nx;
if (y) *y = ny;
if (w) *w = nw;
if (h) *h = nh;
}
void
illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h)
{
int ty, th, bh;
int nx, ny, nw, nh;
if (!zone) return;
e_kbd_safe_app_region_get(zone, &nx, NULL, &nw, &nh);
illume_border_top_shelf_pos_get(zone, NULL, &ty);
illume_border_top_shelf_size_get(zone, NULL, &th);
illume_border_bottom_panel_size_get(zone, NULL, &bh);
ny = (ty + th);
nh = (nh - ny - bh);
if (x) *x = nx;
if (y) *y = ny;
if (w) *w = nw;
if (h) *h = nh;
}
static void
_e_mod_layout_cb_hook_container_layout(void *data, void *data2)
{
@ -684,12 +217,6 @@ _e_mod_layout_cb_hook_post_border_assign(void *data, void *data2)
bd->lock_user_sticky = 1;
}
static void
_e_mod_layout_cb_hook_end(void *data, void *data2)
{
}
static int
_cb_event_border_add(void *data, int type, void *event)
{
@ -814,10 +341,10 @@ _cb_event_client_message(void *data, int type, void *event)
}
zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
bd = illume_border_top_shelf_get(zone);
bd = e_mod_border_top_shelf_get(zone);
if (bd)
ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
bd = illume_border_bottom_panel_get(zone);
bd = e_mod_border_bottom_panel_get(zone);
if (bd)
ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
}
@ -874,5 +401,19 @@ _cb_event_client_message(void *data, int type, void *event)
if ((mode) && (mode->funcs.drag_end))
mode->funcs.drag_end(bd);
}
else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_WINLIST_STATE)
{
Ecore_X_Illume_Winlist_State state;
state = ecore_x_e_illume_winlist_state_get(ev->win);
if (state == ECORE_X_ATOM_E_ILLUME_WINLIST_ON)
{
/* show winlist */
}
else
{
/* hide winlist */
}
}
return 1;
}

View File

@ -1,18 +1,6 @@
#ifndef E_MOD_LAYOUT_H
#define E_MOD_LAYOUT_H
void e_mod_layout_init(E_Module *m);
void e_mod_layout_shutdown(void);
typedef enum _Illume_Anim_Class
{
ILLUME_ANIM_APP,
ILLUME_ANIM_KEYBOARD,
ILLUME_ANIM_SHELF,
ILLUME_ANIM_DIALOG,
ILLUME_ANIM_OTHER
} Illume_Anim_Class;
typedef struct _Illume_Layout_Mode Illume_Layout_Mode;
struct _Illume_Layout_Mode
@ -35,44 +23,11 @@ struct _Illume_Layout_Mode
} funcs;
};
void e_mod_layout_init(E_Module *m);
void e_mod_layout_shutdown(void);
void illume_layout_mode_register(const Illume_Layout_Mode *laymode);
void illume_layout_mode_unregister(const Illume_Layout_Mode *laymode);
Eina_List *illume_layout_modes_get(void);
void illume_border_activate(E_Border *bd);
void illume_border_show(E_Border *bd);
void illume_border_deactivate(E_Border *bd);
Eina_Bool illume_border_is_dialog(E_Border *bd);
Eina_Bool illume_border_is_keyboard(E_Border *bd);
Eina_Bool illume_border_is_bottom_panel(E_Border *bd);
Eina_Bool illume_border_is_top_shelf(E_Border *bd);
Eina_Bool illume_border_is_mini_app(E_Border *bd);
Eina_Bool illume_border_is_notification(E_Border *bd);
Eina_Bool illume_border_is_home(E_Border *bd);
Eina_Bool illume_border_is_side_pane_left(E_Border *bd);
Eina_Bool illume_border_is_side_pane_right(E_Border *bd);
Eina_Bool illume_border_is_overlay(E_Border *bd);
Eina_Bool illume_border_is_conformant(E_Border *bd);
Eina_List *illume_border_valid_borders_get(E_Zone *zone);
E_Border *illume_border_valid_border_get(E_Zone *zone);
int illume_border_valid_count_get(E_Zone *zone);
E_Border *illume_border_at_xy_get(E_Zone *zone, int x, int y);
E_Border *illume_border_in_region_get(E_Zone *zone, int x, int y, int w, int h);
E_Border *illume_border_keyboard_get(E_Zone *zone);
E_Border *illume_border_top_shelf_get(E_Zone *zone);
E_Border *illume_border_bottom_panel_get(E_Zone *zone);
void illume_border_top_shelf_pos_get(E_Zone *zone, int *x, int *y);
void illume_border_top_shelf_size_get(E_Zone *zone, int *w, int *h);
void illume_border_bottom_panel_pos_get(E_Zone *zone, int *x, int *y);
void illume_border_bottom_panel_size_get(E_Zone *zone, int *w, int *h);
void illume_border_slide_to(E_Border *bd, int x, int y, Illume_Anim_Class aclass);
void illume_border_min_get(E_Border *bd, int *mw, int *mh);
void illume_border_max_get(E_Border *bd, int *mw, int *mh);
void illume_border_app1_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
void illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
#endif

View File

@ -1,5 +1,6 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_border.h"
#include "e_mod_config.h"
#include "e_mod_layout.h"
#include "e_mod_layout_illume.h"
@ -95,7 +96,7 @@ _border_add(E_Border *bd)
if ((bd->new_client) || (!bd->visible)) return;
/* check if this border is conformant */
conform = illume_border_is_conformant(bd);
conform = e_mod_border_is_conformant(bd);
/* is this a fullscreen border ? */
if ((bd->need_fullscreen) || (bd->fullscreen))
@ -109,14 +110,14 @@ _border_add(E_Border *bd)
bd->lock_user_stacking = 1;
/* conformant fullscreen borders just hide bottom panel */
b = illume_border_bottom_panel_get(bd->zone);
b = e_mod_border_bottom_panel_get(bd->zone);
if (b) e_border_fx_offset(b, 0, -panelsize);
/* for non-conformant fullscreen borders,
* we hide top shelf and bottom panel in all cases */
if (!conform)
{
b = illume_border_top_shelf_get(bd->zone);
b = e_mod_border_top_shelf_get(bd->zone);
if (b) e_border_fx_offset(b, 0, -shelfsize);
}
}
@ -134,7 +135,7 @@ _border_add(E_Border *bd)
&& (!bd->lock_focus_out))
e_border_focus_set(bd, 1, 1);
if (bd == illume_border_top_shelf_get(bd->zone))
if (bd == e_mod_border_top_shelf_get(bd->zone))
{
Ecore_X_Window xwin;
Ecore_X_Illume_Mode mode;
@ -155,14 +156,14 @@ _border_del(E_Border *bd)
E_Border *b;
/* conformant fullscreen borders just get bottom panel shown */
b = illume_border_bottom_panel_get(bd->zone);
b = e_mod_border_bottom_panel_get(bd->zone);
if (b) e_border_fx_offset(b, 0, 0);
/* for non-conformant fullscreen borders,
* we show top shelf and bottom panel in all cases */
if (!illume_border_is_conformant(bd))
if (!e_mod_border_is_conformant(bd))
{
b = illume_border_top_shelf_get(bd->zone);
b = e_mod_border_top_shelf_get(bd->zone);
if (b) e_border_fx_offset(b, 0, 0);
}
}
@ -244,16 +245,16 @@ _zone_layout(E_Zone *z)
if ((bd->zone != z) || (bd->new_client) || (!bd->visible)) continue;
/* check for special windows to get their size(s) */
illume_border_min_get(bd, NULL, &mh);
if (illume_border_is_top_shelf(bd))
e_mod_border_min_get(bd, NULL, &mh);
if (e_mod_border_is_top_shelf(bd))
{
if (shelfsize < mh) shelfsize = mh;
}
else if (illume_border_is_bottom_panel(bd))
else if (e_mod_border_is_bottom_panel(bd))
{
if (panelsize < mh) panelsize = mh;
}
else if (illume_border_is_keyboard(bd))
else if (e_mod_border_is_keyboard(bd))
{
if (kbdsize < mh) kbdsize = mh;
}
@ -267,7 +268,7 @@ _zone_layout(E_Zone *z)
if ((bd->zone != z) || (bd->new_client) || (!bd->visible)) continue;
/* trap 'special' windows as they need special treatment */
if (illume_border_is_top_shelf(bd))
if (e_mod_border_is_top_shelf(bd))
{
/* make sure we are not dragging the shelf */
if (!ecore_x_e_illume_drag_get(bd->client.win))
@ -287,7 +288,7 @@ _zone_layout(E_Zone *z)
e_border_stick(bd);
if (bd->layer != 100) e_border_layer_set(bd, 100);
}
else if (illume_border_is_bottom_panel(bd))
else if (e_mod_border_is_bottom_panel(bd))
{
/* make sure we are not dragging the shelf */
if (!ecore_x_e_illume_drag_get(bd->client.win))
@ -298,18 +299,18 @@ _zone_layout(E_Zone *z)
e_border_stick(bd);
if (bd->layer != 100) e_border_layer_set(bd, 100);
}
else if (illume_border_is_keyboard(bd))
else if (e_mod_border_is_keyboard(bd))
{
_border_resize_fx(bd, z->x, (z->y + z->h - kbdsize),
z->w, kbdsize);
e_border_stick(bd);
if (bd->layer != 150) e_border_layer_set(bd, 150);
}
else if (illume_border_is_dialog(bd))
else if (e_mod_border_is_dialog(bd))
{
int mw, mh;
illume_border_min_get(bd, &mw, &mh);
e_mod_border_min_get(bd, &mw, &mh);
if (mw > z->w) mw = z->w;
if (mh > z->h) mh = z->h;
_border_resize_fx(bd, (z->x + ((z->w - mw) / 2)),
@ -318,7 +319,7 @@ _zone_layout(E_Zone *z)
}
else
{
if (illume_border_is_conformant(bd))
if (e_mod_border_is_conformant(bd))
{
/* make conformant windows under the indicator bar */
if (bd->layer != 90) e_border_layer_set(bd, 90);
@ -338,7 +339,7 @@ _zone_layout_single(E_Border *bd)
/* grab the 'safe' region. Safe region is space not occupied by keyboard */
e_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
if (!illume_border_is_conformant(bd))
if (!e_mod_border_is_conformant(bd))
{
if (!((bd->need_fullscreen) || (bd->fullscreen)))
{
@ -358,7 +359,7 @@ _zone_layout_dual(E_Border *bd)
{
int ty;
illume_border_top_shelf_pos_get(bd->zone, NULL, &ty);
e_mod_border_top_shelf_pos_get(bd->zone, NULL, &ty);
if (ty <= bd->zone->y)
_zone_layout_dual_top(bd);
else
@ -375,10 +376,10 @@ _zone_layout_dual_top(E_Border *bd)
int count, conform;
/* get count of valid borders */
count = illume_border_valid_count_get(bd->zone);
count = e_mod_border_valid_count_get(bd->zone);
/* fetch if this border is conformant */
conform = illume_border_is_conformant(bd);
conform = e_mod_border_is_conformant(bd);
/* grab the 'safe' region. Safe region is space not occupied by keyboard */
e_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
@ -407,12 +408,12 @@ _zone_layout_dual_top(E_Border *bd)
bw = kw;
bh = (kh - ss - ps);
/* grab the border at this location */
b = illume_border_at_xy_get(bd->zone, kx, shelfsize);
b = e_mod_border_at_xy_get(bd->zone, kx, shelfsize);
if ((b) && (bd != b))
{
/* we have a border there, and it's not the current one */
if (!illume_border_is_conformant(b))
if (!e_mod_border_is_conformant(b))
{
/* border in this location is not conformant */
bh = ((kh - ss - ps) / 2);
@ -444,7 +445,7 @@ _zone_layout_dual_top(E_Border *bd)
else
{
/* no border at this location */
b = illume_border_valid_border_get(bd->zone);
b = e_mod_border_valid_border_get(bd->zone);
by = ky + ss;
bh = (ky - b->h);
}
@ -461,16 +462,16 @@ _zone_layout_dual_top_custom(E_Border *bd)
int zx, zy, zw, zh;
/* get count of valid borders */
count = illume_border_valid_count_get(bd->zone);
count = e_mod_border_valid_count_get(bd->zone);
/* fetch if this border is conformant */
conform = illume_border_is_conformant(bd);
conform = e_mod_border_is_conformant(bd);
/* grab the 'safe' region. Safe region is space not occupied by keyboard */
e_kbd_safe_app_region_get(bd->zone, &kx, NULL, &kw, NULL);
illume_border_app1_safe_region_get(bd->zone, &ax, &ay, &aw, &ah);
illume_border_app2_safe_region_get(bd->zone, &zx, &zy, &zw, &zh);
e_mod_border_app1_safe_region_get(bd->zone, &ax, &ay, &aw, &ah);
e_mod_border_app2_safe_region_get(bd->zone, &zx, &zy, &zw, &zh);
/* if there are no other borders, than give this one all available space */
if (count < 2)
@ -503,12 +504,12 @@ _zone_layout_dual_top_custom(E_Border *bd)
else
{
/* grab the border at this location */
bt = illume_border_at_xy_get(bd->zone, kx, ay);
bt = e_mod_border_at_xy_get(bd->zone, kx, ay);
if ((bt) && (bd != bt))
{
/* is there a border in the bottom section */
bb = illume_border_at_xy_get(bd->zone, kx, zy);
bb = e_mod_border_at_xy_get(bd->zone, kx, zy);
if (!bb)
{
bh = zh;
@ -566,10 +567,10 @@ _zone_layout_dual_left(E_Border *bd)
int count, conform;
/* get count of valid borders */
count = illume_border_valid_count_get(bd->zone);
count = e_mod_border_valid_count_get(bd->zone);
/* fetch if this border is conformant */
conform = illume_border_is_conformant(bd);
conform = e_mod_border_is_conformant(bd);
/* grab the 'safe' region. Safe region is space not occupied by keyboard */
e_kbd_safe_app_region_get(bd->zone, &kx, &ky, &kw, &kh);
@ -599,12 +600,12 @@ _zone_layout_dual_left(E_Border *bd)
bh = (kh - ss - ps);
/* grab the border at this location */
b = illume_border_at_xy_get(bd->zone, kx, shelfsize);
b = e_mod_border_at_xy_get(bd->zone, kx, shelfsize);
if ((b) && (bd != b))
{
/* we have a border there, and it's not the current one */
if (!illume_border_is_conformant(b))
if (!e_mod_border_is_conformant(b))
{
/* border in this location is not conformant */
bw = (kw / 2);
@ -636,7 +637,7 @@ _zone_layout_dual_left(E_Border *bd)
else
{
/* no border at this location */
b = illume_border_valid_border_get(bd->zone);
b = e_mod_border_valid_border_get(bd->zone);
bx = kx;
bw = (kw - b->w);
}