Improve reliability of timestamp handling

* 12to11.c (DetermineServerTime): Correctly handle server time
truncation.
* Imakefile (SRCS): Add time.c
(OBJS): Add time.o.
* compositor.h (struct _Timestamp, enum _TimestampDifference):
New structure and enum.
(TimestampIs, TimeIs): New macros.
(struct _CreateOfferFuncs): Accept Timestamp, not Time.
* data_device.c (UpdateSingleReferenceWithForeignOffer)
(XLSetForeignSelection, XLClearForeignSelection): Accept
Timestamp, not Time.
* dnd.c (XLDoDragMotion):
* picture_renderer.c (InitRenderFuncs):
* primary_selection.c (UpdateSingleReferenceWithForeignOffer)
(XLSetForeignPrimary, XLClearForeignPrimary): Adjust for changed
timestamp handling.
* seat.c (struct _Seat): New field `last_user_time'.
(HandleRawKey, DispatchMotion): Record last user time as
timestamp.
(GetLastUserTime, XLSeatGetLastUserTime): Return Timestamp, not
Time.
* select.c (FindWriteTransfer, TransferFinished)
(TransferBecameReadable, ConvertSelectionMultiple)
(HandleSelectionRequest, DrainQueuedTransfers)
(HandlePropertyDelete, HandlePropertyNotify): Allow duplicate
write transfers if the other is only waiting for property
deletion.
* xdata.c (ReceiveBody, HandleOfferResourceDestroy)
(AllocateTimestamp, CreateOffer, CreatePrimaryOffer, SendOffers)
(SendPrimaryOffers, HandleNewSelection, NoticeClipboardCleared)
(NoticePrimaryCleared, HandleSelectionNotify)
(XLNoteSourceDestroyed, NoteLocalSelectionBody)
(NoteLocalSelectionFooter): Adjust timestamp handling to use
wraparound-safe Timestamp and not Time.
This commit is contained in:
oldosfan 2022-10-16 03:31:52 +00:00
parent 08c70b8e3e
commit 5687fbca6d
10 changed files with 288 additions and 132 deletions

View file

@ -23,7 +23,8 @@ SRCS = 12to11.c run.c alloc.c fns.c output.c compositor.c \
icon_surface.c primary_selection.c renderer.c \
picture_renderer.c explicit_synchronization.c transform.c \
wp_viewporter.c decoration.c text_input.c \
single_pixel_buffer.c drm_lease.c pointer_constraints.c
single_pixel_buffer.c drm_lease.c pointer_constraints.c \
time.c
OBJS = 12to11.o run.o alloc.o fns.o output.o compositor.o \
surface.o region.o shm.o atoms.o subcompositor.o positioner.o \
@ -33,7 +34,8 @@ OBJS = 12to11.o run.o alloc.o fns.o output.o compositor.o \
icon_surface.o primary_selection.o renderer.o \
picture_renderer.o explicit_synchronization.o transform.o \
wp_viewporter.o decoration.o text_input.o \
single_pixel_buffer.o drm_lease.o pointer_constraints.o
single_pixel_buffer.o drm_lease.o pointer_constraints.o \
time.o
GENHEADERS = transfer_atoms.h