aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/SetNrmHint.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/SetNrmHint.c')
-rw-r--r--nx-X11/lib/X11/SetNrmHint.c75
1 files changed, 46 insertions, 29 deletions
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 <nx-X11/Xatom.h>
#include <nx-X11/Xos.h>
-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);
}