X Window System Computer Center CS NCTU 2

  • Slides: 25
Download presentation
X Window System

X Window System

Computer Center, CS, NCTU 2 Outline q X Window System • • Introduction Architecture

Computer Center, CS, NCTU 2 Outline q X Window System • • Introduction Architecture X 11 Implemetation The Window Manager q Steps of exercise • Install and Configuring X 11 • Install Window Manager

Computer Center, CS, NCTU 3 X Window System (1) • Introduction – X can

Computer Center, CS, NCTU 3 X Window System (1) • Introduction – X can be called "X"、"X 11"、"X Window", using to provides a graphical user interface (GUI). – X was designed from the beginning to be network-centric, and adopts a "client-server" model. • History – 1984: The X Window system was developed as part of Project Athena at MIT. – 1987: X Version 11 is released. X is now controlled and maintained by the Open Group. – 2005/12: X 11 R 7 – 2009/10: X 11 R 7. 5 – 2010/11: X 11 R 7. 6 – 2012/6: X 11 R 7. 7 – 2013/? ? : X 11 R 7. 8

Computer Center, CS, NCTU 4 X Window System (2) q Architecture: • A client-server

Computer Center, CS, NCTU 4 X Window System (2) q Architecture: • A client-server architecture Ø The X client request display service Ø The X server provide display service Ø Communicate with X Protocol

Computer Center, CS, NCTU X Window System (3) • Client-Server Design – Client •

Computer Center, CS, NCTU X Window System (3) • Client-Server Design – Client • An application written using X libraries (e. g. Xlib) • Request service (like create window) • Receive events from X server (like mouse input) – Server • Runs locally and accepts multiple X clients • Manage the keyboard, mouse and display device • Create, draw and destroy graphic objects on screen 5

Computer Center, CS, NCTU 6 X Window System (4) q X Protocol • The

Computer Center, CS, NCTU 6 X Window System (4) q X Protocol • The X Protocol is also divided into device dependent and device independent layers. • Advantages of X protocol Ø The X server is highly portable (various OS, Language) Ø The X Clients also have high portability Ø Local and network based computing look and feel the same

Computer Center, CS, NCTU X 11 Implementation q Open-source implementations of X Window System

Computer Center, CS, NCTU X 11 Implementation q Open-source implementations of X Window System • XFree 86 project Ø Latest Version: 4. 8. 0 Dec. 15, 2008 • Xorg foundation Ø X 11 official flavor Ø Latest Version: 7. 7 7 June 6, 2012

Computer Center, CS, NCTU The Window Manager (1) • Window Manager – A special

Computer Center, CS, NCTU The Window Manager (1) • Window Manager – A special kind of "X Client" provides certain look-and-feel window in front of you. • Background, desktop, theme • Virtual desktop • Window attributes and operations size: – resize, minimize, maximize – position: overlap, move – Interactions between X server and X client will be redirected to a window manager. 8

Computer Center, CS, NCTU 9 The Window Manager (2) q Some Popular Window Managers

Computer Center, CS, NCTU 9 The Window Manager (2) q Some Popular Window Managers • • • Gnome KDE Lxde Xfce Afterstep etc. .

Computer Center, CS, NCTU 10 Steps of exercise q Install X 11 q Configuring

Computer Center, CS, NCTU 10 Steps of exercise q Install X 11 q Configuring X 11 q Install Window Manager q Configuring Window Manager

Computer Center, CS, NCTU 11 Install X 11 q We use Xorg as our

Computer Center, CS, NCTU 11 Install X 11 q We use Xorg as our X Server • To build and install Xorg from the ports Ø Login as root Ø /usr/ports/x 11/xorg Ø # portmaster x 11/xorg (7. 5. 2) • To build Xorg in its entirety, be sure to have at least 4 GB of free space available. Ø /usr/ports/*/*/work/* Ø /usr/local/*

Computer Center, CS, NCTU Configuring X 11 (1) • Pre-step – know your hardware

Computer Center, CS, NCTU Configuring X 11 (1) • Pre-step – know your hardware – Monitor specifications • Horizon Synchronization frequency – Ex: 31 ~ 81 KHz • Vertical Synchronization frequency – Ex: 56 ~ 76 KHz – Video adaptor chipset • Ex: ATI Radeon 4670 EAH • Ex: n. VIDIA Ge. Fource 9800 GT • Ex: ATI Mobility RADEON 7500 (16 M) (IBMT 30) – Video Adapter Memory • Ex: 128 MB 12

Computer Center, CS, NCTU 13 Configuring X 11 (2) q Starting with version 7.

Computer Center, CS, NCTU 13 Configuring X 11 (2) q Starting with version 7. 4, Xorg can use HAL (Hardware Abstraction Layer) to autodetect keyboards and mice. • Install the following ports Ø sysutils/hal Ø devel/dbus • And adding the following lines into /etc/rc. conf Ø hald_enable="YES" Ø dbus_enable="YES"

Computer Center, CS, NCTU Configuring X 11 (3) • Steps of X 11 configuration

Computer Center, CS, NCTU Configuring X 11 (3) • Steps of X 11 configuration – As of version 7. 3, Xorg often work without any configuration file. • # startx – X 11 configuration – Generate an X 11 configuration skeleton file • # Xorg -configure • The file will be put in /root/xorg. conf. new – Test the existing configuration • # Xorg -config /root/xorg. conf. new • If a black and grey grid an X mouse cursor appear, the configuration was successful 14

Computer Center, CS, NCTU 15 Configuring X 11 (4) q Tune Configuration file •

Computer Center, CS, NCTU 15 Configuring X 11 (4) q Tune Configuration file • Edit /root/xorg. conf. new Ø Section Monitor Ø Section Screen Ø Section Input. Device Section "Screen" Identifier "Screen 0" Device "Card 0" Monitor "Monitor 0" Default. Depth 24 Sub. Section "Display" Viewport 0 0 Depth 24 Modes "1280 x 1024" "1024 x 768" End. Sub. Section End. Section "Input. Device" Identifier "Mouse 0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/sysmouse" Option "ZAxis. Mapping" "4 5" End. Section "Monitor" Identifier "Monitor 0" Vendor. Name "Monitor Vendor" Model. Name "Monitor Model“ Horiz. Sync 31. 0 - 81. 0 Vert. Refresh 56. 0 - 76. 0 End. Section

Computer Center, CS, NCTU 16 Configuring X 11 (5) q Copy the configuration file

Computer Center, CS, NCTU 16 Configuring X 11 (5) q Copy the configuration file to real place • % cp /root/xorg. conf. new /etc/X 11/xorg. conf q Start X • % startx

Computer Center, CS, NCTU 17 Install Window Manager (1) q Here we use xfce

Computer Center, CS, NCTU 17 Install Window Manager (1) q Here we use xfce 4 as our WM • http: //www. xfce. org q Installation • x 11 -wm/xfce 4 • # portmaster x 11 -wm/xfce 4

Computer Center, CS, NCTU Install Window Manager (2) q Configuring X 11 to use

Computer Center, CS, NCTU Install Window Manager (2) q Configuring X 11 to use Xfce 4 • Edit "xinitrc" Ø File Location: – System Default: – Personal: /usr/local/lib/X 11/xinitrc ~/. xinitrc Ø Format: just like a shell script! – exec /usr/local/bin/xfce 4 -session Ø echo "/usr/local/bin/startxfce 4" > ~/. xinitrc # start some nice programs twm & xclock -geometry 50 x 50 -1+1 & xterm -geometry 80 x 50+494+51 & xterm -geometry 80 x 20+494 -0 & exec xterm -geometry 80 x 66+0+0 -name login 18

Computer Center, CS, NCTU 19 Install Window Manager (3) q Run your X Window

Computer Center, CS, NCTU 19 Install Window Manager (3) q Run your X Window • % startx

Computer Center, CS, NCTU Appendix A: X Startup (1) q xinit - X Window

Computer Center, CS, NCTU Appendix A: X Startup (1) q xinit - X Window System initializer • xinit [ [ client ] options ] [ -- [ server ] [ display ] options ] Ø Files – Default client script: » ~/. xinitrc » /usr/local/lib/X 11/xinitrc (run xterm if. xinitrc does not exist) – Default server script: » ~/. xserverrc » /usr/local/lib/X 11/xinit/xserverrc (run X if. xserverrc does not exist) q startx: • script to initiate an X session 20

Computer Center, CS, NCTU Appendix A: X Startup (2) q Xdm - X Display

Computer Center, CS, NCTU Appendix A: X Startup (2) q Xdm - X Display Manager • Xdm provides services similar to those provided by init, getty and login on character terminals Ø x 11/xdm Ø Other display manager – gdm, kdm • Files: Ø /etc/ttys ttyv 8 "/usr/local/bin/xdm -nodaemon" xterm on secure Ø Default script – ~/. xsession 21

Computer Center, CS, NCTU Appendix B: Remote X client q To launch an X

Computer Center, CS, NCTU Appendix B: Remote X client q To launch an X client from a remote host for display on the local X server, you need to do following steps: • Start X Server with tcp connection support Ø % X • Permit for the remote host to display X clients on the local machine. Ø % xhost +remotehost • Set DISPLAY for remote X clients Ø % setenv DISPLAY server: display 22

Computer Center, CS, NCTU Appendix C: X 11 forwarding q To forward X 11

Computer Center, CS, NCTU Appendix C: X 11 forwarding q To forward X 11 connection • Connection to X 11 DISPLAY can be forward by ssh, any X 11 programs started will go through the encrypted channel. • Server: Ø Enables X 11 forwarding: Ø Enables trusted X 11 forwarding: ssh -X ssh -Y (may be dangerous) • Client: Ø Execute any X clients you want • ※Note: Ø X 11 forwarding can represent a security hazard. 23

Computer Center, CS, NCTU Appendix D: VNC q VNC is a graphical desktop sharing

Computer Center, CS, NCTU Appendix D: VNC q VNC is a graphical desktop sharing system to remotely control another computer. • Start VNC Server (and input a connection password) Ø % vncserver Ø VNC startup script – ~/. vnc/xstartup (just like ~/. xinitrc) • Than you can connect to vnc server by a vnc client • Common VNC Client Ø Real. VNC Ø Ultrl. VNC 24

Computer Center, CS, NCTU 25 Reference q http: //www. x. org/wiki/ q http: //en.

Computer Center, CS, NCTU 25 Reference q http: //www. x. org/wiki/ q http: //en. wikipedia. org/wiki/X_Window_System q http: //www. xfce. org q http: //www. freebsd. org/doc/handbook/x 11. html q http: //www. freebsd. org/doc/zh_TW/books/handbook/x 11. ht ml