What are the differences between XDefaultScreen and XDefaultScreenOfDisplay?

StackOverflow https://stackoverflow.com/questions/23154955

  •  05-07-2023
  •  | 
  •  

Question

What are the differences between XDefaultScreen and XDefaultScreenOfDisplay? I can see they respectively return an integer and a struct pointer, but:

  • What are those return values used for?
  • When would you choose one over the other?
  • Why are there 2 functions anyway?
Was it helpful?

Solution

  • XDefaultScreen (usually called by the macro DefaultScreen) returns the screen number which is used in most xlib functions where you want to specify a screen e.g. DefaultGC.

  • XDefaultScreenOfDisplay (usually called by the macro DefaultScreenOfDisplay) returns a Screen pointer and is generally used when you want to find out information about a screen e.g. WidthOfScreen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top