|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Copyright 1986, 1998 The Open Group
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
5bd3a9 |
documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
5bd3a9 |
the above copyright notice appear in all copies and that both that
|
|
Packit |
5bd3a9 |
copyright notice and this permission notice appear in supporting
|
|
Packit |
5bd3a9 |
documentation.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
The above copyright notice and this permission notice shall be included
|
|
Packit |
5bd3a9 |
in all copies or substantial portions of the Software.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
Packit |
5bd3a9 |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Packit |
5bd3a9 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
Packit |
5bd3a9 |
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
Packit |
5bd3a9 |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
Packit |
5bd3a9 |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
Packit |
5bd3a9 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Except as contained in this notice, the name of The Open Group shall
|
|
Packit |
5bd3a9 |
not be used in advertising or otherwise to promote the sale, use or
|
|
Packit |
5bd3a9 |
other dealings in this Software without prior written authorization
|
|
Packit |
5bd3a9 |
from The Open Group.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
5bd3a9 |
#include <config.h>
|
|
Packit |
5bd3a9 |
#endif
|
|
Packit |
5bd3a9 |
#include "Xlibint.h"
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\
|
|
Packit |
5bd3a9 |
CWBorderWidth|CWSibling|CWStackMode)
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Status XReconfigureWMWindow (
|
|
Packit |
5bd3a9 |
register Display *dpy,
|
|
Packit |
5bd3a9 |
Window w,
|
|
Packit |
5bd3a9 |
int screen,
|
|
Packit |
5bd3a9 |
unsigned int mask,
|
|
Packit |
5bd3a9 |
XWindowChanges *changes)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
Window root = RootWindow (dpy, screen);
|
|
Packit |
5bd3a9 |
_XAsyncHandler async;
|
|
Packit |
5bd3a9 |
_XAsyncErrorState async_state;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* Only need to go through the trouble if we are actually changing the
|
|
Packit |
5bd3a9 |
* stacking mode.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
if (!(mask & CWStackMode)) {
|
|
Packit |
5bd3a9 |
XConfigureWindow (dpy, w, mask, changes);
|
|
Packit |
5bd3a9 |
return True;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* We need to inline XConfigureWindow and XSync so that everything is done
|
|
Packit |
5bd3a9 |
* while the display is locked.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
LockDisplay(dpy);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* XConfigureWindow (dpy, w, mask, changes);
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
unsigned long values[7];
|
|
Packit |
5bd3a9 |
register unsigned long *value = values;
|
|
Packit |
5bd3a9 |
long nvalues;
|
|
Packit |
5bd3a9 |
register xConfigureWindowReq *req;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
GetReq(ConfigureWindow, req);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
async_state.min_sequence_number = dpy->request;
|
|
Packit |
5bd3a9 |
async_state.max_sequence_number = dpy->request;
|
|
Packit |
5bd3a9 |
async_state.error_code = BadMatch;
|
|
Packit |
5bd3a9 |
async_state.major_opcode = X_ConfigureWindow;
|
|
Packit |
5bd3a9 |
async_state.minor_opcode = 0;
|
|
Packit |
5bd3a9 |
async_state.error_count = 0;
|
|
Packit |
5bd3a9 |
async.next = dpy->async_handlers;
|
|
Packit |
5bd3a9 |
async.handler = _XAsyncErrorHandler;
|
|
Packit |
5bd3a9 |
async.data = (XPointer)&async_state;
|
|
Packit |
5bd3a9 |
dpy->async_handlers = &asyn;;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
req->window = w;
|
|
Packit |
5bd3a9 |
mask &= AllMaskBits;
|
|
Packit |
5bd3a9 |
req->mask = mask;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
if (mask & CWX) *value++ = changes->x;
|
|
Packit |
5bd3a9 |
if (mask & CWY) *value++ = changes->y;
|
|
Packit |
5bd3a9 |
if (mask & CWWidth) *value++ = changes->width;
|
|
Packit |
5bd3a9 |
if (mask & CWHeight) *value++ = changes->height;
|
|
Packit |
5bd3a9 |
if (mask & CWBorderWidth) *value++ = changes->border_width;
|
|
Packit |
5bd3a9 |
if (mask & CWSibling) *value++ = changes->sibling;
|
|
Packit |
5bd3a9 |
if (mask & CWStackMode) *value++ = changes->stack_mode;
|
|
Packit |
5bd3a9 |
req->length += (nvalues = value - values);
|
|
Packit |
5bd3a9 |
nvalues <<= 2; /* watch out for macros... */
|
|
Packit |
5bd3a9 |
Data32 (dpy, (long *) values, nvalues);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* XSync (dpy, 0)
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
xGetInputFocusReply rep;
|
|
Packit |
5bd3a9 |
_X_UNUSED register xReq *req;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
GetEmptyReq(GetInputFocus, req);
|
|
Packit |
5bd3a9 |
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
DeqAsyncHandler(dpy, &async);
|
|
Packit |
5bd3a9 |
UnlockDisplay(dpy);
|
|
Packit |
5bd3a9 |
SyncHandle();
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* If the request succeeded, then everything is okay; otherwise, send event
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
if (!async_state.error_count)
|
|
Packit |
5bd3a9 |
return True;
|
|
Packit |
5bd3a9 |
else {
|
|
Packit |
5bd3a9 |
XConfigureRequestEvent ev = {
|
|
Packit |
5bd3a9 |
.type = ConfigureRequest,
|
|
Packit |
5bd3a9 |
.window = w,
|
|
Packit |
5bd3a9 |
.parent = root,
|
|
Packit |
5bd3a9 |
.value_mask = (mask & AllMaskBits),
|
|
Packit |
5bd3a9 |
.x = changes->x,
|
|
Packit |
5bd3a9 |
.y = changes->y,
|
|
Packit |
5bd3a9 |
.width = changes->width,
|
|
Packit |
5bd3a9 |
.height = changes->height,
|
|
Packit |
5bd3a9 |
.border_width = changes->border_width,
|
|
Packit |
5bd3a9 |
.above = changes->sibling,
|
|
Packit |
5bd3a9 |
.detail = changes->stack_mode,
|
|
Packit |
5bd3a9 |
};
|
|
Packit |
5bd3a9 |
return (XSendEvent (dpy, root, False,
|
|
Packit |
5bd3a9 |
SubstructureRedirectMask|SubstructureNotifyMask,
|
|
Packit |
5bd3a9 |
(XEvent *)&ev));
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
}
|