* frame_clock.c (StartFrame): If the end frame timer is being
used to, return True and reset end_frame_called.
* subcompositor.c (SubcompositorLookupView): Fix coordinate
lookup inside subsurfaces.
* xdg_surface.c (NoteFrame): Rearrange frame callback logic.
* compositor.h: Remove some unused prototypes.
* seat.c (DispatchButton): Remove redundant popup code as
owner-events is now handled correctly when a surface is not
found.
* xdg_popup.c (Detach, Dismiss, RecordGrabPending, CanDestroyPopup)
(Destroy, MaybeDismissPopup): Keep track of which grabbed popup
is topmost, and don't allow deleting non-topmost ones.
(HandleOneGenericEvent, XLHandleButtonForXdgPopups): Delete
functions.
* seat.c (InterpolateAxes): New function.
(HandleValuatorMotion): Do not report discreet scroll events for
version 8 clients when the event comes from a finger scrolling
source.
* compositor.h (struct _RoleFuncs)
(struct _XdgRoleImplementationFuncs): New role functions
`outputs_changed'.
* output.c (NoticeOutputsMaybeChanged): Call surface
outputs_changed hook if it exists.
(XLGetMaxOutputBounds): New function.
* xdg_surface.c (OutputsChanged): New function.
(XLGetXdgSurface): Add new role function.
* xdg_toplevel.c (CurrentWindowGeometry): New function.
(SendStates): Factor out geometry calculation to that function.
(SendOutputBounds): New function.
(Commit, OutputsChanged): Send output bounds whenever
appropriate.
(XLGetXdgToplevel): Add new impl func.
* data_device.c (XLClearForeignSelection):
* primary_selection.c (XLClearForeignPrimary): Clear the local
selection as well upon losing selection ownership.
* xdata.c (NoticeClipboardCleared, NoticePrimaryCleared): If a
local selection is in use, don't clear it upon selection clear
events with a timestamp identical to the time at which their
ownership was acquired. Explain why in a comment.
(HandleSelectionNotify): Always use the client time.
* compositor.h: Update prototypes.
* idle_inhibit.c (DetectSurfaceIdleInhibit): Handle subsurfaces;
when an inhibitor attached to a subsurface is displayed, check
if the subsurface's root is focused or not.
(CreateInhibitor): Likewise; handle subsurfaces specially.
* subcompositor.c (ViewisVisible): New function.
* subsurface.c (struct _Subsurface): New field `mapped'.
(Commit, Teardown): Update idle inhibition when the surface is
mapped or unmapped.
(XLSubsurfaceGetRoot): New function.
* 12to11.c (XLMain): Initialize idle inhibition.
* 12to11.man: Document new resources.
* Imakefile (SRCS): Add idle_inhibit.c and process.c.
(OBJS): Add idle_inhibit.o and process.o.
(idle-inhibit-unstable-v1): New scanner target.
* README: Explain what is now supported.
* compositor.h (enum _ClientDataType): Add IdleInhibitData.
(struct _Surface): Keep track of the number of focused seats.
* fns.c (UnblockSigbus): Fix unblocking of SIGBUS.
(XLAddFdFlag): New function.
* picture_renderer.c (GetRenderDevice):
* seat.c (WriteKeymap):
* drm_lease.c (AddProvider): Make various file descriptors
close-on-exec.
* run.c (RunStep): Change poll function to one that applies the
result of SIGCHLD.
* surface.c (XLSurfaceNoteFocus): Keep track of the number of
focused seats and call idle inhibit hooks when that changes.
Some window managers look up client PIDs via the resource
extension, which means killing stuck clients will actually kill
the protocol translator. Provide a mechanism to turn
_NET_WM_PING off.
* 12to11.man: Document new resource WmProtocols.wmProtocols.
* xdg_toplevel.c (Attach): Don't enable _NET_WM_PING if it is
turned off.
(ReadWmProtocolsString, ParseWmProtocols): New functions.
(XLInitXdgToplevels): Call them.
* 12to11.man: Update documentation.
* compositor.h (enum _FocusMode): New enum.
(struct _RoleFuncs, struct _XdgRoleImplementationFuncs): Add
`note_focus'.
* seat.c (CancelResizeOperation, InterceptButtonEventForResize):
Re-enter surface underneath pointer upon completion.
(InterceptResizeEvent): Accept subcompositor argument.
(NoticeDeviceDisabled): Unfocus surface upon the seat becoming
inert.
(SetFocusSurface): Call surface note_focus function.
(DispatchMotion, DispatchButton): Adjust calls to
InterceptResizeEvent.
(HandleResizeUnmapped): Adjust calls to CancelResizeOperation.
(DispatchBarrierHit): Use correct surface.
(FakePointerEdge): Leave any entered surface, as button events
will no longer be reported.
* surface.c (XLSurfaceNoteFocus): New function.
* xdg_surface.c (NoteFocus): New function.
(XLGetXdgSurface): Attach new function.
* xdg_toplevel.c (struct _XdgToplevel): New field
focus_seat_count.
(SendStates): Don't compute width and height when just sending
state.
(NoteFocus): Increment focus seat count.
(XLGetXdgToplevel): Attach new function if the window manager
does not support _NET_WM_STATE_FOCUSED.
* 12to11.c (XLMain): Initialize timestamp tracking.
* 12to11.man: Document *.useDirectPresentation resource.
* atoms.c (names): Add _NET_WM_PID and _NET_WM_PING.
(XLInitAtoms): Likewise.
* compositor.h (struct _RenderFuncs): Update doc of
cancel_presentation.
(enum _FrameMode): Add ModeNotifyDisablePresent.
(struct _XdgRoleList, struct _XdgWmBase): New structs.
* frame_clock.c (StartFrame): Return if the clock was really
started.
(XLFrameClockStartFrame): Likewise.
(XLInitFrameClock): Move Sync extension initialization to
InitTime.
* picture_renderer.c (struct _PresentCompletionCallback)
(struct _PictureTarget, InitSynchronizedPresentation)
(InitRenderFuncs, TargetFromDrawable, DestroyRenderTarget)
(PresentToWindow, CancelPresentationCallback, AddRenderFlag)
(HandlePresentCompleteNotify): Link structure on target. When
synchronized presentation is enabled, use the approriate msc to
present, and record the last known msc.
* run.c (HandleOneXEvent): Handle timestamp events.
* subcompositor.c (SubcompositorUpdate): Note frame with
ModeNotifyDisablePresent.
(FindSystemCounter, ValueToScalar, ScalarToValue, StartAlarms)
(HandleAlarmNotify, HandleOneXEventForTime, InitTime): New
functions.
* xdg_surface.c (struct _XdgRole): New fields `link' and
`wm_base'.
(struct _PingEvent): New structure.
(ReleaseBacking): Release all ping events.
(NoteFrame, WriteRedirectProperty): Allow unredirection under
some circumstances.
(XLGetXdgSurface): Attach wm base.
(XLXdgRoleHandlePing, ReplyPingEvent, XLXdgRoleReplyPing): New
function.
* xdg_toplevel.c (GetClientMachine): New function.
(WriteCredentialProperties): New function.
(Attach): Write credential properties.
(ReplyToPing): New function.
(XLHandleXEventForXdgToplevels): Handle ping events.
* xdg_wm.c (Pong): Reply to ping events once pong is received
from the client.
(HandleResourceDestroy): Detach all surfaces and run their ping
events.
(HandleBind): Allocate memory for XdgWmBase.
(XLXdgWmBaseSendPing): New function.
* 12to11.c (XLMain): Initialize keyboard shortcut inhibition.
* Imakefile (SRCS): Add keyboard_shortcuts_inhibit.c.
(OBJS): Add keyboard_shortcuts_inhibit.o.
* compositor.h (enum _ClientDataType): Add ShortcutInhibitData.
(struct _ClientData): New structure.
(struct _Surface): Make client data a linked list.
* pointer_constraints.c (Reconfine, XLPointerBarrierLeft)
(XLPointerBarrierCheck, XLPointerConstraintsSurfaceMovedTo):
Adjust to new client data storage approach.
* seat.c (struct _Seat): New fields `last_focus_time' and
`external_grab_time'.
(HandleBind, SelectDeviceEvents, SetFocusSurface): Use size_t to
represent mask length.
(DispatchFocusIn): Set last focus time.
(FakePointerEdge, XLSelectStandardEvents): Likewise; use size_t.
(XLSeatExplicitlyGrabSurface): Clear active grab.
(XLSeatBeginDrag): Use size_t to represent XI mask length.
(XLSeatApplyExternalGrab, XLSeatCancelExternalGrab): New
functions.
* subsurface.c (Teardown, XLSubsurfaceHandleParentCommit):
Adjust client data storage.
* surface.c (HandleSurfaceDestroy, XLSurfaceGetClientData):
Adjust client data storage to use a linked list.
(XLSurfaceFindClientData): New function.
* text_input.c (FilterInputCallback): Pacify cppcheck.
* compositor.h (XLAssert): Make a macro.
* dnd.c (HandleCirculateNotify, HandleReparentNotify): Fix NULL
checks.
(ReadProtocolProperties): Return suitable values for windows
that aren't in the cache.
* egl.c (HaveEglExtension1): Avoid redundant assignment to n.
* fns.c (XLAssert): Delete function.
* picture_renderer.c (GetRenderDevice): Remove redundant TODO.
(BufferFromShm): Assert that pict_format is non-NULL.
(ValidateShmParams): Likewise.
* pointer_constraints.c (ApplyLines): Remove redundant
assignment to i.
* renderer.c (PickRenderer): Fix build with non-GCC compilers.
* seat.c (ComputeHotspot): Return values when surface is NULL.
(XLSeatExplicitlyGrabSurface): Don't save keyboard grab state.
* shm.c (CreatePool): Close fd and return if pool could not be
allocated.
* subcompositor.c (GetContentScale): Move earlier.
(ViewDamageBuffer, ViewGetContentScale): New functions.
(SubcompositorUpdate): Remove redundant assignment.
* surface.c (ApplyViewport): Make dest_width and dest_height
double.
(ApplyDamage): Call ViewDamageBuffer.
(ScaleToWindow):
* text_input.c (HandleNewIM):
* xdg_toplevel.c (SendDecorationConfigure1, HandleWmStateChange)
(HandleAllowedActionsChange, HandleDecorationResourceDestroy):
Avoid NULL pointer dereferences in various cases.
* 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.
* compositor.h (struct _RenderFuncs): Accept damage in
finish_render.
* egl.c (EglInitFuncs): Load eglSwapBuffersWithDamageEXT.
(FinishRender): Accept damage and swap only damaged area if
possible.
(UpdateBuffer): Always update textures.
* explicit_synchronization.c (XLSyncRelease): Fix comment.
* renderer.c (RenderFinishRender): Accept damage argument.
* subcompositor.c (ViewWidth, ViewHeight): Fix computation of
destination width and height when there is a content scale;
those values have already been adjusted into window coordinates.
(SubcompositorUpdate, SubcompositorExpose): Pass damage to
RenderFinishRender.
* surface.c (ApplyDamage): Fix some aspects of damage
calculation.
* xdg_surface.c (IsRoleMapped): Fix crash when destroying client
with subsurfaces.
(Commit, NoteBounds, ResizeForMap, XLXdgRoleSendConfigure)
(XLXdgRoleSetBoundsSize, XLXdgRoleResizeForMap): Really fix
window state reverting to maximized during unmaximization. This
had two causes: the first was that the window geometry would be
set even before ack_configure, which was fixed by moving setting
the window geometry into NoteBounds, and the second was that
NoteBounds would sometimes resize the window back to its old
dimensions if a commit (or subsurface update) happened between
SetBoundsSize and the configure event arriving, also confusing
the window manager.
* xdg_toplevel.c (NoteConfigureTime): Fix coding style.
(HandleConfigureEvent): Call SetBoundsSize before posting the
configure event.
* 12to11.c (XLMain): Initialize window decoration.
* Imakefile (SRCS, OBJS): Add decoration.c and decoration.o.
* README: Document support for zdg_decoration_manager_v1.
* compositor.h: Update prototypes.
* xdg_toplevel.c (XdgDecoration, DecorationMode): New types.
(enum _DecorationMode): New structures.
(struct _XdgToplevel): New fields `decor' and `decoration'.
(struct _XdgDecoration): New struct.
(SendDecorationConfigure): New function.
(Commit): Apply decoration should it be dirty.
(HandleResourceDestroy): Detach decoration object.
(Destroy): Post error if decoration object would be orphaned.
(DestroyDecoration, SetMode, UnsetMode)
(HandleDecorationResourceDestroy, XLXdgToplevelGetDecoration):
New functions.