27 printf(
"addWindowBox : name = %s, geometry = %s\n", boxname, geometry);
31 winbox->name = strdup(boxname);
32 winbox->geometry = strdup(geometry);
33 winbox->winlist = NULL;
34 if(!
Scr->FirstWindowBox) {
35 Scr->FirstWindowBox = winbox;
37 return (&(winbox->winlist));
47 for(winbox =
Scr->FirstWindowBox; winbox; winbox = winbox->next) {
48 int mask,
x,
y, gravity;
54 if(mask & XNegative) {
56 gravity = (mask & YNegative) ? SouthEastGravity : NorthEastGravity;
59 gravity = (mask & YNegative) ? SouthWestGravity : NorthWestGravity;
61 if(mask & YNegative) {
65 win = XCreateSimpleWindow(
dpy,
Scr->Root,
x,
y, w, h, 0,
Scr->Black,
68 printf(
"createWindowBoxes : name = %s, win = 0x%x, x = %d, y = %d, w = %d, h = %d\n",
69 winbox->name, win,
x,
y, w, h);
71 sprintf(title,
"%s", winbox->name);
73 sizehints.flags = USPosition | USSize | PWinGravity;
78 sizehints.win_gravity = gravity;
80 wmhints.initial_state = NormalState;
82 wmhints.flags = InputHint | StateHint;
84 XmbSetWMProperties(
dpy, win, title, title, NULL, 0,
85 &sizehints, &wmhints, NULL);
90 fprintf(stderr,
"cannot create %s window box, exiting...\n", winbox->name);
93 winbox->twmwin->iswinbox =
true;
101 if(twmwin->iswinbox) {
104 if(!
Scr->FirstWindowBox) {
107 for(winbox =
Scr->FirstWindowBox; winbox; winbox = winbox->next) {
110 twmwin->winbox = winbox;
120 XWindowAttributes attr;
124 XGetWindowAttributes(
dpy, twmwin->winbox->window, &attr);
131 if(
x > attr.width - 1) {
132 *nx = attr.width - 1;
134 if(
y > attr.height - 1) {
135 *ny = attr.height - 1;
142 int minx, miny, maxx, maxy,
x,
y, w, h;
147 for(t =
Scr->FirstWindow; t != NULL; t = t->
next) {
148 if(t->winbox && (t->winbox->twmwin == twmwin)) {
170 for(t =
Scr->FirstWindow; t != NULL; t = t->
next) {
171 if(t->winbox && (t->winbox->twmwin == twmwin)) {
TwmWindow * AddWindow(Window w, AWType wtype, IconMgr *iconp, VirtualScreen *vs)
int frame_x
X position on screen of frame.
int frame_y
Y position on screen of frame.
int frame_bw
2d border width.
unsigned int frame_width
Width of frame.
unsigned int frame_height
Height of frame.
int frame_bw3D
3d border width.
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
Info and control for every X Window we take over.
struct TwmWindow * next
Next TwmWindow on the Screen.
char * name
Current window name. Points into TwmWindow::names.
XClassHint class
Window class info. From XGetClassHint().
struct WindowBox WindowBox
void SetupWindow(TwmWindow *tmp_win, int x, int y, int w, int h, int bw)
bool visible(const TwmWindow *tmp_win)
void createWindowBoxes(void)
WindowBox * findWindowBox(TwmWindow *twmwin)
void fittocontent(TwmWindow *twmwin)
name_list ** addWindowBox(char *boxname, char *geometry)
void ConstrainedToWinBox(TwmWindow *twmwin, int x, int y, int *nx, int *ny)
int RLayoutXParseGeometry(RLayout *layout, const char *geometry, int *x, int *y, unsigned int *width, unsigned int *height)
Parse an X Geometry out to get the positions and sizes.