parent
ee1106fa61
commit
1c29ff504b
|
@ -46,6 +46,8 @@ typedef Ecore_X_ID Ecore_X_Colormap;
|
|||
typedef Ecore_X_ID Ecore_X_Time;
|
||||
typedef Ecore_X_ID Ecore_X_Cursor;
|
||||
typedef void Ecore_X_Display;
|
||||
typedef Ecore_X_ID Ecore_X_Sync_Counter;
|
||||
typedef Ecore_X_ID Ecore_X_Sync_Alarm;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -631,7 +633,8 @@ struct _Ecore_X_Event_Sync_Counter
|
|||
|
||||
struct _Ecore_X_Event_Sync_Alarm
|
||||
{
|
||||
Ecore_X_Time time;
|
||||
Ecore_X_Time time;
|
||||
Ecore_X_Sync_Alarm alarm;
|
||||
};
|
||||
|
||||
struct _Ecore_X_Event_Window_Delete_Request
|
||||
|
@ -1242,7 +1245,6 @@ EAPI int ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int
|
|||
EAPI int ecore_x_netwm_icon_get(Ecore_X_Window win, int *width, int *height, unsigned int **data, int *num);
|
||||
EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height);
|
||||
EAPI int ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height);
|
||||
EAPI void ecore_x_netwm_ping(Ecore_X_Window win);
|
||||
EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, int pid);
|
||||
EAPI int ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid);
|
||||
EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
|
||||
|
@ -1263,6 +1265,11 @@ EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned
|
|||
EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity);
|
||||
EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
|
||||
EAPI int ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb);
|
||||
EAPI void ecore_x_netwm_ping(Ecore_X_Window win);
|
||||
EAPI int ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter);
|
||||
EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial);
|
||||
|
||||
|
||||
|
||||
EAPI void ecore_x_e_init(void);
|
||||
EAPI void ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
|
||||
|
@ -1344,6 +1351,10 @@ EAPI void ecore_x_events_allow_all(void);
|
|||
EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
|
||||
EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y);
|
||||
|
||||
/* ecore_x_sync.c */
|
||||
EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter);
|
||||
EAPI int ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -121,6 +121,7 @@ extern Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS;
|
|||
|
||||
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING;
|
||||
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
|
||||
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER;
|
||||
|
||||
/* Selections */
|
||||
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS;
|
||||
|
|
|
@ -1535,10 +1535,12 @@ _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;
|
||||
e->alarm = sync_alarm_event->alarm;
|
||||
ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -268,6 +268,7 @@ Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
|
|||
|
||||
Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
|
||||
Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
|
||||
Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0;
|
||||
|
||||
void
|
||||
ecore_x_netwm_init(void)
|
||||
|
@ -363,6 +364,7 @@ ecore_x_netwm_init(void)
|
|||
|
||||
ECORE_X_ATOM_NET_WM_PING = _ATOM_GET("_NET_WM_PING");
|
||||
ECORE_X_ATOM_NET_WM_SYNC_REQUEST = _ATOM_GET("_NET_WM_SYNC_REQUEST");
|
||||
ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = _ATOM_GET("_NET_WM_SYNC_REQUEST_COUNTER");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1330,3 +1332,38 @@ ecore_x_netwm_ping(Ecore_X_Window win)
|
|||
|
||||
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
|
||||
}
|
||||
|
||||
int
|
||||
ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter)
|
||||
{
|
||||
int ret;
|
||||
unsigned int tmp;
|
||||
|
||||
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
|
||||
&tmp, 1);
|
||||
|
||||
if (counter) *counter = tmp;
|
||||
return ret == 1 ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial)
|
||||
{
|
||||
XSyncValue value;
|
||||
XEvent xev;
|
||||
|
||||
XSyncIntToValue(&value, serial);
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.display = _ecore_x_disp;
|
||||
xev.xclient.window = win;
|
||||
xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
|
||||
xev.xclient.data.l[1] = CurrentTime;
|
||||
xev.xclient.data.l[2] = XSyncValueLow32(value);
|
||||
xev.xclient.data.l[3] = XSyncValueHigh32(value);
|
||||
xev.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent(_ecore_x_disp, win, False, 0, &xev);
|
||||
}
|
||||
|
|
|
@ -9,3 +9,40 @@
|
|||
#include "Ecore_X.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
|
||||
Ecore_X_Sync_Alarm
|
||||
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
|
||||
{
|
||||
Ecore_X_Sync_Alarm alarm;
|
||||
XSyncAlarmAttributes values;
|
||||
XSyncValue init;
|
||||
|
||||
XSyncIntToValue(&init, 0);
|
||||
XSyncSetCounter(_ecore_x_disp, counter, init);
|
||||
|
||||
values.trigger.counter = counter;
|
||||
values.trigger.value_type = XSyncAbsolute;
|
||||
XSyncIntToValue(&values.trigger.wait_value, 1);
|
||||
values.trigger.test_type = XSyncPositiveComparison;
|
||||
|
||||
XSyncIntToValue(&values.delta, 1);
|
||||
|
||||
values.events = True;
|
||||
|
||||
alarm = XSyncCreateAlarm(_ecore_x_disp,
|
||||
XSyncCACounter |
|
||||
XSyncCAValueType |
|
||||
XSyncCAValue |
|
||||
XSyncCATestType |
|
||||
XSyncCADelta |
|
||||
XSyncCAEvents,
|
||||
&values);
|
||||
|
||||
ecore_x_sync();
|
||||
return alarm;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
|
||||
{
|
||||
return XSyncDestroyAlarm(_ecore_x_disp, alarm);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue