aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/SetNrmHint.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-12 08:32:04 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-12 08:32:04 +0200
commit051d521f6e20761ba6831cecd91883da960fa931 (patch)
treeb28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/SetNrmHint.c
parent6dce607bad8711dd06a5a7b69ad1930386b4123b (diff)
parentb8de7bf654929c823080b211aeac56cd213f5a32 (diff)
downloadnx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz
nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2
nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214 Fixes ArcticaProject/nx-libs#157.
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);
}