The X Window System

Download Report

Transcript The X Window System

The X Window System
Module 5
X-Windows
P.K.K.Thambi
X Window System
 The X Window system was developed as part
of Project Athena at MIT. In 1987, X Version 11
is released. X is now controlled and
maintained by the Open Group.
 The X Windows System, also referred to as ‘X’
or “X11”, is the standard graphical engine for
Unix , Linux and Sun workstations.
 It is largely OS and hardware independent, it
is network-transparent, and it supports many
different desktops.
X-Windows
P.K.K.Thambi
The Graphic User Interface in X
 X Window uses a bit-mapped display where
each pixel can be manipulated individually.
 The entire display is known as the root
window, and individual applications are
displayed as windows on this root window.
 X is started with the startx or xinit commands.
– X can also be invoked during system startup
X-Windows
P.K.K.Thambi
X-window Screen
X-Windows
P.K.K.Thambi
Client / Server Architecture
Separate programs that talks together for
a specific aim.
Server will be the program that supplies
the services and the client is who make
the requests.
X-Windows
P.K.K.Thambi
X Window Clients and Servers
 Although you can easily use the X Window system to run
programs stored on your local computer, you can also
run applications over the network
 X Window uses a client/server model in which a
program can run on one computer but display its output
on another
 The desktop system from which you run a program is
called the X server, the system that hosts and executes
the program is called the X client (this is opposite of
normal networking)
X-Windows
P.K.K.Thambi
X Protocol
Based on TCP/IP stack
The X Protocol provides a client-server architecture at
the application level:
The X client is the processing part of the application
and often runs on a remote machine.
The X server is the display and interaction system.
X-Windows
P.K.K.Thambi
X Protocol cont’d
The X Protocol is also divided into device dependent and
device independent layers.
X-Windows
P.K.K.Thambi
X architecture
The client-server nature of the X Protocol allows a
single X server to support many clients
(applications) on several hosts.
X-Windows
P.K.K.Thambi
Client-Server Window System
Client Application
Programs
Application 1
Application 2
Application n
Virtual
display 1
Virtual
display 2
Virtual
display n
Server
Could be
Window
Manager
Resource
allocator
Device-independent abstraction level
Translates abstraction into reality:
one per terminal type
Devices
X-Windows
Keyboard Mouse
Device
driver
Window
1
Window
2
Window
n
(After Fig 10.2, Dix, Finlay,
Abowd and Beale)
P.K.K.Thambi
X Server Design
 Device Dependent Layer
– It is this layer that is responsible for localizing the X
server to the native environment, be it Windows NT
or Solaris.
– This layer swaps bytes of data from machines with
differing byte ordering. Byte ordering (MSB and
LSB) is noted in each X request.
– This layer hides the architectural differences in
hardware and operating systems.
– Maintains device driver dependencies for
keyboard, mouse and video.
X-Windows
P.K.K.Thambi
X Server
The X server therefore:
 displays drawing requests on the screen.
 replies to information requests.
 reports an error in a request.
 Manages the keyboard, mouse and display device.
– Multiplexes keyboard and mouse input onto the
network (or via local IPC) to the respective X clients.
(X events)
 creates, maps and destroys windows.
– writes and draws in windows
X-Windows
P.K.K.Thambi
X Client
• sends requests to the server.
• receives events from server.
• receives errors from the server
X-Windows
P.K.K.Thambi
X Protocol
 X client communicate with X server using the X
protocol.
 Data is exchanged in an asynchronous manner over a
two-way communication path that enables
transmission of a stream of 8 –bit bytes.
 X protocol is the machine language for the X Window
system
X-Windows
P.K.K.Thambi
X Protocol messages
Requests – client sends requests to the server (e.g.
create window)
Replies – server response to client requests
Events – server forwards events (such as mouse clicks
or keyboard entry) to the client
Errors – server reports errors to the client
X-Windows
P.K.K.Thambi
Protocol Messages - Requests
Requests
 X clients make requests to the X server for a certain
action to take place. i.e.: Create Window
 To enhance performance, the X client normally does
not expect nor wait for a response. The request is
typically left to the reliable network layer to deliver.
X-Windows
P.K.K.Thambi
Protocol Messages - Replies
Replies
 The X Server will respond to certain X client requests
that require a reply. As noted, not all requests require
a reply.
X-Windows
P.K.K.Thambi
Protocol Messages - Events
Events
 The X server will forward to the X client an event that
the application is expecting. This could include
keyboard or mouse input. To minimize network traffic,
only expected events are sent to X clients.
 X events are 32 bytes
X-Windows
P.K.K.Thambi
Protocol Messages - Errors
Errors
 The X server will report errors in requests to the X
client. Errors are like an event but are handled
differently.
 X errors are the same size as events to simplify their
handling. They are sent to the error handling routine
of the X client.
X-Windows
P.K.K.Thambi
Xlib: The Assemble language of X
 A set of C library of X window system
 Xlib gives you access to the X protocol through more
than 300 utility routines.
 It is the The Assemble language of X Window System.
X-Windows
P.K.K.Thambi
X Toolkit: The High level language of X
 XToolkit Intrinsic (Xt Intrinsic) – an object- oriented
approach to implement the basic building blocks
called widgets
X-Windows
P.K.K.Thambi
Structure of an X application
X application
X toolkit
Xt intrinsic
Xlib
X protocol
Network
Interface
X protocol
X Server
Device- dependent Layer
X-Windows
User
P.K.K.Thambi