use focused client for window actions if passed object is not a client object

in the case where an action is triggered from the compositor or manager contexts
the passed object will not be a client, causing actions to fail when they should
succeed

fix T3854
This commit is contained in:
Mike Blumenkrantz 2016-06-09 11:26:17 -04:00
parent 89efcfd2d2
commit fc4f5d4f83
1 changed files with 54 additions and 146 deletions

View File

@ -93,7 +93,8 @@ static int _action_groups_sort_cb(const void *d1, const void *d2);
/***************************************************************************/
ACT_FN_GO(window_move, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE) return;
if (!((E_Client *)obj)->lock_user_location)
@ -145,11 +146,6 @@ ACT_FN_GO_KEY(window_move, EINA_UNUSED, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_location)
e_client_act_move_keyboard((E_Client *)obj);
}
@ -157,9 +153,9 @@ ACT_FN_GO_KEY(window_move, EINA_UNUSED, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_resize, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE) return;
if (!((E_Client *)obj)->lock_user_size)
e_client_act_resize_begin((E_Client *)obj, NULL);
}
@ -225,13 +221,9 @@ ACT_FN_GO_KEY(window_resize, EINA_UNUSED, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_menu, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
e_client_act_menu_begin((E_Client *)obj, NULL, 0);
}
@ -262,13 +254,9 @@ ACT_FN_GO_KEY(window_menu, EINA_UNUSED, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_raise, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_stacking)
evas_object_raise(((E_Client *)obj)->frame);
}
@ -276,13 +264,9 @@ ACT_FN_GO(window_raise, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_lower, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_stacking)
evas_object_lower(((E_Client *)obj)->frame);
}
@ -290,13 +274,9 @@ ACT_FN_GO(window_lower, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_close, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_close)
e_client_act_close_begin((E_Client *)obj);
}
@ -337,9 +317,9 @@ ACT_FN_GO(window_kill, EINA_UNUSED)
E_Client *ec;
char dialog_text[1024];
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE) return;
ec = (E_Client *)obj;
if ((ec->lock_close) || (ec->internal)) return;
@ -379,13 +359,9 @@ ACT_FN_GO(window_kill, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_sticky_toggle, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_sticky)
{
E_Client *ec;
@ -399,13 +375,9 @@ ACT_FN_GO(window_sticky_toggle, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_sticky, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_sticky)
{
E_Client *ec;
@ -426,13 +398,9 @@ ACT_FN_GO(window_iconic_toggle, EINA_UNUSED)
{
E_Client *ec;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
ec = (E_Client *)obj;
if ((!ec->lock_user_iconify) && (!ec->fullscreen) &&
@ -447,13 +415,9 @@ ACT_FN_GO(window_iconic_toggle, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_iconic, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_iconify)
{
E_Client *ec;
@ -472,13 +436,9 @@ ACT_FN_GO(window_iconic, )
/***************************************************************************/
ACT_FN_GO(window_fullscreen_toggle, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_fullscreen)
{
E_Client *ec;
@ -498,13 +458,9 @@ ACT_FN_GO(window_fullscreen_toggle, )
/***************************************************************************/
ACT_FN_GO(window_fullscreen, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_fullscreen)
{
E_Client *ec;
@ -540,13 +496,9 @@ ACT_FN_GO(window_maximized_toggle, )
E_Client *ec;
Eina_Bool resize = EINA_FALSE;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
ec = (E_Client *)obj;
/* internal dialog which is resizable */
@ -608,13 +560,9 @@ maximize:
/***************************************************************************/
ACT_FN_GO(window_maximized, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_maximize)
{
E_Client *ec;
@ -666,13 +614,9 @@ ACT_FN_GO(window_maximized, )
/***************************************************************************/
ACT_FN_GO(window_shaded_toggle, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_shade)
{
E_Client *ec;
@ -720,13 +664,9 @@ ACT_FN_GO(window_shaded_toggle, )
/***************************************************************************/
ACT_FN_GO(window_shaded, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (!((E_Client *)obj)->lock_user_shade)
{
E_Client *ec;
@ -914,13 +854,9 @@ ACT_FN_GO(window_move_by, )
/***************************************************************************/
ACT_FN_GO(window_move_to, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
{
E_Client *ec;
@ -1014,13 +950,9 @@ ACT_FN_GO(window_move_to_center, EINA_UNUSED)
{
E_Client *ec;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
ec = (E_Client *)obj;
e_comp_object_util_center(ec->frame);
@ -1031,13 +963,9 @@ ACT_FN_GO(window_move_to_center, EINA_UNUSED)
/***************************************************************************/
ACT_FN_GO(window_resize_by, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
{
@ -1062,13 +990,9 @@ ACT_FN_GO(window_resize_by, )
/***************************************************************************/
ACT_FN_GO(window_push, )
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
{
@ -1251,13 +1175,9 @@ ACT_FN_GO(window_jump_to_or_start, )
/***************************************************************************/
ACT_FN_GO(window_drag_icon, EINA_UNUSED)
{
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
{
E_Client *ec;
@ -1275,15 +1195,11 @@ ACT_FN_GO(window_desk_move_by, )
int x, y;
if (!params) return;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj)
obj = E_OBJECT(e_client_action_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj)
obj = E_OBJECT(e_client_action_get());
if (!obj) return;
}
ec = (E_Client *)obj;
if ((!ec->zone) || (!ec->desk)) return;
@ -1341,15 +1257,11 @@ ACT_FN_GO(window_zone_move_by, )
Eina_Bool fullscreen;
if (!params) return;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj)
obj = E_OBJECT(e_client_action_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
ec = (E_Client *)obj;
/* bad */
@ -1385,15 +1297,11 @@ ACT_FN_GO(window_desk_move_to, )
int x, y;
if (!params) return;
if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (obj->type != E_CLIENT_TYPE))
obj = E_OBJECT(e_client_focused_get());
if (!obj)
obj = E_OBJECT(e_client_action_get());
if (!obj) return;
if (obj->type != E_CLIENT_TYPE)
{
obj = E_OBJECT(e_client_focused_get());
if (!obj)
obj = E_OBJECT(e_client_action_get());
if (!obj) return;
}
ec = (E_Client *)obj;
if ((!ec->zone) || (!ec->desk)) return;