Commit graph

14 commits

Author SHA1 Message Date
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
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
oldosfan
c1959e5f22 Implement relative pointer protocol
* 12to11.c (XLMain): Initialize relative pointer.
* 12to11.man: Document new protocol.
* Imakefile (SRCS): Add relative_pointer.c.
(OBJS): Add relative_pointer.o.
(relative-pointer-unstable-v1): New scanner target.
* README: Document support for new protocol.
* compositor.h: Update prototypes.
* pointer_constraints.c (HandleResourceDestroy)
(HandleSeatDestroyed): Don't destroy commit callback if not
attached.
* seat.c (struct _Keyboard): Fix comment.
(struct _RelativePointer): New structure.
(struct _SeatClientInfo): Add relative pointer fields.
(CreateSeatClientInfo, ReleaseSeatClientInfo): Initialize and
check relative pointer list.
(SendRelativeMotion): New function.
(EnteredSurface): Clear surface coordinate set flag.
(DispatchMotion): Dispatch relative motion if possible.
(DispatchBarrierHit, XLGetGEWindowForSeats, XLSelectStandardEvents)
(XLDispatchGEForSeats): Handle barrier hit events for relative
motion.
(XLSeatGetRelativePointer, XLSeatDestroyRelativePointer): New
functions.
2022-10-16 11:35:56 +00:00
oldosfan
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.
2022-10-15 07:58:40 +00:00
oldosfan
f2e3baad45 Add support for more resources and single pixel buffers
* 12to11.c (HandleCmdline): Handle `-xrm'.
(XLMain): Initialize single pixel buffers.
* 12to11.man: Improve documentation.
* Imakefile (SRCS): Add single_pixel_buffer.c.
(OBJS): Add single_pixel_buffer.o.
(single-pixel-buffer-v1): Add new scanner target.
* README: Document new supported protocol.
* compositor.h (struct _BufferFuncs): Add single pixel buffer
functions.
* egl.c (enum _EglBufferType): New buffer type.
(struct _EglSinglePixelBuffer): New struct.
(struct _EglBuffr): Add EglSinglePixelBuffer.
(struct _CompositeProgram): Add source_color uniform.
(EglCompileCompositeProgram): Look for both uniforms.
(EglCompileShaders): Compile single pixel shader.
(FindProgram, GetTextureTarget, Composite, UpdateTexture)
(EnsureTexture, UpdateBuffer): Handle single pixel buffers.
(BufferFromSinglePixel, FreeSinglePixelBuffer): New functions.
(egl_buffer_funcs): Add new buffer functions.
* picture_renderer.c (BufferFromSinglePixel,
FreeSinglePixelBuffer): New functions.
(picture_buffer_funcs): Add new buffer functions.
* renderer.c (RenderBufferFromSinglePixel)
(RenderUpdateBufferForDamage): New functions.
(ReadRendererResource, PickRenderer): Read resource if no
environment variable was specified.
* shaders.txt (Composite Rectangle Fragment Shader Single
Pixel): New shader.
* text_input.c (struct _TextInput, UpdatePreedit)
(PreeditStartCallback, PreeditCaretCallback): Correctly handle
caret types and style.
(XLInitTextInput): Fix failure message.
2022-10-06 10:46:54 +00:00
oldosfan
c190ead122 Implement support for zwp_text_input_manager_v3
* 12to11.c (HandleCmdline): New function.
(XLMain): Handle locale, initialize text input and and set up
the resource database.
* 12to11.man: Document resources and command-line arguments.
* Imakefile (SRCS, OBJS): Add text_input.c and text_input.o.
(text-input-unstable-v3): New scanner target.
* README: Document support for zwp_text_input_manager_v3.
* alloc.c (XLMalloc, XLCalloc, XLRealloc): Allow alloc of size 0
to return NULL.
* atoms.c (resource_quark, app_quark, QString): New quarks.
(XLInitAtoms): Initialize some quarks.
* compositor.h (struct _Compositor): Add resource and app names.
(struct _RoleFuncs): Add `select_extra_events'.
(struct _TextInputFuncs): New structure.
* run.c (HandleOneXEvent): Filter events if necessary.
* seat.c (AllKeyMask): New define.
(input_funcs): New variable.
(MakeSeatForDevicePair, NoticeDeviceDisabled): Always assign a
single seat the role of "text input seat".
(ClearFocusSurface, SetFocusSurface): Call input method hooks.
(HackKeyboardModifiers): New function.
(DispatchKey): Ignore repeated key events.
(XLSeatGetFocus): New function.
(XLSeatSetTextInputFuncs, XLSeatGetKeyboardDevice)
(XLSeatGetInputMethodSeat, XLSeatDispatchCoreKeyEvent): New
function.
* surface.c (XLSurfaceSelectExtraEvents): New function.
* xdg_surface.c (DefaultEventMask): Add core event mask here.
(XLHandleXEventForXdgSurfaces): Handle core key events.
(Commit, NoteBounds): Improve debug code.
(SelectExtraEvents): New function.
(XLGetXdgSurface, XLXdgRoleSetBoundsSize): Improve debug code.
(XLInitXdgSurfaces): Reduce size of assoc table.
* xdg_toplevel.c (SendConfigure, SendDecorationConfigure, Map)
(HandleConfigureEvent, SetMode, UnsetMode): Avoid sending
decoration configure before initial commit.
2022-10-06 02:09:36 +00:00
oldosfan
a5f2c99939 Implement support for XDG window decoration
* 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.
2022-09-30 07:38:12 +00:00
oldosfan
23e4bf9bac Add code to make tarballs
* Imakefile (.PHONY): Add dist.
(dist, 12to11.tar.gz): New targets.

* README: Remove wayland-scanner dependency when not building
from a repository checkout.
2022-09-30 03:27:16 +00:00
oldosfan
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.
2022-09-30 01:17:47 +00:00
oldosfan
ebcc957302 Implement explicit synchronization
* 12to11.c (XLMain): Initialize explicit synchronization.
* Imakefile (SRCS, OBJS): Remove generated files.
(ScannerTarget): New macro.
(clean): Clean GENSRCS as well.
(linux-dmabuf-unstable-v1.h):
(linux-dmabuf-unstable-v1.c):
(xdg-shell.h):
(xdg-shell.c):
(primary-selection-unstable-v1.h):
(primary-selection-unstable-v1.c): Remove and replace with
ScannerTarget.
* README: Announce explicit synchronization support.
* compositor.h (union _RenderFence): New union.
(struct _RenderFuncs): Add fence functions.
(struct _Surface): New fields for explicit synchronization
objects and release callbacks.
* egl.c (EglInitFuncs, EglInitGlFuncs, EglInitDisplay):
Initialize functions and extensions used for explicit
synchronization, and set render func flags.
(ImportFdFence, WaitFence, DeleteFence, HandleFenceReadable)
(GetFinishFence): New functions.
(egl_render_funcs): Add those functions.
(AddRenderFlag): New function.
* fns.c (MaybeInstallBusHandler): Fix coding style.
* picture_renderer.c (ImportFdFence, WaitFence, DeleteFence)
(GetFinishFence): New stubs.
(picture_render_funcs): Add those functions; they should never
be called.
* renderer.c (RenderImportFdFence):
(RenderWaitFence):
(RenderDeleteFence):
(RenderGetFinishFence): New wrapper functions.
* run.c (struct _PollFd, XLAddWriteFd, XLAddReadFd): Add pollfd
field to callback args.
(RunStep): Pass them to callbacks.  Also, fix a comment.
* surface.c (DoRelease): New function.
(DestroySurface): Clear release if possible.
(SavePendingState, TryEarlyRelease): Extract release code to
DoRelease.
(InternalCommit): Wait for sync fences before continuing.
(Commit): Close acquire fence and release sync release object.
(HandleSurfaceDestroy): Destroy release callback and close
acquire fence.
(XLCreateSurface): Clear acquire fence field with right initial
value.
* xdata.c (NoticeTransferWritable):
(NoticeTransferReadable):
(NoticeConversionTransferReadable):
(NoticeConversionTransferWritable): Adjust arguments for new
callback data.
2022-09-25 08:21:31 +00:00
oldosfan
b4ee06589e Add support for EGL, for YUV image formats
EGL support is still incomplete; stuff like scaling is missing.

* 12to11.c (PickVisual, XLMain): Remove function.  Initialize
renderers, and rely on that to initialize the visuals.
* 12to11.man: Document new environment variables.
* Imakefile (SRCS, OBJS): Add picture_renderer.c and renderer.c
and their associated objects.
(GENHEADERS): New variable for generated headers.
(EGL_SRCS, EGL_OBJS): New variables.
(LOCAL_LIBRARIES, SRCS, OBJS, DEFINES): [HaveEglSupport]: Add
EGL defines, libraries, and objects.:(shaders.h): New rule.
(depend, cleandir): Depend on generated headers and SRCs.
$($(OBJS)): Depend on $(GENHEADERS).
* README: Write how to build with EGL support and update content
descriptions.
* buffer.c (XLPictureFromBuffer): Delete function.
(XLRenderBufferFromBuffer): New function.
(XLPixmapFromBuffer): Delete function.
* compositor.h (enum _Operation, struct _SharedMemoryAttributes)
(struct _DmaBufAttributes, union _RenderTarget)
(union _RenderBuffer, struct _RenderFuncs, struct _DrmFormat)
(struct _ShmFormat, struct _BufferFuncs, struct
_ExtBufferFuncs): New structures.
(Fallthrough): New define.  Define to __attribute__
((fallthrough)) wherever supported.  Replace uses of Picture
with RenderBuffer.
* dmabuf.c (struct _DrmFormatInfo): Remove structures.
(struct _BufferParams): Remove link.
(struct _Buffer): Replace pixmap and picture with render buffer
object.
(dri3_opcode, all_formats, pending_success, next_roundtrip_id)
(round_trip_window): Delete.
(ReleaseBufferParams, HandleParamsResourceDestroy, ForceRoundTrip)
(DepthForFormat, XLHandleErrorForDmabuf, PictFormatForFormat)
(DestroyBacking, GetPictureFunc, GetPixmapFunc, GetBufferFunc)
(CreateBufferFor, ModifierHigh, FinishBufferCreation)
(XLHandleOneXEventForDmabuf, CreateHeader, Create, CreateImmed)
(FindFormatMatching, FindSupportedModifiers, FindSupportedFormats)
(SendSupportedFormats, HandleBind, InitDrmDevice, WriteFormatTable)
(ReallyInitDmabuf, ReadSupportedFormats, XLInitDmabuf): Remove
various functions and reimplement as a wrapper around the
renderer abstraction, instead of DRI3.
* fns.c (struct _Busfault): New structure.
(busfault_tree, bus_handler_installed): New variables.
(GetHeight, FixHeights, RotateLeft, RotateRight, RebalanceBusfault)
(RecordBusfault, DetectBusfault, DeleteMin, RemoveBusfault)
(HandleBusfault, MaybeInstallBusHandler, BlockSigbus)
(UnblockSigbus, XLRecordBusfault, XLRemoveBusfaults): New
functions to store non-overlapping regions of mapped memory in
an AVL tree, and to ignore SIGBUS events that trap within.
* icon_surface.c (struct _IconSurface): Replace picture with
rendering target.
(ReleaseBacking, XLGetIconSurface): Use rendering targets
instead of pictures.
* libraries.def: Add defines for EGL.
* run.c (HandleOneXEvent): Replace old dmabuf code with renderer
code.
* seat.c (CursorFromRole, PictureForCursor, ApplyCursor)
(UpdateCursorFromSubcompositor, Subframe, EndSubframe): Rewrite
cursor code to use rendering targets and not pictures.
* shm.c (Buffer, DereferencePool): Remove SIGBUS protection.
(DereferenceBuffer): Reimplement in terms of renderer functions.
(GetPictureFunc): Delete function.
(GetBufferFunc): New function.
(GetPixmapFunc): Delete function.
(PrintBuffer): Remove now-broken implementation.
(DepthForFormat, PictFormatForFormat): Delete functions, as they
are now part of the rendering backend.
(IsFormatSupported): New function.
(CreateBuffer): Reimplement in terms of renderer functions.
(ResizePool): Change SIGBUS protection for resize.
(CreatePool): Protect buffer data from SIGBUS should a client
truncate the file.
(PostFormats): Reimplement in terms of RenderGetShmFormats.
(XLInitShm): Stop initializing MIT-SHM.
* subcompositor.c (IsTargetAttached): New flag and associated
macros.
(struct _View): Remove useless field.
(struct _Subcompositor): Change target to RenderTarget.  Add
fields for prior damage.
(MakeSubcompositor): Initialize new fields.
(SubcompositorSetTarget): Accept RenderTarget, not picture, and
set target attached flag.
(ViewGetTransform): Delete function.
(ViewApplyTransform): New function.
(FillBoxesWithTransparency): Reimplement in terms of renderer
functions.
(StorePreviousDamage): New function.
(SubcompositorUpdate): Reimplement in terms of renderer
functions.  Also, learn to deal with situations where the buffer
reflects the state 1 to 2 swaps ago.
(SubcompositorExpose): Reimplement in terms of renderer
functions.
(SubcompositorFree): Free new fields.
(SubcompositorInit): Remove no longer required initialization of
identity matrix.
* xdata.c (ReceiveBody): Fix coding style.
* xdg_surface.c (struct _XdgRole, ReleaseBacking,
XLGetXdgSurface): Switch from pictures to RenderTargets.
* xerror.c (ErrorHandler): Handle errors for picture renderer
instead of dmabuf.c.
2022-09-23 08:44:37 +00:00
oldosfan
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.
2022-09-15 02:08:55 +00:00
oldosfan
6c7801f0fd Implement primary selections, and minor improvements elsewhere
* 12to11.c (XLMain): Initialize primary selections.  Transfer
between X and Wayland programs is still incomplete.
* Imakefile (SRCS, OBJS): Add primary selection related objects
and sources.
(primary-selection-unstable-v1.h):
(primary-selection-unstable-v1.c): New targets.
* README: Update what is not supported.
* compositor.h: New prototypes.

* data_device.c (XLDataDeviceSendEnter): Handle resource
allocation failures.
* mime1.awk: Update generated code for changes in target entry
structures.
* seat.c (SetFocusSurface): Handle focus change for primary
selections as well.
(FindSurfaceUnder): Cut off fractional portion instead of
rounding the given coordinates, so the correct surface is found
when the cursor is moved just inside the rightmost pixel.
* surface.c (XLSurfaceRunFrameCallbacks): Handle timestamp
overflow.
* xdata.c (struct _TargetMapping): Rename atom to atom_flag, and
use it to store flags.
(MappingAtom, MappingFlag, MappingIsNextDuplicate, MappingSetFlag)
(MappingUnsetFlag, MappingIs): New macros.
(struct _TargetMappingTable): New structure.
(Duplicate): New definition.
(direct_transfer): Update duplicate types.
(mapping_table): New hash table.
(HashMimeString, SetupMappingTable): New functions.
(FindTranslationForMimeType, Receive): Use the target mapping
table to look up targets instead.
(CheckDuplicate): New function.
(SendOffers): Call CheckDuplicates.
(XLInitXData): Set up duplicate relationship between UTF8_STRING
and is conversion entry, and the targets mapping table.
2022-09-13 11:41:07 +00:00
oldosfan
528f7ba858 Import files 2022-09-12 13:24:50 +00:00