Enlightenment CVS committal Author : sebastid Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: Ecore_X.h Makefile.am ecore_x.c ecore_x_events.c ecore_x_private.h Added Files: ecore_x_sync.c Log Message: Cleanup, and add XSync support. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.132 retrieving revision 1.133 diff -u -3 -r1.132 -r1.133 --- Ecore_X.h 5 Jun 2005 14:46:55 -0000 1.132 +++ Ecore_X.h 6 Jun 2005 09:40:00 -0000 1.133 @@ -239,24 +239,27 @@ 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 @@ 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 @@ 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 @@ 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_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_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; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- Makefile.am 23 Mar 2005 11:49:47 -0000 1.22 +++ Makefile.am 6 Jun 2005 09:40:00 -0000 1.23 @@ -28,6 +28,7 @@ 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_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 \ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v retrieving revision 1.86 retrieving revision 1.87 diff -u -3 -r1.86 -r1.87 --- ecore_x.c 5 Jun 2005 14:46:55 -0000 1.86 +++ ecore_x.c 6 Jun 2005 09:40:00 -0000 1.87 @@ -17,6 +17,7 @@ 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_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_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 @@ { 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 @@ 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_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_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_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(); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -3 -r1.62 -r1.63 --- ecore_x_events.c 5 Jun 2005 14:46:55 -0000 1.62 +++ ecore_x_events.c 6 Jun 2005 09:40:00 -0000 1.63 @@ -1516,3 +1516,29 @@ 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); +} =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- ecore_x_private.h 28 Apr 2005 12:26:34 -0000 1.44 +++ ecore_x_private.h 6 Jun 2005 09:40:00 -0000 1.45 @@ -17,6 +17,7 @@ #include <X11/keysymdef.h> #include <X11/extensions/XShm.h> #include <X11/extensions/shape.h> +#include <X11/extensions/sync.h> #ifdef ECORE_XCURSOR #include <X11/Xcursor/Xcursor.h> #endif @@ -174,6 +175,8 @@ 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 @@ /* from netwm */ Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a); +/* from sync */ + #endif ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs