mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
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:
parent
6633ea0273
commit
96c7159f66
3 changed files with 18 additions and 17 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -133,15 +133,12 @@ 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);
|
||||
}
|
||||
|
||||
static void
|
||||
selection_notify (XEvent * event)
|
||||
selection_notify (XEvent *event)
|
||||
{
|
||||
unsigned char *data, *p;
|
||||
unsigned long num_bytes;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -423,9 +422,11 @@ XLateKey (XKeyEvent * ev, int *k, int *u)
|
|||
}
|
||||
|
||||
static void
|
||||
event_key (XEvent * event)
|
||||
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) {
|
||||
|
@ -439,10 +440,12 @@ event_key (XEvent * event)
|
|||
}
|
||||
|
||||
static void
|
||||
event_button (XEvent * event)
|
||||
event_button (XEvent *event)
|
||||
{
|
||||
int but;
|
||||
|
||||
x_time = event->xbutton.time;
|
||||
|
||||
but = event->xbutton.button;
|
||||
if (but == 2)
|
||||
but = 3;
|
||||
|
@ -464,7 +467,7 @@ event_button (XEvent * event)
|
|||
}
|
||||
|
||||
static void
|
||||
event_focusout (XEvent * event)
|
||||
event_focusout (XEvent *event)
|
||||
{
|
||||
XAutoRepeatOn (x_disp);
|
||||
if (in_snd_block->int_val) {
|
||||
|
@ -474,7 +477,7 @@ event_focusout (XEvent * event)
|
|||
}
|
||||
|
||||
static void
|
||||
event_focusin (XEvent * event)
|
||||
event_focusin (XEvent *event)
|
||||
{
|
||||
if (key_dest == key_game)
|
||||
XAutoRepeatOff (x_disp);
|
||||
|
@ -498,8 +501,10 @@ center_pointer (void)
|
|||
}
|
||||
|
||||
static void
|
||||
event_motion (XEvent * event)
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue