diff --git a/src/bin/e_border.c b/src/bin/e_border.c index cc4b593bd..039bda332 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -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*/ diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 83acc64e2..7387e5bd7 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -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; diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c index 22f7bffac..2f9b1462b 100644 --- a/src/bin/e_exec.c +++ b/src/bin/e_exec.c @@ -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) diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 1eba90e4e..ddb2c5c8a 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -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); } }