[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

1714.0. "disabling resizing from xlib application" by SNOC02::ZAMBOTTIW () Fri Nov 10 1989 05:09

    Hello,
    
    I would like to know how I can disable the resizing of an application
    created window created via xlib library calls.
    
    I have a graphics window which i have created using
    
    XCreateWindow()
    
    It came automatically with some nice features,  iconify and lower
    window buttons but it also came with a resizing button.  Every time
    I resize the window I lose its contents even though I have set the
    backing_store field of the XSetWindowAttributes structure to "Always".
    
    Is there a way I can disable the resizing button or gadget (whats its
    proper name anyway).
    
    I'm using xlib under a decwindows environment.
    
    Walter
T.RTitleUserPersonal
Name
DateLines
1714.1can't depend on backing stroeTOOLEY::B_WACKERFri Nov 10 1989 10:1713
>    I would like to know how I can disable the resizing of an application
>    created window created via xlib library calls.

setvalues for XtNnoResize on the shell.
    
>Every time I resize the window I lose its contents even though I have
>set the backing_store field of the XSetWindowAttributes structure to
>"Always".

Even if backing store were implemented, which it isn't, you still have 
to provide your own, because it is NEVER guaranteed.  Use the expose 
events to redraw or copy from a pixmap duplicate prepared for this 
purpose.
1714.2NorthWestGravity bit_gravityDECWIN::KLEINFri Nov 10 1989 11:3820
Since you're doing the XCreateWindow yourself, you should be setting
bit_gravity to NorthWestGravity.  The default, ForgetGravity, is what
is causing your window to be completely cleared and exposed whenever
it is resized.

Thus, if you wanted to preserve resize capability, you could specify
NorthWestGravity for bit_gravity on the XCreateWindow, and you would
then only get Expose events when the window is made larger, and then
only for the newly exposed regions.

Note that there is a bug (?) in the server that causes ForgetGravity bit_gravity
in any window to propagate (override) the bit_gravity in any of its children.
This is especially noticable with the MOTIF window manager, since MWM
uses ForgetGravity in the frame around your application, effectively
counteracting the benefits of using bit_gravity in your own window.
DECWINMGR was fixed for V1 to avoid this problem.

But anyway...

-steve-
1714.3De-pravity or bit_gravity ???WPOMM2::ZAMBOTTIMon Nov 13 1989 21:3615
    Thanks,
    
    I'm not to sure what you mean by the second half of your reply (.2) but
    the gravity issue is most kindly accepted.
    
    But still is there away to disable the resizing button.  I'm am not
    using X toolkit just X lib so the function you mentioned in (.1) isn't
    any good to me.
    
    p.s. the application is several hundred thousand lines of fortran code
    long and already is written to use a simple graphics routines.  I
    cannot rewrite this foreign application to use the nicities of X
    toolkit unfortunately.
    
    Walter Zambotti.
1714.4Here's another "hint"DECWIN::KLEINTue Nov 14 1989 10:5848
Here are some "hints" on how to disable the resize (and other) buttons
when using the DECwindows window manager.  You need to use the DEC_WM_HINTS
property.

>>Assume the following have been initialized:

static Display dpy;		/* display ID */
static Window win;		/* top level window */

>>Get the atom name (once per display, please):

static int decWmHintsAtom = XInternAtom (dpy, "DEC_WM_HINTS", 0);

>> Set the attributes in the hints structure.  Any attributes you do not
>> explicitly set will revert to their default values!

{
    DECWmHintsRec decHints;

    decHints.no_iconify_button = 1;
    decHints.no_resize_button = 1;
    decHints.no_lower_button = 1;

    decHints.value_mask =
	(DECWmNoIconifyButtonMask
	| DECWmNoResizeButtonMask
	| DECWmNoLowerButtonMask);

    XChangeProperty (dpy, win, decWmHintsAtom,
	decWmHintsAtom, 32, PropModeReplace, &decHints,
	sizeof (DECWmHintsRec) / 4);
}

This is "semi-supported", and there are quite a few "gotchas", the most
serious of which is that omitted property fields are changed to their default
values when one would hope that they would be left alone.  This means
that you should send down a complete hints property each time you change
it.  Keep a (static) copy of the hints structure in your application
for each top level window.  Another "gotcha" is that this is a DEC extension.
The MOTIF window manager interface is different.

Another thing to watch out for is that if you post a "confusing" hints
property, the window manager is likely to crash.  It has been quite
easy to confuse the window manager, so be prepared.

Hope this helps.  Enjoy.

-steve-
1714.5She went that a way < ^ v > ... WPOMM2::ZAMBOTTIThu Nov 16 1989 21:4610
    Wow !!!
    
    Yeah what ever.  This is going to take me moment/while to digest. 
    Thanks this is great stuff.
    
    One last question.  How did you know all this ?  I mean thats amazing.
    
    Bewildered,
    
    Walter Zambotti
1714.6In trivial pursuit...DECWIN::KLEINFri Nov 17 1989 10:599
>>    One last question.  How did you know all this ?  I mean thats amazing.

Well, thanks.  But the real credit goes to the people who wrote this beast.

As to how I came to know all this trivia:  I read the toolkit sources.

Cheers.

-steve-
1714.7Can't get at Window IDHEIDI::MACKENZIEFri Jan 12 1990 09:2844
Since I an a veritable novice at DW, please bear with me.  I have read notes
125, 1499, 1559, 1714, etc, etc, etc...

I am having a problem getting a valid window ID.  I keep getting a window ID
value of zero.  Here is an abbreviated piece of code...any help would be 
most appreciated.

Regards (and thanks),

Chris


/*
**  Begin here...
*/ 
int main (argc, argv)

  unsigned int argc;
  char **argv;

{
    Arg args[10];
    int i;
    Display *dpy;
    Widget toplevel, main, foo;
    Window toplvl;

    toplevel = XtInitialize ( "FOO", " ", NULL, 0, &argc, argv );
    dpy = XtDisplay ( toplevel );

    i=0;
    XtSetArg ( args[i], XtNwidth, 1000 ); i++;
    XtSetArg ( args[i], XtNheight, 860 ); i++;
    main = DwtDialogBoxCreate ( toplevel, "", args, i );

    foo    = XtParent ( mainwindow );
    toplvl = XtWindow ( foo );

    .
    .
    .
}
    
1714.8Realize == windowDECWIN::KLEINFri Jan 12 1990 09:503
Window IDs are not assigned until a widget is REALIZED.

-steve-
1714.9HEIDI::MACKENZIEFri Jan 12 1990 10:183
    Thanks Steve...that makes sense now!
    
    CCM