Peng Xiaoyu wrote:
thank you, Will
this little program works, although an unnamed window appears in the
task list
it's quite annoying.
i still wonder how Rezza had his panel work fine
2006/4/23, Will Udovich <
[EMAIL PROTECTED]>:
Rezza
and I had this discussion a few weeks ago. For him, his windows
saw the panel just fine and it worked. I was using pekwm and this did
not happen. I then found this nice little program which will set the
"strut" around your desktop as to where windows will minimize or
maximize to.
Code:
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#define LEFT 30
#define RIGHT 30
#define TOP 30
#define BOTTOM 30
int main(int argc, char **argv)
{
Display *dpy;
Window win;
XEvent event;
unsigned long strut[4];
XWMHints xwmh = { (InputHint|StateHint), False, IconicState, 0, 0,
0,
0, 0, 0, };
if ((dpy = XOpenDisplay(NULL)) == NULL) {
fprintf(stderr, "%s: can't open %s\en", argv[0],
XDisplayName(NULL));
exit(1);
}
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
0, 0, 1, 1, 0, 0, 0);
XSetWMHints(dpy, win, &xwmh);
XMapWindow(dpy, win);
strut[0] = LEFT;
strut[1] = RIGHT;
strut[2] = TOP;
strut[3] = BOTTOM;
XChangeProperty (dpy, win, XInternAtom(dpy, "_NET_WM_STRUT", False),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) strut, 4);
while (1) {
XNextEvent(dpy, &event);
}
}
To Compile:
gcc -L/usr/X11R6/lib -lX11 -o simple_strut simple_strut.c
Adjust the values which are set to 30 for all borders by default. I set
left and right to zero, and then changed top and bottom to accommodate
my panel. It may take a few tries to get things just right. Once the
program has compiled, run it in the background and your windows should
maximize right where you want them to. Good luck!
This is a problem I have had as well. For the time being I've lived
with it, but any additions/modifications to the code or any tips on how
to remove the program window would be appreciated. If I happen to
figure it out, I'll drop a line back here. - Will
|