[PATCH xts 3/3] Fix XSetWMSizeHints et al.
Peter Harris
pharris at opentext.com
Fri May 31 13:20:21 PDT 2013
Xlib, since release 1.1.2, only transmits fields for which the
corresponding flags bit is set (to avoid a potential information leak).
Set the flags field to include all the fields to be tested.
Signed-off-by: Peter Harris <pharris at opentext.com>
---
xts5/Xlib15/XGetWMNormalHints.m | 7 ++++---
xts5/Xlib15/XGetWMSizeHints.m | 7 ++++---
xts5/Xlib15/XSetWMNormalHints.m | 8 ++++----
xts5/Xlib15/XSetWMProperties/XSetWMProperties.m | 8 ++++----
xts5/Xlib15/XSetWMSizeHints.m | 9 +++++----
5 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/xts5/Xlib15/XGetWMNormalHints.m b/xts5/Xlib15/XGetWMNormalHints.m
index 5a754d0..28dd70a 100644
--- a/xts5/Xlib15/XGetWMNormalHints.m
+++ b/xts5/Xlib15/XGetWMNormalHints.m
@@ -111,7 +111,8 @@ long *supplied_return = &supret;
#include "X11/Xatom.h"
#define NumPropSizeElements 18
#define OldNumPropSizeElements 15
-static XSizeHints sizehints = { 0 ,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17};
+#define AllFlags (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect|PBaseSize|PWinGravity)
+static XSizeHints sizehints = { AllFlags ,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17};
static XSizeHints rhints = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
{111, 112}, {113, 114}, 115, 116, 117 };
static long supret;
@@ -161,8 +162,8 @@ XVisualInfo *vp;
} else
CHECK;
- if(rhints.flags != 0) {
- report("The flags component of the XSizeHints structure was %lu instead of 0.", rhints.flags);
+ if(rhints.flags != AllFlags) {
+ report("The flags component of the XSizeHints structure was %lX instead of %X.", rhints.flags, AllFlags);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XGetWMSizeHints.m b/xts5/Xlib15/XGetWMSizeHints.m
index 21cccda..0e0370b 100644
--- a/xts5/Xlib15/XGetWMSizeHints.m
+++ b/xts5/Xlib15/XGetWMSizeHints.m
@@ -112,7 +112,8 @@ Atom property = XA_WM_NORMAL_HINTS;
#include "X11/Xatom.h"
#define NumPropSizeElements 18
#define OldNumPropSizeElements 15
-static XSizeHints sizehints = {0,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17};
+#define AllFlags (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect|PBaseSize|PWinGravity)
+static XSizeHints sizehints = {AllFlags,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17};
static XSizeHints rhints = {100,101,102,103,104,105,106,107,108,109,110, {111,112} , {113,114}, 115, 116, 117};
static long supret;
>>ASSERTION Good A
@@ -161,8 +162,8 @@ XVisualInfo *vp;
} else
CHECK;
- if(rhints.flags != 0) {
- report("The flags component of the XSizeHints structure was %lu instead of 0.", rhints.flags);
+ if(rhints.flags != AllFlags) {
+ report("The flags component of the XSizeHints structure was %lX instead of %X.", rhints.flags, AllFlags);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XSetWMNormalHints.m b/xts5/Xlib15/XSetWMNormalHints.m
index 44325a6..5216314 100644
--- a/xts5/Xlib15/XSetWMNormalHints.m
+++ b/xts5/Xlib15/XSetWMNormalHints.m
@@ -109,8 +109,8 @@ XSizeHints *hints = &sizehints_0;
>>EXTERN
#include "X11/Xatom.h"
#define NewNumPropSizeElements 18 /* ICCCM v. 1 */
-static XSizeHints sizehints_0 = { PAllHints,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0};
-static XSizeHints sizehints_1 = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
+static XSizeHints sizehints_0 = { PAllHints|PBaseSize|PWinGravity,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0};
+static XSizeHints sizehints_1 = { PAllHints|PBaseSize|PWinGravity,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
>>ASSERTION Good A
A call to xname sets the
.S WM_NORMAL_HINTS
@@ -188,8 +188,8 @@ int i;
pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */
pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */
- if(pp.flags != PAllHints) {
- report("The flags component of the XSizeHints structure was %lu instead of PAllHints (%ld).", pp.flags, PAllHints);
+ if(pp.flags != (PAllHints|PBaseSize|PWinGravity)) {
+ report("The flags component of the XSizeHints structure was %lu instead of PAllHints|PBaseSize|PWinGravity (%ld).", pp.flags, PAllHints|PBaseSize|PWinGravity);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m b/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m
index 9ef85f7..8058915 100644
--- a/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m
+++ b/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m
@@ -147,8 +147,8 @@ Test2 : Test2.o $(LIBS) $(top_builddir)/src/tet3/tcm/libtcmchild.la
#define NewNumPropSizeElements 18 /* ICCCM v. 1 */
#define NumPropWMHintsElements 9
#include "X11/Xatom.h"
-static XSizeHints sizehints = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
-static XSizeHints sizehints_1 = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
+static XSizeHints sizehints = { PAllHints|PBaseSize|PWinGravity,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
+static XSizeHints sizehints_1 = { PAllHints|PBaseSize|PWinGravity,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
>>ASSERTION Good A
When the
.A window_name
@@ -534,8 +534,8 @@ int i;
pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */
pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */
- if(pp.flags != PAllHints) {
- report("The flags component of the XSizeHints structure was %lu instead of PAllHints (%ld).", pp.flags, PAllHints);
+ if(pp.flags != (PAllHints|PBaseSize|PWinGravity)) {
+ report("The flags component of the XSizeHints structure was %lu instead of PAllHints|PBaseSize|PWinGravity (%ld).", pp.flags, PAllHints|PBaseSize|PWinGravity);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XSetWMSizeHints.m b/xts5/Xlib15/XSetWMSizeHints.m
index f4cfee7..68e0696 100644
--- a/xts5/Xlib15/XSetWMSizeHints.m
+++ b/xts5/Xlib15/XSetWMSizeHints.m
@@ -110,8 +110,9 @@ Atom property = XA_WM_NORMAL_HINTS;
>>EXTERN
#define NumPropSizeElements 18 /* ICCCM v. 1 */
#include "X11/Xatom.h"
-static XSizeHints sizehints_0 = { 0,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0};
-static XSizeHints sizehints_1 = { 0,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
+#define AllFlags (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect|PBaseSize|PWinGravity)
+static XSizeHints sizehints_0 = { AllFlags,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0};
+static XSizeHints sizehints_1 = { AllFlags,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17};
>>ASSERTION Good A
A call to xname sets the
property, specified by the
@@ -190,8 +191,8 @@ int i;
pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */
pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */
- if(pp.flags != 0) {
- report("The flags component of the XSizeHints structure was %lu instead of 0.", pp.flags);
+ if(pp.flags != AllFlags) {
+ report("The flags component of the XSizeHints structure was %lX instead of %X.", pp.flags, AllFlags);
FAIL;
} else
CHECK;
--
1.7.10.4
More information about the xorg-devel
mailing list