I know this is a new feature. i know i know. doing this because

otherwise we weill need another efl release for e17 to get out.

modified patch from:
http://trac.enlightenment.org/e/ticket/1306



SVN revision: 75409
This commit is contained in:
Carsten Haitzler 2012-08-18 11:29:47 +00:00
parent 5daa1a432a
commit 4e17d57b06
6 changed files with 78 additions and 8 deletions

View File

@ -1045,6 +1045,8 @@ EAPI extern int ECORE_X_EVENT_DESKTOP_CHANGE;
EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
EAPI extern int ECORE_X_EVENT_XKB_STATE_NOTIFY; /** @since 1.7 */
EAPI extern int ECORE_X_EVENT_XKB_NEWKBD_NOTIFY; /** @since 1.7 */
EAPI extern int ECORE_X_EVENT_GENERIC;
@ -2169,6 +2171,12 @@ struct _Ecore_X_Event_Damage
typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage;
struct _Ecore_X_Event_Xkb
{
int group;
};
typedef struct _Ecore_X_Event_Xkb Ecore_X_Event_Xkb; /** @since 1.7 */
EAPI Eina_Bool ecore_x_damage_query(void);
EAPI Ecore_X_Damage ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level);
EAPI void ecore_x_damage_free(Ecore_X_Damage damage);
@ -2375,8 +2383,8 @@ EAPI void
ecore_x_e_illume_window_state_set(Ecore_X_Window win,
Ecore_X_Illume_Window_State state);
EAPI Ecore_X_Illume_Window_State
ecore_x_e_illume_window_state_get(Ecore_X_Window win);
EAPI Ecore_X_Illume_Window_State ecore_x_e_illume_window_state_get(Ecore_X_Window win);
EAPI void ecore_x_xkb_select_group(int group); /* @since 1.7 */
#ifdef __cplusplus
}

View File

@ -1404,6 +1404,12 @@ ecore_x_default_depth_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *scre
return s->root_depth;
}
API void
ecore_x_xkb_select_group(int group)
{
// XXX: implement me */
}
/**
* Sets the timeout for a double and triple clicks to be flagged.
*

View File

@ -180,6 +180,8 @@ EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0;
EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
EAPI int ECORE_X_EVENT_XKB_STATE_NOTIFY = 0;
EAPI int ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = 0;
EAPI int ECORE_X_EVENT_GENERIC = 0;
void
@ -243,6 +245,8 @@ _ecore_xcb_events_init(void)
ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new();
ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
ECORE_X_EVENT_XKB_STATE_NOTIFY = ecore_event_type_new();
ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = ecore_event_type_new();
ECORE_X_EVENT_GENERIC = ecore_event_type_new();
}
}

View File

@ -50,6 +50,9 @@ static int _ecore_x_event_damage_id = 0;
#ifdef ECORE_XGESTURE
static int _ecore_x_event_gesture_id = 0;
#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XKB
static int _ecore_x_event_xkb_id = 0;
#endif /* ifdef ECORE_XKB */
static int _ecore_x_event_handlers_num = 0;
static void (**_ecore_x_event_handlers) (XEvent * event) = NULL;
@ -124,6 +127,10 @@ EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
EAPI int ECORE_X_EVENT_XKB_STATE_NOTIFY = 0;
EAPI int ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = 0;
EAPI int ECORE_X_EVENT_GENERIC = 0;
EAPI int ECORE_X_MODIFIER_SHIFT = 0;
@ -299,7 +306,9 @@ ecore_x_init(const char *name)
int gesture_base = 0;
int gesture_err_base = 0;
#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XKB
int xkb_base = 0;
#endif /* ifdef ECORE_XKB */
if (++_ecore_x_init_count != 1)
return _ecore_x_init_count;
@ -390,6 +399,18 @@ ecore_x_init(const char *name)
ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents);
#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XKB
{
int dummy;
if (XkbQueryExtension(_ecore_x_disp, &dummy, &xkb_base,
&dummy, &dummy, &dummy))
_ecore_x_event_xkb_id = xkb_base;
XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotify,
XkbAllStateComponentsMask, XkbGroupStateMask);
}
ECORE_X_EVENT_HANDLERS_GROW(xkb_base, XkbNumberEvents);
#endif
_ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
if (!_ecore_x_event_handlers)
@ -502,7 +523,9 @@ ecore_x_init(const char *name)
Bool works = 0;
XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works);
}
while (0);
while (0);
if (_ecore_x_event_xkb_id)
_ecore_x_event_handlers[_ecore_x_event_xkb_id] = _ecore_x_event_handle_xkb;
#endif /* ifdef ECORE_XKB */
#ifdef ECORE_XGESTURE
@ -585,6 +608,9 @@ ecore_x_init(const char *name)
ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
ECORE_X_EVENT_XKB_STATE_NOTIFY = ecore_event_type_new();
ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = ecore_event_type_new();
ECORE_X_EVENT_GENERIC = ecore_event_type_new();
}
@ -1016,14 +1042,12 @@ _ecore_x_fd_handler(void *data,
XEvent ev;
XNextEvent(d, &ev);
#ifdef ENABLE_XIM
/* Filter event for XIM */
if (XFilterEvent(&ev, ev.xkey.window))
continue;
#endif /* ifdef ENABLE_XIM */
if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num))
{
if (_ecore_x_event_handlers[AnyXEvent])
@ -2135,6 +2159,14 @@ ecore_x_default_depth_get(Ecore_X_Display *disp,
return DefaultDepth(disp, ecore_x_screen_index_get(screen));
}
EAPI void
ecore_x_xkb_select_group(int group)
{
#ifdef ECORE_XKB
XkbLockGroup(_ecore_x_disp, XkbUseCoreKbd, group);
#endif
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/

View File

@ -2221,7 +2221,7 @@ _ecore_x_event_handle_fixes_selection_notify(XEvent *event)
void
_ecore_x_event_handle_damage_notify(XEvent *event)
{
XDamageNotifyEvent *damage_event;
XDamageNotifyEvent *damage_event;
Ecore_X_Event_Damage *e;
_ecore_x_last_event_mouse_move = 0;
@ -2496,4 +2496,21 @@ _ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
}
#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XKB
void
_ecore_x_event_handle_xkb(XEvent *xevent)
{
XkbEvent *xkbev;
Ecore_X_Event_Xkb *e;
xkbev = (XkbEvent *) xevent;
e = calloc(1, sizeof(Ecore_X_Event_Xkb));
if (!e)
return;
e->group = xkbev->state.group;
if (xkbev->any.xkb_type == XkbStateNotify)
ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, NULL, NULL);
else if (xkbev->any.xkb_type == XkbNewKeyboardNotify)
ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, e, NULL, NULL);
}
#endif /* ifdef ECORE_XKB */

View File

@ -258,6 +258,9 @@ void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent);
#ifdef ECORE_XDAMAGE
void _ecore_x_event_handle_damage_notify(XEvent *xevent);
#endif /* ifdef ECORE_XDAMAGE */
#ifdef ECORE_XKB
void _ecore_x_event_handle_xkb(XEvent *xevent);
#endif /* ifdef ECORE_XKB */
void _ecore_x_event_handle_generic_event(XEvent *xevent);
void _ecore_x_selection_data_init(void);