keep track of the times of the last event (for those events that report time)

and use that instead of CurrentTime in the X selection code (as recommended
by the ICCCM)
This commit is contained in:
Bill Currie 2002-01-08 20:07:19 +00:00
parent 6633ea0273
commit 96c7159f66
3 changed files with 18 additions and 17 deletions

View file

@ -44,6 +44,7 @@ extern XVisualInfo *x_visinfo;
extern double x_gamma;
extern int x_screen;
extern int x_shmeventtype;
extern Time x_time;
extern qboolean doShm;
extern qboolean oktodraw;

View file

@ -89,6 +89,7 @@ Visual *x_vis;
Window x_win;
Cursor nullcursor = None;
static Atom aWMDelete = 0;
Time x_time;
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask)
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
@ -180,13 +181,7 @@ X11_ProcessEvent (void)
XEvent x_event;
XNextEvent (x_disp, &x_event);
if (x_event.type >= LASTEvent) {
if (x_event.type == x_shmeventtype)
oktodraw = 1;
return;
}
if (event_handlers[x_event.type])
event_handlers[x_event.type] (&x_event);
X11_ProcessEventProxy (&x_event);
}
void

View file

@ -133,10 +133,7 @@ in_paste_buffer_f (void)
if (XGetSelectionOwner (x_disp, XA_PRIMARY) == None)
return;
property = XInternAtom (x_disp, "GETCLIPBOARDDATA_PROP", False);
//FIXME shouldn't use CurrentTime but rather the timestamp of the event
//triggering this (timestamp of the last event?)
XConvertSelection (x_disp, XA_PRIMARY, XA_STRING, property, x_win,
CurrentTime);
XConvertSelection (x_disp, XA_PRIMARY, XA_STRING, property, x_win, x_time);
XFlush (x_disp);
}
@ -149,6 +146,8 @@ selection_notify (XEvent * event)
int format;
Atom type, property;
x_time = event->xselection.time;
if ((property = event->xselection.property) == None)
return;
@ -426,6 +425,8 @@ static void
event_key (XEvent *event)
{
int key, unicode;
x_time = event->xkey.time;
if (old_key_dest != key_dest) {
old_key_dest = key_dest;
if (key_dest == key_game) {
@ -443,6 +444,8 @@ event_button (XEvent * event)
{
int but;
x_time = event->xbutton.time;
but = event->xbutton.button;
if (but == 2)
but = 3;
@ -500,6 +503,8 @@ center_pointer (void)
static void
event_motion (XEvent *event)
{
x_time = event->xmotion.time;
if (dga_active) {
in_mouse_x += event->xmotion.x_root;
in_mouse_y += event->xmotion.y_root;