XSetWMProtocols(3)

πŸ’… XSetWMProtocols(3) β€” XLIB FUNCTIONS πŸ’…

🌸 NAME 🌸

XSetWMProtocols, XGetWMProtocols β€” set or read a window's WM_PROTOCOLS property. that's the whole assignment, bestie. iykyk πŸ’–

✨ SYNTAX ✨

okay so these are the exact signatures, no cap:

Status XSetWMProtocols(Display *display, Window w, Atom *protocols, int count);

Status XGetWMProtocols(Display *display, Window w, Atom **protocols_return, int *count_return);

πŸŽ€ ARGUMENTS πŸŽ€

  • display β€” specifies the connection to the X server. literally the server link.
  • count β€” specifies the number of protocols in the list. the count, the number, the vibe.
  • count_return β€” returns the number of protocols in the list. ngl, it's the return-value bestie.
  • protocols β€” specifies the list of protocols. the list you're handing over.
  • protocols_return β€” returns the list of protocols. yes, it returns the list. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so XSetWMProtocols is the one that replaces the WM_PROTOCOLS property on the specified window with the list of atoms you passed in protocols. if that property does not already exist, XSetWMProtocols sets the WM_PROTOCOLS property on the specified window to the list of atoms specified by the protocols argument. no drama, it just sets it. lowkey main character energy.

the property is stored with a type of ATOM and a format of 32. periodt.

if it cannot intern the WM_PROTOCOLS atom, XSetWMProtocols returns a zero status. otherwise, it returns a nonzero status. slay.

XSetWMProtocols can generate BadAlloc and BadWindow errors. keep that in mind, bestie.


XGetWMProtocols is the read girlie: it returns the list of atoms stored in the WM_PROTOCOLS property on the specified window. those atoms describe window manager protocols in which the owner of this window is willing to participate. it's giving "these are the protocols I'm down for."

if the property exists, is of type ATOM, is of format 32, and the atom WM_PROTOCOLS can be interned, XGetWMProtocols sets the protocols_return argument to a list of atoms, sets the count_return argument to the number of elements in the list, and returns a nonzero status. iconic.

otherwise, it sets neither of the return arguments and returns a zero status. 😭 fr fr.

to release the list of atoms, use XFree. don't forget, or it's giving leak vibes.

XGetWMProtocols can generate a BadWindow error.

🌈 PROPERTIES 🌈

  • WM_PROTOCOLS β€” list of atoms that identify the communications protocols between the client and window manager in which the client is willing to participate. that's the whole vibe of this property.

πŸ’€ DIAGNOSTICS πŸ’€

  • BadAlloc β€” the server failed to allocate the requested resource or server memory. not the moment, honestly.
  • BadWindow β€” a value for a Window argument does not name a defined Window. vibe check your window, bestie.

πŸ‘‘ SEE ALSO πŸ‘‘

also: Xlib - C Language X Interface β€” the big classic. 🫢


πŸ’– okay that's the whole page! obsessed. X Version 11, libX11 1.8.14, XSetWMProtocols(3), signing off β€” mwah πŸ’–

πŸ“¦ where this page comes from