home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Shareware 1999 March
/
PCShareware-3-99.iso
/
IMPLE
/
DJGPP.RAR
/
DJGPP2
/
XLIB-SR0.ZIP
/
SRC
/
XLIBEMU
/
RECONFW.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-20
|
6KB
|
225 lines
/* $Id: reconfw.c 1.2 1994/02/20 19:53:38 ulrich Exp $ */
/*
* X library function XConfigureWindow.
*/
#include "Xlibemu.h"
int
XConfigureWindow (Display* dpy,
Window w,
unsigned int value_mask,
XWindowChanges* values)
{
int mapped;
int i, x, y, width, height, border_width;
XEvent xe;
Window sibling, window;
if (0 == _WCheckWindow (dpy, w, X_ConfigureWindow))
return 0;
i = ConnectionNumber(dpy);
if (w->override_redirect == False
&& w->parent != None
&& 0 != (w->parent->event_mask & SubstructureRedirectMask)
&& 0 == (w->parent->event_masks[i] & SubstructureRedirectMask)) {
xe.xconfigurerequest.type = ConfigureRequest;
xe.xconfigurerequest.send_event = False;
xe.xconfigurerequest.parent = w->parent;
xe.xconfigurerequest.window = w;
xe.xconfigurerequest.x = (value_mask & CWX) ? values->x : w->x;
xe.xconfigurerequest.y = (value_mask & CWY) ? values->y : w->y;
xe.xconfigurerequest.width = (value_mask & CWWidth) ? values->width : w->width;
xe.xconfigurerequest.height = (value_mask & CWHeight) ? values->height : w->height;
xe.xconfigurerequest.border_width =
(value_mask & CWBorderWidth) ? values->border_width : w->border_width;
xe.xconfigurerequest.above = (value_mask & CWSibling) ? Above : None;
xe.xconfigurerequest.detail = (value_mask & CWStackMode) ? values->stack_mode : 0;
xe.xconfigurerequest.value_mask = value_mask;
if (_WRedirectEvent (dpy, &xe))
return 0;
}
/*
* Note: Xlib manual says override-redirect flag has no effect on
* ResizeRedirectMask.
*/
if (0 != (w->event_mask & ResizeRedirectMask)
&& 0 == (w->event_masks[i] & ResizeRedirectMask)
&& 0 != (value_mask & (CWWidth | CWHeight))) {
xe.xresizerequest.type = ResizeRequest;
xe.xresizerequest.send_event = False;
xe.xresizerequest.window = w;
xe.xresizerequest.width =
(value_mask & CWWidth) ? values->width : w->width;
xe.xresizerequest.height =
(value_mask & CWHeight) ? values->height : w->height;
_WRedirectEvent (dpy, &xe);
/*
* Note: Xlib manual says: Use current width and height.
*/
value_mask &= ~(CWWidth & CWHeight);
}
mapped = w->mapped;
/* Initiailize defaults */
x = w->x;
y = w->y;
width = w->width;
height = w->height;
border_width = w->border_width;
/* Check values */
if (value_mask & CWX) {
if (x != values->x)
x = values->x;
else
value_mask &= ~CWX;
}
if (value_mask & CWY) {
if (y != values->y)
y = values->y;
else
value_mask &= ~CWY;
}
if (value_mask & CWWidth) {
if (width != values->width)
width = values->width;
else
value_mask &= ~CWWidth;
}
if (value_mask & CWHeight) {
if (height != values->height)
height = values->height;
else
value_mask &= ~CWHeight;
}
if (value_mask & CWBorderWidth) {
if (border_width != values->border_width)
border_width = values->border_width;
else
value_mask &= ~CWBorderWidth;
}
if (value_mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth)) {
if (w->mapped) _WUnmapWindow (dpy, w);
w->x = x;
w->y = y;
w->width = width;
w->height = height;
w->border_width = border_width;
_WNewWindowContext (w);
}
if (value_mask & CWStackMode) {
if (w->mapped) _WUnmapWindow (dpy, w);
if (value_mask & CWSibling) {
sibling = values->sibling;
if (sibling->parent == w->parent) {
switch (values->stack_mode) {
case Above:
_WTreeDelete (w);
_WTreeInsertAbove (sibling, w);
break;
case Below:
_WTreeDelete (w);
_WTreeInsertBelow (sibling, w);
break;
case TopIf:
for (window = w;
window != None;
window = window->upper_sibling) {
if (window == sibling
&& EXTENTCHECK(&sibling->border_port, &w->window_port)) {
_WTreeDelete (w);
_WTreeInsertAbove (sibling, w);
}
}
break;
case BottomIf:
for (window = w;
window != None;
window = window->lower_sibling) {
if (window == sibling
&& EXTENTCHECK(&sibling->border_port, &w->window_port)) {
_WTreeDelete (w);
_WTreeInsertBelow (sibling, w);
}
}
break;
case Opposite:
break;
}
}
}
else {
switch (values->stack_mode) {
case Above:
XRaiseWindow (dpy, w);
break;
case Below:
XLowerWindow (dpy, w);
break;
case TopIf:
for (sibling = w->upper_sibling;
sibling != None;
sibling = sibling->upper_sibling) {
if (EXTENTCHECK (&w->window_port, &sibling->border_port)) {
XRaiseWindow (dpy, w);
break;
}
}
break;
case BottomIf:
for (sibling = w->lower_sibling;
sibling != None;
sibling = sibling->upper_sibling) {
if (EXTENTCHECK (&w->border_port, &sibling->window_port)) {
XLowerWindow (dpy, w);
break;
}
}
break;
case Opposite:
break;
}
}
}
if (w->event_mask & StructureNotifyMask) {
xe.xconfigure.type = ConfigureNotify;
xe.xconfigure.send_event = 0;
xe.xconfigure.display = dpy;
xe.xconfigure.event = w;
xe.xconfigure.window = w;
xe.xconfigure.x = w->x;
xe.xconfigure.y = w->y;
xe.xconfigure.width = w->width;
xe.xconfigure.height = w->height;
xe.xconfigure.border_width = w->border_width;
xe.xconfigure.above = w->lower_sibling;
xe.xconfigure.override_redirect = w->override_redirect;
_WDispatchEvent (&xe);
}
if (w->parent != None &&
w->parent->event_mask & SubstructureNotifyMask) {
xe.xconfigure.type = ConfigureNotify;
xe.xconfigure.send_event = 0;
xe.xconfigure.display = dpy;
xe.xconfigure.event = w->parent;
xe.xconfigure.window = w;
xe.xconfigure.x = w->x;
xe.xconfigure.y = w->y;
xe.xconfigure.width = w->width;
xe.xconfigure.height = w->height;
xe.xconfigure.border_width = w->border_width;
xe.xconfigure.above = w->lower_sibling;
xe.xconfigure.override_redirect = w->override_redirect;
_WDispatchEvent (&xe);
}
if (mapped != 0 && w->mapped == 0) _WMapWindow (dpy, w);
return 0;
}