.TH "wayland::read_intent" 3 "Wed May 3 2023" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::read_intent \- Represents an intention to read from the display file descriptor\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "bool \fBis_finalized\fP () const" .br .RI "Check whether this intent was already finalized with \fBcancel\fP or \fBread\fP\&. " .ti -1c .RI "void \fBcancel\fP ()" .br .RI "Cancel read intent\&. " .ti -1c .RI "void \fBread\fP ()" .br .RI "Read events from display file descriptor\&. " .in -1c .SH "Detailed Description" .PP Represents an intention to read from the display file descriptor\&. When not using the convenience method \fBdisplay_t::dispatch\fP that takes care of this automatically, threads that want to read events from a Wayland display file descriptor must announce their intention to do so beforehand - in the C API, this is done using wl_display_prepare_read\&. This intention must then be resolved either by actually invoking a read from the file descriptor or cancelling\&. .PP This RAII class makes sure that when it goes out of scope, the intent is cancelled automatically if it was not finalized by manually cancelling or reading before\&. Otherwise, it would be easy to forget resolving the intent e\&.g\&. when handling errors, potentially leading to a deadlock\&. .PP Read intents can only be created by a \fBdisplay_t\fP with \fBdisplay_t::obtain_read_intent\fP and \fBdisplay_t::obtain_queue_read_intent\fP\&. .PP Undefined behavior occurs when the associated \fBdisplay_t\fP or \fBevent_queue_t\fP is destroyed when a \fBread_intent\fP has not been finalized yet\&. .PP Definition at line \fB370\fP of file \fBwayland\-client\&.hpp\fP\&. .SH "Member Function Documentation" .PP .SS "void wayland::read_intent::cancel ()" .PP Cancel read intent\&. An exception is thrown when the read intent was already finalized\&. .SS "bool wayland::read_intent::is_finalized () const" .PP Check whether this intent was already finalized with \fBcancel\fP or \fBread\fP\&. .SS "void wayland::read_intent::read ()" .PP Read events from display file descriptor\&. This will read events from the file descriptor for the display\&. This function does not dispatch events, it only reads and queues events into their corresponding event queues\&. If no data is avilable on the file descriptor, \fBread()\fP returns immediately\&. To dispatch events that may have been queued, call \fBdisplay_t::dispatch_pending\fP or \fBdisplay_t::dispatch_queue_pending\fP\&. .PP An exception is thrown when the read intent was already finalized\&. Each read intent can only be used for reading once\&. A new one must be obtained for any further read requests\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.