[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2898.0. "GRAVITY IN SET_ATTR/XWININFO - DIFF. VAX/RISC" by MUCTEC::WENDL (The beautiful MUCTEC Cluster) Thu Jun 07 1990 13:39

The DECwindows program given as appendix shows different behavior on VAX
and MIPS processors, as well as on MIPS processors with different Ultrix
versions.
The line of interest is "set_attr.win_gravity="
The permissible values are 0 to ten (or: ForgetGravity to StaticGravity)
(see /usr/include/X11/X.h).

Looking at the window parameters with xwininfo (in /usr/bin or
/usr/bin/X11) a VAX 3500 with Ultrix-32 V3.1 (Rev. 9) UWS V2.1
produces (e.g. with ...gravity="11") the output:
"
xwininfo ==> Window id: 0xa00001 (11  400 300)

         ==> Upper left X: 100
         ==> Upper left Y: 100
         ==> Width: 400
         ==> Height: 300
         ==> Depth: 8
         ==> Border width: 5
         ==> Window class: InputOutput
         ==> Colormap: 0x80065
         ==> Window Bit Gravity State: ForgetGravity
         ==> Window Window Gravity State: unknown (code = 11. = 0xb)
         ==> Window Backing Store State: NotUseful
         ==> Window Save Under State: no
         ==> Window Map State: IsViewable
         ==> Window Override Redirect State: no
         ==> Corners:  +100+100  -514+100  -514-454  +100-454
"
A DECstation 5000-200 with Ultrix-32 T3.1D-0 (Rev. 45) Worksystem 2.2
produces (with an admissable value) the output:
"
xwininfo ==> Window id: 0x200011 (has no name)

         ==> Upper left X: 0
         ==> Upper left Y: 0
         ==> Width: 1024
         ==> Height: 864
         ==> Depth: 8
         ==> Border width: 0
         ==> Window class: InputOutput
         ==> Colormap: 0x80069
         ==> Window Bit Gravity State: NorthWestGravity
         ==> Window Window Gravity State: NorthWestGravity
         ==> Window Backing Store State: NotUseful
         ==> Window Save Under State: no
         ==> Window Map State: IsViewable
         ==> Window Override Redirect State: yes
         ==> Corners:  +0+0  -0+0  -0-0  +0-0
"
where NorthWestGravity=1 in ANY case (set_attr.win_gravity=[0|1|...10]).

It's even worse with illegal values (like 11 above).
On the same MIPS machine the program then terminates,
that is:builds no window, with:
"
csh> X Protocol error detected by server:  BadValue - integer parameter
out of range
  Failed request major op code 2 (X_ChangeWindowAttributes)
  Failed request minor op code 0 (if applicable)
  ResourceID 0xb in failed request (if applicable)
  Serial number of failed request 8
  Current serial number in output stream 12

[1]    Exit 1               outage_gravity
"
Same with a DECstation 3100 with Ultrix-32 X4.0-11 (Rev. 156)
UWS X4.0-11 (Rev. 111).
In the contrary on DECstations with current official releases
(Ultrix-32 V3.1  UWS V2.1) xwininfo gives a result like:
"
...
         ==> Window Window Gravity State: unknown (code = 248 ...
"
when the gravity is set to 8 or 9 (SouthGravity or SouthEastGr.)!

Has anyone an idea? Please let me now

uli



APPENDIX:


#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>

#define WINDOWWIDTH 400
#define WINDOWHEIGHT 300

char hello [] = "gravity";

XEvent myevent;
Display *mydisplay;
Window mywindow;
GC mygc;
unsigned long myforeground, mybackground;

main(argc, argv)
int argc;
char *argv[];

{
	KeySym mykey;
	XSizeHints myhint;

	int myscreen;
	char text[10];
	int done;
	int i;

	if (!( mydisplay = XOpenDisplay(NULL)))
	{
	  fprintf(stderr,"cannot establish display connection");
	  exit(1);
	}
	myscreen = DefaultScreen(mydisplay);
	mybackground = WhitePixel(mydisplay, myscreen);
	myforeground = BlackPixel(mydisplay, myscreen);

	myhint.x = 100;
	myhint.y = 100;
	myhint.width = WINDOWWIDTH;
	myhint.height = WINDOWHEIGHT;
	myhint.flags = PPosition | PSize;

	mywindow = XCreateSimpleWindow(mydisplay,
	    DefaultRootWindow(mydisplay),
	    myhint.x, myhint.y, myhint.width, myhint.height,
	    5, myforeground, mybackground);

	XSetStandardProperties(mydisplay, mywindow, hello, hello, None,
	    argv, argc, &myhint);
	    {
		/* Eintraege einer Sued-ost-gravitaet */
		XSetWindowAttributes set_attr;
		unsigned long set_mask = CWWinGravity;

set_attr.win_gravity= 11;

   XChangeWindowAttributes(mydisplay, mywindow, set_mask, &set_attr);
	    }
	mygc = XCreateGC(mydisplay, mywindow, 0, 0);
	XSetBackground(mydisplay, mygc, mybackground);
	XSetForeground(mydisplay, mygc, myforeground);

	XSelectInput(mydisplay, mywindow,
	    ButtonPressMask | KeyPressMask | ExposureMask);
	XMapRaised(mydisplay, mywindow);

	done = 0;
	while (done == 0)
	{
	    XNextEvent(mydisplay, &myevent);
	    switch (myevent.type)
	    {
	    case Expose:
		if (myevent.xexpose.count == 0)
		{
			XDrawImageString(myevent.xexpose.display,
				myevent.xexpose.window, mygc,
				50, 50, hello, strlen(hello));
		}
		break;

		case MappingNotify:
		  XRefreshKeyboardMapping(&myevent);
		  break;
		case KeyPress:
		  i = XLookupString(&myevent, text, 10, &mykey, 0);
		  if (i == 1 && text[0] == 'q')
			done = 1;
		  break;
		}
	}
	XFreeGC(mydisplay, mygc);
	XDestroyWindow(mydisplay, mywindow);
	XCloseDisplay(mydisplay);
	exit(0);
}	
T.RTitleUserPersonal
Name
DateLines
2898.1GILROY::kleeKen LeeThu Jun 07 1990 14:039
I'm not really sure what your question is.

There may be a bug in xwininfo, but this program is currently unsupported in UWS.

You should get a Value error, as you did, if you try to set a window
attribute to an invalid value.  Some UWS X servers may not have done
this in the past, but all should, either now or in the next release.

Ken
2898.2THERE IS A (SUBTLE?) DIFFERENCEMUCTEC::WENDLThe beautiful MUCTEC ClusterFri Jun 08 1990 07:5223
Thank you for the prompt answer.

The problem is that the program (which is an excerpt of a customers
application) works well on my VAX, but not on MIPS (customer uses
DECstations) for some ALLOWED gravity values (e.g. SouthEastGravity).

The customer uses UWS V2.0, i already suggested to upgrade to 2.1,
though it doesn't make sense. Because on UWS V2.1 for MIPS it's the
same (as we already know).

New to digital and DECwindows, i've heard there are NO differences
for DW whether you use VAX or MIPS! At least with official releases!

xwininfo is only an easy way for me to look at actual parameters, and
performs well even for nonsense values on my VAX; there i get the value
i set, and ForgetGravity as default when trying to set a nonsense.
On the DECstations i get NorthWestGravity independent of which (correct)
value i set! That may be a xwininfo problem. I didn't know that
xwininfo is unsupported, it is in the normal Reference Pages, Section 1.

Thanks again

uli
2898.3GILROY::kleeKen LeeFri Jun 08 1990 14:158
Re: .3

Please upgrade to UWS2.2 or UWS4.0.  This part of DECwindows has been
almost completely rewritten since UWS2.0.  If there is still a problem,
please file a QAR stating what you're setting, how you're setting it,
what the result is, and how you're determining the result.  Thanks.

Ken