XLib Confusion (display, screenid, desktop,..)
Hey
I'm currently a little confused about what types/objects are used for what.
1. From what I learned so far, screenId must be the monitor, but what is Display * then ?
2. How are the multiple desktops handled ? can they be accessed at all ?
3. How are positions handled for multiple monitors and multiple desktops ?
i.e. when both my monitors are 640x480, would the position 800,100 be on the second monitor or on the second desktop ?
4.Can I get the monitor handle (screenid?) from a window handle ?
i.e. detect what monitor the specified window is on ?
Is there somewhere an introduction into all the xlib programming stuff you need to know ?
I haven't found good explanations yet, that's why I'm asking here.
Thx
I am sorry that I am unable to answer to your question.
I found a link to a book about it, however. I have no idea if it is legal or not, but google returned this as one of the first results. ("xlib guide")
Here it is:
http://www.myacrobatpdf.com/1747/xlib--c-language-x-interface.html#
The other result google gave me is:
http://tronche.com/gui/x/xlib/introduction/
I found a link to a book about it, however. I have no idea if it is legal or not, but google returned this as one of the first results. ("xlib guide")
Here it is:
http://www.myacrobatpdf.com/1747/xlib--c-language-x-interface.html#
The other result google gave me is:
http://tronche.com/gui/x/xlib/introduction/
While I can't give authoritative answers on your questions, I can give you two pieces of advice:
1) Do not write low level X code unless you want to make yourself unhappy.
2) If you absolutely want to ignore advice #1, use xcb instead of xlib. xcb is a modern replacement for xlib with a better interface.
Okay, I do have one piece of answer: I don't think multiple monitors actually translate to multiple screens nowadays. I think it's all on one big screen, and the monitor configuration can be gleaned from the RandR protocol. There may be some window manager interaction as well.
1) Do not write low level X code unless you want to make yourself unhappy.
2) If you absolutely want to ignore advice #1, use xcb instead of xlib. xcb is a modern replacement for xlib with a better interface.
Okay, I do have one piece of answer: I don't think multiple monitors actually translate to multiple screens nowadays. I think it's all on one big screen, and the monitor configuration can be gleaned from the RandR protocol. There may be some window manager interaction as well.
Widelands - laid back, free software strategy
dilyan:
thanx, I'll take a look at those links.
prefect:
Thx for the hint, but..
1. why not ? I just wanna write opengl window & input code, no extra widgets.
I'll take a deeper look into xcb right away, but I would really like to know what xcb has that xlib doesn't, except for a nicer interface.
2.a do you have to install xcb on the client, or is it available by default
2.b is it really a replacement, or just a wrapper ? ( in other words, does it re-route original xlib code or is it a rewrite of xlib ? )
edit: from what I've read so far, I'd say that xlib is capable of having the client on a different machine than the server,
while xcb does not(making it faster), is that correct ?
thanx, I'll take a look at those links.
prefect:
Thx for the hint, but..
1. why not ? I just wanna write opengl window & input code, no extra widgets.
I'll take a deeper look into xcb right away, but I would really like to know what xcb has that xlib doesn't, except for a nicer interface.
2.a do you have to install xcb on the client, or is it available by default
2.b is it really a replacement, or just a wrapper ? ( in other words, does it re-route original xlib code or is it a rewrite of xlib ? )
edit: from what I've read so far, I'd say that xlib is capable of having the client on a different machine than the server,
while xcb does not(making it faster), is that correct ?
Quote: Original post by TTK-Bandit
1. why not ? I just wanna write opengl window & input code, no extra widgets.
Because if that's all you want, you could just use SDL. It's much simpler, less code for you to write, and it will be almost trivial to port to Windows, Mac OS, and probably even some obscurer platforms.
Quote:
I'll take a deeper look into xcb right away, but I would really like to know what xcb has that xlib doesn't, except for a nicer interface.
Since both xlib and xcb are just "convenience libraries" for the X11 protocol, the only differences are in the interface and in the expectation of future maintenance. xlib will be phased out eventually (though it's obviously going to stay around for a long time still)
Quote:
2.a do you have to install xcb on the client, or is it available by default
It is a relatively recent development (two years ago or so?), so it won't be available on older distributions. On newer distributions, it is available by default.
Quote:
2.b is it really a replacement, or just a wrapper ? ( in other words, does it re-route original xlib code or is it a rewrite of xlib ? )
It is a replacement.
Quote:
edit: from what I've read so far, I'd say that xlib is capable of having the client on a different machine than the server,
while xcb does not(making it faster), is that correct ?
No, that's wrong. Both libraries have the same functionality wrt X11 protocol, except that xcb makes it easier to use asynchronous calls, multi-threading and sane error handling.
Widelands - laid back, free software strategy
Quote: Original post by PrefectBecause if that's all you want, you could just use SDL. It's much simpler, less code for you to write, and it will be almost trivial to port to Windows, Mac OS, and probably even some obscurer platforms.
Well, I won't use SDL, reasons listed here: Gloot Library
thx for all the info, I started working with xcb, and came across a few problems,
some of them I was able to solve, others still bug me.. the documentation of xcb is pretty much non-existent.
for example one problem I can't seem to solve is that XGetXCBConnection() and XSetEventQueueOwner()
can't be found by the linker, even tho it links to libX11-xcb without any error/warning.
I've download the Xlib source and rebuild it to make sure the libraries are up to date, but the same error happens.
I've now temporarily solved the problem by copying the code of those 2 functions into my code, but I'd rather do it the nice way.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement