Class Display
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDestroyListener
(org.freedesktop.wayland.server.Listener listener) int
addShmFormat
(int format) Add support for a wl_shm pixel formatint
Add a socket to Wayland display for the clients to connect.static Display
create()
Create Wayland display object.void
destroy()
Destroy Wayland display object.boolean
void
static Display
get
(MemorySegment pointer) int
Get the current serial numberint
hashCode()
int
initShm()
int
Get the next serial numbervoid
register
(DestroyListener destroyListener) void
run()
void
void
unregister
(DestroyListener destroyListener)
-
Field Details
-
OBJECT_ID
public static final int OBJECT_ID- See Also:
-
pointer
-
-
Constructor Details
-
Display
-
-
Method Details
-
addDestroyListener
protected void addDestroyListener(org.freedesktop.wayland.server.Listener listener) -
create
Create Wayland display object.This creates the wl_display object.
- Returns:
- The Wayland display object. Null if failed to create
-
get
-
addSocket
Add a socket to Wayland display for the clients to connect.This adds a Unix socket to Wayland display which can be used by clients to connect to Wayland display.
If NULL is passed as name, then it would look for WAYLAND_DISPLAY env variable for the socket name. If WAYLAND_DISPLAY is not set, then default wayland-0 is used.
The Unix socket will be created in the directory pointed to by environment variable XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, then this function fails and returns -1.
The length of socket path, i.e., the path set in XDG_RUNTIME_DIR and the socket name, must not exceed the maxium length of a Unix socket path. The function also fails if the user do not have write permission in the XDG_RUNTIME_DIR path or if the socket name is already in use.
- Parameters:
name
- Name of the Unix socket.- Returns:
- 0 if success. -1 if failed.
-
addSocketAuto
-
terminate
public void terminate() -
run
public void run() -
flushClients
public void flushClients() -
getSerial
public int getSerial()Get the current serial numberThis function returns the most recent serial number, but does not increment it.
-
nextSerial
public int nextSerial()Get the next serial numberThis function increments the display serial number and returns the new value.
-
getEventLoop
-
register
-
unregister
-
initShm
public int initShm() -
addShmFormat
public int addShmFormat(int format) Add support for a wl_shm pixel formatAdd the specified wl_shm format to the list of formats the wl_shm object advertises when a client binds to it. Adding a format to the list means that clients will know that the compositor supports this format and may use it for creating wl_shm buffers. The compositor must be able to handle the pixel format when a client requests it.
The compositor by default supports WL_SHM_FORMAT_ARGB8888 and WL_SHM_FORMAT_XRGB8888.
- Parameters:
format
- The wl_shm pixel format to advertise- Returns:
- The wl_shm format that was added to the list or 0 if adding it to the list failed.
-
hashCode
-
equals
-
destroy
public void destroy()Destroy Wayland display object.This function emits the wl_display destroy signal, releases all the sockets added to this display, free's all the globals associated with this display, free's memory of additional shared memory formats and destroy the display object.
- See Also:
-