From 687d44b6eaa3c64a12af9bbd557b401419b208eb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 29 Jul 2016 00:44:38 +0200 Subject: update src files *[ch] to libX11 1.3.4 --- nx-X11/lib/X11/SetNrmHint.c | 75 +++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 29 deletions(-) (limited to 'nx-X11/lib/X11/SetNrmHint.c') diff --git a/nx-X11/lib/X11/SetNrmHint.c b/nx-X11/lib/X11/SetNrmHint.c index ec9e7cfb4..937f4eb6b 100644 --- a/nx-X11/lib/X11/SetNrmHint.c +++ b/nx-X11/lib/X11/SetNrmHint.c @@ -59,15 +59,16 @@ from The Open Group. #include #include -void XSetWMSizeHints (dpy, w, hints, prop) - Display *dpy; - Window w; - XSizeHints *hints; - Atom prop; +void XSetWMSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + Atom prop) { xPropSizeHints data; - data.flags = (hints->flags & + memset(&data, 0, sizeof(data)); + data.flags = (hints->flags & (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| PResizeInc|PAspect|PBaseSize|PWinGravity)); @@ -75,35 +76,51 @@ void XSetWMSizeHints (dpy, w, hints, prop) * The x, y, width, and height fields are obsolete; but, applications * that want to work with old window managers might set them. */ - data.x = hints->x; - data.y = hints->y; - data.width = hints->width; - data.height = hints->height; - - data.minWidth = hints->min_width; - data.minHeight = hints->min_height; - data.maxWidth = hints->max_width; - data.maxHeight = hints->max_height; - data.widthInc = hints->width_inc; - data.heightInc = hints->height_inc; - data.minAspectX = hints->min_aspect.x; - data.minAspectY = hints->min_aspect.y; - data.maxAspectX = hints->max_aspect.x; - data.maxAspectY = hints->max_aspect.y; - data.baseWidth = hints->base_width; - data.baseHeight = hints->base_height; - data.winGravity = hints->win_gravity; - + if (hints->flags & (USPosition|PPosition)) { + data.x = hints->x; + data.y = hints->y; + } + if (hints->flags & (USSize|PSize)) { + data.width = hints->width; + data.height = hints->height; + } + + if (hints->flags & PMinSize) { + data.minWidth = hints->min_width; + data.minHeight = hints->min_height; + } + if (hints->flags & PMaxSize) { + data.maxWidth = hints->max_width; + data.maxHeight = hints->max_height; + } + if (hints->flags & PResizeInc) { + data.widthInc = hints->width_inc; + data.heightInc = hints->height_inc; + } + if (hints->flags & PAspect) { + data.minAspectX = hints->min_aspect.x; + data.minAspectY = hints->min_aspect.y; + data.maxAspectX = hints->max_aspect.x; + data.maxAspectY = hints->max_aspect.y; + } + if (hints->flags & PBaseSize) { + data.baseWidth = hints->base_width; + data.baseHeight = hints->base_height; + } + if (hints->flags & PWinGravity) { + data.winGravity = hints->win_gravity; + } + XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &data, NumPropSizeElements); } -void XSetWMNormalHints (dpy, w, hints) - Display *dpy; - Window w; - XSizeHints *hints; +void XSetWMNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints) { XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); } -- cgit v1.2.3