aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/SetNrmHint.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2016-07-29 00:44:38 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-10 22:52:29 +0200
commit687d44b6eaa3c64a12af9bbd557b401419b208eb (patch)
tree55c30ba6b0ae6a2618395fae92922ea4402d52f6 /nx-X11/lib/X11/SetNrmHint.c
parentea24f0b0eb7b82ad879810c8e84292d6bf810bea (diff)
downloadnx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.tar.gz
nx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.tar.bz2
nx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.zip
update src files *[ch] to libX11 1.3.4
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);
}