Copyright (C) 2022 various contributors. This file is part of 12to11. 12to11 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 12to11 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with 12to11. If not, see https://www.gnu.org/licenses/. This protocol is used by the 12to11 protocol translator to support various tests. The test_manager global allows creating a surface whose bounds and contents can be inspected, and connecting to the X server used by the compositor. Upon binding to the test_manager, a display_string event is sent containing the name of the X display. Get a test_surface object for a particular surface. If a role was already attached to this surface, or a role of a different type was previously attached, post a role_present error. Create the window immediately after get_test_surface is called; the window is mapped once a commit request with a non-nil buffer is made. The window is created as an override-redirect child of the root window, at 0, 0. Once the window associated with the test_surface object is mapped, send a mapped event. Create a new test_scale_lock object. As long as this object exists, set the global output scale to the scale specified in this request (or in a subsequent test_scale_lock.set_scale request.) If a test_scale_lock object already exists, generate a scale_lock_exists error. If the scale is invalid (by being less than 0), post an invalid_scale error. Create a new seat controller object and its associated seat. The seat will not correspond to any real input device, but will allow artificial events to be constructed and processed. A test_seat_controller.bind_seat request can be used to bind to the given seat. Send a serial event with the next serial of the display. Set the label of the given buffer to the specified string. The label is used only for debugging purposes. The display_string event sends the name of the X display to clients. It is sent immediately after binding to the test_manager object. The serial event is sent in reply to the get_serial request. It provides the next serial that will be used by the display. This role provides a test surface. Various buffers and subsurfaces can be attached, and the resulting display contents validated. When a buffer is commited to a test surface, the frame callback is run after any window configuration or resize has completed. Destroy the test_surface role. Subsequently, get_test_surface can be called again with its surface. The map event is sent once the window is mapped and its contents can be retrieved. The two arguments are the XID of the window and the name of the display it is on. If the surface is mapped, then unmapped (by having a nil buffer attached) and then mapped again, without waiting for the first mapped event, the delivery of subsequent mapped events becomes undefined. The activated is sent when the xdg_activation protocol causes the surface associated with the role to be activated. Its parameters constitute the timestamp at which the activation occurred. A scale lock resource represents the "lock" a client holds on the global output scale. While it still exists, the scale for every output will be whatever was specified when the lock was created or by the last set_scale request. Destroy the specified scale lock, restore the actual scale of each output, and let clients call get_scale_lock again. Set the scale of each output to the specified scale, and resize all surfaces accordingly. If the scale is invalid, post an invalid_scale error. The button state associated with an event. Destroy the given resource. Add the button with the given number to the button state. If button is 0 or more than 8, raise an invalid_button error. Remove the button with the given number from the button state. If button is 0 or more than 8, raise an invalid_button error. If the button was not previously added to the button state, do nothing. The modifier state associated with an event. Destroy the given resource. Set the modifiers in this modifier state. The valuator state associated with an event. Destroy the given resource. Add a valuator with the given value to the specified valuator state. If the value already exists, post a value_exists error. If the valuator is more than 65535 or 0, post an invalid_valuator error. Simulated XInput 2 device information for a device. Destroy the test device info resource. Set the device ID of this device info structure to the specified ID. If the ID is less than 65536, post an invalid_device_id error. Set the name of this device to the specified name. Set the use of this device to the specified value. Set the device attachment to the master pointer and keyboard of the specified seat controller. Set whether or not the device is enabled. Add a scroll class with the specified type, source ID, number, scroll type, increment and flags to the device info. If the specified source device ID is less than 65536, post an invalid_device_id error. Add a valuator class with the specified type, source ID, number, label, min, max, value, resolution and mode to the device info. If the specified source device ID is less than 65536, post an invalid_device_id error. Intern the label into an atom. If the string is empty, raise an invalid_label error. This object allows registering a list of artificial input devices to use during tests. These devices must have a device ID larger than 65535, and are removed upon destruction of the test controller resource. Destroy the test device controller resource. Register a device with the specified device information. If the device info is incomplete, meaning that one of set_device_id, set_name, set_use, set_attachment, or set_enabled was not called after it was created, post an incomplete_device_info error. If the device ID already exists, post a device_exists error if the device was not created by this device controller, or update the device with the new information if it was. If a test seat is created with the device ID in the specified device info after add_device_info is called, then the seat will not possess this device info. The device will be removed upon destruction of the test_device_controller resource. Create a device information object. The device information object is not associated with the test controller in any way. This object extends a wl_seat created with the test_manager.get_test_seat request with several requests to dispatch generated events. Immediately after being created, a device_id event is sent with the device ID of this seat. If the seat associated with the test controller is destroyed by the time a request is made with the test controller, the latter request is simply ignored. Destroy the test seat controller resource. Create a wl_seat resource for this seat controller's associated seat, with the specified version. If the version is unsupported, raise a bad_seat_version error. Create a test_XIModifierState resource with all fields set to 0. Create a test_XIButtonState resource containing no buttons. Create a test_XIValuatorState resource containing no valuators. Dispatch an XI_Enter event to the seat. If buttons (or any following field) is null, use a value comprised of 0s instead. Dispatch an XI_Leave event to the seat. If buttons (or any following field) is null, use a value comprised of 0s instead. Dispatch an XI_Motion device event to the seat. Dispatch an XI_ButtonPress device event to the seat. Dispatch an XI_ButtonRelease device event to the seat. Obtain a new device controller. Set the user time of the specified seat to the specified time. If the last user time is greater than the specified time, raise an invalid_user_time error. The month describes the number of times the millisecond counter has wrapped around, and milliseconds specifies the X server time. (This representation is also internally used in the X sample server.) This event is sent immediately after the test_seat_controller is created, with the device ID of the test seat.