Commit graph

91 commits

Author SHA1 Message Date
hujianwei
2230f5e406 Check in changes to core files used for tests
* 12to11.c (XLMain): Initialize tests.
* 12to11.conf (WAYLAND_CLIENT, PNG): New libraries
(BuildTests): New define.
* Imakefile: Add the ability to build tests in a subdirectory.
* compositor.c (HandleResourceDestroy, HandleBind): Remove
unused list.
* compositor.h (enum _RoleType): Add TestSurfaceType.
* run.c (HandleOneXEvent): Handle events for test surfaces.
* xdg_surface.c (FreeRecords): Cancel idle callback if
necessary.
(BufferIdleCallback): Remove extra whitespace.
(XLGetXdgSurface): Fix coding style.
2022-11-04 02:39:50 +00:00
hujianwei
4e9a442856 Check in C and XML files for tests
* 12to11-test.xml:
* buffer_release.c:
* test.c: New files.
2022-11-04 02:25:44 +00:00
hujianwei
0a68122e52 Fix damage unioning upon ViewMove
* subcompositor.c (ViewMove): Union previous damage at right
place.
2022-11-03 04:06:28 +00:00
hujianwei
6ad5901c97 Fix some positioner bugs
* positioner.c (DebugPrint): New macro.
(CalculatePosition, TrySlideX): Add more instrumentation.  Add
defaults when no gravity is specified.
(TrySlideY): Add defaults when no gravity is specified.
(TryFlipX): Fix incorrect inversion of AnchorGravityBottomRight.
(ApplyConstraintAdjustment): Add more instrumentation.
2022-11-02 08:00:28 +00:00
hujianwei
a7a17e02fa Implement damage simplification and some more optimizations for Firefox
* compositor.h (Rectangle): New struct for non-box rectangles.

* subcompositor.c (struct _Subcompositor): New fields
`last_update_max_x' and `last_update_max_y'.
(IsDamageComplicated, SimplifyDamage): Add simple damage
simplifier.
(SubcompositorUpdateBounds, SubcompositorUpdateBoundsForInsert)
(ViewAfterSizeUpdate, ViewAttachBuffer, ViewMove): Avoid
garbaging subcompositor on max_x and max_y changes for Firefox
Nightly.
(SubcompositorComposite): Simplify overcomplex damage.
(SubcompositorUpdate): Garbage subcompositor on max size change.
2022-11-02 06:31:20 +00:00
hujianwei
8eebb04502 Fix rotating transforms on EGL
* egl.c (UpdateBuffer): Fix coding style.
* subcompositor.c (IsPreviouslyTransformed)
(SetPreviouslyTransformed, ClearPreviouslyTransformed): New
macros.
(ViewSetTransform): Mark damage as untrusted until the next time
the buffer is uploaded.
(ApplyBufferDamage, ApplyUntransformedDamage): Upload entire
buffer upon untrusted damage.
2022-11-02 02:46:43 +00:00
hujianwei
168ce048be Implement support for pointer-gestures-unstable-v1
* 12to11.c (XLMain): Initialize pointer gestures.
* 12to11.man (supported): Document that pointer gestures are now
supported.
* Imakefile (SRCS): Add pointer_gestures.c.
(OBJS): Add pointer_gestures.o.
(pointer-gestures-unstable-v1): New scanner target.
* README (supported): Documentation changes.
* compositor.h: Update prototypes.  Export xi2_major and
xi2_minor from seat.c.
* seat.c (struct _SwipeGesture, struct _PinchGesture): New
structures.
(struct _SeatClientInfo, CreateSeatClientInfo): Initialize those
structures in the seat client info.
(EnteredSurface): Clear any gestures if the surface changed.
(SendGesturePinchBegin, SendGesturePinchUpdate)
(SendGesturePinchEnd, DispatchGesturePinch, SendGestureSwipeBegin)
(SendGestureSwipeUpdate, SendGestureSwipeEnd,
DispatchGestureEnd): New functions.
(XLGetGEWindowForSeats, XLSelectStandardEvents)
(XLDispatchGEForSeats): Handle and select for various kinds of
XI events.
(XLInitSeats): Ask for XI 2.4.
(XLSeatGetSwipeGesture, XLSeatGetPinchGesture)
(XLSeatDestroySwipeGesture, XLSeatDestroyPinchGesture): New
functions.
2022-11-01 11:02:36 +00:00
hujianwei
000231fbb2 Check in new files for pointer gestures
* pointer-gestures-unstable-v1.xml:
* pointer_gestures.c: New files.
2022-11-01 10:56:52 +00:00
hujianwei
743d363ad2 Fix race condition between ConfigureNotify and PresentCompleteNotify
* compositor.h: Update prototypes.
* frame_clock.c (struct _FrameClock): New fields for keeping
track of configure events.
(FreezeForValue): If the freeze is outdated, bring the counter
up to date now.
(XLFrameClockHandleFrameEvent): Set the number of configure
events that should have been considered by the frame clock upon
processing.
(XLFrameClockNoteConfigure): New function.
* picture_renderer.c (SwapBackBuffers): Remove outdated comment.
* xdg_surface.c (NoteConfigure, XLXdgRoleReconstrain):
* xdg_toplevel.c (NoteWindowResized): Note frame clock
configure.
2022-11-01 01:25:42 +00:00
hujianwei
da212fe729 Fix problems seen with some programs in the wild
* subcompositor.c (ViewAttachBuffer): Correctly determine when
to recompute view bounds.
* subsurface.c (AfterParentCommit): Unskip view first, and
commit pending state second.  Explain why.
* xdg_toplevel.c (Unmap, Map): Add new "initial configure" flag.
(Commit): Use it instead of testing current_buffer.  Explain
why.
(XLGetXdgToplevel): Set that flag by default.
2022-10-30 13:53:10 +00:00
hujianwei
0c3e5a0e7d Fix subsurface PlaceBelow relationship checks
* subsurface.c (PlaceBelow): Fix conditions in check.
2022-10-30 11:38:41 +00:00
hujianwei
3732001e57 ; * picture_renderer.c (MaybeApplyTransform): Check in missed change. 2022-10-30 11:34:02 +00:00
hujianwei
e001d7cf69 Fix and implement transforms in the EGL renderer
* 12to11.c (XLMain): Initialize Xlib threads.
* compositor.h: Update prototype of ApplyInverseTransform.
* egl.c (ComputeTransformMatrix): Handle transforms.
(Composite): Ensure textures if none were generated.
(FinishRender): Take callback and data and return NULL key.
(UpdateBuffer): Handle transforms by uploading everything.
Suboptimal!
(IsBufferOpaque): New function.
(egl_buffer_funcs): Add it.
* picture_renderer.c (MaybeApplyTransform): Add some comments.
* subcompositor.c (TransformBufferDamage): Avoid inverting
damage.
(ViewDamageBuffer): Directly apply untransformed buffer damage.
(ApplyUntransformedDamage): New function.
* transform.c (MatrixRotate): Fix minor row ordering error.
(ApplyInverseTransform): Adjust accordingly.
2022-10-30 09:51:54 +00:00
hujianwei
b8d26761c1 Fix crash during subsurface destruction
* subcompositor.c (ViewUnparent): Don't consider view as
attached if there is no subcompositor.
2022-10-30 02:35:48 +00:00
hujianwei
6f3941866a Apply subcompositor optimizations for Firefox Nightly
* subcompositor.c (struct _View): Fix comment.
(struct _Subcompositor): New field `additional_damage'.
(MakeSubcompositor): Initialize that field.
(SubcompositorUpdateBounds, SubcompositorUpdateBoundsForInsert):
Only garbage subcompositor if bounds really changed.
(SkipSlug): Move definition earlier.
(ViewUnionInferiorBounds, DamageIncludingInferiors): New
functions.
(SubcompositorInsert, SubcompositorInsertBefore)
(SubcompositorInsertAfter, ViewInsert, ViewInsertAfter)
(ViewInsertBefore, ViewUnparent, ViewAfterSizeUpdate)
(ViewAttachBuffer, ViewMove, ViewMoveFractional, ViewUnskip)
(ViewSetScale, ViewSetTransform, ViewSetViewport)
(ViewClearViewport, SubcompositorComposite, SubcompositorRedraw)
(SubcompositorFree): Handle damage in a more detailed fashion;
try to avoid garbaging upon subsurface movement, mapping, or
unmapping.
* wp_viewporter.c (SetSource, SetDestination): Don't set pending
if things didn't actually change.
2022-10-29 11:15:40 +00:00
hujianwei
a05a62d9d0 Rework subcompositor damage culling and use a back buffer in the pict renderer
Note that the EGL renderer has been broken by these changes.

* compositor.h (struct _RenderFuncs): Change arguments to
`finish_render'.  Add `cancel_completion_callback'.  Remove
`cancel_presentation'.
(struct _BufferFuncs): Add `is_buffer_opaque'.
* egl.c: Note that the EGL renderer is currently broken.
* fence_ring.c (FenceFree, struct _Fence, GetFence, FenceAwait)
(FenceToXFence): Repurpose fence code as a generic allocator of
fences.
* frame_clock.c (EndFrame): Adjust calculation of even value.
* picture_renderer.c (struct _BufferActivityRecord): Remove
`fence'.
(struct _PictureBuffer): Remove unused field.
(struct _PresentCompletionCallback): Remove unused fields
linking it to the target.
(struct _BackBuffer): New structure.
(IsBufferBusy, SetBufferBusy, ClearBufferBusy): New macros.
(struct _PictureTarget): Add back buffer and GC fields.
(use_sync_fences): Remove variable.
(RecordBufferActivity): Don't take fence.
(UnlinkActivityRecord): Don't wait on fence.
(FreeBackBuffer, FreeBackBuffers, CreateBackBuffer)
(MakePresentationCallback, SwapBackBuffers)
(SwapBackBuffersWithCopy, MaybeAwaitBuffer, GetNextBackBuffer)
(EnsurePicture): New functions.
(TargetFromDrawable): Don't create picture for window targets,
and create GC for those.
(NoteTargetSize): Free back buffers instead of creating
presentation windows.
(DestroyRenderTarget): Free back buffers.
(ViewContainsExtents): Delete function.
(FinishRender): Swap back buffers and handle callbacks.
(CancelCompletionCallback): New function.
(TargetAge): Implement accordingly.
(PresentToWindow, CancelPresentationCallback): Present to the
regular window instead of a separate ``presentation window''.
(CancelPresentation): Remove function.
(picture_render_funcs): Add CancelCompletionCallback; remove
NeverAges and CancelPresentation.
(BufferFromDmaBuf, FinishDmaBufRecord, BufferFromShm): Set
opaque flag accordingly.
(IsBufferOpaque): New function.
(picture_buffer_funcs): Add IsBufferOpaque.
(HandlePresentCompleteNotify, HandlePresentIdleNotify): Handle
back buffer release.

* renderer.c (RenderFinishRender, RenderCancelCompletionCallback)
(RenderCancelPresentation, RenderIsBufferOpaque): Adjust
accordingly.
* seat.c (InterpolateAxes): Fix NULL-pointer dereference.

* subcompositor.c (SetFrozen, IsFrozen): Get rid of unused
state.
(struct _View): Cache the width and height.  Add cull_region
field.
(struct _Subcompositor): Add `render_key' field.
(ViewAfterSizeUpdate): Set cached width and height.
(ViewAttachBuffer): Correctly handle size changes.
(ViewDamage): Apply buffer damage.
(ViewDamageBuffer): use ViewDamage.
(ApplyBufferDamage): New function.:(FillBoxesWithTransparency,
ViewContainsExtents, IntersectBoxes): Delete unused functions.
(RenderCompletedCallback): New function.
(NoViewsAfter): Delete function.
(SkipSlug): New slug.
(SubcompositorUpdateAncillary, TryPresent, AnyParentUnmapped)
(DoCull, DrawBackground, CompositeSingleView, InitBackground)
(SubcompositorComposite1, SubcompositorComposite): New
functions.  Implement new redisplay logic here.
(SubcompositorUpdate, CopyRegion): New function.
(SubcompositorExpose, SubcompositorFree): Clear render callback
if set.
(SubcompositorLookupView): Use cached width and height.
(SubcompositorFreeze, SubcompositorUnfreeze): Remove unused
functions.
* time.c (InitTime): Fix use of uninitialized value initializing
the Sync extension.
* transform.c (TransformBox): Pacify compiler warning.
2022-10-29 05:21:35 +00:00
hujianwei
0b5d44537b Allow the user to manually specify format modifiers
* 12to11.conf (DRMFOURCCH): New variable.
* 12to11.man: Document new resource.
* Imakefile (GENHEADERS): Add
drm_modifiers.h.:(drm_modifiers.h): New target.
(cleandir): Clean up.
* compositor.h: Update prototypes.
* fns.c (TransformBox): Move to transform.c.
* frame_clock.c (PostEndFrame): Use 200 us, since 100 us is not
always enough.
* picture_renderer.c (struct _DrmModifierName): New structure.
(known_modifiers): New array.
(AddAdditionalModifier, ParseAdditionalModifiers)
(InitAdditionalModifiers): New functions.
(InitRenderFuncs): Call them.
(ApplyInverseTransform): Accept buffer width and height instead
of PictureBuffer.  Move to transform.c.
(MaybeApplyTransform): Adjust calls.
(FindSupportedModifiers, InitDrmFormats): Stop adding the linear
format by default, and let the user specify it instead.
* subcompositor.c (InvertTransform): Move to transform.c.
* svnignore.txt: Add new generated header.
* transform.c (ApplyInverseTransform, TransformBox)
(InvertTransform): Move some functions here as they will be used
in the EGL backend.
2022-10-26 06:48:59 +00:00
hujianwei
8e4391f941 Check in new file for generating modifier list
* modifiers.awk: New file.
2022-10-26 06:44:31 +00:00
hujianwei
768f2d98b5 Implement buffer transforms on the XRender backend
* 12to11.conf (XSHMFENCELIB): New library.
* 12to11.man: Document that surface transforms are now
supported.
* Imakefile (LOCAL_LIBRARIES): Add XSHMFENCELIB.
(SRCS, OBJS): Add fence_ring.c and fence_ring.o.
* README: Require xshmfence.
* buffer.c: Include stdio.h.
* compositor.h (enum _BufferTransform): New enum.
(struct _DrawParams): Add TransformSet.
(RotatesDimensions): New macro.
(struct _State): Add buffer transform.
* egl.c: Add TODO for buffer transforms.
* fns.c (TransformBox, XLTransformRegion): New functions.
* picture_renderer.c (struct _BufferActivityRecord): New field
`fence'.
(struct _PictureBuffer): Add buffer width and height.
(struct _DmaBufRecord, RecordBufferActivity, UnlinkActivityRecord)
(DestroyRenderTarget, GetBufferTransform, MaybeApplyTransform)
(Composite, FinishRender, BufferFromDmaBuf, FinishDmaBufRecord)
(BufferFromDmaBufAsync, BufferFromShm, FreeAnyBuffer): Record
width and height, and handle transforms; add some disabled
fencing code.
* subcompositor.c (struct _View): Add transform.  Rearrange
fields for alignment.
(MakeView): Initialize transform.
(InvertTransform): New function.
(BufferWidthAfterTransform, BufferHeightAfterTransform)
(TransformBufferDamage): New functions.
(ViewDamageBuffer): Transform buffer damage if necessary.
(ViewWidth, ViewHeight): Use width and height after transform.
(ViewComputeTransform): Apply transform.
* surface.c (ApplyBufferTransform): New function.
(ApplyViewport, CheckViewportValues, SavePendingState)
(InternalCommit, GetBufferTransform, SetBufferTransform,
InitState): Initialize and handle transforms.
(XLStateAttachBuffer, XLStateDetachBuffer): Delete unused
functions.
* time.c (InitTime): Require a newer version of the Sync
extension.
* transform.c (MatrixRotate, MatrixMirrorHorizontal): New
functions.
2022-10-25 10:15:28 +00:00
hujianwei
65a2e4de5b Check in unrelated fence code
* fence_ring.c: New file.
2022-10-25 10:02:14 +00:00
hujianwei
a63a7ebdd6 Fix frame timing prediction algorithm
* compositor.h (struct _RoleFuncs): Replace subframe with
`subsurface_update'.
* dmabuf.c (ExistingModifier):
* fns.c (RebalanceBusfault): Pacify various compiler warnings.
* frame_clock.c (struct _FrameClock, PostEndFrame)
(XLFrameClockHandleFrameEvent, XLMakeFrameClockForWindow): Fix
presentation logic.  First, store absolute presentation
timestamps.  Secondly, use the frame_delay to adjust timestamps.
* icon_surface.c (Subframe): Delete function.
(SubsurfaceUpdate): New function.
(EndSubframe): Delete function.
(XLGetIconSurface): Change attached functions.
* picture_renderer.c (struct _PictureTarget, RecordBufferActivity)
(HandleActivityEvent, DestroyRenderTarget)
(FillBoxesWithTransparency, Composite, FinishRender)
(picture_render_funcs): Send roundtrip event only once, and
flush upon FinishRender.
* process.c (ProcessPendingDescriptions, RunProcess,
ProcessPoll): Don't block signals where unnecessary.
* seat.c (struct _Seat, CursorFromRole, ReleaseSeat, Subframe)
(EndSubframe, MakeCurrentCursor, HandleBind, MakeSeatForDevicePair)
(StartResizeTracking):
* subsurface.c (Subframe, EndSubframe, Commit, Teardown)
(GetSubsurface):
* surface.c (HandleScaleChanged):
* xdg_surface.c (CheckFrame, Commit, Subframe, SubsurfaceUpdate)
(EndSubframe, XLGetXdgSurface):
* xdg_toplevel.c (Unmap): Adjust for above changes, and fix some
compiler warnings.
2022-10-24 03:45:57 +00:00
hujianwei
491f1a6a1c Slightly improve frame prediction cutoff point
* frame_clock.c (PostEndFrame): Use 5000 us by default, only
reverting to the old algorithm if the presentation time is less
than that.
2022-10-23 13:18:32 +00:00
hujianwei
19f6f6454c Fix problems found with Firefox Nightly
* subsurface.c (Teardown): Correctly free subsurface actions.
* xdg_surface.c (NoteFrame): Fix conditions to avoid frame
callback spam.
2022-10-23 11:56:35 +00:00
hujianwei
0612e0df6e Fix display of deferred frames
* subcompositor.c (SubcompositorUpdate): Always call note frame
callback.
* xdg_surface.c (MaybeRunLateFrame): New function.
(AfterFrame, NoteFrame): Potentially run late frames.
2022-10-23 08:47:27 +00:00
hujianwei
76e40a1a74 Fix more instances of flicker in subsurfaces
* 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.
2022-10-23 07:35:18 +00:00
hujianwei
f83f80abd8 Fix reusing subsurfaces and XDG surfaces after roles are destroyed
* subsurface.c (DestroySubsurface):
* xdg_surface.c (Destroy): Release/detach role from surface.
2022-10-23 06:38:04 +00:00
hujianwei
ef7f5537f9 Fix thinko in X clipboard setup code
* xdata.c (XLInitXData): Ignore, not block, SIGPIPE.
2022-10-23 05:41:59 +00:00
hujianwei
a0d2d34f0f Improve xdg_popup error checking and remove redundant code
* 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.
2022-10-23 05:11:11 +00:00
hujianwei
a220f29723 Fix scroll axis interpolation with the libinput driver
* atoms.c (names, XLInitAtoms): Intern "libinput Scrolling Pixel
Distance".
* compositor.h: Update atom.
* seat.c (struct _DeviceInfo): New field
`scroll_pixel_distance'.
(UpdateScrollPixelDistance): New function.
(RecordDeviceInformation, HandlePropertyChanged): Update that
field whenever necessary.
(InterpolateAxes, SendScrollAxis): Fix NULL pointer dereference
and always interpolate axes by the scroll pixel distance
whenever available.
(HandleValuatorMotion): Don't scale axis values by 10.
2022-10-23 02:17:00 +00:00
hujianwei
b0db38043a Improve scroll axis reporting behavior
* 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.
2022-10-23 01:15:43 +00:00
hujianwei
276445926e Send correct surface bounds to xdg_toplevel resources
* 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.
2022-10-23 01:07:34 +00:00
hujianwei
6e062e2e2f Fix selection timestamp handling problems
* 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.
2022-10-22 07:40:26 +00:00
hujianwei
3fe08b5c7c Fix various problems encountered
* egl.c (AddShmFormat): Fix coding style.
* explicit_synchronization.c (HandleSurfaceCommit): Remove
redundant NULL check.
* run.c (RunStep): Flush clients after completing selection
transfers.  Fix sizeof when allocating pollfds.
* seat.c (CancelResizeOperation): Avoid NULL-pointer dereference
when subcompositor is not specified.
* shm.c (DereferencePool, CreatePool): Remove redundant checks
of pool->size; it can never be zero.
* subsurface.c (Setup): Remove redundant NULL check.
* text_input.c (SetCursorRectangle): Fix some statements.
(FindTextSections, EncodeIMString, CheckStyles, ConvertString)
(PreeditString, CommitString): Fix usage of format modifiers in
debug trace code.
* xdata.c (HandleSelectionNotify): Use selection time, not event
time.
* xdg_popup.c (MoveWindow, InternalReposition): Remove various
redundant checks.
2022-10-22 07:13:21 +00:00
hujianwei
c4f2e07a4b Detect idle inhibition on subsurfaces
* 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.
2022-10-22 05:48:23 +00:00
hujianwei
edfdc76f6d Implement idle_inhibit_unstable_v1
* 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.
2022-10-22 04:47:51 +00:00
hujianwei
0b2a069ac5 Check in files for idle inhibition
* idle-inhibit-unstable-v1.xml:
* idle_inhibit.c:
* process.c: New files.
2022-10-22 04:43:14 +00:00
hujianwei
7d11425454 Update toplevel surface outputs upon resize
* xdg_surface.c (NoteBounds): Obtain root window position and
update the output set upon a resize.
2022-10-21 04:23:06 +00:00
hujianwei
584ea0ac4d Fix output computation when width and height are unspecified
* output.c (XLUpdateSurfaceOutputs): Calculate width and height
before checking if the surface is in the output region.
2022-10-21 03:29:15 +00:00
hujianwei
a866c4068a Fix calculation of microsecond time in relative pointer events
* src/relative_pointer.c (XLRelativePointerSendRelativeMotion):
Fix computation of time_lo.
2022-10-20 12:44:59 +00:00
hujianwei
5cec85b987 ; * svnignore.txt: Add Valgrind output files. 2022-10-20 11:08:40 +00:00
hujianwei
58a954db7f Allow disabling _NET_WM_PING
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.
2022-10-20 11:07:46 +00:00
hujianwei
e0e1a6ecb1 Fix sending state events while resize is in progress
* xdg_surface.c (SetWindowGeometry, NoteBounds): Allow window
geometry changes even if window didn't resize.
* xdg_toplevel.c (NoteConfigureTime, SendStates): Always use
current toplevel width and height to compute desired window
geometry.
(Map): Remove unused flag.
2022-10-20 10:42:43 +00:00
hujianwei
8d310f9ab3 Implement wl_seat version 8
* 12to11.man:
* README: Update documentation.
* seat.c (MakeSeatForDevicePair): Support version 8.
(HandleRawButton): Minor markup changes.
(DispatchEntryExit): Send motion event for ungrab events.
(SendScrollAxis): Send value120 events when supported by the
client.
* subsurface.c (GetRootSurface): New function.
(GetSubsurface): Disallow invalid parent/child combinations.
2022-10-20 07:53:56 +00:00
hujianwei
b515414946 Improve behavior under older window managers
* 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.
2022-10-20 06:56:03 +00:00
oldosfan
d38093f59e ; * COPYING: Check in new file. 2022-10-20 04:15:16 +00:00
oldosfan
a12570b7a7 ; * svnignore.txt: Check in new file. 2022-10-20 04:10:11 +00:00
oldosfan
d143b45496 Implement _NET_WM_PING and some WIP Present code
* 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.
2022-10-20 03:55:19 +00:00
oldosfan
17571b6f97 Implement keyboard shortcut inhibition
* 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.
2022-10-18 05:35:52 +00:00
oldosfan
f683d8c30f Check in files for keyboard shortcut inhibition
* keyboard-shortcuts-inhibit-unstable-v1.xml:
* keyboard_shortcuts_inhibit.c: New files.
2022-10-18 05:21:33 +00:00
oldosfan
167001689a Fix bugs discovered by static analyzers and fix buffer damage calculation
* 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.
2022-10-17 04:44:49 +00:00