Program on xlib does not want to be establish a position according to the coordinates x and y!
I wrote a gui program! Here's the code: ` #include <stdio.h> #include <X11/Xlib.h> #include <unistd.h>
int main() { Display *d; d = XOpenDisplay(NULL); if(d == NULL) { printf("Fail\n"); return 1; }
int dscr = DefaultScreen(d);
XSetWindowAttributes attrs;
attrs.background_pixel = WhitePixel(d, dscr);
int root = RootWindow(d, dscr);
Window w;
w = XCreateWindow(d, root, 0, 0, 300, 100, 0,
DefaultDepth(d, dscr), InputOutput, DefaultVisual(d, dscr),
CWBackPixel, &attrs);
XStoreName(d, w, "Hello!");
XMapWindow(d, w);
XFlush(d);
sleep(3);
XDestroyWindow(d, w);
XCloseDisplay(d);
return 0;
} ` Here is the screenshot of the result: https://imgur.com/a/8FbELpo
I replaced this line:
w = XCreateWindow(d, root, 0, 0, 300, 100, 0, DefaultDepth(d, dscr), InputOutput, DefaultVisual(d, dscr), CWBackPixel, &attrs);
to this:
w = XCreateWindow(d, root, 400, 300, 300, 100, 0, DefaultDepth(d, dscr), InputOutput, DefaultVisual(d, dscr), CWBackPixel, &attrs);
And here is the screenshot of the result: https://imgur.com/a/G6lqvIk
As you can see, the window did not change its coordinates, although everything was fine before. Before this recently, I updated the system. That's the problem and I do not know how to decide who will help me?
You cannot place a window with XCreateWindow alone on any ICCCM compliant window manager. Icewm is placing your window where it fits the best on the desktop according to its smart placement strategy. If you want to place a window at a position, you need to set the PPostion or UPosition flags on the WM_NORMAL_HINTS property on the window before mapping it. You can do this with XSetWMNormalHints(3) before mapping the window. Note that an ICCCM compliant window manager does not even have to map your window unless you set the initial state with the WM_HINTS protoperty on the window (e.g. with XSetWMHints(3)).