[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

3150.0. "UWS 2.1 to 2.2 imcompatibilities?" by SNOC02::ZAMBOTTIW (It only works after you ask!) Tue Jul 31 1990 05:04

    Hello all,
    
    I have helped in an application port onto the the RISC decwindows
    environment.   When this project started we were using UWS 2.1.  After
    finding some bugs we were advised to update to UWS 2.2 as the bugs we
    were encountering were known and fixed in 2.2.
    
    Ok so I have finally installed 2.2 and now none of the application
    works!  It frequently core dumps and many X lib functions simply don't
    work the way they used to.
    
    In the application I have set "backing store" = "always" and open the
    window to the full size of the screen.  Before I "map" this window I
    give the give the following functions to display a smaller window than
    I opened :
    
    	XSizeHints	MyHints = { PPosition|PSize|PMinSize|PMaxSize,
    				0, 0, 640, 350, 640, 350, 1020, 840 } ;
    
    	...
    
    	XSetNormalHints(Disp, Win, &MyHints) ;
    	XResizeWindow(Disp, Win, 640, 350) ;
    
    	XMapWindow(Disp, Win) ;
    
    Anyway this fails!  In desperation I tried compiling the application
    under VMS decwindows and it worked without any problems.  Not bad
    seeing that I wrote the application under RISC UWS 2.1 and I didn't
    change one line under VMS.
    
    The lines of code above also work under RISC UWS 2.1 but not under 2.2. 
    The bugs in 2.1 I am encountering are completely unrelated to the piece
    of code above.
    
    Can anybody help!
    
    Walter Zambotti.
T.RTitleUserPersonal
Name
DateLines
3150.1ABYSS::dikeTue Jul 31 1990 08:183
How about showing us a stack trace from dbx of the crash?  Also, a piece of
code that will reproduce the crash would be nice.
				Jeff
3150.2What crash??? It just dont work!SNOC02::ZAMBOTTIWIt only works after you ask!Tue Jul 31 1990 09:4318
    Hi Jeff,
    
    sorry if I cnfused the issue here.  I re-read my note and I notice I
    failed to describe what actually doesn't work.
    
    It's not that the program crashes, because it doesn't.  What fails to
    work is the resizing of my window.
    
    As I mentioned I open the window the full size of the screen (well
    close to, 1020 by 840), but you notice my XSizeHints and XResizeWindow
    specify a much smaller window (640 by 350) when the window is "mapped"
    under UWS 2.1 and on VMS the window is 640 by 350 and not the entire
    screen as with UWS 2.2.
    
    Yes I will get the piece of code for you its not to big and I'll post
    it in my next reply.
    
    Walter.
3150.3The sample code...SNOC02::ZAMBOTTIWIt only works after you ask!Tue Jul 31 1990 10:0983
    Hi again,
    
    heres the code that fails to resize the window.  And I have managed to
    solve the problemsthat core dumped,  it was a question of some
    specialize fonts that I needed to reinstall that were obviously erased
    in the ULTRIX upgrade, core dumps gone but window resize still don't
    work.
    
    I added a stub main to call the code I couldn't test it but its a
    pretty simple stub, should work.
    
#include <stdio.h>
#ifdef VMS
#include <decw$include/Xlib.h>
#include <decw$include/Xutil.h>
#include <decw$include/Xatom.h>
#else
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#endif

Display              *Disp = NULL ;
Screen               *Screen1 ;
Visual               *DefScreenVis ;
GC                   GCID, TextCurGC, TextGC, PaintGC ;
Window               Win1, DefRootWin ;
XSetWindowAttributes WinAttr ;
XGCValues            GCVals ;
Window               FocusReturn ;
int                  RevertToReturn ;
XWMHints             Win1WMHints = { InputHint|StateHint, FALSE, NormalState, 0, 0, 0, 0, 0 } ;
XSizeHints           Win1SizeHints = { PSize|PMinSize|PMaxSize, 0, 0, 640, 350, 640, 350, 1020, 840 } ;

int                  HaloErrCode = 0 ;

void initgraphics(mode)

int     *mode ; /* not used anyway ! */

{
    if(Disp != NULL) {
        return ;
    }

    Disp = XOpenDisplay(NULL) ;

    if(Disp == NULL) {
        HaloErrCode = 3 ;
        return ;
    }

    Screen1 = XDefaultScreenOfDisplay(Disp) ;
    DefRootWin = XDefaultRootWindow(Disp) ;
    DefScreenVis = XDefaultVisualOfScreen(Screen1) ;
    /* XSynchronize(Disp, TRUE) ; */

    WinAttr.event_mask = ResizeRedirectMask + ButtonPressMask ;
    WinAttr.background_pixel = XBlackPixel(Disp, XDefaultScreen(Disp)) ;
    WinAttr.backing_store = Always ;

    Win1 = XCreateWindow(Disp, DefRootWin, 0, 0, 1020, 840, 0, CopyFromParent, InputOutput, CopyFromParent,
              CWEventMask | CWBackPixel | CWBackingStore, &WinAttr) ;

    XStoreName(Disp, Win1, "Surpac Mining") ;
    XSetIconName(Disp, Win1, "Surpac Mining") ;
    XSetNormalHints(Disp, Win1, &Win1SizeHints) ;
    XResizeWindow(Disp, Win1, 640, 350) ; /* this line isn't even needed using UWS 2.1 or VMS decwindows */
    XMapWindow(Disp, Win1) ;
    XGetInputFocus(Disp, &FocusReturn, &RevertToReturn) ;
    /* XSynchronize(Disp, FALSE) ; */

    HaloErrCode = 0 ;
    return ;
}


main()

{
    initgraphics(NULL) ;
}
    
3150.4ABYSS::dikeTue Jul 31 1990 13:567
I'm running UWS4.0, not 2.2, but your code makes a small window for me.  It
sounds like the window manager that you are running on 2.2 has more respect
for initial window sizes and less respect for SizeHints than the other 
platforms you tried it on.  If you're interested, you might try different
window managers and see if they help, like remotely displaying the UWS2.1 or
VMS window managers on your 2.2 system.
				Jeff
3150.5GILROY::kleeTue Jul 31 1990 14:0713
The problems you are seeing are probably due to changes in the
"Inter-Client Communications Conventions Manual" (ICCCM) between MIT
releases X11R3 and X11R4.  The UWS2.2 dxwm uses (most of) the X11R4
ICCCM, which is, unfortunately, sometimes not compatible with earlier
versions (such as that used in UWS2.1).  dxwm tries to identify and
support clients using the old ICCCM, but is not always successful,
especially when clients are compiled with new versions of Xlib.  The
UWS2.2 release notes discuss new Xlib functions that support the new
ICCCM.  The XSetNormalHints function that you are using are now
obsolete.  The XResizeWindow request is probably intercepted by the
window manager and ignored (as the ICCCM allows it to).

Ken
3150.6OK so whats my immediate solution!SNOC02::ZAMBOTTIWIt only works after you ask!Tue Jul 31 1990 22:3412
    Hi,
    
    re. 5 well that's all well and good (actually BAD) but how can I
    resolve this situation NOW?
    
    It took fourteen weeks for UWS 2.2 to arrive after it was ordered.  It
    fact I gave up and bordered a copy from a mate on the other side of
    Australia.  SDC swore black and blue that the latest shipping version
    was UWS 2.0.  I have almost lost face with the developer and I need a
    quick solution.
    
    Walter.
3150.7GILROY::kleeThu Aug 02 1990 15:3460
The following program correctly resizes top level windows in UWS2.2. It
toggles the window size based on mouse button presses.

Ken
===============
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>

main()
{
    Window w;
    Display *d = XOpenDisplay(NULL);
    int s;
    if (d == NULL) {
        puts("cannot open display\n");
        exit(1);
    }
    s = DefaultScreen(d);
    {
        unsigned long mask;
        XSetWindowAttributes xswa;
        xswa.event_mask = ButtonPressMask;
        xswa.background_pixel = BlackPixel(d, s);
        mask = CWBackPixel | CWEventMask;
        w = XCreateWindow(d, DefaultRootWindow(d), 0, 0, 1020, 840, 0,
            CopyFromParent, InputOutput, CopyFromParent, mask, &xswa);
        XMapWindow(d, w);
    }
    {
        XSizeHints xsh;
        xsh.min_width = 640;
        xsh.min_height = 350;
        xsh.max_width = 1020;
        xsh.max_height = 840;
        xsh.base_width = 640;
        xsh.base_height = 350;
        xsh.flags = PSize|PBaseSize|PMinSize|PMaxSize;
        XSetWMNormalHints(d, w, &xsh);
    }
    while (1) {
        XEvent xev;
        XNextEvent(d, &xev);
        if (xev.type = ButtonPress) {
            static int small = False;
            XWindowChanges xwc;
            if (small) {
                xwc.width = 1020;
                xwc.height = 840;
                small = False;
            } else {
                xwc.width = 640;
                xwc.height = 350;
                small = True;
            }
            XReconfigureWMWindow(d, w, 0, CWWidth | CWHeight, &xwc);
        }
    }
}