e17: remove focus workaround for illume.

- keep track to which window was grabinput_focus set last, so that 
unfocusing last visible window will only set focus to container->bg_win
if no window is 'focusing' or 'focusing_next'   


SVN revision: 62529
This commit is contained in:
Hannes Janetzek 2011-08-17 08:33:35 +00:00
parent c1d2231e94
commit 3f5b9c8705
1 changed files with 109 additions and 94 deletions

View File

@ -211,6 +211,7 @@ static Eina_List *handlers = NULL;
static Eina_List *borders = NULL; static Eina_List *borders = NULL;
static Eina_Hash *borders_hash = NULL; static Eina_Hash *borders_hash = NULL;
static E_Border *focused = NULL; static E_Border *focused = NULL;
static E_Border *focusing = NULL;
static Eina_List *focus_next = NULL; static Eina_List *focus_next = NULL;
static Ecore_X_Time focus_time = 0; static Ecore_X_Time focus_time = 0;
@ -2035,15 +2036,16 @@ e_border_focus_set(E_Border *bd,
return; return;
} }
if ((set) && (focus)) if (focus)
{
if (set)
{ {
if (bd->visible && bd->changes.visible) if (bd->visible && bd->changes.visible)
{ {
bd->want_focus = 1; bd->want_focus = 1;
bd->changed = 1; bd->changed = 1;
return;
} }
if ((!bd->focused) || (focus_next && (bd != eina_list_data_get(focus_next)))) else if ((!bd->focused) || (focus_next && (bd != eina_list_data_get(focus_next))))
{ {
Eina_List *l; Eina_List *l;
@ -2051,15 +2053,17 @@ e_border_focus_set(E_Border *bd,
focus_next = eina_list_promote_list(focus_next, l); focus_next = eina_list_promote_list(focus_next, l);
else else
focus_next = eina_list_prepend(focus_next, bd); focus_next = eina_list_prepend(focus_next, bd);
}
return; return;
} }
}
else if ((focus) && (!bd->focused)) if (!bd->focused)
{ {
E_Event_Border_Focus_In *ev; E_Event_Border_Focus_In *ev;
if (focused) if (focused) unfocus = focused;
unfocus = focused; if (focusing == bd) focusing = NULL;
bd->focused = 1; bd->focused = 1;
focused = bd; focused = bd;
@ -2079,26 +2083,26 @@ e_border_focus_set(E_Border *bd,
ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev, ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev,
_e_border_event_border_focus_in_free, NULL); _e_border_event_border_focus_in_free, NULL);
} }
else if ((!focus) && (bd->want_focus)) }
{ else
if ((bd->visible) && (bd->changes.visible))
{ {
bd->want_focus = 0; bd->want_focus = 0;
bd->changed = 1; focus_next = eina_list_remove(focus_next, bd);
return; if (bd == focusing) focusing = NULL;
}
} if (bd->focused)
else if ((!focus) && (bd->focused))
{ {
unfocus = bd; unfocus = bd;
/* should always be the case. anyway */ /* should always be the case. anyway */
if (bd == focused) if (bd == focused) focused = NULL;
focused = NULL;
if (set) if ((set) && (!focus_next) && (!focusing))
{
e_grabinput_focus(bd->zone->container->bg_win, E_FOCUS_METHOD_PASSIVE); e_grabinput_focus(bd->zone->container->bg_win, E_FOCUS_METHOD_PASSIVE);
} }
}
}
if ((unfocus) && if ((unfocus) &&
(!e_object_is_del(E_OBJECT(unfocus)) && (!e_object_is_del(E_OBJECT(unfocus)) &&
@ -3163,11 +3167,13 @@ e_border_idler_before(void)
{ {
/* already focused. but anyway dont be so strict, this /* already focused. but anyway dont be so strict, this
fcks up illume setting focus on internal windows */ fcks up illume setting focus on internal windows */
// return; return;
} }
focus_time = ecore_x_current_time_get(); focus_time = ecore_x_current_time_get();
focusing = bd;
if ((bd->client.icccm.take_focus) && if ((bd->client.icccm.take_focus) &&
(bd->client.icccm.accepts_focus)) (bd->client.icccm.accepts_focus))
{ {
@ -4330,11 +4336,17 @@ _e_border_free(E_Border *bd)
e_int_border_menu_del(bd); e_int_border_menu_del(bd);
if (focusing == bd)
focusing = NULL;
if (focused == bd) if (focused == bd)
{ {
// ecore_x_window_focus(bd->zone->container->manager->root); if ((!focus_next) && (!focusing))
{
e_grabinput_focus(bd->zone->container->bg_win, E_FOCUS_METHOD_PASSIVE); e_grabinput_focus(bd->zone->container->bg_win, E_FOCUS_METHOD_PASSIVE);
e_hints_active_window_set(bd->zone->container->manager, NULL); e_hints_active_window_set(bd->zone->container->manager, NULL);
}
focused = NULL; focused = NULL;
} }
E_FREE_LIST(bd->handlers, ecore_event_handler_del); E_FREE_LIST(bd->handlers, ecore_event_handler_del);
@ -4434,6 +4446,9 @@ _e_border_del(E_Border *bd)
if (bd == focused) if (bd == focused)
focused = NULL; focused = NULL;
if (bd == focusing)
focusing = NULL;
focus_next = eina_list_remove(focus_next, bd); focus_next = eina_list_remove(focus_next, bd);
if (bd->fullscreen) bd->desk->fullscreen_borders--; if (bd->fullscreen) bd->desk->fullscreen_borders--;