24
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL X Windows

Xwindows Notes

Embed Size (px)

Citation preview

Page 1: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Windows

Page 2: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Course topics• X Windows♦ X Protocol♦ Window managers♦ Classic X apps♦ Starting X apps

Page 3: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X WindowsThe X Windows System, also referred to as ‘X’ or “X11”, is the standard graphical engine for Unix and Linux.

It is largely OS and hardware independent, it is network-transparent, and it supports many different desktops.

Page 4: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Page 5: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Windows cont’dX was developed in the mid 80’s to provide a standard GUI for Unix systems, similar to Microsoft Windows.

Windows only runs locally on the machine, but X Windows uses the X Protocol to separate the processing and display for an application.

Page 6: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X ProtocolThe 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.

Page 7: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Protocol cont’dThe X Protocol is also divided into device dependent and device independent layers.

Page 8: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X architectureThe client-server nature of the X Protocol allows a single X server to support many clients (applications) on several hosts.

Page 9: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

roles of a windowing system

Page 10: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Windows architecture

Page 11: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Windows architecture (ctd)• pixel imaging model with some pointing

mechanism

• X protocol defines server-client communication

• separate window manager client enforces policies for input/output:♦ how to change input focus♦ tiled vs. overlapping windows♦ inter-client data transfer

Page 12: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Client-server designX server• Runs locally and accepts multiple X clients• Displays drawing requests and errors• Handles keyboard, video, and mouse• Creates and destroys windows

X client• An application written using X libraries (e.g. Xlib)• Sends request and receives events and errors

Page 13: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

X Protocol messagesRequests – 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

Page 14: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

An aside: XFree86What is XFree86?

“In short, XFree86 is an open source X11-based desktop infrastructure.” – xfree86.org

It runs primarily on Unix and Unix-like OSes such as Linux (and also under Cygwin).

Page 15: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Using X WindowsFirst, an X server must be running:On a local PC or workstation, you can usually start the X server with the “startx” command or it may start automatically, presenting a graphical login display.

Historical note: An X terminal is a dumb terminal that only runs the X server locally, and always connects to X clients on a remote host.

Page 16: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

xtermThe most important X application is, rather ironically, the terminal program xterm.

Old school xterm:

Page 17: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Xterm cont’d

Fancy xterm: OS X xterm:

Page 18: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

An aside: Copying textIn X Windows, the copying interaction is very different from the Ctrl-C/Ctrl-V of Windows.

In an xterm or other X application, highlight the text with the left button, and then paste by middle clicking in any window accepting input.

Page 19: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Some classic X appsxman – manual pages app

Not this

Page 20: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Some classic X appsxbiff – mail notification

Back when we didn’t have mail servers (and we liked it!), mail was stored in local spool files and a process notified the user of new mail. xbiff is named after biff, which is named after Biff the dog, who barked at the postman. Seriously.

Page 21: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Some classic X appsxeyes – ok, this is really the most important

Page 22: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Some classic X appsxclock – pretty self-explanatory

Page 23: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Window managersThe window manager is a special X client that controls the placement and movement of applications, provides title bars and control buttons, menus and taskbars. Some support virtual desktops and very fancy graphics.

Classic window managers include: twm, mwm, olwm, fvwm

Page 24: Xwindows Notes

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Starting X applicationsTo launch an X client from a remote host for display on the local X server, you need to set two things:1) Permission for the remote host to display X clients on the local machine.

xhost +remotehost2) The target display for the remote application.

setenv DISPLAY=server:display