It has to do with the X Window Server. They define what display numbers there are.
You shouldn't need to worry about explicitly supporting a display number; at the very most, you simply hand the reference to the X Window Client library and let it figure it out.
Modern servers can make multiple displays available with multi-head adapters and with multiple adapters. The vast majority of the time, :0
will be your only display. This is because there really is only one, and that's the default number when there is just one. It is possible to make it start as :2
, which is unusual, but everything would still work okay.
With multi-head displays and/or multiple cards, it is possible to have an X Server manage multiple displays as discrete screens (i.e. with things like Xinerama turned off). Then you can get display numbers like :0.0
and :0.1
. I used to run a desktop like this for a long time. Nothing broke because everything took the display number and just handed it to the X Client library. One unusual advantage was that each screen gets it's own list of virtual desktops. In a Xinerama display, you can't do that. But you have the disadvantage of not being able to move windows between screens, because they have different display numbers.
You can even do things like run multiple X Servers. That's when you get :0
and :1
etc. The problem with that is who gets the keyboard and mouse.