forked from enlightenment/efl
From: 이상진 <lsj119@samsung.com>
generic events exposed from ecore_x (if you have the newest xlib goop like xi2) SVN revision: 45318
This commit is contained in:
parent
38d5b876b0
commit
6052f73462
|
@ -45,9 +45,9 @@
|
|||
|
||||
|
||||
typedef unsigned int Ecore_X_ID;
|
||||
# ifndef _ECORE_X_WINDOW_PREDEF
|
||||
#ifndef _ECORE_X_WINDOW_PREDEF
|
||||
typedef Ecore_X_ID Ecore_X_Window;
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_ECORE_X_XCB
|
||||
typedef Ecore_X_ID Ecore_X_Visual;
|
||||
#else
|
||||
|
@ -326,8 +326,8 @@ typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver
|
|||
typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter;
|
||||
typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm;
|
||||
typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change;
|
||||
typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change;
|
||||
typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change;
|
||||
typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change;
|
||||
typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change;
|
||||
typedef struct _Ecore_X_Event_Randr_Output_Property_Notify Ecore_X_Event_Randr_Output_Property_Notify;
|
||||
|
||||
typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request;
|
||||
|
@ -348,6 +348,8 @@ typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_C
|
|||
|
||||
typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence;
|
||||
|
||||
typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic;
|
||||
|
||||
struct _Ecore_X_Event_Mouse_In
|
||||
{
|
||||
int modifiers;
|
||||
|
@ -829,10 +831,17 @@ struct _Ecore_X_Event_Desktop_Change
|
|||
int source;
|
||||
};
|
||||
|
||||
struct _Ecore_X_Event_Generic
|
||||
{
|
||||
int extension;
|
||||
int evtype;
|
||||
unsigned int cookie;
|
||||
void *data;
|
||||
};
|
||||
|
||||
EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on
|
||||
backend in use, if Xlib will be XEvent,
|
||||
if XCB will be xcb_generic_event_t.
|
||||
|
||||
@warning avoid using it.
|
||||
*/
|
||||
EAPI extern int ECORE_X_EVENT_MOUSE_IN;
|
||||
|
@ -893,6 +902,8 @@ 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_GENERIC;
|
||||
|
||||
EAPI extern int ECORE_X_EVENT_XDND_ENTER;
|
||||
EAPI extern int ECORE_X_EVENT_XDND_POSITION;
|
||||
EAPI extern int ECORE_X_EVENT_XDND_STATUS;
|
||||
|
|
|
@ -120,6 +120,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;
|
||||
|
||||
#if 1 //def USE_XI
|
||||
EAPI int ECORE_X_EVENT_GENERIC = 0;
|
||||
#endif
|
||||
|
||||
int ECORE_X_MODIFIER_SHIFT = 0;
|
||||
int ECORE_X_MODIFIER_CTRL = 0;
|
||||
int ECORE_X_MODIFIER_ALT = 0;
|
||||
|
@ -273,6 +277,9 @@ ecore_x_init(const char *name)
|
|||
_ecore_x_event_handlers[ColormapNotify] = _ecore_x_event_handle_colormap_notify;
|
||||
_ecore_x_event_handlers[ClientMessage] = _ecore_x_event_handle_client_message;
|
||||
_ecore_x_event_handlers[MappingNotify] = _ecore_x_event_handle_mapping_notify;
|
||||
#if 1 //def USE_XI
|
||||
_ecore_x_event_handlers[GenericEvent] = _ecore_x_event_handle_generic_event;
|
||||
#endif
|
||||
if (_ecore_x_event_shape_id)
|
||||
_ecore_x_event_handlers[_ecore_x_event_shape_id] = _ecore_x_event_handle_shape_change;
|
||||
if (_ecore_x_event_screensaver_id)
|
||||
|
@ -372,6 +379,10 @@ ecore_x_init(const char *name)
|
|||
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();
|
||||
|
||||
#if 1 //def USE_XI
|
||||
ECORE_X_EVENT_GENERIC = ecore_event_type_new();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* everything has these... unless its like a pda... :) */
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "ecore_x_private.h"
|
||||
#include "Ecore_X.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
#include "Ecore_Input.h"
|
||||
|
||||
/** OpenBSD does not define CODESET
|
||||
* FIXME ??
|
||||
|
@ -192,7 +191,7 @@ _ecore_x_event_modifiers(unsigned int state)
|
|||
return modifiers;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
|
||||
int x, int y,
|
||||
int x_root, int y_root,
|
||||
|
@ -242,8 +241,7 @@ _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_key_press(int event,
|
||||
XKeyEvent *xevent)
|
||||
_ecore_key_press(int event, XKeyEvent *xevent)
|
||||
{
|
||||
Ecore_Event_Key *e;
|
||||
char *compose = NULL;
|
||||
|
@ -356,7 +354,7 @@ _ecore_key_press(int event,
|
|||
if (tmp) free(tmp);
|
||||
}
|
||||
|
||||
static Ecore_Event_Mouse_Button*
|
||||
Ecore_Event_Mouse_Button *
|
||||
_ecore_mouse_button(int event,
|
||||
unsigned int timestamp, unsigned int xmodifiers,
|
||||
unsigned int buttons,
|
||||
|
@ -437,94 +435,13 @@ _ecore_mouse_button(int event,
|
|||
return e;
|
||||
}
|
||||
|
||||
#ifdef ECORE_XI2
|
||||
extern int _ecore_x_xi2_opcode;
|
||||
#endif
|
||||
|
||||
void
|
||||
_ecore_x_event_handle_any_event(XEvent *xevent)
|
||||
{
|
||||
XEvent* ev = malloc(sizeof(XEvent));
|
||||
memcpy(ev, xevent, sizeof(XEvent));
|
||||
|
||||
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
|
||||
|
||||
#ifdef ECORE_XI2
|
||||
if (xevent->xcookie.type == GenericEvent &&
|
||||
xevent->xcookie.extension == _ecore_x_xi2_opcode)
|
||||
{
|
||||
if (XGetEventData(_ecore_x_disp, &(xevent->xcookie)))
|
||||
{
|
||||
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
||||
int devid = evd->deviceid;
|
||||
|
||||
//printf("deviceID = %d\n", devid);
|
||||
switch (xevent->xcookie.evtype)
|
||||
{
|
||||
case XI_Motion:
|
||||
_ecore_mouse_move
|
||||
(evd->time,
|
||||
0, // state
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
//printf("motion\n");
|
||||
printf("=");
|
||||
break;
|
||||
case XI_ButtonPress:
|
||||
_ecore_mouse_button
|
||||
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
evd->time,
|
||||
0, // state
|
||||
0, // button
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
//printf("abs X:%f Y:%f - ", evd->root_x, evd->root_y);
|
||||
//printf("win X:%f Y:%f\n", evd->event_x, evd->event_y);
|
||||
printf("[[");
|
||||
break;
|
||||
case XI_ButtonRelease:
|
||||
_ecore_mouse_button
|
||||
(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||
evd->time,
|
||||
0, // state
|
||||
0, // button
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
//printf("unclick\n");
|
||||
printf("]]\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
XFreeEventData(_ecore_x_disp, &(xevent->xcookie));
|
||||
#endif
|
||||
memcpy(ev, xevent, sizeof(XEvent));
|
||||
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2131,3 +2048,51 @@ _ecore_x_event_handle_damage_notify(XEvent *event)
|
|||
ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_ecore_x_event_free_generic_event(void *data, void *ev)
|
||||
{
|
||||
#ifdef ECORE_XI2
|
||||
Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic*)ev;
|
||||
|
||||
if (e->data)
|
||||
{
|
||||
XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_x_event_handle_generic_event(XEvent *event)
|
||||
{
|
||||
#ifdef ECORE_XI2
|
||||
XGenericEvent *generic_event;
|
||||
Ecore_X_Event_Generic *e;
|
||||
|
||||
generic_event = (XGenericEvent *)event;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_X_Event_Generic));
|
||||
if (!e) return;
|
||||
|
||||
if (XGetEventData(_ecore_x_disp, &event->xcookie))
|
||||
{
|
||||
e->cookie = event->xcookie.cookie;
|
||||
e->data = event->xcookie.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->cookie = 0;
|
||||
e->data = NULL;
|
||||
}
|
||||
|
||||
e->extension = generic_event->extension;
|
||||
e->evtype = generic_event->evtype;
|
||||
|
||||
if (e->extension == _ecore_x_xi2_opcode)
|
||||
{
|
||||
_ecore_x_input_handler(event);
|
||||
}
|
||||
|
||||
ecore_event_add(ECORE_X_EVENT_GENERIC, e, _ecore_x_event_free_generic_event, event);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore_X.h"
|
||||
#include "Ecore_Input.h"
|
||||
|
||||
/* FIXME: this is for simulation only */
|
||||
#include "Ecore_Txt.h"
|
||||
|
@ -251,6 +252,7 @@ void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent);
|
|||
#ifdef ECORE_XDAMAGE
|
||||
void _ecore_x_event_handle_damage_notify(XEvent *xevent);
|
||||
#endif
|
||||
void _ecore_x_event_handle_generic_event(XEvent *xevent);
|
||||
|
||||
void _ecore_x_selection_data_init(void);
|
||||
void _ecore_x_selection_shutdown(void);
|
||||
|
@ -288,9 +290,14 @@ void _ecore_x_randr_init(void);
|
|||
|
||||
void _ecore_x_atoms_init(void);
|
||||
|
||||
extern int _ecore_x_xi2_opcode;
|
||||
|
||||
void _ecore_x_input_init(void);
|
||||
void _ecore_x_input_shutdown(void);
|
||||
|
||||
void _ecore_x_input_handler(XEvent* xevent);
|
||||
/* from sync */
|
||||
|
||||
void _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers, int x, int y, int x_root, int y_root, unsigned int event_window, unsigned int window, unsigned int root_win, int same_screen, int dev, double radx, double rady, double pressure, double angle, double mx, double my, double mrx, double mry);
|
||||
Ecore_Event_Mouse_Button *_ecore_mouse_button(int event, unsigned int timestamp, unsigned int xmodifiers, unsigned int buttons, int x, int y, int x_root, int y_root, unsigned int event_window, unsigned int window, unsigned int root_win, int same_screen, int dev, double radx, double rady, double pressure, double angle, double mx, double my, double mrx, double mry);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,8 +13,12 @@
|
|||
#include "Ecore_X.h"
|
||||
|
||||
#ifdef ECORE_XI2
|
||||
#include "Ecore_Input.h"
|
||||
#endif
|
||||
|
||||
int _ecore_x_xi2_opcode = -1;
|
||||
|
||||
#ifdef ECORE_XI2
|
||||
static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
|
||||
static int _ecore_x_xi2_num = 0;
|
||||
#endif
|
||||
|
@ -57,6 +61,72 @@ _ecore_x_input_shutdown(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_x_input_handler(XEvent* xevent)
|
||||
{
|
||||
#ifdef ECORE_XI2
|
||||
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
||||
int devid = evd->deviceid;
|
||||
|
||||
//printf("deviceID = %d\n", devid);
|
||||
switch (xevent->xcookie.evtype)
|
||||
{
|
||||
case XI_Motion:
|
||||
_ecore_mouse_move
|
||||
(evd->time,
|
||||
0, // state
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
break;
|
||||
case XI_ButtonPress:
|
||||
_ecore_mouse_button
|
||||
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
evd->time,
|
||||
0, // state
|
||||
0, // button
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
break;
|
||||
case XI_ButtonRelease:
|
||||
_ecore_mouse_button
|
||||
(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||
evd->time,
|
||||
0, // state
|
||||
0, // button
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y,
|
||||
evd->event,
|
||||
(evd->child ? evd->child : evd->event),
|
||||
evd->root,
|
||||
1, // same_screen
|
||||
devid, 1, 1,
|
||||
1.0, // pressure
|
||||
0.0, // angle
|
||||
evd->event_x, evd->event_y,
|
||||
evd->root_x, evd->root_y);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_x_input_multi_select(Ecore_X_Window win)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue