Louvre
v2.13.0-1
C++ library for Wayland compositors
|
Group of input and output devices. More...
Classes | |
struct | OutputConfiguration |
Configuration parameters for an output. More... | |
Public Member Functions | |
LSeat (const void *params) | |
Constructor of the LSeat class. More... | |
~LSeat () | |
Destructor of the LSeat class. More... | |
const std::vector< LGPU * > & | gpus () const noexcept |
Retrieves the available GPUs. More... | |
const std::vector< LOutput * > & | outputs () const noexcept |
Vector of available outputs. More... | |
const std::vector< LInputDevice * > & | inputDevices () const noexcept |
Vector of available input devices. More... | |
const std::vector< LSurface * > & | idleInhibitorSurfaces () const noexcept |
Surfaces requesting to inhibit the idle state. More... | |
const std::vector< const LIdleListener * > & | idleListeners () const noexcept |
Listeners used by clients to detect when the user has been idle for a specified amount of time. More... | |
void | setIsUserIdleHint (bool isIdle) noexcept |
Sets a hint about the user's idle state. More... | |
bool | isUserIdleHint () const noexcept |
Hint about the user's idle state set with setIsUserIdleHint() . More... | |
const char * | name () const noexcept |
The seat name. More... | |
LToplevelRole * | activeToplevel () const noexcept |
Active toplevel surface. More... | |
const std::vector< LToplevelResizeSession * > & | toplevelResizeSessions () const noexcept |
Active LToplevelRole resize sessions. More... | |
const std::vector< LToplevelMoveSession * > & | toplevelMoveSessions () const noexcept |
Active LToplevelRole move sessions. More... | |
LPointer * | pointer () const noexcept |
Access to pointer events. More... | |
LKeyboard * | keyboard () const noexcept |
Access to keyboard events. More... | |
LTouch * | touch () const noexcept |
Access to touch events. More... | |
LDND * | dnd () const noexcept |
Access to the drag & drop session manager. More... | |
LClipboard * | clipboard () const noexcept |
Access to the clipboard manager. More... | |
void | dismissPopups () noexcept |
Close all popups. More... | |
LPopupRole * | topmostPopup () const noexcept |
Retrieve the topmost popup role. More... | |
Public Member Functions inherited from LFactoryObject | |
Type | factoryObjectType () const noexcept |
Gets the base factory object type. More... | |
Public Member Functions inherited from LObject | |
LObject (const LObject &) noexcept | |
Copy constructor. More... | |
LObject & | operator= (const LObject &) noexcept |
Assignment operator (each object has its own individual LWeak reference count). More... | |
void | setUserData (UIntPtr data) const noexcept |
Store an unsigned integer value/pointer. More... | |
UIntPtr | userData () const noexcept |
Retrieves the stored unsigned integer value/pointer. More... | |
Session | |
void | setTTY (UInt32 tty) noexcept |
Switches session. More... | |
Int32 | openDevice (const char *path, Int32 *fd) noexcept |
Open a device. More... | |
Int32 | closeDevice (Int32 id) noexcept |
Closes a device. More... | |
libseat * | libseatHandle () const noexcept |
Libseat handle. More... | |
bool | enabled () const noexcept |
Check the session state. More... | |
Virtual Methods | |
virtual void | enabledChanged () |
Notify a change in the enabled() property. More... | |
virtual void | outputPlugged (LOutput *output) |
New available output. More... | |
virtual void | outputUnplugged (LOutput *output) |
Disconnected output. More... | |
virtual void | inputDevicePlugged (LInputDevice *device) |
New available input device. More... | |
virtual void | inputDeviceUnplugged (LInputDevice *device) |
Disconnected input device. More... | |
virtual bool | isIdleStateInhibited () const |
Checks if the idle state is inhibited. More... | |
virtual void | onIdleListenerTimeout (const LIdleListener &listener) |
Notifies the timeout of an idle listener. More... | |
virtual void | onEvent (const LEvent &event) |
Notifies of any input event. More... | |
virtual void | nativeInputEvent (void *event) |
Native input backend events. More... | |
virtual bool | configureOutputsRequest (LClient *client, const std::vector< OutputConfiguration > &configurations) |
Handles a client request to configure outputs. More... | |
Additional Inherited Members | |
Public Types inherited from LFactoryObject | |
enum class | Type : Int32 |
Base factory object types. More... | |
Protected Member Functions inherited from LObject | |
LObject () noexcept=default | |
Constructor of the LObject class. More... | |
virtual | ~LObject () noexcept |
Destructor of the LObject class. More... | |
void | notifyDestruction () noexcept |
Notifies the object destruction. More... | |
Group of input and output devices.
The LSeat class represents a collection of input and output devices such as a mouse, keyboard, touch screen, and displays (outputs). These devices are used within a session. Typically, for security reasons, access to these devices is restricted to a single process per session, often a Wayland compositor or X11 server.
To enable the libinput and DRM backends to manage devices without requiring superuser privileges, the openDevice() method is used to obtain device file descriptors. This method internally employs libseat.
By setting the environment variable LOUVRE_ENABLE_LIBSEAT to 0, libseat can be disabled, causing the compositor to launch without multi-session support. Consequently, certain features such as switching to another TTY may become unavailable.
struct Louvre::LSeat::OutputConfiguration |
Configuration parameters for an output.
This structure is used in configureOutputsRequest().
Class Members | ||
---|---|---|
LOutput & | output | The output to be configured. |
bool | initialized | Whether to enable or disable the output, see LCompositor::addOutput() and LCompositor::removeOutput(). |
const LOutputMode & | mode | The desired output mode to be applied, see LOutput::setMode(). |
LPoint | pos | The desired output position to be applied, see LOutput::setPos(). |
LTransform | transform | The desired output transform to be applied, see LOutput::setTransform(). |
Float32 | scale | The desired scale to be applied, see LOutput::setScale(). |
LSeat | ( | const void * | params | ) |
Constructor of the LSeat class.
params | Internal parameters provided in LCompositor::createObjectRequest(). |
~LSeat | ( | ) |
Destructor of the LSeat class.
Invoked after LCompositor::onAnticipatedObjectDestruction().
|
noexcept |
Retrieves the available GPUs.
There is always at least one available GPU (even if virtual), and each output belongs to a single GPU.
|
noexcept |
Vector of available outputs.
This method provides a vector of currently available outputs. The vector includes connected outputs that can be initialized as well as those that are already initialized.
To obtain only initialized outputs, refer to LCompositor::outputs().
|
noexcept |
Vector of available input devices.
|
noexcept |
Surfaces requesting to inhibit the idle state.
|
noexcept |
Listeners used by clients to detect when the user has been idle for a specified amount of time.
|
noexcept |
Sets a hint about the user's idle state.
Resetting all idle listener timers manually with LIdleListeners::resetTimer() each time an event occurs isn't very CPU-friendly, as multiple events can be triggered in a single main loop iteration.
Instead, by using this method (which only updates a boolean variable), we can ask Louvre to update all timers only once at the end of a main loop iteration.
true
at the start of each iteration.
|
noexcept |
Hint about the user's idle state set with setIsUserIdleHint()
.
true
if the user is idle, false
otherwise.
|
noexcept |
The seat name.
This method returns the name of the seat (E.g. "seat0").
|
noexcept |
Active toplevel surface.
This method returns the current LToplevelRole being configured with the LToplevelRole::State::Activated flag.
Only one toplevel surface can be active at a time, Louvre automatically deactivates other toplevels when one is activated.
nullptr
if no toplevel is active.
|
noexcept |
Active LToplevelRole resize sessions.
|
noexcept |
Active LToplevelRole move sessions.
|
inlinenoexcept |
Access to pointer events.
Access to the LPointer instance used to receive pointer events from the backend and redirect them to clients.
|
inlinenoexcept |
Access to keyboard events.
Access to the LKeyboard instance used to receive keyboard events from the backend and redirect them to clients.
|
inlinenoexcept |
Access to touch events.
Access to the LTouch instance used to receive touch events from the backend and redirect them to clients.
|
inlinenoexcept |
Access to the drag & drop session manager.
|
inlinenoexcept |
Access to the clipboard manager.
|
noexcept |
Close all popups.
This method closes all active LPopupRole surfaces in reverse order of creation.
|
noexcept |
Retrieve the topmost popup role.
This method returns a pointer to the topmost popup.
nullptr
if there is no popup.
|
noexcept |
Switches session.
This method allows you to switch to another session (TTY). Louvre also allows switching sessions using the shortcuts Ctrl + Alt + [F1, F2, ..., F10]
.
tty | TTY number. |
Open a device.
Opens a device returning its ID and storing its file descriptor in fd.
The DRM and Libinput backends use this method to open GPUs and input devices respectively.
path | Location of the device (E.g. "/dev/dri/card0") |
fd | Stores the file descriptor. |
Closes a device.
This method is used by the input and graphic backends to close devices.
id | The id of the device returned by openDevice(). |
|
noexcept |
|
noexcept |
Check the session state.
The session is considered disabled if the user is engaged in another active session (TTY).
true
if the seat is active, false
otherwise.
|
virtual |
Notify a change in the enabled() property.
Override this virtual method if you want to be notified when the seat is enabled or disabled.
The seat is enabled when the user is in the session (TTY) in which the compositor is running, and disabled when switching to a different session.
|
virtual |
New available output.
This event is invoked by the graphic backend when a new output is available, for example when connecting an external monitor through an HDMI port.
The default implementation initializes the new output and positions it at the end (right) of the already initialized outputs.
|
virtual |
Disconnected output.
This event is invoked by the graphic backend when an output is no longer available, for example when an external monitor connected to an HDMI port is disconnected.
The default implementation removes the output from the compositor and re-arranges the ones already initialized.
|
virtual |
New available input device.
|
virtual |
Disconnected input device.
|
virtual |
Checks if the idle state is inhibited.
The default implementation returns true
if at least one of the surfaces listed in idleInhibitorSurfaces()
is mapped and visible on at least one output.
true
if the idle state is inhibited, false
otherwise.
|
virtual |
Notifies the timeout of an idle listener.
If LIdleListener::resetTimer() is not called within this event, the LIdleListener::client() will be notified that the user is idle until LIdleListener::resetTimer() is called again.
If the idle state is being inhibited (see isIdleStateInhibited()) LIdleListener::resetTimer() should always be called.
|
virtual |
Notifies of any input event.
This event is similar to nativeInputEvent()
, but is only invoked for input event types currently supported by Louvre.
|
virtual |
Native input backend events.
Override this virtual method if you want to access all events generated by the input backend.
event | Opaque handle to the native backend event. When using the Libinput backend it corresponds to a libinput_event struct |
|
virtual |
Handles a client request to configure outputs.
Triggered by clients using the wlr-output-management protocol, such as wdisplays
, wlr-randr
, and wayland-displays
.
The configurations
vector contains all parameters the client intends to configure all available outputs with, including uninitialized ones (see outputs()).
The compositor can ignore the provided parameters and configure the outputs differently (e.g., to prevent overlapping). Returning true
notifies the client that the configurations were fully or partially applied. Returning false
indicates that the configurations failed to apply, and Louvre will revert all output parameters to their previous state.
client | The client issuing the request. |
configurations | Parameters to configure each available output. |
true
if the configurations were completely or partially applied, or false
to revert changes.