|
Setting the WM_NAME property.Until now our little program hasn't displayed anything in it's titlebar. The windowmanager will look for the WM_NAME property for our top level window and use this as the title. Setting properties is usually a pretty complicated business but luckily this is such a common action that a convenience function has been made. More information about properties and atoms will follow in the third tutorial.
We start out by defining the title we want and the XTextProperty structure we want to use. We then call the XStringListToTextProperty function which fills out the XTextProperty structure for us. Note that XStringListToTextProperty expects an array as the first argument and that we cheat by giving it the pointer the title pointer specifying that this is an array of length 1. In case we're out of memory we check the return value of XStringListToTextProperty and show the user and error before we quit. The title has successfully been transferred to our XTextProperty structure and we call XSetWMName to set this property on the X server. Finally we clean up after ourselves by calling XFree on the value variable of our XTextProperty which XStringListToTextProperty allocated for us. Final wordsThe latest version of this tutorial is part of the frekko project and can always be found here.Hopefully this little tutorial has given you a feeling about how events work. Next time we will be back with a tutorial about atoms, the inner building blocks of X ;) Attached files: Comment List
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||