diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 9466663c5a..debd2f78fb 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -239,24 +239,27 @@ typedef struct _Ecore_X_Event_Xdnd_Status Ecore_X_Event_Xdnd_Status typedef struct _Ecore_X_Event_Xdnd_Leave Ecore_X_Event_Xdnd_Leave; typedef struct _Ecore_X_Event_Xdnd_Drop Ecore_X_Event_Xdnd_Drop; typedef struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Event_Xdnd_Finished; -typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request; -typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request; -typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request; -typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping; -typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change; typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message; typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape; +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_Window_Delete_Request Ecore_X_Event_Window_Delete_Request; typedef struct _Ecore_X_Event_Window_Prop_Title_Change Ecore_X_Event_Window_Prop_Title_Change; typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change Ecore_X_Event_Window_Prop_Visible_Title_Change; typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change Ecore_X_Event_Window_Prop_Icon_Name_Change; typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change; -typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change Ecore_X_Event_Window_Prop_Client_Machine_Change; +typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change Ecore_X_Event_Window_Prop_Client_Machine_Change; typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change Ecore_X_Event_Window_Prop_Name_Class_Change; -typedef struct _Ecore_X_Event_Window_Prop_Pid_Change Ecore_X_Event_Window_Prop_Pid_Change; -typedef struct _Ecore_X_Event_Window_Prop_Desktop_Change Ecore_X_Event_Window_Prop_Desktop_Change; - +typedef struct _Ecore_X_Event_Window_Prop_Pid_Change Ecore_X_Event_Window_Prop_Pid_Change; +typedef struct _Ecore_X_Event_Window_Prop_Desktop_Change Ecore_X_Event_Window_Prop_Desktop_Change; + +typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request; +typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request; +typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request; +typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping; +typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change; + struct _Ecore_X_Event_Key_Down { char *keyname; @@ -602,42 +605,6 @@ struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Atom action; }; -struct _Ecore_X_Event_Window_Move_Resize_Request -{ - Ecore_X_Window win; - int x, y; - int direction; - int button; - int source; -}; - -struct _Ecore_X_Event_Window_State_Request -{ - Ecore_X_Window win; - Ecore_X_Window_State_Action action; - Ecore_X_Window_State state[2]; - int source; -}; - -struct _Ecore_X_Event_Frame_Extents_Request -{ - Ecore_X_Window win; -}; - -struct _Ecore_X_Event_Ping -{ - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Desktop_Change -{ - Ecore_X_Window win; - unsigned int desk; - int source; -}; - struct _Ecore_X_Event_Client_Message { Ecore_X_Window win; @@ -657,6 +624,16 @@ struct _Ecore_X_Event_Window_Shape Ecore_X_Time time; }; +struct _Ecore_X_Event_Sync_Counter +{ + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Sync_Alarm +{ + Ecore_X_Time time; +}; + struct _Ecore_X_Event_Window_Delete_Request { Ecore_X_Window win; @@ -720,6 +697,42 @@ struct _Ecore_X_Event_Window_Prop_Desktop_Change Ecore_X_Time time; }; +struct _Ecore_X_Event_Window_Move_Resize_Request +{ + Ecore_X_Window win; + int x, y; + int direction; + int button; + int source; +}; + +struct _Ecore_X_Event_Window_State_Request +{ + Ecore_X_Window win; + Ecore_X_Window_State_Action action; + Ecore_X_Window_State state[2]; + int source; +}; + +struct _Ecore_X_Event_Frame_Extents_Request +{ + Ecore_X_Window win; +}; + +struct _Ecore_X_Event_Ping +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Desktop_Change +{ + Ecore_X_Window win; + unsigned int desk; + int source; +}; + extern EAPI int ECORE_X_EVENT_KEY_DOWN; extern EAPI int ECORE_X_EVENT_KEY_UP; extern EAPI int ECORE_X_EVENT_MOUSE_BUTTON_DOWN; @@ -751,13 +764,10 @@ extern EAPI int ECORE_X_EVENT_WINDOW_MAPPING; extern EAPI int ECORE_X_EVENT_SELECTION_CLEAR; extern EAPI int ECORE_X_EVENT_SELECTION_REQUEST; extern EAPI int ECORE_X_EVENT_SELECTION_NOTIFY; -extern EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST; -extern EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST; -extern EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST; -extern EAPI int ECORE_X_EVENT_PING; -extern EAPI int ECORE_X_EVENT_DESKTOP_CHANGE; extern EAPI int ECORE_X_EVENT_CLIENT_MESSAGE; extern EAPI int ECORE_X_EVENT_WINDOW_SHAPE; +extern EAPI int ECORE_X_EVENT_SYNC_COUNTER; +extern EAPI int ECORE_X_EVENT_SYNC_ALARM; extern EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST; extern EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE; @@ -769,6 +779,12 @@ extern EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE; extern EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE; extern EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE; +extern EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST; +extern EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST; +extern EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST; +extern EAPI int ECORE_X_EVENT_PING; +extern EAPI int ECORE_X_EVENT_DESKTOP_CHANGE; + extern EAPI int ECORE_X_EVENT_XDND_ENTER; extern EAPI int ECORE_X_EVENT_XDND_POSITION; extern EAPI int ECORE_X_EVENT_XDND_STATUS; diff --git a/legacy/ecore/src/lib/ecore_x/Makefile.am b/legacy/ecore/src/lib/ecore_x/Makefile.am index cbae57ddfb..6b3bac9c23 100644 --- a/legacy/ecore/src/lib/ecore_x/Makefile.am +++ b/legacy/ecore/src/lib/ecore_x/Makefile.am @@ -28,6 +28,7 @@ Ecore_X_Cursor.h libecore_x_la_SOURCES = \ ecore_x.c \ ecore_x_dnd.c \ +ecore_x_sync.c \ ecore_x_error.c \ ecore_x_events.c \ ecore_x_icccm.c \ @@ -66,6 +67,7 @@ Ecore_X_Atoms.h \ Ecore_X_Cursor.h \ ecore_x.c \ ecore_x_dnd.c \ +ecore_x_sync.c \ ecore_x_error.c \ ecore_x_events.c \ ecore_x_icccm.c \ diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index 3e28104d5a..84043e9968 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -17,6 +17,7 @@ static void _ecore_x_event_filter_end(void *data, void *loop_data); static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL; static Ecore_Event_Filter *_ecore_x_filter_handler = NULL; static int _ecore_x_event_shape_id = 0; +static int _ecore_x_event_sync_id = 0; static int _ecore_x_event_handlers_num = 0; static void (**_ecore_x_event_handlers) (XEvent * event) = NULL; @@ -113,13 +114,10 @@ int ECORE_X_EVENT_WINDOW_MAPPING = 0; int ECORE_X_EVENT_SELECTION_CLEAR = 0; int ECORE_X_EVENT_SELECTION_REQUEST = 0; int ECORE_X_EVENT_SELECTION_NOTIFY = 0; -int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; -int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; -int ECORE_X_EVENT_PING = 0; -int ECORE_X_EVENT_DESKTOP_CHANGE = 0; int ECORE_X_EVENT_CLIENT_MESSAGE = 0; int ECORE_X_EVENT_WINDOW_SHAPE = 0; +int ECORE_X_EVENT_SYNC_COUNTER = 0; +int ECORE_X_EVENT_SYNC_ALARM = 0; int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0; @@ -131,6 +129,12 @@ int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0; +int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; +int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; +int ECORE_X_EVENT_PING = 0; +int ECORE_X_EVENT_DESKTOP_CHANGE = 0; + int ECORE_X_EVENT_XDND_ENTER = 0; int ECORE_X_EVENT_XDND_POSITION = 0; int ECORE_X_EVENT_XDND_STATUS = 0; @@ -167,6 +171,8 @@ ecore_x_init(const char *name) { int shape_base = 0; int shape_err_base = 0; + int sync_base = 0; + int sync_err_base = 0; if (_ecore_x_init_count > 0) { @@ -177,10 +183,23 @@ ecore_x_init(const char *name) if (!_ecore_x_disp) return 0; _ecore_x_error_handler_init(); _ecore_x_event_handlers_num = LASTEvent; + if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base)) _ecore_x_event_shape_id = shape_base + ShapeNotify; if (_ecore_x_event_shape_id >= LASTEvent) _ecore_x_event_handlers_num = _ecore_x_event_shape_id + 1; + + if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base)) + { + int major, minor; + + _ecore_x_event_sync_id = sync_base; + if (!XSyncInitialize(_ecore_x_disp, &major, &minor)) + _ecore_x_event_sync_id = 0; + } + if (_ecore_x_event_sync_id + XSyncAlarmNotify >= LASTEvent) + _ecore_x_event_handlers_num = _ecore_x_event_sync_id + XSyncAlarmNotify + 1; + _ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *)); if (!_ecore_x_event_handlers) { @@ -226,6 +245,13 @@ ecore_x_init(const char *name) _ecore_x_event_handlers[ClientMessage] = _ecore_x_event_handle_client_message; 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_sync_id) + { + _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncCounterNotify] = + _ecore_x_event_handle_sync_counter; + _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncAlarmNotify] = + _ecore_x_event_handle_sync_alarm; + } if (!ECORE_X_EVENT_KEY_DOWN) { ECORE_X_EVENT_KEY_DOWN = ecore_event_type_new(); @@ -259,13 +285,10 @@ ecore_x_init(const char *name) ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_PING = ecore_event_type_new(); - ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new(); @@ -277,6 +300,12 @@ ecore_x_init(const char *name) ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_PING = ecore_event_type_new(); + ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c index 498ae96730..eb64279584 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c @@ -1516,3 +1516,29 @@ _ecore_x_event_handle_shape_change(XEvent *xevent) e->time = shape_event->time; ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); } + +void +_ecore_x_event_handle_sync_counter(XEvent *xevent) +{ + XSyncCounterNotifyEvent *sync_counter_event; + Ecore_X_Event_Sync_Counter *e; + + sync_counter_event = (XSyncCounterNotifyEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)); + if (!e) return; + e->time = sync_counter_event->time; + ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); +} + +void +_ecore_x_event_handle_sync_alarm(XEvent *xevent) +{ + XSyncAlarmNotifyEvent *sync_alarm_event; + Ecore_X_Event_Sync_Alarm *e; + + sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)); + if (!e) return; + e->time = sync_alarm_event->time; + ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); +} diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h index c877818f57..e0ce3c9c8f 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef ECORE_XCURSOR #include #endif @@ -174,6 +175,8 @@ void _ecore_x_event_handle_colormap_notify(XEvent *xevent); void _ecore_x_event_handle_client_message(XEvent *xevent); void _ecore_x_event_handle_mapping_notify(XEvent *xevent); void _ecore_x_event_handle_shape_change(XEvent *xevent); +void _ecore_x_event_handle_sync_counter(XEvent *xevent); +void _ecore_x_event_handle_sync_alarm(XEvent *xevent); void _ecore_x_selection_data_init(void); void _ecore_x_selection_shutdown(void); @@ -196,4 +199,6 @@ void _ecore_x_dnd_shutdown(void); /* from netwm */ Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a); +/* from sync */ + #endif diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_sync.c b/legacy/ecore/src/lib/ecore_x/ecore_x_sync.c new file mode 100644 index 0000000000..dc2ab3d388 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_sync.c @@ -0,0 +1,11 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +/* + * XSync code + */ +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" +