Commit graph

186 commits

Author SHA1 Message Date
hujianwei
1ce5081dfa Major refactoring of the frame clock code
This is in preparation for a migration to the Present extension
on systems that do not support frame synchronization.

* 12to11.man: Remove option that is no longer useful.
* Imakefile (SRCS, OBJS): Add `sync_source.c.'.
* compositor.h (enum _RenderMode): New enum.
(struct _RenderFuncs): Add some new functions.
(enum _FrameMode): Remove ModeNotifyDisablePresent.

* frame_clock.c (struct _FrameClockCallback): Add draw time to
frame callback.
(struct _FrameClock): Rearrange for alignment and remove many
unused members.
(BumpFrame): New function.
(FreezeForValue): Remove code that is no longer useful, as
clock->frozen no longer exists.
(StartFrame, EndFrame): Remove clock "freezing" logic.  Only
`need_configure' remains.
(RunFrameCallbacks, NoteFakeFrame): Add frame drawn time.
(XLFrameClockAfterFrame): Adjust for new type of callback.
(XLFrameClockFreeze): Remove function.
(XLFrameClockFrameInProgress): Remove test for
`frozen_until_end_frame'.
(XLFrameClockHandleFrameEvent): Improve code in accordance with
above changes.
(XLFrameClockUnfreeze, XLFrameClockNeedConfigure): Remove
functions.
(XLFrameClockIsFrozen): Remove function.
(XLFrameClockSetFreezeCallback): Accept new callback
`fast_forward_callback'.
(XLFrameClockGetFrameTime): Remove unused function.

* icon_surface.c (struct _IconSurface, ReleaseBacking)
(ReleaseBuffer, RunFrameCallbacks, AfterFrame, Commit)
(SubsurfaceUpdate, XLGetIconSurface)
(XLHandleOneXEventForIconSurfaces): Switch the icon surface to
the sync helper abstraction, and allow asynch buffer release
from inside.

* picture_renderer.c (struct _PictureTarget): New field
`next_msc' and `render_mode'.
(SwapBackBuffers): Respect the render mode.
(InitSynchronizedPresentation): Delete function.
(InitAdditionalModifiers): Remove incorrect comment.
(InitRenderFuncs): Stop initializing obsolete option.
(SetRenderMode): New function.
(PresentToWindow): Respect the render mode.
(NotifyMsc): New function.
(picture_render_funcs): Add notify_msc.
(HandlePresentCompleteNotify): Call completion callback with the
fraame counter.

* renderer.c (RenderSetRenderMode):
(RenderNotifyMsc): New functions.

* subcompositor.c (struct _Subcompositor)
(SubcompositorSetNoteFrameCallback): Add msc and ust to note
frame callback.
(PresentCompletedCallback, RenderCompletedCallback): Call with
msc and ust.
(BeginFrame): When presentation is being synchronized and there
is no existing presentation callback, ask for an event to be
sent on the next frame.
(EndFrame): Do not clear the presentation callbacks, as the
update might not touch anything.

* test.c (NoteFrame): Update prototype.
* xdg_popup.c (InternalReposition): Stop "freezing" the frame
clock.

* xdg_surface.c (struct _XdgRole): Replace the frame clock with
the sync helper abstraction.
(RunFrameCallbacks): Run with the frame time.
(RunFrameCallbacksConditionally): Save the pending frame time.
(UpdateFrameRefreshPrediction): Delete function.
(XLHandleXEventForXdgSurfaces): Give events to the sync helper
instead.
(Unfreeze, IsRoleMapped, CheckFrame): Remove functions.
(Commit, SubsurfaceUpdate): Update using the sync helper
instead, only if not pending ack commit.
(MaybeRunLateFrame, AfterFrame): Delete functions.
(NoteConfigure, NoteBounds): Update for the sync helper.
(WriteRedirectProperty): Always require redirection for now.
Disabling redirection requires sorting out some Present problems
on the X server side.
(WasFrameQueued, NoteFrame): Delete functions.
(HandleFreeze): Delete function.
(HandleResize, CheckFastForward, HandleFrameCallback): New
functions.
(XLGetXdgSurface): Use the sync helper for most things.
(XLXdgRoleSendConfigure, XLXdgRoleReconstrain)
(XLXdgRoleGetFrameClock): Delete function.
(XLXdgRoleNoteRejectedConfigure): Clean up for using the sync
clock instead.
2022-11-22 10:57:50 +00:00
hujianwei
ed9a704e69 Add tearing control protocol
* 12to11-test.xml (test_surface) <committed>: New event.
* 12to11.c (XLMain): Initialize tearing control.
* Imakefile (SRCS, OBJS): Add tearing_control.c/.o.
(tearing-control-v1): New scanner target.

* compositor.h (enum _PresentationHint): New enum.
(struct _State): Add fields for tearing control.
(enum _ClientDataType): Add tearing control type.
* surface.c (SavePendingState, InternalCommit1): Handle
presentation hints.
* test.c (Commit): Send new committed event.
* tests/Imakefile (OBJS16, SRCS16): Add
tearing_control_test.c/tearing_control_test.o.
(PROGRAMS): Add tearing_control_test.
(tearing-control-v1): New scanner target.

* tests/buffer_test.c (test_names): Fix typos.
* tests/run_tests.sh (standard_tests): Add tearing_control_test.
* tests/svnignore.txt: Add tearing_control_test.
* xdg_surface.c (UpdateFrameRefreshPrediction): Return whether
or not refresh prediction is on.
(MaybeRunLateFrame): Don't clear StateLateFrame until after
SubcompositorUpdate.
(WasFrameQueued): New function.
(NoteFrame): If a frame was queued and async presentation was
requested, present now.
2022-11-19 06:36:56 +00:00
hujianwei
4c7b4a2c5a Check in new files for tearing control protocol
* tearing-control-v1.xml:
* tearing_control.c:
* tests/tearing_control_test.c: New files.
2022-11-19 06:28:50 +00:00
hujianwei
94333293c8 Fix compatibility with Chromium
* dmabuf.c (struct _Buffer): New field `is_fallback'.
(DestroyBacking): Destroy fallback buffers appropriately.
(CreatePlaceholderBuffer): New function.
(CreateImmed): Create palceholder buffers upon a `failed' event
being sent.
* xdg_toplevel.c (UnsetMaximized, UnsetFullscreen): Add
workarounds for Chromium bugs.
2022-11-18 13:11:22 +00:00
hujianwei
042e10486a Fix set_maximized and set_fullscreen for unmapped toplevels
* xdg_toplevel.c (Map): Apply queued window manager state.
(SetMaximized, UnsetMaximized, SetFullscreen, UnsetFullscreen):
Set a flag to apply the state later, upon mapping.  If the state
is already set, just send a configure event in response.
2022-11-18 06:16:57 +00:00
hujianwei
bc22380754 Add buffer release test
* tests/Imakefile (OBJS15, SRCS15): New files.
(PROGRAMS): Add buffer_test.
(buffer_test): New program target.
* tests/run_tests.sh (standard_tests): Add buffer_test.
* tests/svnignore.txt: Add buffer_test
* tests/test_harness.c (handle_wl_buffer_release, get_test_buffer)
(test_buffer_committed, verify_buffer_released): New functions.
* tests/test_harness.h (struct test_buffer): New struct.
2022-11-18 02:38:36 +00:00
hujianwei
b35873d200 Add buffer release test
* tests/buffer_test.c: New file.
2022-11-18 02:34:32 +00:00
hujianwei
d894bcd0a0 Add new single-pixel buffer tests
* tests/Imakefile (OBJS14, SRCS14): Add
single_pixel_buffer_test.c/.o.
(single_pixel_buffer_test): New test.
* tests/run_tests.sh (standard_tests): New test.
* tests/svnignore.txt: Add single_pixel_buffer_test.
2022-11-17 11:12:05 +00:00
hujianwei
b2fdfdb2f4 Check in new files for single pixel buffer tests
* tests/single_pixel_buffer.dump:
* tests/single_pixel_buffer_test.c:
* tests/single_pixel_buffer_viewport.dump: New files.
2022-11-17 11:09:46 +00:00
hujianwei
1b02ff9833 Fix crash trying to update seat cursor outputs
* seat.c (UpdateCursorOutput): Do not update if the surface has
been destroyed.
2022-11-17 06:18:50 +00:00
hujianwei
01a957737b Fix precision of vertex shader
* shaders.txt (Composite Rectangle Vertex Shader): Use medium
precision.
2022-11-17 06:07:30 +00:00
hujianwei
5e2d83c0d0 Make test reference data work on systems other than mine
* tests/test_harness.c (struct image_difference_statistics): New
struct.
(compare_single_row_8bpc4, compare_single_row_8bpc4x1)
(compare_single_row): Allow slight differences to compensate for
hardware differences.
(verify_image_data): Adjust accordingly.
2022-11-17 06:06:45 +00:00
hujianwei
ac7b6b5915 Allow running tests with an always garbaged subcompositor
* 12to11-test.xml (test_surface) <set_always_garbage>: New
request.
* compositor.h: Update prototypes.
* subcompositor.c (SubcompositorUpdate): Don't clear garbaged
flag if the subcompositor is always garbaged.
(SubcompositorSetAlwaysGarbaged): New function.
* test.c (SetAlwaysGarbage): New function.
(test_surface_impl): Add function.
* tests/test_harness.c (make_test_surface): Always garbage the
subcompositor if TEST_ALWAYS_GARBAGE is set.
2022-11-17 04:56:55 +00:00
hujianwei
d2abef20c4 Pacify more compiler warnings
* text_input.c (EncodeIMString):
* xdata.c (GetConversionCallback, PostReceiveConversion): Pacify
GCC suspecting memory leaks after iconv_open returns -1.
2022-11-17 02:45:33 +00:00
hujianwei
69e0902cfc Implement wl_output version 4
* 12to11.man:
* README: Update documentation.
* output.c (struct _Output): Rearrange structure for alignment.
(HandleBind): Send output name if necessary.
(CompareOutputs): Handle name changes separately.
(MakeGlobal): Support version 4 or later.
(SendUpdates): Handle name changes separately.
2022-11-17 02:26:27 +00:00
hujianwei
d4df421f8b Implement output transforms
* output.c (ComputeTransform): Handle all combinations of
rotation and X axis reflection.
2022-11-17 02:11:15 +00:00
hujianwei
7128095c18 Fix names of reference data
* tests/buffer_scale_2_5_1.dump:
* tests/buffer_scale_2_5_2.dump:
* tests/buffer_scale_3_5_1.dump:
* tests/buffer_scale_3_5_2.dump: Fix reference data names.
2022-11-17 01:56:08 +00:00
hujianwei
7deac88eae Add new scale tests
* tests/scale_test.c (enum test_kind): New test for 2x5 scale.
(test_names): Add new test name.
(LAST_TEST): Set to new test.
(do_verify_window_size): New function.
(test_single_step): Verify window sizes as well.  Implement new
test.

* tests/test_harness.c (verify_window_size): New function.
* tests/test_harness.h: New prototype.
2022-11-17 01:52:55 +00:00
hujianwei
897035e531 Add new buffer scale tests
* tests/buffer_scale_3_5_1.dump:
* tests/buffer_scale_3_5_2.dump: New files.
2022-11-17 01:36:51 +00:00
hujianwei
fb2fd1b5d1 Pacify analyzer warning
* text_input.c (HandleNewIM): Pacify false positive warning.
2022-11-16 11:53:26 +00:00
hujianwei
4772d8cede Fix XDG activation in some edge cases
* 12to11-test.xml (test_manager) <activated>: Add
activator_surface parameter.

* compositor.h (enum _ClientDataType): New XdgActivationData
type.
(struct _RoleFuncs, struct _XdgRoleImplementationFuncs): Pass
activator surface in `activate'.
* seat.c (struct _Seat): New field for the serial of the last
entry event.
(SendKeyboardEnter, XLSeatCheckActivationSerial): Add
workarounds for Firefox.
* surface.c (HandleSurfaceDestroy): Allow client data
free_functions to be NULL.
* test.c (Activate): Accept and send activator surface.

* xdg_activation.c (struct _XdgActivationToken): New fields for
the surface and destroy callback.
(HandleSurfaceDestroyed): New function.
(SetSurface): Really record the activator surface.
(GetIdForSurface): New function.
(Commit): Include activator surface ID.
(HandleResourceDestroy): Destroy activator surface.
(GetSurfaceForId): New function.
(Activate): Pass activator surface whenever specified.

* xdg_surface.c (Activate):
* xdg_toplevel.c (Activate): Adjust accordingly.

* tests/xdg_activation_test.c (check_activation_with_serial):
Check activator surface as well.
(test_single_step): Fix damage rect for dummy buffer.
(handle_test_surface_activated): Record the activator surface.
2022-11-16 07:11:03 +00:00
hujianwei
13b3d3d04b Add new seat tests for key presses
* 12to11-test.xml (test_seat_controller) <dispatch_XI_FocusIn>:
<dispatch_XI_FocusOut>
<dispatch_XI_RawKeyPress>
<dispatch_XI_RawKeyRelease>
<dispatch_XI_KeyPress>
<dispatch_XI_KeyRelease>: New requests.

* seat.c (MakeSeatForDevicePair): Prevent seat->key_pressed from
being NULL as long as keymaps have been initialized.

* test_seat.c (DispatchXIFocusIn, DispatchXIFocusOut)
(GenerateRawEvent, DispatchXIRawKeyRelease, DispatchXIKeyPress)
(DispatchXIKeyRelease): New functions.
(seat_controller_impl): Add new functions.
(XLGetTestSeat): Prevent seat->key_pressed from being NULL.

* tests/seat_test.c (enum test_expect_event_kind): Add keyboard
events.
(struct test_recorded_keyboard_enter_event)
(struct test_recorded_keyboard_key_event)
(struct test_recorded_keyboard_modifiers_event): New structs.
(enum test_kind, test_names): Add new test.
(LAST_TEST): Set to key test.
(run_key_test, test_single_step): Implement new test.
(expect_keyboard_enter_event, expect_keyboard_modifiers_event)
(expect_keyboard_key_event): New function.
(handle_keyboard_keymap, handle_keyboard_enter)
(handle_keyboard_leave, handle_keyboard_key)
(handle_keyboard_repeat_info): New functions.
(keyboard_listener, run_test): Attach new keyboard listener.

* tests/test_harness.c (test_init_seat): Initialize keyboard.
* tests/test_harness.h (struct test_seat): New field `keyboard'.
2022-11-16 02:15:47 +00:00
hujianwei
e7b89cec3b Fix crashes during scale changes
* compositor.h (struct _XdgRoleImplementationFuncs): New
function `rescale'.
* subsurface.c (Rescale): If the parent has been detached, don't
call MoveFractional.
* xdg_surface.c (Rescale): Call rescale hook.
* xdg_toplevel.c (SendOutputBounds): Check that some fields are
present.  Scale geometry correctly.
(Rescale): New function.
(ShowWindowMenu): Scale coordinates correctly.
(XLGetXdgToplevel): Add Rescale hook.
2022-11-15 12:17:26 +00:00
hujianwei
62a055983c * tests/subsurface_test_39.dump: New file. 2022-11-15 05:01:13 +00:00
hujianwei
ad9d1c3d6a Add new test for role actions
* subcompositor.c (ViewSetSubcompositor):
* subsurface.c (Teardown, XLSubsurfaceParentDestroyed):
* surface.c (HandleSurfaceDestroy): Restore previous code with
more comments.

* tests/subsurface_test.c (test_single_step): Test that surface
actions work with unconfirmed subsurfaces.
2022-11-15 05:00:56 +00:00
hujianwei
dfb8378257 Check in new files for subsurface tests
* tests/subsurface_stack_1.png:
* tests/subsurface_stack_2.png:
* tests/subsurface_test_35.dump:
* tests/subsurface_test_36.dump:
* tests/subsurface_test_37.dump:
* tests/subsurface_test_38.dump: New files.
2022-11-15 04:27:18 +00:00
hujianwei
e8b746e7ec Update subsurface tests to handle reparenting and fix discovered bugs
* 12to11-test.xml (test_manager) <set_buffer_label>: New
request.
* 12to11.man:
* README: Add missing documentation.
* buffer.c (ExtBufferDestroy): Free buffer label.
* compositor.h (struct _ExtBuffer): New field `label'
* linux-dmabuf-unstable-v1.xml: Update from wayland-protocols.
* subcompositor.c (IsSkipped, SetSkipped, ClearSkipped): Delete
macros.
(SubcompositorUpdateBounds, SubcompositorUpdateBoundsForInsert)
(SkipSlug): Adjust accordingly.
(DamageIncludingInferiors): Fix function.
(SubcompositorInsert, SubcompositorInsertBefore)
(SubcompositorInsertAfter, ViewIsVisible, ViewRecomputeChildren)
(ViewInsert, ViewInsertAfter, ViewInsertBefore): Call
DamageIncludingInferiors on child, not view.
(ViewSetSubcompositor, ViewAfterSizeUpdate, ViewMove): Get rid
of "skipped" state.
(ViewUnskip, ViewSkip): delete functions.
(ViewFree, DoCull, SubcompositorLookupView): Get rid of
"skipped" state.
* subsurface.c (struct _Subsurface): New field `pending'.
(AfterParentCommit): Attach views whenever pending.
(Setup): Stop attaching views upon setup.
(Teardown): Only detach views when not pending.
(GetSubsurface): Add comment.
(XLSubsurfaceParentDestroyed): Set subcompositor to NULL when
parent is destroyed.
(XLSubsurfaceHandleParentCommit): New function.
* surface.c (RunCommitCallbacks): Run commit callbacks in the
order in which they were created.
(NotifySubsurfaceDestroyed): Assert that a role is present.
(HandleSurfaceDestroy): Clear subsurfaces before releasing role.
Set subsurfaces to NULL.
* test.c (SetBufferLabel): New function.
(test_manager_impl): Implement.
* tests/subsurface_test.c (enum test_kind): New
SUBSURFACE_REPARENT_KIND.
(test_names): Add names
(LAST_TEST): Set to SUBSURFACE_REPARENT_KIND.
(test_single_step): Implement new test.
* tests/test_harness.c (load_png_image): Set buffer debug label.
2022-11-15 04:26:36 +00:00
hujianwei
7919b65eca Fix xdg-positioner implementation
* compositor.h (struct _Positioner): New struct.
* positioner.c (struct _Positioner): Move to compositor.h.
(RetainPositioner, ReleasePositioner): Remove functions.
(HandleResourceDestroy): Destroy positioner instead.
(XLCreateXdgPositioner): Remove reference-counting logic.
(XLRetainPositioner, XLReleasePositioner): Delete functions.
(XLPositionerIsReactive): Delete function.
* xdg_popup.c (struct _XdgPopup): Make positioner a struct
instead of a pointer.
(DestroyBacking, InternalReposition, Reposition)
(HandleParentConfigure, HandleParentResize, XLGetXdgPopup): Copy
positioner instead of taking a reference.
2022-11-14 10:26:58 +00:00
hujianwei
d32e9cbf8a Remove extra debugging code
* xdg_toplevel.c (Activate): Remove left-over debug code.
2022-11-14 06:53:16 +00:00
hujianwei
2979979633 Implement xdg-activation-v1
* 12to11-test.xml (test_surface): <activated>: New event.
* 12to11.c (XLMain): Initialize XDG activation.
* Imakefile (SRCS, OBJS): Add xdg_activation.c and
xdg_activation.o.
(xdg-activation-v1): New scanner target.
* atoms.c (names, XLInitAtoms): New atom `_NET_ACTIVE_WINDOW'.
Adjust accordingly.
* compositor.h (struct _RoleFuncs): New function `activate'.
(struct _XdgRoleImplementationFuncs): Likewise.
* seat.c (XLSeatCheckActivationSerial): New function.
* test.c (Activate): New function.
(GetTestSurface): Attach new hook.
* tests/Imakefile (OBJS13, SRCS13): Add xdg_activation_test.c/o.
(xdg-activation-v1): New scanner target.
(PROGRAMS): Add xdg_activation_test.
(xdg_activation_test): New program target.
* tests/run_tests.sh (standard_tests): Add xdg_activation_test.
* tests/svnignore.txt: Add xdg_activation_test.
* xdg_surface.c (Activate): New function.
(XLGetXdgSurface): Attach hook.
* xdg_toplevel.c (Activate): New function.
(XLGetXdgToplevel): Attach hook.
2022-11-14 06:05:23 +00:00
hujianwei
556cf6dbcc Check in new files for xdg-activation
* xdg-activation-v1.xml:
* xdg_activation.c:
* tests/xdg_activation_test:
* tests/xdg_activation_test.c: New files.
2022-11-14 05:58:00 +00:00
hujianwei
a3e87a1f34 Fix built-in resize with new frame clock logic
* compositor.h (struct _XdgRoleImplementationFuncs): Replace
`commit_inside_frame' with `after_commit'.
* xdg_surface.c (Commit): Call after_commit hook.
(NoteFrame): Stop calling commit_inside_frame.

* xdg_toplevel.c (CommitInsideFrame): Remove function.
(AfterCommit): New function.  Post pending resize here instead.
(XLGetXdgToplevel): Attach after_commit hook.
2022-11-14 01:42:01 +00:00
hujianwei
ecac908923 Fix some comments
* drm_lease.c:
* subcompositor.c (ViewUnparent):
* xdata.c (NoticeTransferWritable): Remove obsolete TODO
comments.
2022-11-14 01:12:49 +00:00
hujianwei
30f22613b8 Fix some minor problems
* seat.c (DispatchEntryExit): Understand all kinds of entry and
exit events instead of just non-grab ones.
* subcompositor.c (SubcompositorComposite1): Remove redundant
assignment.
* xerror.c (CategorizeClients): Add new assertion.

* tests/select_test.c (verify_sample_text):
(verify_sample_text_multiple): Fix typos.
2022-11-13 13:45:11 +00:00
hujianwei
563422d8cf Improve handling of pointer unlock events
* compositor.h: Update prototypes.
* idle_inhibit.c (DestroyIdleInhibitManager): New function.
(idle_inhibit_manager_impl): Add missing op handler.
* seat.c (struct _Seat): Remove pointer unlock surface.  Add
last_seen_subcompositor.
(ReleaseSeat): Release the last seen subcompositor callback.
(ClearPointerUnlockSurface, SwapUnlockSurface): Delete
functions.
(HandleSubcompositorDestroy): New function.
(EnteredSurface): Stop calling SwapUnlockSurface.
(DispatchEntryExit): Set the last seen subcompositor.
(DispatchMotion, CancelGrab1, CancelGrab): Use the last seen
subcompositor to decide where to unlock instead.
(LockSurfaceFocus, DispatchButton, DispatchGesturePinch)
(DispatchGestureSwipe): Stop calling SwapUnlockSurface.
(FakePointerEdge, ForceEntry): Stop calling SwapUnlockSurface.

* subcompositor.c (struct _SubcompositorDestroyCallback): New
struct.
(struct _Subcompositor): New field `destroy_callbacks'.
(MakeSubcompositor): Initialize new field.
(SubcompositorFree): Run and free destroy callbacks.
(SubcompositorOnDestroy, SubcompositorRemoveDestroyCallback):
New functions.
* tests/run_tests.sh:
* tests/select_test.c (verify_sample_text_multiple): Fix
ommissions and typos.
2022-11-13 11:18:44 +00:00
hujianwei
b54e5a1a01 * tests/select_helper.c: Make atom_names big enough. 2022-11-13 05:46:38 +00:00
hujianwei
3244ab82f2 Track keyboard modifiers on a per-seat basis
* seat.c (MakeSeatForDevicePair): Get keyboard state and select
for events from the master keyboard.
(UpdateModifiersForSeats): Rename to UpdateModifierForSeat.
Accept seat arg.
(SetupKeymap): Stop selecting for state changes here.
(HandleXkbEvent): Associate each XkbStateNotify with an
extension device's keyboard.
2022-11-13 03:00:08 +00:00
hujianwei
442f80b667 Implement support for multiple providers
* README: Document changes.
* compositor.h (struct _BufferFuncs): Rename `get_render_device'
to `get_render_devices' and make it return a list of providers.
* dmabuf.c (MakeFeedback): Send 1 tranche for each device.
(InitDrmDevice): Rename to InitDrmDevices.  Set up for multiple
devices.
(WriteFormatTable): Adjust call accordingly.

* egl.c (GetRenderDevice): Remove function.
(GetRenderDevices): New function.
(egl_buffer_funcs): Change accordingly.

* output.c (XLInitRROutputs): Require RandR 1.4.

* picture_renderer.c (GetRenderDevice): Remove calls to open.
(GetRenderDevices): New function.
(picture_buffer_funcs): Adjust accordingly.

* renderer.c (RenderGetRenderDevice): Delete function.
(RenderGetRenderDevices): New function.
2022-11-13 02:08:10 +00:00
hujianwei
b022f0dbd9 Fix handling of MULTIPLE selections and add test
* select.c (SignalConversionPerformed): Improve diagnostic
messages.
(ConvertSelectionMultiple): Use correct atoms.
(HandleSelectionRequest): Allow selection requests with target
MULTIPLE.

* tests/Imakefile (SRCS12, OBJS12): Add select_helper_multiple.c
and .o.
(PROGRAMS): Add select_helper_multiple.
(select_helper_multiple): New program.
* tests/select_helper.c (main): Fix typo.

* tests/select_test.c (verify_sample_text_multiple): New function.
(test_single_step): Call it.
* tests/svnignore.txt: Add select_helper_multiple.
2022-11-12 08:07:43 +00:00
hujianwei
8810afbe2d Check in new file for select tests
* tests/select_helper_multiple.c: New file.
2022-11-12 08:04:52 +00:00
hujianwei
456537aee9 * tests/run_test.sh: Allow running select tests. 2022-11-12 05:23:31 +00:00
hujianwei
0bdc502068 Fix text input bugs with grabbed popups and bugs found by new tests
* 12to11-test.xml (test_manager) <error>: Add
invalid_user_time.
<get_serial, serial> New request and event.
(test_seat_controller) <set_last_user_time>: New request.

* compositor.h (struct _TextInputFuncs): Make `filter_input'
return keycode.
* data_device.c (DestroyReference): Check if reference device is
detached before unlinking reference.
* seat.c (LookupKeysym): Delete function.
(DispatchKey): Use keycodes instead.
(XLSeatExplicitlyGrabSurface): Avoid using owner-events keyboard
grab.

* select.c (struct _SelectionOwnerInfo, HandleSelectionRequest):
Allow CurrentTime in selection requests.  Compensate for
wraparound as well.
(OwnSelection, DisownSelection): Use Timestamp instead of Time.
* test.c (GetSerial): New function.
(test_manager_impl): Add new function.
* test_seat.c (SetLastUserTime): New function.
(seat_controller_impl): Add new function.
* tests/Imakefile (LOCAL_LIBRARIES): Remove GBM and DRM.
(SRCS10, OBJS10, SRCS11, OBJS11): New variables.
(dmabuf_test): Only link this program with GBM and DRM.
(PROGRAMS): Add select_test, select_helper.
(select_test, select_helper): New programs.

* tests/README: Document that select_test needs to be run under
vfb.
* tests/run_tests.sh: Add TODO note.
* tests/svnignore.txt: Add select_test and select_helper.
* tests/test_harness.c (handle_test_manager_serial): New
function.
(test_manager_listener): Add new function.
(open_test_display): Clear display->seat.
(test_get_serial): New function.

* tests/test_harness.h (struct test_display): New function
`serial'.

* text_input.c (CreateIC): Improve debugging code.
(CalculateKeycodeForEvent): Move earlier.
(FilterInputCallback): Handle keycodes here as well.
(XLTextInputDispatchCoreEvent): Add more debugging code.

* xdata.c (SelectSelectionInput): Obtain server time here.
(XLOwnDragSelection, NoteLocalSelectionFooter): Convert times to
Timestamp.
2022-11-12 03:51:21 +00:00
hujianwei
be955e3c79 Check in new files for selection tests
* tests/select_helper.c:
* tests/select_test.c: New files.
2022-11-12 03:42:39 +00:00
hujianwei
be117ac93d Improve serial wraparound checking
* data_device.c (SetSelection):
* primary_selection.c (SetSelection): Handle selection serial
wraparound.
2022-11-11 11:16:01 +00:00
hujianwei
c90af69ecd Fix key release tracking for input methods
* compositor.h: Update prototypes.
* seat.c (XLSeatDispatchCoreKeyEvent): Remove argument `keysym'.
Stop handling keysyms here.
(XLKeysymToKeycode): New function.
* text_input.c (struct _KeysymMap): Rename to KeycodeMap.
(struct _TextInput, ClearKeysymMap, InsertKeysym, RemoveKeysym)
(GetKeysym, GetKeycode, InputDoLeave, HandleResourceDestroy)
(ScanForwardWord, ScanBackwardWord, CalculateKeycodeForEvent)
(XLTextInputDispatchCoreEvent, InitInputStyles): Calculate
keycodes instead of passing the keysym to DispatchCoreKeyEvent
here, and record the keycodes used instead.
2022-11-11 02:12:14 +00:00
hujianwei
18d18aabb5 Remove broken tests in subcompositor.c
These tests have already been superseeded by the more
comprehensive tests in subsurface_tests.c (and to a lesser
extent under tests/*.c in general), and do not build anymore.

* subcompositor.c (TEST_STATIC): Remove define.
(IsTargetAttached, ClearPreviouslyTransformed, struct _View)
(struct _Subcompositor, MakeSubcompositor, MakeView)
(SubcompositorInsert, SubcompositorInsertBefore)
(SubcompositorInsertAfter, ViewInsert, ViewInsertAfter)
(ViewInsertBefore, ViewInsertStart, ViewUnparent)
(ViewSetSubcompositor, PrintView, PrintSubcompositor, TestView)
(TestSubcompositor, main): Delete all code under #ifdef TEST.
2022-11-10 12:36:09 +00:00
hujianwei
bf568311a6 Improve handling of keysyms returned by input methods
* text_input.c (struct _KeysymMap): New struct.
(struct _TextInput): New field `keysym_map'.
(ClearKeysymMap, InsertKeysym, RemoveKeysym, GetKeysym): New
function.
(InputDoLeave, HandleResourceDestroy): Clear the keysym map.
(NoticeLeave): Fix coding style.
(LookupString): Always prefer keysyms looked up.
(XLTextInputDispatchCoreEvent): Store keysym into map upon
KeyPress under the keycode, and use that keysym with the
corresponding KeyRelease.
2022-11-10 12:12:53 +00:00
hujianwei
163dca96bd Add scroll valuator tests
* 12to11-test.xml (test_manager): <error>: New errors.
(test_XIDeviceInfo, test_device_controller): New interfaces.
(test_seat_controller): <get_device_controller>: New request.
<device_id>: New event.

* seat.c (NoticeDeviceDisabled): Ignore test seats.
(XLSeatDispatchCoreKeyEvent): Expand commentary.

* test_seat.c (struct _TestDeviceController)
(struct _TestXIDeviceInfo): New structs.
(DestroyXIValuatorState): New function.
(AddValuatorToTestXIValuatorState): Fix crashes.
(XIValuatorState_impl): Add DestroyXIValuatorState.
(DestroyDeviceInfo, SetDeviceId, SetName, SetUse, SetAttachment)
(SetEnabled, AddXIScrollClassInfo, AddXIValuatorClassInfo): New
functions.
(XIDeviceInfo_impl): New interface implementation.
(HandleXIDeviceInfoDestroy): New function.
(DestroyDeviceController, AddDeviceInfo, GetDeviceInfo): New
functions.
(device_controller_impl): New interface.
(HandleTestDeviceControllerDestroy): New function.
(GetDeviceController): New function.
(seat_controller_impl): Add it.
(XLGetTestSeat): Send new `device_id' event.

* tests/seat_test.c (enum test_expect_event_kind): Add
POINTER_AXIS_VALUE120_EVENT.
(struct test_recorded_axis_value120_event): New event kind.
(enum test_kind): Add TEST_VALUATOR_KIND.
(test_names): Add test_valuator.
(LAST_TEST): Set to TEST_VALUATOR_KIND.
(run_valuator_test): New function.
(test_single_step): Implement accordingly.
(expect_axis_value120_event, handle_pointer_axis_value120): New
functions.

* tests/test_harness.c (handle_seat_controller_device_id): New
function.
(seat_controller_listener): New listener.
(test_init_seat): Wait for device ID and init device controller.

* tests/test_harness.h (struct test_seat): Add device controller
and device ID fields.
2022-11-10 06:14:51 +00:00
hujianwei
e2afe671df ; * xerror.c (CategorizeClients): Remove debugging code. 2022-11-09 02:55:20 +00:00
hujianwei
45df6087d6 Update dmabuf and seat tests
* tests/dmabuf_test.c (enum test_kind): Add XBGR888_KIND.
(test_names): Add that test.
(LAST_TEST): Set to XBGR888_KIND.
(verify_single_step, test_single_step, test_next_step):
Implement that test, but keep it disabled for now.
* tests/seat_test.c (struct test_subsurface): New struct.
(enum test_kind): Add TEST_GRAB_KIND.
(test_names): Add that test kind.
(LAST_TEST): Set to TEST_GRAB_KIND.
(make_test_subsurface): New function.
(run_grab_test): New functions.
(test_single_step): Implement new test.
(expect_enter_event): Accept surface arg.
(expect_surface_enter): Adjust accordingly.
(handle_wl_callback_done, wait_frame_callback): New functions.
2022-11-09 02:12:28 +00:00