oh for gods sake! now all day was sunk into getting focus fixed for dialogs.

argh! i'll have to do the app cache after this... grrr....x


SVN revision: 16905
This commit is contained in:
Carsten Haitzler 2005-09-24 09:04:39 +00:00
parent 59e96236e8
commit 9063352d93
9 changed files with 65 additions and 23 deletions

View File

@ -1155,18 +1155,25 @@ e_border_focus_set(E_Border *bd, int focus, int set)
{
if (bd->focused)
{
if ((!bd->client.icccm.accepts_focus) &&
(!bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_NO_INPUT);
else if ((bd->client.icccm.accepts_focus) &&
(bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
else if ((!bd->client.icccm.accepts_focus) &&
(bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
else if ((bd->client.icccm.accepts_focus) &&
if (bd->internal)
{
e_grabinput_focus(bd->win, E_FOCUS_METHOD_PASSIVE);
}
else
{
if ((!bd->client.icccm.accepts_focus) &&
(!bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_NO_INPUT);
else if ((bd->client.icccm.accepts_focus) &&
(bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
else if ((!bd->client.icccm.accepts_focus) &&
(bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
else if ((bd->client.icccm.accepts_focus) &&
(!bd->client.icccm.take_focus))
e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
}
}
else
{

View File

@ -1017,7 +1017,7 @@ _e_container_cb_mouse_in(void *data, int type, void *event)
{
bd = e_border_focused_get();
if (bd) e_focus_event_mouse_out(bd);
evas_event_feed_mouse_in(con->bg_evas, ev->time, NULL);
evas_event_feed_mouse_in(con->bg_evas, ev->time, NULL);
}
return 1;
}

View File

@ -54,8 +54,17 @@ e_focus_event_mouse_out(E_Border* bd)
{
if (e_config->focus_policy == E_FOCUS_MOUSE)
{
if (!bd->lock_focus_in)
e_border_focus_set(bd, 0, 1);
/* FIXME: this is such a hack. its a big hack around x's async events
* as we dont know always exactly what action causes what event
* so by waiting more than 0.2 secs before reverting focus to nothing
* since we entered root, we are ignoring mouse in's on the root
* container for a bit after the mosue may have entered it
*/
if ((ecore_time_get() - e_grabinput_last_focus_time_get()) > 0.2)
{
if (!bd->lock_focus_in)
e_border_focus_set(bd, 0, 1);
}
}
if (bd->raise_timer)
{

View File

@ -7,10 +7,11 @@
static void _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method);
/* local subsystem globals */
Ecore_X_Window grab_mouse_win = 0;
Ecore_X_Window grab_key_win = 0;
Ecore_X_Window focus_win = 0;
E_Focus_Method focus_method = E_FOCUS_METHOD_NO_INPUT;
static Ecore_X_Window grab_mouse_win = 0;
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 double last_focus_time = 0.0;
/* externally accessible functions */
int
@ -87,6 +88,12 @@ e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
_e_grabinput_focus(win, method);
}
double
e_grabinput_last_focus_time_get(void)
{
return last_focus_time;
}
/* local subsystem functions */
static void
_e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
@ -108,4 +115,5 @@ _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
default:
break;
}
last_focus_time = ecore_time_get();
}

View File

@ -20,6 +20,7 @@ EAPI int e_grabinput_shutdown(void);
EAPI void e_grabinput_get(Ecore_X_Window mouse_win, int confine_mouse, Ecore_X_Window key_win);
EAPI void e_grabinput_release(Ecore_X_Window mouse_win, Ecore_X_Window key_win);
EAPI void e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method);
EAPI double e_grabinput_last_focus_time_get(void);
#endif
#endif

View File

@ -720,7 +720,13 @@ _e_int_menus_clients_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
if (!bd->lock_user_stacking)
e_border_raise(bd);
if (!bd->lock_focus_out)
e_border_focus_set(bd, 1, 1);
{
if (e_config->focus_policy != E_FOCUS_CLICK)
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);
}
}
static void

View File

@ -480,7 +480,7 @@ _e_manager_cb_key_down(void *data, int ev_type __UNUSED__, void *ev)
man = data;
e = ev;
// printf("KEY %s [win=%x event_win=%x]\n", e->keyname, e->win, e->event_win);
printf("KEY %s [win=%x event_win=%x]\n", e->keyname, e->win, e->event_win);
if (e->event_win != man->root) return 1;
if (e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev))
return 0;

View File

@ -42,8 +42,8 @@ e_win_new(E_Container *con)
if (!win) return NULL;
win->container = con;
/* TODO: Maybe use an own config for windows? */
if (e_canvas_engine_decide(e_config->evas_engine_errors) ==
E_EVAS_ENGINE_GL_X11)
win->engine = e_canvas_engine_decide(e_config->evas_engine_errors);
if (win->engine == E_EVAS_ENGINE_GL_X11)
{
win->ecore_evas = ecore_evas_gl_x11_new(NULL, con->manager->root,
0, 0, 1, 1);
@ -95,6 +95,16 @@ e_win_show(E_Win *win)
if (!win->placed)
win->border->re_manage = 0;
win->border->internal = 1;
if (win->engine == E_EVAS_ENGINE_GL_X11)
{
ecore_evas_gl_x11_extra_event_window_add(win->ecore_evas, win->border->win);
ecore_evas_gl_x11_extra_event_window_add(win->ecore_evas, win->border->event_win);
}
else
{
ecore_evas_software_x11_extra_event_window_add(win->ecore_evas, win->border->win);
ecore_evas_software_x11_extra_event_window_add(win->ecore_evas, win->border->event_win);
}
}
e_border_show(win->border);
ecore_evas_show(win->ecore_evas);

View File

@ -16,6 +16,7 @@ struct _E_Win
E_Object e_obj_inherit;
int x, y, w, h;
int engine;
E_Container *container;
E_Border *border;
Ecore_Evas *ecore_evas;