X Window System core protocol: Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m Graphic contexts and fonts: Task 16: replaced (1×) / removed (0×) deprecated |dead-url= and |deadurl= with |url-status=;
Filled in 3 bare reference(s) with reFill 2
Line 54:
Most requests for graphic operations include a ''graphic context'', which is a structure that contains the parameters of the graphic operations. A graphic context includes the foreground color, the background color, the font of text, and other graphic parameters. When requesting a graphic operation, the client includes a graphic context. Not all parameters of the graphic context affect the operation: for example, the font does not affect drawing a line.
 
The core protocol specifies the use of server-side fonts.<ref name="font-faq">[{{Cite web|url=http://www.faqs.org/faqs/fonts-faq/part15/ |title=comp.fonts FAQ: X11 Info]|website=www.faqs.org}}</ref> Such fonts are stored as [[Computer file|file]]s, and the server accesses them either directly via the local [[filesystem]] or via the network from another program called ''font server''. Clients can request the list of fonts available to the server and can request a font to be loaded (if not already) or unloaded (if not used by other clients) by the server. A client can request general information about a font (for example, the font ascent) and the space a specific string takes when drawn with a specific font.
 
[[Image:Xfontsel.png|thumb|450px|The <code>xfontsel</code> program allows the user to view the glyphs of a font.]]
Line 81:
Identifiers are unique to the server, not only to the client; for example, no two windows have the same identifier, even if created by two different clients. A client can access any object given its identifier. In particular, it can also access resources created by any other client, even if their identifiers are outside the set of identifiers it can create.
As a result, two clients connected to the same server can use the same identifier to refer to the same resource. For example, if a client creates a window of identifier <code>0x1e00021</code> and passes this number <code>0x1e00021</code> to another application (via any available means, for example by storing this number in a file that is also accessible to the other application), this other application is able to operate on the very same window. This possibility is for example exploited by the X Window version of [[Ghostview]]: this program creates a subwindow, storing its identifier in an [[environment variable]], and calls [[Ghostscript]]; this program draws the content of the [[PostScript]] file to show in this window.<ref name="ghos-inte">[{{Cite web|url=https://www.gnu.org/software/gv/manual/html_node/Interface-with-ghostscript.html Ghostview: |title=Interface with ghostscript] - GNU gv Manual|website=www.gnu.org}}</ref>
 
Resources are normally destroyed when the client that created them closes the connection with the server. However, before closing connection, a client can request the server not to destroy them.
Line 183:
Properties are mostly used for inter-client communication. For example, the property named <code>WM_NAME</code> (the property named by the atom whose associated string is <code>"WM_NAME"</code>) is used for storing the name of windows. [[Window manager]]s typically read this property to display the name of windows in their title bar.
Some types of inter-client communication use properties of the root window. For example, according to the [[freedesktop]] window manager specification,<ref name="free-desk">[http{{Cite web|url=https://www.freedesktop.org/wiki/Specifications/wm-spec/?action=show&redirect=Standards%2Fwm/wm-spec|title=wm-spec|website=www.freedesktop.org}}</ref> Freedesktopwindow managers should store the identifier of the currently [[active window]] managerin specificationthe property named <code>_NET_ACTIVE_WINDOW</code> of the root window. The [[X resources]], which contain [[parameter (computer science)|parameter]]s of programs, are also stored in properties of the root window; this way, all clients can access them, even if running on different computers.
</ref> window managers should store the identifier of the currently [[active window]] in the property named <code>_NET_ACTIVE_WINDOW</code> of the root window. The [[X resources]], which contain [[parameter (computer science)|parameter]]s of programs, are also stored in properties of the root window; this way, all clients can access them, even if running on different computers.
The <code>xprop</code> program prints the properties of a given window; <code>xprop -root</code> prints the name, type, and value of each property of the root window.