Irbis
Irbis

Reputation: 13509

x11 - how to keep window at fixed position

I develop a plugin for Compiz (window manager). A window manager is run by xfce on my test machine. I have two monitors which are set vertically (top 1920x1080+0+0, bottom 1920x1080+0+1080). A bottom monitor is set as a primary monitor. This option (primary monitor) is available for example in nvidia-settings. In my code I can use xlib function XConfigureWindow when I want to set a top left corner of the game window at position [0,0]. This works fine, but when a window is in the fullscreen mode (covers two monitors) and get a focus it sometimes changes a position. Then the new position of the top left corner starts at 0, 1080 and I can only see half of the window. Maybe that behaviour is connected with the primary screen option. What the primary screen mean for x11 window system ? I'm not allowed to change that option. How to keep a window at fixed position ? Is there any xlib function or a flag which I can use ?

Upvotes: 0

Views: 2047

Answers (1)

user43853
user43853

Reputation: 11

Window manager will not be able to do anything to a window created with this option.

// Create a window : 
window = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 
            win_X, win_Y, win_width,
            win_height, 0, 0, 0);

// Set non managed window
XSetWindowAttributes set_attr;
set_attr.override_redirect = True;
XChangeWindowAttributes(dpy, window, CWOverrideRedirect, &set_attr);

// Map the window on screen
XMapWindow(dpy, window);

Upvotes: 1

Related Questions