static Eina_List *borders = NULL;
static Eina_Hash *borders_hash = NULL;
static E_Border *focused = NULL;
+static Eina_List *focus_next = NULL;
+static Ecore_X_Time focus_time = 0;
static E_Border *resize = NULL;
static E_Border *move = NULL;
{
E_Event_Border_Focus_In *ev;
- if ((bd->visible) && (bd->changes.visible))
- {
- bd->want_focus = 1;
- bd->changed = 1;
- return;
- }
if (set)
- {
- if ((bd->client.icccm.take_focus) &&
- (bd->client.icccm.accepts_focus))
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
- return;
- }
- else if (!bd->client.icccm.accepts_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
- return;
- }
- else if (!bd->client.icccm.take_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
- }
+ {
+ focus_next = eina_list_prepend(focus_next, bd);
+ return;
}
if (focused)
bd->focused = 1;
focused = bd;
+
e_focus_event_focus_in(bd);
e_border_focus_latest_set(bd);
e_hints_active_window_set(bd->zone->container->manager, bd);
e_container_border_list_free(bl);
}
}
+
+ if (focus_next)
+ {
+ E_Border *bd = NULL, *bd2;
+
+ EINA_LIST_FREE(focus_next, bd2)
+ if ((!bd) && (bd2->visible)) bd = bd2;
+
+ if (!bd)
+ {
+ /* TODO revert focus when lost here ? */
+ return;
+ }
+
+ focus_time = ecore_x_current_time_get();
+
+ if ((bd->client.icccm.take_focus) &&
+ (bd->client.icccm.accepts_focus))
+ {
+ e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
+ }
+ else if (!bd->client.icccm.accepts_focus)
+ {
+ e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
+ }
+ else if (!bd->client.icccm.take_focus)
+ {
+ e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
+ }
+ }
}
EAPI Eina_List *
E_Event_Border_Remove *ev;
E_Border *child;
+ if (bd == focused)
+ focused = NULL;
+
+ focus_next = eina_list_remove(focus_next, bd);
+
if (bd->fullscreen) bd->desk->fullscreen_borders--;
if ((drag_border) && (drag_border->data == bd))
{
if (e->detail == ECORE_X_EVENT_DETAIL_POINTER) return ECORE_CALLBACK_PASS_ON;
}
- e_border_focus_set(bd, 1, 0);
+ if (e->time >= focus_time)
+ e_border_focus_set(bd, 1, 0);
return ECORE_CALLBACK_PASS_ON;
}
#include "e.h"
/* local subsystem functions */
-static void _e_grabinput_focus_job(void *data);
static void _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method);
/* local subsystem globals */
static Ecore_X_Window grab_key_win = 0;
static Ecore_X_Window focus_win = 0;
static E_Focus_Method focus_method = E_FOCUS_METHOD_NO_INPUT;
-static Ecore_X_Window do_focus_win = 0;
-static E_Focus_Method do_focus_method = E_FOCUS_METHOD_NO_INPUT;
-static Ecore_Job *focus_job = NULL;
static double last_focus_time = 0.0;
/* externally accessible functions */
focus_method = method;
}
else
- {
- do_focus_win = win;
- do_focus_method = method;
- if (!focus_job)
- focus_job = ecore_job_add(_e_grabinput_focus_job, NULL);
- //_e_grabinput_focus(win, method);
+ {
+ _e_grabinput_focus(win, method);
}
}
return last_focus_time;
}
-/* local subsystem functions */
-static void
-_e_grabinput_focus_job(void *data __UNUSED__)
-{
- focus_job = NULL;
- _e_grabinput_focus(do_focus_win, do_focus_method);
- do_focus_win = 0;
-}
-
static void
_e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
{
break;
case E_FOCUS_METHOD_LOCALLY_ACTIVE:
ecore_x_window_focus(win);
- ecore_x_sync(); // let x actually get the x focus request
ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get());
- ecore_x_sync(); // let x actually get the x focus request
break;
case E_FOCUS_METHOD_GLOBALLY_ACTIVE:
ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get());
- ecore_x_sync(); // let x actually get the x focus request
break;
case E_FOCUS_METHOD_PASSIVE:
ecore_x_window_focus(win);
- ecore_x_sync(); // let x actually get the x focus request
break;
default:
break;