forked from 12to11/12to11
8 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
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. |
||
![]() |
5687fbca6d |
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. |
||
![]() |
98bbad068c |
Implement support for zwp_pointer_constraints_v1
* 12to11.c (XLMain): Initialize pointer constraints. * 12to11.conf: Add Emacs local variables section. * 12to11.man: Document new protocol. * Imakefile (SRCS): Add pointer_constraints.c. (OBJS): Add pointer_constraints.o. (pointer-constraints-unstable-v1): New scanner target. * README: Update accordingly. * compositor.h (enum _ClientDataType): Add PointerConfinementData. * dmabuf.c (struct _BufferParams): Rearrange for alignment. (struct _Buffer): Rearrange for alignment. * dnd.c (struct _DndState, struct _DragState) (struct _WindowCacheEntry): * seat.c (struct _SeatCursor, struct _ScrollValuator) (struct _SeatClientInfo, struct _Seat): Rearrange for alignment. (SendMotion): Do not send pointer motion to locked seats. (CheckPointerBarrier): New function. (EnteredSurface, DispatchMotion): Check for pointer confinement changes. (XLSeatGetPointerDevice): New function. (XLPointerGetSeat, XLSeatGetMouseData, XLSeatLockPointer) (XLSeatUnlockPointer): New functions. * shm.c (HandleResourceDestroy, CreatePool, HandleBind): Remove redundant `all_shms' field. * subcompositor.c (struct _View): New function `maybe_resized'. (ViewAfterSizeUpdate): Call it if necessary. (ViewAttachBuffer): Update a comment. (ViewSetMaybeResizedFunction): New function. * subsurface.c (MoveFractional): * surface.c (ApplyInputRegion, HandleScaleChanged, MaybeResized) (XLCreateSurface, XLWindowFromSurface): Update pointer constraints. * xdata.c (struct _ReadTargetsData, struct _ConversionTransferInfo) (struct _TargetMappingTable): Rearrange for alignment. (XLInitXData): Require fixes 1.5. * xdg_surface.c (struct _XdgRole): Rearrange fr alignment. (AckConfigure): Fix serial monotonicity checking. (NoteConfigure): Update pointer constraints. * xdg_toplevel.c (struct _XdgToplevel): Rearrange for alignment. |
||
![]() |
4d2e85d002 |
Implement wp_viewporter support and fix scaling for fractional values
* 12to11.c (XLMain): Initialize wp_viewporter. * Imakefile (ETAGS): Remove unused variable. (SRCS, OBJS): Add wp_viewporter.c and wp_viewporter.o. (GENHEADERS): Remove unnecessary headers. (viewporter): New scanner target. * README: Document support for wp_viewporter. * compositor.h (struct _ViewportExt): New forward declaration. (struct _DrawParams): New fields for cropping and stretching. (struct _RenderFuncs): Describe how composite works. (struct _BufferFuncs): Make update_buffer_for_damage take DrawParams as an argument. (struct _State): New fields for viewporting. (struct _Surface): New field `viewport' and associated input delta. (struct _XdgRoleImplementationFuncs): New field `is_window_mapped'. Do not commit while unmapped. * dmabuf.c (XLInitDmabuf): Remove outdated comment. * dnd.c (HandleMotion): Use TruncateWindowToSurface. * egl.c (struct _EglBuffer): Add 3x3 reverse transformation matrix. (struct _CompositeProgram): Rename `scale' to `source'. (Index): New macro. (PickBetterVisual, FindVisual): Compensate for EGL picking a non-RGBA visual. (EglCompileCompositeProgram): Look for source, not scale. (ComputeTransformMatrix): New function. (Composite): Compute transformation matrix and draw using that. (BufferFromDmaBuf, BufferFromShm): Copy identity transform and stop setting scale. (ReverseTransformToBox): New function. (UpdateShmBufferIncrementally): Accept DrawParams and invert damage according to that. (UpdateBuffer, UpdateBufferForDamage): Pass draw params to the incremental buffer update function. * fns.c (XLExtendRegion): New function. * frame_clock.c (CurrentHighPrecisionTimestamp): Delete function. (HighPrecisionTimestamp, HighPrecisionTimestamp32): New functions. (PostEndFrame): Handle X server time truncation to 32 bits. (XLFrameClockFreeze): Remove trailing whitespace. * picture_renderer.c (GetSourceX, GetSourceY, CompareStretch): New functions. (MaybeApplyTransform): Check more values before applying transformations. Then, handle stretch and offset. * positioner.c (GetAdjustmentOffset, ApplyConstraintAdjustment) (XLPositionerCalculateGeometry): Scale coordinates using new functions. * renderer.c (RenderUpdateBufferForDamage): Accept DrawParams instead of scale. * shaders.txt (Composite Rectangle Fragment Shader RGBA) (Composite Rectangle Fragment Shader RGBX) (Composite Rectangle Fragment Shader External): Stop transforming texcoords. (Composite Rectangle Vertex Shader): Transform texcoords in the vertex shader instead. * subcompositor.c (IsViewported, SetViewported, ClearViewported): New functions. (struct _View): New fields for tracking viewports and fractional offsets. (ViewAttachBuffer): Do not garbage upon buffer size change if a viewport is set. (ViewMoveFractional): New function. (ViewDamage): Describe what the damage is and is not transformed by. (GetContentScale): New function. (ViewWidth, ViewHeight): Apply viewport. (ViewSetScale): Use ViewAfterSizeUpdate instead of duplicating code. (ViewSetViewport, ViewClearViewport): New functions. (ViewComputeTransform): Compute transform for viewports. New arg draw; use it to determine whether or not to include a fractional offset. (IntersectBoxes): Fix intersection calculation. (SubcompositorUpdate): Don't keep calling ViewWidth and ViewHeight in a loop. (SubcompositorExpose): Adjust for changes to buffer damage uploading. * subsurface.c (MoveFractional): New function. Handle fractional offsets after scaling. (MaybeUpdateOutputs, AfterParentCommit, Setup, Rescale): Use that function to move the subsurface instead. * surface.c (ApplyScale): Update comment. (ApplyViewport, CheckViewportValues): New functions. (HandleScaleChanged): Apply the viewport as well upon scale change. (ApplyDamage): Improve damage calculation for viewported surfaces. (SavePendingState, InternalCommit): Save and commit viewport state; check old values upon buffer commit. (InitState): Initialize viewport to initial values. (XLSurfaceRunFrameCallbacks): Handle overflows of 32-bit time at the 49-day mark. (SurfaceToWindow, ScaleToWindow, WindowToSurface, ScaleToSurface) (TruncateScaleToWindow, TruncateScaleToWindow) (TruncateWindowToSurface, TruncateScaleToSurface): New functions for handling scale. * xdg_popup.c (MoveWindow, IsWindowMapped, XLGetXdgPopup): * xdg_surface.c (IsRoleMapped, Commit, Subframe) (GetResizeDimensions, XLXdgRoleCalcNewWindowSize): * xdg_toplevel.c (IsWindowMapped, NoteConfigureTime, SendStates) (RecordStateSize, HandleWindowGeometryChange, NoteWindowPreResize) (XLGetXdgToplevel): Use them instead of manually multiplying with the factor. |
||
![]() |
7f33ba9ae3 |
Improve handling buffer scale factors
* compositor.h (struct _DrawParams): New structure. (struct _RenderFuncs): Remove `apply_transform' and `reset_transform'. Make `composite' accept DrawParams. (struct _BufferFuncs): Give scale to update_buffer_for_damage. (struct _Surface): New field `factor'. (struct _RoleFuncs): New callback `parent_rescale'. * dnd.c (HandleMotion): Fix some aspects of scale handling. * egl.c (struct _EglBuffer): Remove `scale' field. (ApplyTransform): Delete function. (Composite): Pass scale specified in params as uniform to program. (ResetTransform): Delete function. (egl_render_funcs): Delete apply_transform and reset_transform. (BufferFromDmaBuf, BufferFromShm): Stop setting scale attribute. (UpdateBufferForDamage): Accept new arg `scale' and use it. * picture_renderer.c (struct _PictureBuffer): New structure. Store picture and last seen draw parameters. (ApplyTransform): Delete function. (GetScale): New function. (MaybeApplyTransform): New function. (Composite): Recompute and set pictures if draw parameters change. (ResetTransform): Delete function. (picture_render_funcs): Remove unused hooks. (BufferFromDmaBuf, FinishDmaBufRecord, BufferFromShm) (FreeShmBuffer, FreeDmabufBuffer): Replace xid with wrapper structure. * positioner.c (TryFlipX, TryFlipY, GetAdjustmentOffset) (ApplyConstraintAdjustment): * renderer.c (RenderApplyTransform, RenderComposite) (RenderResetTransform, RenderFinishRender) (RenderUpdateBufferForDamage): * seat.c (UpdateCursorOutput, ComputeHotspot, HandleRawButton) (TransformToView, DispatchEntryExit, DispatchMotion, CancelGrab) (DispatchButton, ForceEntry): * subcompositor.c (GetTxTy, ViewApplyTransform, ViewHaveTransform) (ViewComputeTransform, SubcompositorUpdate, SubcompositorExpose): * subsurface.c (MaybeUpdateOutputs, AfterParentCommit, Rescale) (Teardown, GetSubsurface, XLUpdateOutputsForChildren): Use surface-specific scale factors. * surface.c (ApplyScale): Compute a new scale factor to convert between window and surface scale. (ApplyOpaqueRegion, ApplyInputRegion, HandleScaleChanged) (ApplySurfaceDamage, InternalCommit, XLCreateSurface): Use new factors instead. * xdg_popup.c (MoveWindow): * xdg_surface.c (GetResizeDimensions, XLXdgRoleCalcNewWindowSize): * xdg_toplevel.c (NoteConfigureTime, SendStates, RecordStateSize) (HandleWindowGeometryChange, NoteWindowPreResize): Use surface-specific scale factors. |
||
![]() |
007ba43dba |
Resolve some TODOs
* 12to11.c (PickVisual): Remove redundant TODOs. * dmabuf.c (CreateHeader): Handle flags like wlroots. * dnd.c (HandleXdndPositionEvent): * subsurface.c: * xdg_surface.c (CurrentRootPosition, XLGetXdgSurface): Remove outdated TODOs. |
||
![]() |
112c4d4fbe |
Various improvements to primary selections and resize handling
* 12to11.man: Document new environment variables. * Imakefile ($(OBJS)): Also depend on protocol headers. * README: Update implementation status. * compositor.h: Update prototypes. * data_device.c (DataOfferSetActions): Fix error sent when the offer is invalid. * dnd.c: Remove out of date comment. * primary_selection.c (struct _PDataSource): Move declaration to compositor.h. New field `atom_types'. (Offer): Record atom types as well. (HandleSourceResourceDestroy): Maybe disown the primary selection, and free offered MIME types. (XLResourceFromPDataSource, XLPDataSourceHasAtomTarget) (XLPDataSourceHasTarget, XLPDataSourceTargetCount) (XLPDataSourceGetTargets): New functions. (UpdateForSingleReference): Handle foreign selections correctly. (SetSelection): Try to own the X selection. (XLSetForeignPrimary, XLClearForeignPrimary): New functions. * seat.c (XLSeatResizeInProgress): New function. * xdata.c (struct _ReadTargetsData): New field `selection'. (struct _DataConversion): Pass send function and source resource to conversion function. (last_primary_time): New timestamp variable. (x_primary_targets, num_x_primary_targets, primary_data_source): New variables. (HasSelectionTarget, FindTranslationForMimeType): Accept arg `is_primary', meaning that the primary selection data should be used instead. (ReceiveBody): Extract generic code from Receive. (Receive): Replace with above macro. (Finish, SetActions): Correctly post errors on DND-specific actions. (ReceivePrimary): New function. (primary_offer_impl): New interface implementation. (CreatePrimaryOffer): New function. (SendOffers1): Extract generic code from SendOffers. (SendOffers, SendPrimaryOffers): Reimplement in terms of SendOffers1. (HandleNewSelection): Handle PRIMARY selection changes. (TargetsFinishCallback): Pass selection to HandleNewSelection. (NoticeClipboardChanged): Set TargetsReadData selection. (NoticePrimaryChanged): New function. (NoticeClipboardCleared): Free unused data. (NoticePrimaryCleared): New function. (HandleSelectionNotify): Handle notifications for both CLIPBOARD and PRIMARY. (MimeTypeFromTarget, TypeFromTarget): Accept argument `primary', meaning to use the primary selection when determining whether or not to call a conversion callback. (GetClipboardCallback): Pass resource and functions to the clipboard callback. (GetConversionCallback): Update to use provided functions and resource. (GetDragCallback, XLNoteSourceDestroyed): Fix typos in debug string. (XLNotePrimaryDestroyed): New function. (NoteLocalSelectionBody, NoteLocalSelectionFooter): Extract selection-generic code from XLNoteLocalSelection. (XLNoteLocalSelection): Reimplement in terms of the above two macros. (XLNoteLocalPrimary, GetPrimaryCallback): New functions. (XLInitXData): Select for selection input from XA_PRIMARY as well. * xdg_surface.c (AckConfigure): Improve debug code. (Commit): Clear that flag. (NoteBounds): If that flag is set, return. (HandleFreeze): Assume a configure event will arrive after a sync request; set flags accordingly. (XLGetXdgSurface): Add HandleFreeze. (XLXdgRoleSendConfigure): Clear some flags and add new state flag `StateWaitingForAckCommit'. Set it. It means that no commit has yet happened after ack_configure. (XLXdgRoleNoteRejectedConfigure): New function. Clear flags if the configure event following _NET_WM_SYNC_REQUEST was rejected. * xdg_toplevel.c (struct _XdgToplevel): New state flags StatePendingResize, StateConfigureSize, StatePendingConfigureStates. New field `configuration_timer'. (batch_state_changes): New flag. (DestroyBacking): Clear configuration timer. (NoteConfigureTime): New function; apply queued state changes. (HandleWmStateChange, HandleConfigureEvent): By default, queue state changes and configure events so they can be applied in one go. (Unmap): Clear delayed configuration timer. (Commit, CommitInsideFrame, PostResize): Improve movement delta adjustment for min_width and min_height, and queue pending motion for after ack_configure. (XLInitXdgToplevels): Set `batch_state_changes' depending on the DIRECT_STATE_CHANGES' environment variable. |
||
![]() |
528f7ba858 | Import files |