forked from enlightenment/enlightenment
Tiling2: Cleaned up ignored windows support.
This commit is contained in:
parent
bfdb22b0b8
commit
052a13b462
|
@ -50,6 +50,8 @@ typedef struct Client_Extra {
|
||||||
overlay_t overlay;
|
overlay_t overlay;
|
||||||
char key[4];
|
char key[4];
|
||||||
int last_frame_adjustment; // FIXME: Hack for frame resize bug.
|
int last_frame_adjustment; // FIXME: Hack for frame resize bug.
|
||||||
|
Eina_Bool sticky : 1;
|
||||||
|
Eina_Bool floating : 1;
|
||||||
} Client_Extra;
|
} Client_Extra;
|
||||||
|
|
||||||
struct tiling_g tiling_g = {
|
struct tiling_g tiling_g = {
|
||||||
|
@ -170,9 +172,12 @@ desk_should_tile_check(const E_Desk *desk)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
is_floating_window(const E_Client *ec)
|
is_ignored_window(const Client_Extra *extra)
|
||||||
{
|
{
|
||||||
return EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec);
|
if (extra->sticky || extra->floating)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -434,9 +439,6 @@ _add_client(E_Client *ec)
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_floating_window(ec)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!is_tilable(ec)) {
|
if (!is_tilable(ec)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +446,10 @@ _add_client(E_Client *ec)
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_get_or_create_client_extra(ec);
|
Client_Extra *extra = _get_or_create_client_extra(ec);
|
||||||
|
|
||||||
|
if (is_ignored_window(extra))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Stack tiled window below so that winlist doesn't mix up stacking */
|
/* Stack tiled window below so that winlist doesn't mix up stacking */
|
||||||
evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
|
evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
|
||||||
|
@ -482,9 +487,6 @@ _remove_client(E_Client *ec)
|
||||||
if (!ec)
|
if (!ec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (is_floating_window(ec))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!is_tilable(ec))
|
if (!is_tilable(ec))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -493,7 +495,11 @@ _remove_client(E_Client *ec)
|
||||||
|
|
||||||
DBG("removing %p", ec);
|
DBG("removing %p", ec);
|
||||||
|
|
||||||
eina_hash_del(_G.client_extras, ec, NULL);
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
||||||
|
if (!extra) {
|
||||||
|
ERR("No extra for %p", ec);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Window tree updating. */
|
/* Window tree updating. */
|
||||||
{
|
{
|
||||||
|
@ -508,8 +514,8 @@ _remove_client(E_Client *ec)
|
||||||
_G.tinfo->tree = tiling_window_tree_remove(_G.tinfo->tree, item);
|
_G.tinfo->tree = tiling_window_tree_remove(_G.tinfo->tree, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec);
|
if (!is_ignored_window(extra))
|
||||||
EINA_LIST_REMOVE(_G.tinfo->sticky_windows, ec);
|
eina_hash_del(_G.client_extras, ec, NULL);
|
||||||
|
|
||||||
_reapply_tree();
|
_reapply_tree();
|
||||||
}
|
}
|
||||||
|
@ -525,15 +531,24 @@ toggle_floating(E_Client *ec)
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) {
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
||||||
EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec);
|
if (!extra) {
|
||||||
|
ERR("No extra for %p", ec);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_add_client(ec);
|
extra->floating = !extra->floating;
|
||||||
} else {
|
|
||||||
|
/* This is the new state, act accordingly. */
|
||||||
|
if (extra->floating)
|
||||||
|
{
|
||||||
_remove_client(ec);
|
_remove_client(ec);
|
||||||
_restore_client(ec);
|
_restore_client(ec);
|
||||||
EINA_LIST_APPEND(_G.tinfo->floating_windows, ec);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
_add_client(ec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -603,16 +618,15 @@ _pre_client_assign_hook(void *data __UNUSED__,
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (is_floating_window(ec)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_tilable(ec)) {
|
if (!is_tilable(ec)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill initial values if not already done */
|
/* Fill initial values if not already done */
|
||||||
_get_or_create_client_extra(ec);
|
Client_Extra *extra = _get_or_create_client_extra(ec);
|
||||||
|
|
||||||
|
if (is_ignored_window(extra))
|
||||||
|
return;
|
||||||
|
|
||||||
if ((ec->bordername && strcmp(ec->bordername, "pixel"))
|
if ((ec->bordername && strcmp(ec->bordername, "pixel"))
|
||||||
|| !ec->bordername)
|
|| !ec->bordername)
|
||||||
|
@ -628,9 +642,6 @@ static void _move_or_resize(E_Client *ec)
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_floating_window(ec)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!is_tilable(ec)) {
|
if (!is_tilable(ec)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -655,6 +666,9 @@ static void _move_or_resize(E_Client *ec)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_ignored_window(extra))
|
||||||
|
return;
|
||||||
|
|
||||||
if ((ec->x == extra->expected.x) && (ec->y == extra->expected.y) &&
|
if ((ec->x == extra->expected.x) && (ec->y == extra->expected.y) &&
|
||||||
(ec->w == extra->expected.w) && (ec->h == extra->expected.h))
|
(ec->w == extra->expected.w) && (ec->h == extra->expected.h))
|
||||||
{
|
{
|
||||||
|
@ -762,11 +776,6 @@ _remove_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event)
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) {
|
|
||||||
EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_remove_client(ec);
|
_remove_client(ec);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -785,10 +794,15 @@ _iconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event)
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) {
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
||||||
|
if (!extra) {
|
||||||
|
ERR("No extra for %p", ec);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_ignored_window(extra))
|
||||||
|
return true;
|
||||||
|
|
||||||
_remove_client(ec);
|
_remove_client(ec);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -822,15 +836,24 @@ toggle_sticky(E_Client *ec)
|
||||||
if (!desk_should_tile_check(ec->desk))
|
if (!desk_should_tile_check(ec->desk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EINA_LIST_IS_IN(_G.tinfo->sticky_windows, ec)) {
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
||||||
EINA_LIST_REMOVE(_G.tinfo->sticky_windows, ec);
|
if (!extra) {
|
||||||
|
ERR("No extra for %p", ec);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_add_client(ec);
|
extra->sticky = !extra->sticky;
|
||||||
} else {
|
|
||||||
|
/* This is the new state, act accordingly. */
|
||||||
|
if (extra->sticky)
|
||||||
|
{
|
||||||
_remove_client(ec);
|
_remove_client(ec);
|
||||||
_restore_client(ec);
|
_restore_client(ec);
|
||||||
EINA_LIST_APPEND(_G.tinfo->sticky_windows, ec);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
_add_client(ec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -873,13 +896,9 @@ _desk_set_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client_Desk_S
|
||||||
if (!desk_should_tile_check(ev->desk))
|
if (!desk_should_tile_check(ev->desk))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (is_floating_window(ev->ec)) {
|
if (tiling_window_tree_client_find(_G.tinfo->tree, ev->ec)) {
|
||||||
EINA_LIST_REMOVE(_G.tinfo->floating_windows, ev->ec);
|
_remove_client(ev->ec);
|
||||||
} else {
|
_restore_client(ev->ec);
|
||||||
if (tiling_window_tree_client_find(_G.tinfo->tree, ev->ec)) {
|
|
||||||
_remove_client(ev->ec);
|
|
||||||
_restore_client(ev->ec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!desk_should_tile_check(ev->ec->desk))
|
if (!desk_should_tile_check(ev->ec->desk))
|
||||||
|
@ -906,7 +925,6 @@ _clear_info_hash(void *data)
|
||||||
{
|
{
|
||||||
Tiling_Info *ti = data;
|
Tiling_Info *ti = data;
|
||||||
|
|
||||||
eina_list_free(ti->floating_windows);
|
|
||||||
tiling_window_tree_free(ti->tree);
|
tiling_window_tree_free(ti->tree);
|
||||||
ti->tree = NULL;
|
ti->tree = NULL;
|
||||||
E_FREE(ti);
|
E_FREE(ti);
|
||||||
|
|
|
@ -51,11 +51,6 @@ struct _Tiling_Info
|
||||||
|
|
||||||
struct _Config_vdesk *conf;
|
struct _Config_vdesk *conf;
|
||||||
|
|
||||||
/* List of windows which were toggled floating */
|
|
||||||
Eina_List *floating_windows;
|
|
||||||
/* List of sticky windows. */
|
|
||||||
Eina_List *sticky_windows;
|
|
||||||
|
|
||||||
Window_Tree *tree;
|
Window_Tree *tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue