fix wad of focus issues with click-to-focus and alt+tab + fullscreen

windows.



SVN revision: 75399
This commit is contained in:
Carsten Haitzler 2012-08-18 04:40:56 +00:00
parent 3517cea324
commit 1739590e05
9 changed files with 105 additions and 116 deletions

View File

@ -2123,15 +2123,22 @@ e_border_focus_set(E_Border *bd,
if (focus)
{
if (bd->iconic)
return;
if (!bd->visible)
return;
{
e_border_uniconify(bd);
if (!focus_track_frozen)
e_border_focus_latest_set(bd);
return;
}
else if (!bd->visible)
{
return;
}
/* FIXME: hack for deskflip animation:
* dont update focus when sliding previous desk */
if ((!bd->sticky) && (bd->desk != e_desk_current_get(bd->desk->zone)))
return;
else if ((!bd->sticky) && (bd->desk != e_desk_current_get(bd->desk->zone)))
{
return;
}
}
if ((bd->modal) && (bd->modal != bd) && (bd->modal->visible))
@ -2145,6 +2152,8 @@ e_border_focus_set(E_Border *bd,
return;
}
fprintf(stderr, "focus set bd %p client %x focus %i set %i [%s]\n", bd, bd->client.win, focus, set, bd->client.netwm.name);
if (focus)
{
if (set)
@ -2170,11 +2179,42 @@ e_border_focus_set(E_Border *bd,
if (!bd->focused)
{
Eina_List *l;
E_Border *bd2;
if (focused) bd_unfocus = focused;
if (focusing == bd) focusing = NULL;
bd->focused = 1;
focused = bd;
if (!bd_unfocus)
{
EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
{
if ((bd2->fullscreen) &&
(bd2 != bd) &&
(bd2->zone == bd->zone) &&
((bd2->desk == bd->desk) ||
(bd2->sticky) || (bd->sticky)))
{
Eina_Bool unfocus_is_parent = EINA_FALSE;
E_Border *bd_parent;
bd_parent = bd->parent;
while (bd_parent)
{
if (bd_parent == bd2)
{
unfocus_is_parent = EINA_TRUE;
break;
}
bd_parent = bd->parent;
}
if ((!unfocus_is_parent) &&
(!e_config->allow_above_fullscreen))
e_border_iconify(bd2);
}
}
}
focus_changed = EINA_TRUE;
}
}
@ -2188,7 +2228,8 @@ e_border_focus_set(E_Border *bd,
bd_unfocus = bd;
/* should always be the case. anyway */
if (bd == focused) focused = NULL;
if (bd == focused)
focused = NULL;
if ((set) && (!focus_next) && (!focusing))
{
@ -2197,7 +2238,7 @@ e_border_focus_set(E_Border *bd,
}
}
}
if ((bd_unfocus) &&
(!e_object_is_del(E_OBJECT(bd_unfocus)) &&
(e_object_ref_get(E_OBJECT(bd_unfocus)) > 0)))
@ -3352,7 +3393,7 @@ e_border_idler_before(void)
(bd->client.icccm.accepts_focus))
{
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
/* TODO what if the client doesnt took focus ? */
/* TODO what if the client didn't take focus ? */
}
else if (!bd->client.icccm.accepts_focus)
{
@ -4675,7 +4716,9 @@ _e_border_del(E_Border *bd)
E_Border *child;
if (bd == focused)
focused = NULL;
{
focused = NULL;
}
if (bd == focusing)
focusing = NULL;
@ -5563,14 +5606,14 @@ _e_border_cb_window_focus_in(void *data __UNUSED__,
t = time(NULL);
ct = ctime(&t);
ct[strlen(ct) - 1] = 0;
DBG("FF ->IN %i 0x%x %s md=%s dt=%s",
DBG("FF ->IN %i 0x%x %s md=%s dt=%s\n",
e->time,
e->win,
ct,
modes[e->mode],
details[e->detail]);
DBG("%s cb focus in %d %d",
DBG("%s cb focus in %d %d\n",
e_border_name_get(bd),
bd->client.icccm.accepts_focus,
bd->client.icccm.take_focus);

View File

@ -128,7 +128,7 @@ e_container_new(E_Manager *man)
con->scratch_win = ecore_x_window_override_new(con->win, 0, 0, 7, 7);
/* init layers */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
con->layers[i].win = ecore_x_window_input_new(con->win, 0, 0, 1, 1);
ecore_x_window_lower(con->layers[i].win);
@ -147,7 +147,7 @@ e_container_new(E_Manager *man)
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
0, 0, 0, 0, 0,
con->layers[6].win, ECORE_X_WINDOW_STACK_ABOVE);
con->layers[10].win, ECORE_X_WINDOW_STACK_ABOVE);
/* Put menu win on top */
mwin = e_menu_grab_window_get();
@ -156,7 +156,7 @@ e_container_new(E_Manager *man)
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
0, 0, 0, 0, 0,
con->layers[6].win, ECORE_X_WINDOW_STACK_ABOVE);
con->layers[10].win, ECORE_X_WINDOW_STACK_ABOVE);
/* Put background win at the bottom */
ecore_x_window_configure(con->bg_win,
@ -552,7 +552,11 @@ e_container_shape_solid_rect_get(E_Container_Shape *es, int *x, int *y, int *w,
* 100 = normal
* 150 = above
* 200 = fullscreen
* 999 = internal on top windows for E
* 250 = fullscreen
* 300 = fullscreen
* 350 = stuff over fullscreen
* 400 = stuff over stuff
* 450 = yet more stuff on top
*/
EAPI int
e_container_borders_count(E_Container *con)
@ -560,23 +564,21 @@ e_container_borders_count(E_Container *con)
return con->clients;
}
EAPI void
e_container_border_add(E_Border *bd)
static int
_e_container_layer_map(int layer)
{
int pos = 0;
if (!bd->zone) return;
if (bd->layer == 0) pos = 0;
else if ((bd->layer > 0) && (bd->layer <= 50))
pos = 1;
else if ((bd->layer > 50) && (bd->layer <= 100))
pos = 2;
else if ((bd->layer > 100) && (bd->layer <= 150))
pos = 3;
else if ((bd->layer > 150) && (bd->layer <= 200))
pos = 4;
else pos = 5;
if (layer < 0) layer = 0;
pos = 1 + (layer / 50);
if (pos > 10) pos = 10;
return pos;
}
EAPI void
e_container_border_add(E_Border *bd)
{
int pos = _e_container_layer_map(bd->layer);
bd->zone->container->clients++;
bd->zone->container->layers[pos].clients =
eina_list_append(bd->zone->container->layers[pos].clients, bd);
@ -591,7 +593,7 @@ e_container_border_remove(E_Border *bd)
if (!bd->zone) return;
/* FIXME: Could revert to old behaviour, ->layer is consistent
* with pos now. */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
bd->zone->container->layers[i].clients =
eina_list_remove(bd->zone->container->layers[i].clients, bd);
@ -604,19 +606,7 @@ e_container_border_remove(E_Border *bd)
EAPI void
e_container_window_raise(E_Container *con, Ecore_X_Window win, int layer)
{
int pos = 0;
if (layer <= 0) pos = 0;
else if ((layer > 0) && (layer <= 50))
pos = 1;
else if ((layer > 50) && (layer <= 100))
pos = 2;
else if ((layer > 100) && (layer <= 150))
pos = 3;
else if ((layer > 150) && (layer <= 200))
pos = 4;
else pos = 5;
int pos = _e_container_layer_map(layer);
ecore_x_window_configure(win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
@ -627,19 +617,7 @@ e_container_window_raise(E_Container *con, Ecore_X_Window win, int layer)
EAPI void
e_container_window_lower(E_Container *con, Ecore_X_Window win, int layer)
{
int pos = 0;
if (layer <= 0) pos = 0;
else if ((layer > 0) && (layer <= 50))
pos = 1;
else if ((layer > 50) && (layer <= 100))
pos = 2;
else if ((layer > 100) && (layer <= 150))
pos = 3;
else if ((layer > 150) && (layer <= 200))
pos = 4;
else pos = 5;
int pos = _e_container_layer_map(layer);
ecore_x_window_configure(win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
@ -656,23 +634,14 @@ e_container_border_raise(E_Border *bd)
if (!bd->zone) return NULL;
/* Remove from old layer */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
bd->zone->container->layers[i].clients =
eina_list_remove(bd->zone->container->layers[i].clients, bd);
}
/* Add to new layer */
if (bd->layer <= 0) pos = 0;
else if ((bd->layer > 0) && (bd->layer <= 50))
pos = 1;
else if ((bd->layer > 50) && (bd->layer <= 100))
pos = 2;
else if ((bd->layer > 100) && (bd->layer <= 150))
pos = 3;
else if ((bd->layer > 150) && (bd->layer <= 200))
pos = 4;
else pos = 5;
pos = _e_container_layer_map(bd->layer);
ecore_x_window_configure(bd->win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
@ -714,23 +683,14 @@ e_container_border_lower(E_Border *bd)
if (!bd->zone) return NULL;
/* Remove from old layer */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
bd->zone->container->layers[i].clients =
eina_list_remove(bd->zone->container->layers[i].clients, bd);
}
/* Add to new layer */
if (bd->layer <= 0) pos = 0;
else if ((bd->layer > 0) && (bd->layer <= 50))
pos = 1;
else if ((bd->layer > 50) && (bd->layer <= 100))
pos = 2;
else if ((bd->layer > 100) && (bd->layer <= 150))
pos = 3;
else if ((bd->layer > 150) && (bd->layer <= 200))
pos = 4;
else pos = 5;
pos = _e_container_layer_map(bd->layer);
ecore_x_window_configure(bd->win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
@ -748,7 +708,7 @@ e_container_border_lower(E_Border *bd)
else
{
/* Need to check the layers above */
for (i = pos + 1; i < 10; i++)
for (i = pos + 1; i < 11; i++)
{
if (bd->zone->container->layers[i].clients)
{
@ -769,7 +729,7 @@ e_container_border_stack_above(E_Border *bd, E_Border *above)
if (!bd->zone) return;
/* Remove from old layer */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
bd->zone->container->layers[i].clients =
eina_list_remove(bd->zone->container->layers[i].clients, bd);
@ -777,18 +737,8 @@ e_container_border_stack_above(E_Border *bd, E_Border *above)
/* Add to new layer */
bd->layer = above->layer;
if (bd->layer <= 0) pos = 0;
else if ((bd->layer > 0) && (bd->layer <= 50))
pos = 1;
else if ((bd->layer > 50) && (bd->layer <= 100))
pos = 2;
else if ((bd->layer > 100) && (bd->layer <= 150))
pos = 3;
else if ((bd->layer > 150) && (bd->layer <= 200))
pos = 4;
else pos = 5;
pos = _e_container_layer_map(bd->layer);
ecore_x_window_configure(bd->win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
@ -806,7 +756,7 @@ e_container_border_stack_below(E_Border *bd, E_Border *below)
if (!bd->zone) return;
/* Remove from old layer */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
bd->zone->container->layers[i].clients =
eina_list_remove(bd->zone->container->layers[i].clients, bd);
@ -814,17 +764,7 @@ e_container_border_stack_below(E_Border *bd, E_Border *below)
/* Add to new layer */
bd->layer = below->layer;
if (bd->layer <= 0) pos = 0;
else if ((bd->layer > 0) && (bd->layer <= 50))
pos = 1;
else if ((bd->layer > 50) && (bd->layer <= 100))
pos = 2;
else if ((bd->layer > 100) && (bd->layer <= 150))
pos = 3;
else if ((bd->layer > 150) && (bd->layer <= 200))
pos = 4;
else pos = 5;
pos = _e_container_layer_map(bd->layer);
ecore_x_window_configure(bd->win,
ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
@ -848,7 +788,7 @@ _e_container_border_list_new(E_Container *con)
list->container = con;
e_object_ref(E_OBJECT(list->container));
eina_array_step_set(&(list->client_array), sizeof(list->client_array), 256);
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
EINA_LIST_FOREACH(con->layers[i].clients, l, bd)
eina_array_push(&(list->client_array), bd);
@ -952,7 +892,7 @@ _e_container_free(E_Container *con)
ecore_x_window_free(con->event_win);
/* We can't use e_object_del here, because border adds a ref to itself
* when it is removed, and the ref is never unref'ed */
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
ecore_x_window_free(con->layers[i].win);
/* FIXME: had to disable this as it was freeing already freed items during
@ -1252,7 +1192,7 @@ _e_container_resize_handle(E_Container *con)
ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL);
for (i = 0; i < 10; i++)
for (i = 0; i < 11; i++)
{
Eina_List *tmp = NULL;
E_Border *bd;

View File

@ -50,7 +50,7 @@ struct _E_Container
struct {
Ecore_X_Window win;
Eina_List *clients;
} layers[10];
} layers[11];
Ecore_X_Window scratch_win;
};

View File

@ -20,7 +20,7 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc)
if (!pop) return NULL;
zone = e_gadcon_client_zone_get(gcc);
pop->win = e_popup_new(zone, 0, 0, 0, 0);
e_popup_layer_set(pop->win, 255);
e_popup_layer_set(pop->win, 350);
o = edje_object_add(pop->win->evas);
e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup");

View File

@ -92,6 +92,7 @@ e_grabinput_release(Ecore_X_Window mouse_win, Ecore_X_Window key_win)
grab_key_win = 0;
if (focus_win != 0)
{
fprintf(stderr, "release focus to %x\n", focus_win);
_e_grabinput_focus(focus_win, focus_method);
focus_win = 0;
focus_method = E_FOCUS_METHOD_NO_INPUT;
@ -104,11 +105,13 @@ e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
{
if (grab_key_win != 0)
{
fprintf(stderr, "while grabbed focus changed to %x\n", win);
focus_win = win;
focus_method = method;
}
else
{
fprintf(stderr, "focus to %x\n", win);
_e_grabinput_focus(win, method);
}
}
@ -130,6 +133,7 @@ _e_grabinput_focus_check(void *data __UNUSED__)
{
if (ecore_x_window_focus_get() != focus_fix_win)
{
fprintf(stderr, "foc do 2\n");
_e_grabinput_focus_do(focus_fix_win, focus_fix_method);
}
focus_fix_timer = NULL;
@ -139,6 +143,7 @@ _e_grabinput_focus_check(void *data __UNUSED__)
static void
_e_grabinput_focus_do(Ecore_X_Window win, E_Focus_Method method)
{
fprintf(stderr, "focus to %x method %i\n", win, method);
switch (method)
{
case E_FOCUS_METHOD_NO_INPUT:
@ -163,6 +168,7 @@ _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
{
focus_fix_win = win;
focus_fix_method = method;
fprintf(stderr, "foc do 1\n");
_e_grabinput_focus_do(win, method);
last_focus_time = ecore_loop_time_get();
if (focus_fix_timer) ecore_timer_del(focus_fix_timer);

View File

@ -165,7 +165,7 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup)
if (popup)
{
e_win_layer_set(win->ewin, 255);
e_win_layer_set(win->ewin, 350);
ecore_x_netwm_window_type_set(win->ewin->evas_win,
ECORE_X_WINDOW_TYPE_UTILITY);

View File

@ -770,7 +770,7 @@ _pager_popup_new(E_Zone *zone, int keyaction)
E_FREE(pp);
return NULL;
}
e_popup_layer_set(pp->popup, 255);
e_popup_layer_set(pp->popup, 350);
pp->pager = _pager_new(pp->popup->evas, zone, NULL);
pp->pager->popup = pp;

View File

@ -150,7 +150,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
evas_event_feed_mouse_move(_winlist->evas, -1000000, -1000000,
ecore_x_current_time_get(), NULL);
e_popup_layer_set(_winlist, 255);
e_popup_layer_set(_winlist, 350);
evas_event_freeze(_winlist->evas);
o = edje_object_add(_winlist->evas);
_bg_object = o;

View File

@ -247,7 +247,7 @@ _e_wizard_main_new(E_Zone *zone)
Eina_Bool kg;
popup = e_popup_new(zone, 0, 0, zone->w, zone->h);
e_popup_layer_set(popup, 255);
e_popup_layer_set(popup, 350);
o = edje_object_add(popup->evas);
e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/main");
@ -301,7 +301,7 @@ _e_wizard_extra_new(E_Zone *zone)
Evas_Object *o;
popup = e_popup_new(zone, 0, 0, zone->w, zone->h);
e_popup_layer_set(popup, 255);
e_popup_layer_set(popup, 350);
o = edje_object_add(popup->evas);
e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/extra");
evas_object_move(o, 0, 0);