X Concepts
Goals of X Window System:
- Provide windows on bitmapped terminals
- Protablity across different OS and maintian high performance
- Allow many mchines to cooperate within a network
- Should not require a particular style of usre interface, "policy free."
X Protocol: Client-Sever Communication
X protocol specifies the pachaging of information between server and Xlib,
even when the server and application program is running on the same machine.
There are 4 types of packets:
- Request:
- From client to server
- A request for service or information
- Not necessarily round-trip request
- Reply:
- Replies from round-trip request
- Information but into:
- Arguments or
- Return value
- Event:
- Generated by:
- User
- Server - Side action of another event
- Window Manger
- Other clients
- Event structure
- Place in clients Event Queue that selects event type
- Error:
- Tell client that previous request invalid
- Handled by error-handling routines in Xlib
Buffering
- To save on network traffic request for information are not sent imediately
to X server rather stored in buffer
- This is possible because many request do not need immediate response
- Buffers are flushed when client:
- Waiting on an event that is not in event queue
- Round-trip request
- Explicit flush of buffer
Resources:
So that large data structures are not transmitted over the web, many
data structures are kept with the server
- Large data structures kept on the X server:
- Windows
- Pixmaps
- Color maps
- Cursor
- Font
- Graphics Context
- Client and server can not pass reference or pointer, so pass ID number
- Reduces network traffic
- ID is return during client request for creation of data structure
For example requise to make a window is illustrated below:
Propeties: Client - client communication
So that clients can communicate artibrary data, properties are packets
of information associated with a window. Client and Window Manager
communicate using properties.
- Properties are packets of information associated with the window
- Have string names (typical upper case with underscore, eg
"WM_COLORMAP") and unique numerical identifier, atom.
- Which are associated with atom identifiers - limit identifier size,
for network efficient communication
- After creating, XInternAtom(), application then use only
the atom.
- Propeties are associated with a window, but multible windows can
have the same propety type, consequently both atom and window ID is
required in a call to the server.
- Predefined atoms (eg. XA_WM_HINTS) are contianed in Xatom.h,
so clients do not need to call XInternAtom(), general
beginning with XA_, for example XA_WM_HINTS
- Predefined properties have specific get and set functions
- Standard properties of each top level window are required
by Window Manager
- Properties are also used for client-client communication, the server
acts intermediator
Window Manger: A special client
- Control the resources of the display
- Decorate the top level application window by reparenting
- WM - application communication is via properties and events
- WM substructure redirection intercepts all window configuration
- Session Mangers control the start up and killing of applications
Windows: Rectangular objects
Windows in X windowing is a rectanglar object on the screen.
Characteristics:
- Parent:
- Can only show in parent window
- Application top level window is child of root window
- Coordinate system:
- Window configuration:
- Window geometery:
- Position of upper left coner - (x, y) origin
- Size; wdith and height
- Border
- Stack order
- Color Cfharacteristics:
- Depth - number of bits/pixel
- Visual - gray/color
- Class type:
- InputOutput - Can revieve input and display output
- InputOnly - All window can revieve input
- Attributes:
- Background - solid, tiled pixmap or transparent
- Border - solid or tiled pixmap
- Bit Gravity - how paritial windows are displayed
- Window Gravity - how child window are displayed
- Backing Store - how to save window
- Saving Under - how to save when obscured
- Events - selected events'
- Substructure Redirect Override - only for temporay windows
- Colormap - which to use
- Cursor - which to use
Window Hiearchy: window tree
- Subwindows are children of the parent
- Wiondows have stacking order among siblings
Window Visible?
- Must be mapped with XMapWindow()
- All ancestors must be mapped
- Must not be obscured by siblings or ancestors siblings
- Buffer must be flushed
- Top level window must be Expose
Events:
- Examples
- User inputs
- Side effects
- Client - client communications
- Imply user control of application
Event Loop:
Propagation of envents:
Events propagate up the window until the first window that has selected
the event or a window that has set do_not_propagate.