window always on top and without titlebar

Two questions:
1- Is it possible to make the opengl window always on top(meaning, always on the screen even activating other windows)? It is a vital factor for my project.

2- How to create an opengl window without title bar?

I’m not sure how 1 can be done although I’m pretty sure it can be done. I think XMMS among other apps does it. Anyway in 2 I assume you want to get rid of all decorations, not just the title bar.In order to do that you have to set the override_redirect attribute to true when creating the window.For example:

XSetWindowAttributes wattr;

wattr.border_pixel = 0;
wattr.override_redirect = True; /<----/
wattr.colormap = XCreateColormap(dpy, RootWindow(dpy, vis->screen), vis->visual, AllocNone);
wattr.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask;

w = XCreateWindow(dpy, RootWindow(dpy, vis->screen), 0, 0,
640, 480, 0,
vis->depth, InputOutput, vis->visual,
CWBorderPixel | CWColormap | CWEventMask |
CWOverrideRedirect /<—/, &wattr);

Also be sure to get the Xlib programming manual.

[This message has been edited by zen (edited 05-15-2003).]

thank you but,
How about creating the window using glut as following:

glutInitWindowSize(640, 480);  

/* the window starts at the upper left corner of the screen */
glutInitWindowPosition(0, 0);  

/* Open a window */  
window = glutCreateWindow("OPENGL");  

The answer may be smthg like sizing the window as below.
I do not know anything else to create an opengl panel (or object?) onto a window. I am a beginner.

It is better for me to use glut functions.

My question is living…

I agree it’s better to use glut for now but I looked through the specs briefly and I don’t think you can get that much control over your window using glut.Better check out the specs yourself to make sure but I doubt you’re going to find anything.
You might want to take a look at other toolkits though but again I doubt any general purpose toolkit would give so much control over window creation.
So if no toolkits suit your needs, you can go to and download the lesson about setting up an opengl window. There’s a native Xlib port for it. Then get the xlib programming manual and follow the lesson step by step using the manual to look up what every xlib call does. Also read the general sections on window handling etc. in the manual. If all this sounds terribly hard it isn’t. It won’t be portable either though…

PS: glut removes the decorations of a window automatically when going to fullscreen mode but I suppose you need an undecorated window in, well… windowed mode.

[This message has been edited by zen (edited 05-15-2003).]

Sure, not much control over window properties. It is time to learn and use xlib functions without help of glut.

I couldn’t find anything about xlib on setting up opengl window section of There, all the examples are using glut to create opengl window. What is the address of the link you talk about.

Thank you much

There is the Linux/GLX port of Lesson 2.Try this link. Next get the xlib manual . Also bear in mind that the last time I checked that code it was not, well,entirely by the book. This should not concern you as it should work fine but you may want to change some things. Oh and you might want the ICCM manual too. ICCM is the standard for amongs others the communication of the window manager with X so it might help you get some things like say undecorated and fixed size windows working.
Happy reading.

You may want to look at GLFW too. It does not give much better window control than GLUT, but I think it’s fullscreen management is better than that of GLUT (at least it will be, once I have fixed a few bugs). Also, it’s 100% free & open source, so you can use/study the Xlib code in GLFW if you want to get started with Xlib programming.

Now, I have a window always on top(I did nothing to gain this property, it is always on top by default ? ) and without title bar.
I used xlib to control window attributes. To control existing of title bar, I used “override_redirect” attribute.
thank you Zen.

just care about your mouse and keyboard. This way may disturb your focus. (it did some to me, not yet now).

Well I guess the always on top behaviur comes from the override_redirect flag. This flag actually tells the windowmanager that it can’t touch this window. Take a look at XGrabKeyboard and XGrabPointer to make sure only your app has control over the mouse and keyboard(as jide suggested).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.