Fundamentals of Xlib Programming by Examples by Ross Maloney Contents 1 Introduction 1 1.1 Critic of the available literature . 1 1.2 The Place of the X Protocol . 1 1.3 X Window Programming gotchas . 2 2 Getting started 4 2.1 Basic Xlib programming steps . 5 2.2 Creating a single window . 5 2.2.1 Open connection to the server . 6 2.2.2 Top-level window . 7 2.2.3 Exercises . 10 2.3 Smallest Xlib program to produce a window . 10 2.3.1 Exercises . 10 2.4 A simple but useful X Window program . 11 2.4.1 Exercises . 12 2.5 A moving window . 12 2.5.1 Exercises . 15 2.6 Parts of windows can disappear from view . 16 2.6.1 Testing overlay services available from an X server . 17 2.6.2 Consequences of no server overlay services . 17 2.6.3 Exercises . 23 2.7 Changing a window’s properties . 23 2.8 Content summary . 25 3 Windows and events produce menus 26 3.1 Colour . 26 3.1.1 Exercises . 27 i CONTENTS 3.2 A button to click . 29 3.3 Events . 33 3.3.1 Exercises . 37 3.4 Menus . 37 3.4.1 Text labelled menu buttons . 38 3.4.2 Exercises . 43 3.5 Some events of the mouse . 44 3.6 A mouse behaviour application . 55 3.6.1 Exercises . 58 3.7 Implementing hierarchical menus . 58 3.7.1 Exercises . 67 3.8 Content summary . 67 4 Pixmaps 68 4.1 The pixmap resource . 68 4.2 Pattern patches . 69 4.3 Bitmap patterns . 69 4.3.1 Exercises . 74 4.4 A bitmap cursor . 74 4.4.1 Exercises . 78 4.5 A partially transparent pixmap . 78 4.6 Using Postscript to create labels . 79 4.7 Changing the colour of a pixmap . 83 4.8 Reducing server-client interaction by images . 87 4.8.1 Exercises . 90 4.9 Creating menus by using the image format . 90 4.9.1 Exercises . 95 4.10 Forming text messages from bitmap glyphs . 95 4.10.1 Accessing X11 standard bitmap fonts . 96 ii CONTENTS 4.10.2 How to used the bitmap fonts . 99 4.10.3 Exercises . 106 4.11 Using pixmaps to colour a window’s background . 106 4.11.1 Exercises . 111 4.12 Content summary . 111 5 Keyboard entry and displaying text 112 5.1 Elementary X keyboard text entry . 113 5.1.1 Exercises . 116 5.2 What fonts are available . 116 5.3 Keyboard echoing on windows . 118 5.3.1 Exercises . 123 5.4 Putting text in a window . 123 5.4.1 Exercises . 126 5.5 Insertion cursor . 126 5.5.1 Exercised . 131 5.6 Moving between text input windows using keys . 131 5.6.1 Exercises . 135 5.7 A slider bar . 136 5.7.1 Exercises . 140 5.8 Scrolling text . 140 5.8.1 Scrolling horizontally . 141 5.8.2 Scrolling vertically . 145 5.8.3 Exercises . 149 5.9 Contents Summary . 150 6 Classic drawing 151 6.1 Limit on multiple objects in a request . 151 6.2 Drawing lines, circles, and a coloured-in square . 153 6.2.1 Exercises . 156 iii CONTENTS 6.3 A symbol composed from circle parts . 156 6.3.1 Exercises . 159 6.4 A circle bouncing off plain edges . 160 6.4.1 Exercises . 163 6.5 Displaying the multi colours of a photograph . 163 6.5.1 Exercises . 168 6.6 Content summary . 168 7 Extras 169 7.1 Multi-colour XPM pixmaps . 169 7.1.1 Exercises . 175 7.2 Using the X Protocol directly . 175 iv Chapter 1 Introduction 1.1 Critic of the available literature 1.2 The Place of the X Protocol The X Protocol is the information that is exchanged between the client and the server of the X Win- dow system. It is the protocol that enables X to work. It is the existence of this protocol for such an information interchange that enables the client and the server of X Window to be network connected in contrast to being on the one computer. The client program exchanges these protocol packets with the server program, using.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages180 Page
-
File Size-