ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am having trouble writing an Xlib application that displays a window. The most frustrating thing is that I've written applications like this before, and never had any problems. For some reason I cannot get this program to work properly. I'm running KDE and when I launch the program, a "button" for the application will appear on the application panel, however, no window will display. It is possible to right click on the panel button and select the Close item which will successfully close the window.
The following is source code that when built will exhibit the behaviour described above:
Does it give you any error messages (i.e. when running your application from a terminal) ?
First thing I'd check in an OpenGL app is if OpenGL is generally supported (glXQueryExtension) and then deciding what to do next.
I have always been launching the program from GDB, and I have never noticed the program emitting any error information. This is just another aspect that adds to the frustration of the problem.
OpenGL is definitely supported. Other application I've written like this use OpenGL and they work fine. I cannot determine what the difference is between this more recent application which doesn't work and the former applications what work just fine.
Could it be because of you specifying the bordersize as null but adding the CWBorderPixel mask ? Weird, but stranger things do happen sometimes.
Otherwise, did you try yet to replace the gl-specific arguments to XCreateWindow with "CopyFromParent" to rule out that it's something gl-specific ?
Well, that's at least the two next thoughts I had about your code. If they don't give any more hints I guess it's time to check all return values etc., and see where it all goes wrong.
Are you sure $DISPLAY is set correctly? Are you able to run your program directly from the command prompt? Do standard X clients (e.g. "xclock") run OK from the same command prompt?
I know that border_width must be 0 for an InputOnly window, but I wasn't aware of any restriction where it *couldn't* be zero...
SUGGESTION:
I think maybe fantas hit it on the head:
Quote:
Could it be because of you specifying the bordersize as null but adding the CWBorderPixel mask?
Try *removing* CWBorderPixel, change border_width back from 1 to 0, and see if it works now.
QUESTION:
I'm also curious about your version info:
a) platform (e.g. Ubuntu 8.04),
b) X Windows version,
... and ...
c) desktop Window Manager (e.g. KDE xy.z)
I removed the CWBorderPixel flag from the XCreateWindow and changed the border_width back to zero. The window failed to display.
I'm running Fedora 9 on an Intel Core2 Duo system.
X-Server version 11
KDE 4.2.0
NVIDIA GeForce 7600 GT/PCI/SSE2
Compiz Window Manager with Slate Horn Emerald theme.
Less weird now (at least to me as I would have been surprised that X11 could choke on such a situation), but still enough weird that a zero-size border should give such a result.
I have no ideas about KDE or Compiz though, but in this light it sounds like that's where the bug (if we can call it like that) originates from.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.