add support for X-Enlightenment-Single-Instance :)

SVN revision: 76756
This commit is contained in:
Carsten Haitzler 2012-09-17 11:51:04 +00:00
parent 84bd5f65fc
commit 7a59e58273
4 changed files with 67 additions and 30 deletions

View File

@ -9700,4 +9700,39 @@ e_border_tmp_input_hidden_pop(E_Border *bd)
ecore_x_window_ignore_set(bd->win, EINA_FALSE);
}
}
EAPI void
e_border_activate(E_Border *bd, Eina_Bool just_do_it)
{
if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
((bd->parent) &&
((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
((bd->parent->focused) &&
(e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))) ||
(just_do_it))
{
if (bd->iconic)
{
if (e_config->clientlist_warp_to_iconified_desktop == 1)
e_desk_show(bd->desk);
if (!bd->lock_user_iconify)
e_border_uniconify(bd);
}
if ((!bd->iconic) && (!bd->sticky))
e_desk_show(bd->desk);
if (!bd->lock_user_stacking) e_border_raise(bd);
if (!bd->lock_focus_out)
{
/* XXX ooffice does send this request for
config dialogs when the main window gets focus.
causing the pointer to jump back and forth. */
if ((e_config->focus_policy != E_FOCUS_CLICK) &&
!(bd->client.icccm.name && !strcmp(bd->client.icccm.name, "VCLSalFrame")))
ecore_x_pointer_warp(bd->zone->container->win,
bd->x + (bd->w / 2), bd->y + (bd->h / 2));
e_border_focus_set(bd, 1, 1);
}
}
}
/*vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0*/

View File

@ -776,6 +776,8 @@ EAPI void e_border_comp_hidden_set(E_Border *bd, Eina_Bool hidden);
EAPI void e_border_tmp_input_hidden_push(E_Border *bd);
EAPI void e_border_tmp_input_hidden_pop(E_Border *bd);
EAPI void e_border_activate(E_Border *bd, Eina_Bool just_do_it);
extern EAPI int E_EVENT_BORDER_RESIZE;
extern EAPI int E_EVENT_BORDER_MOVE;
extern EAPI int E_EVENT_BORDER_ADD;

View File

@ -99,8 +99,35 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
{
E_Exec_Launch *launch;
E_Exec_Instance *inst = NULL;
const char *single = NULL;
if ((!desktop) && (!exec)) return NULL;
single = eina_hash_find(desktop->x, "X-Enlightenment-Single-Instance");
if (single)
{
if ((!strcasecmp(single, "true")) ||
(!strcasecmp(single, "yes"))||
(!strcasecmp(single, "1")))
{
Eina_List *l;
E_Border *bd;
EINA_LIST_FOREACH(e_border_client_list(), l, bd)
{
if (bd->desktop == desktop)
{
if (bd)
{
if (!bd->focused) e_border_activate(bd, EINA_TRUE);
else e_border_raise(bd);
return NULL;
}
}
}
}
}
launch = E_NEW(E_Exec_Launch, 1);
if (!launch) return NULL;
if (zone)

View File

@ -981,7 +981,7 @@ _e_manager_cb_client_message(void *data __UNUSED__, int ev_type __UNUSED__, void
if (e->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
{
bd = e_border_find_by_client_window(e->win);
if ((bd) && (!bd->focused))
if (bd)
{
#if 0 /* notes */
if (e->data.l[0] == 0 /* 0 == old, 1 == client, 2 == pager */)
@ -997,35 +997,8 @@ _e_manager_cb_client_message(void *data __UNUSED__, int ev_type __UNUSED__, void
timestamp = e->data.l[1];
requestor_id e->data.l[2];
#endif
if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
((bd->parent) &&
((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
((bd->parent->focused) &&
(e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))))
{
if (bd->iconic)
{
if (e_config->clientlist_warp_to_iconified_desktop == 1)
e_desk_show(bd->desk);
if (!bd->lock_user_iconify)
e_border_uniconify(bd);
}
if ((!bd->iconic) && (!bd->sticky))
e_desk_show(bd->desk);
if (!bd->lock_user_stacking) e_border_raise(bd);
if (!bd->lock_focus_out)
{
/* XXX ooffice does send this request for
config dialogs when the main window gets focus.
causing the pointer to jump back and forth. */
if ((e_config->focus_policy != E_FOCUS_CLICK) &&
!(bd->client.icccm.name && !strcmp(bd->client.icccm.name, "VCLSalFrame")))
ecore_x_pointer_warp(bd->zone->container->win,
bd->x + (bd->w / 2), bd->y + (bd->h / 2));
e_border_focus_set(bd, 1, 1);
}
}
if (!bd->focused) e_border_activate(bd, EINA_FALSE);
else e_border_raise(bd);
}
}