[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

1513.0. "Window and icon disappear!" by CSC32::B_WACKER () Mon Oct 02 1989 11:07

I'm trying to make a little sample program that disables/enables the 
iconify button as well as iconifies under program control.  It works 
fine until I force iconification.  After I deiconify it then toggling 
the iconify button causes both the window AND the icon to disappear.

Anybody know why?

#include <decw$include/DwtWidget.h>
#include <decw$include/Vendor.h>

#define MAXARGS           5

static XtCallbackProc ButtonArmed(),
                      ButtonActivated();

static DwtCallback arm_callback[] = {
					{ButtonArmed, NULL},
					{NULL, NULL}
				    },
		   activate_callback[] = {
					     {ButtonActivated, NULL},
					     {NULL, NULL}
					 };

Atom icon_state_atom;
Widget top_level,main_dialog,exit_push_button,icon_push_button,
	   iconify_push_button;

int	istate = 1;
XWMHints wmh;

main(argc,argv)
    unsigned int argc;
    char *argv[];
{
    Arg args[MAXARGS];
    int n;

    /* Initialize the toolkit, and create the top-level widget */

    top_level = XtInitialize("Gizmos!","Example",NULL,0,&argc,argv);

    n = 0;
    XtSetArg(args[n],DwtNx,700);                ++n;
    XtSetArg(args[n],DwtNy,10);			++n;
    XtSetArg(args[n],XtNallowShellResize,True);	++n;
    XtSetValues(top_level,args,n);
					
    /* Get the icon-state atom */

    icon_state_atom = XInternAtom(XtDisplay(top_level),
				 "DEC_WM_ICON_STATE", /* Property name */
				 FALSE);              /* only_if_exists? */

    /* Create and manage main_dialog widget */

    main_dialog = DwtDialogBoxCreate(top_level,"mainDialog",0,0);
    XtManageChild(main_dialog);

    /* Create exit push-button widget using low-level interface */

    n = 0;
    XtSetArg(args[n],DwtNarmCallback,arm_callback);		    ++n;
    XtSetArg(args[n],DwtNactivateCallback,activate_callback);	    ++n;
    XtSetArg(args[n],DwtNlabel,DwtLatin1String("Exit Gizmos!"));  ++n;

    exit_push_button = DwtPushButtonCreate(main_dialog,"ePushButton",args,n);

    XtManageChild(exit_push_button);

    /* Create icon push-button widget using low-level interface */

    n = 0;
    XtSetArg(args[n],DwtNy,20);					++n;
    XtSetArg(args[n],DwtNactivateCallback,activate_callback);   ++n;
    XtSetArg(args[n],DwtNlabel,DwtLatin1String("Toggle Iconify"));	++n;

    icon_push_button = DwtPushButtonGadgetCreate(main_dialog,"iPushButton",
						 args,n);

    XtManageChild(icon_push_button);

    /* Create iconify push-button widget using low-level interface */

    n = 0;
    XtSetArg(args[n],DwtNy,80);					++n;
    XtSetArg(args[n],DwtNactivateCallback,activate_callback);   ++n;
    XtSetArg(args[n],DwtNlabel,DwtLatin1String("Programmed Iconify"));	++n;

    iconify_push_button = DwtPushButtonGadgetCreate(main_dialog,"yPushButton",
						 args,n);

    XtManageChild(iconify_push_button);

    XtRealizeWidget(top_level);

    XtMainLoop();  /* Never returns */
}

static XtCallbackProc ButtonArmed(widget,tag,reason)
   Widget widget;
   char *tag;
   DwtAnyCallbackStruct *reason;
{
   Arg arg;

   XtSetArg(arg,DwtNlabel,DwtLatin1String("Goodbye, World!"));
   XtSetValues(widget,&arg,1);
}

static XtCallbackProc ButtonActivated(widget,tag,reason)
    Widget widget;
    char *tag;
    DwtAnyCallbackStruct *reason;
{
    Arg arg;
/*    getval(XtDisplay(top_level),XtWindow(top_level));*/
    if(widget == exit_push_button)
	exit(1);
    else if(widget == iconify_push_button){
	wmh.flags = StateHint;
	wmh.initial_state = IconicState;
	XSetWMHints(XtDisplay(top_level),XtWindow(top_level),&wmh);
    }
    else{
	if(widget == icon_push_button){
	    XtSetArg(arg,XtNnoIconify, istate ? True : False);
	    istate = 1 - istate;

    /* Must unmap and map for the new window decoration to take effect */

	    XtUnmapWidget(top_level);
	    XtSetValues(top_level,&arg,1);
	    XtMapWidget(top_level);
	}
    }
}

T.RTitleUserPersonal
Name
DateLines
1513.1WM confused but doesn't know itCSC32::B_WACKERTue Oct 03 1989 10:4319
To restate in fewer lines-- if you first do a:

	wmh.flags = StateHint;
	wmh.initial_state = IconicState;
	XSetWMHints(XtDisplay(top_level),XtWindow(top_level),&wmh);

Then deiconify manually and do a:

	    XtSetArg(arg,XtNnoIconify, True)
	    XtUnmapWidget(top_level);
	    XtSetValues(top_level,&arg,1);
	    XtMapWidget(top_level);

The widget window disappears AND the icon disappears.  Also, I just 
found that if you set XtNoiconify to True then set initial_state to 
iconic it crashes the WM.

Is there a way to talk to the WM without blowing its brains??

1513.2qardCSC32::B_WACKERTue Oct 03 1989 15:192
Qar 3625

1513.3?STAR::CYPRYCHTue Oct 03 1989 16:445
    Creating a dialog box that does not have an iconify
    button indicates that iconification is not permitted
    for that dialog box.   Attempting to then iconify
    the window programmatically is not supported - fyi.

1513.4Why's that?GR8FUL::HERBERTLegalize it!Tue Oct 03 1989 18:157
Re: .3

Why? An application might not want iconification based on the window-manager
supplied mechanism, but why can't it supply its own?

Kevin

1513.5Icons, Shmi-cons...SDSVAX::SWEENEYI was focused when focus wasnt coolTue Oct 03 1989 18:2410
    What's an icon anyway?
    
    If you mean a resource managed by the window manager, then you either
    use the window manager's mechanisms or you don't.
    
    If you mean the on-screen appearance of a pixmap which is (typically)
    smaller than the application which it symbolically represents, then, by
    all means, an application can create it's own icon: appearance _and_
    interaction semantics, and window manager treats them passively.

1513.6if no iconify ability is requested, you get itSTAR::CYPRYCHWed Oct 04 1989 11:4412
    re: .4
    
    I didnt say that you can not programmatically
    iconify a window.   What I mean to say is that
    you can not programmatically iconify a window
    that you have set up without an iconify button.
    
    If you wish not to have window manager control
    over a window,  then this is a different problem
    altogether.  I am referring to window manager
    controlled windows.

1513.7Unable to map after wm_hints iconificationCSC32::B_WACKERWed Oct 04 1989 14:3814
>    you can not programmatically iconify a window
>    that you have set up without an iconify button.

This is a red herring because you can obviously keep track of whether 
or not you have an iconify button and disallow programmed 
iconification where appropriate, though it would be nice if the WM 
didn't crash if you forgot!

However, the original problem boils down to once you have
programatically iconified using wm_hints, deiconifed manually, then you
cannot unmap/map the window without reiconifying it.  I even tried 
resetting wm_hints to normal and still couldn't unmap/map without
iconifying.

1513.8STAR::CYPRYCHWed Oct 04 1989 15:166
    I believe this may be a style guide issue...
    If you don't have an iconify button you don't
    want to ever iconify.
    
    I don't know about the other problem.

1513.9Venturing to disagreeMELTIN::dickfailed XperimentWed Oct 04 1989 15:3621
.8

I would strongly disagree.  It is a wm bug not a style guide issue.  Not
all applications with which dxwm must work will be style guide compliant.
It is probably reasonable to assume that they will be ICCCM compliant.
What does the ICCCM say about this?  I would find it reasonable that some
applications would want to override the window manager when active but
would provide some means for iconifying (and thus return control to the
wm).  A typical example would be an IC layout application which might take
control of the whole screen (override redirect, width and height = root size)
and provide its own button for iconification.

No iconify button may only mean that the application wants to provide its
own mechanism to tell when iconify should happen.

I repeat that I have not checked the ICCCM on this but it is clearly not
a "style" issue.  A "style" issue would be whether XUI applications should
use this mechanism not whether it should work.

Dick Schoeller

1513.10no_iconify means somethingSTAR::CYPRYCHThu Oct 05 1989 14:0334
    If there is no iconify button,  then there is no
    icon created for the dialog box.  If there is no
    icon,  what is the window manager supposed to
    iconify the dialog box into?  Whether you tell
    the window manager to iconify programmatically
    or via a button,  it doesn't matter, there's
    no icon.
    
    If you wish to just get the dialog box out of
    the user's face,  then just unmap the window.
    If you wish to do something then unmap the
    window and create your own mechanism,  then
    feel free -- just please don't set no_iconify
    in DEC_WM_HINTS. 
    
    Somehow we have to provide a way to create
    dialog boxes which users can NOT iconify.
    This is how we did it,  you set no_iconify in
    DEC_WM_HINTS.   If the window manager is informed 
    you don't want to iconify the window,  then there
    will be no icon created.   We can not just
    change this functionality because thousands
    of other dialog boxes are relying on us to
    NOT iconify their window.
    
    This came about due to an alleged bug,  and
    what the window manager interprets no_iconify as
    meaning.
    
    I suppose if we had no iconify button, and still have 
    an icon and then the ability to iconify is still there.
    The user is still able to iconify so Im not sure what it
    has bought you really.

1513.11Which "style guide" are we talking about?IO::MCCARTNEYJames T. McCartney III - DTN 381-2244 ZK02-2/N24Thu Oct 05 1989 15:438
Also, given the recent move to adopt OSF/Motif as our strategic UI style,
what do we want to worry about being XUI conformant?

As .9 points out, it really isn't a style guide issue anyway.

James

1513.12ImplementationMELTIN::dickGVRIEL::SCHOELLERWed Oct 11 1989 12:5216
.10

What I read your note to say is: "Because of the way in which we implemented
dxwm, this idea can't work".  It does not say that we COULDN'T have
implemented it otherwise.  It does not say that we DID implement it RIGHT.
It only says, "That's the way it is, so tough!"  So my question would be,
"Why MUST it be that way?"  (Note, I did not ask why it is that way).

The big problem I see here is the insistence that when you have an icon box
you must have an icon in it for active, iconifiable windows.  As far as I
know that is not an ICCCM requirement.  If there were only icons present for
the iconified windows then one could be put there for any window that got
iconified no matter how it got that way.

Dick

1513.13Intention of note is changing.STAR::CYPRYCHWed Oct 11 1989 17:2226
      
    I was merely describing what .0's bug is.
    
    The bug is:
    The no_iconify_button boolean (that gets set in .0
    and .1's examples) indicates to the window
    manager whether you wish to use the button or not.
    This boolean does NOT indicate "now iconify the window,  now
    de-iconify the window" which is what .0 was attempting to
    do. 
    
    This is purely a technical point - changing the meaning
    of the boolean no_iconify_button will break many applications. 
                                         
    That is all this note was about,  a bug.  I don't doubt
    there are other ways to iconify, some better and some worse.
    
    The window manager is an implementation of the style guide.
    Page 2-3 of the style guide describes the relationship between
    the iconify button and the icon in the icon box.
    
    The suggestions/ideas "to be able to iconify a window
    whether the iconify button exists or not" have been noted.
      
    

1513.14Just to set the record straightCSC32::B_WACKERThu Oct 12 1989 17:5247
>    The bug is:
>    The no_iconify_button boolean (that gets set in .0
>    and .1's examples) indicates to the window
>    manager whether you wish to use the button or not.
>    This boolean does NOT indicate "now iconify the window,  now
>    de-iconify the window" which is what .0 was attempting to
>    do. 

I'm .0 and that's not what I was attempting to do.  What I was 
attempting was INDEPENDENT control over existence of an iconify button 
and trying to achieve iconification by programmed control.  Two bugs 
appeared.

1) If you've turned of the icon button and programmed iconify it 
crashes the window manager.  This isn't too important to me because 
you've given it inconsistent commands and it is easy to avoid.  On the 
other hand the WM shouldn't go bye-bye.

2) The worse bug appered because to make the icon button state take
effect you have to unmap/map and once you've set wm_hints to force 
iconification then mapping always makes it iconify.  That might even 
be acceptable except that if you catch when the user deiconifies in a 
structure notify callback and reset wm_hints it doesn't work, either.
So, if you force iconification, the user clicks to deiconify, any 
subsequent map will iconify.  If you reset wm_hints in an independent 
operation (another button callback) then you can map without 
iconification.  I think the WM errs when it does not keep wm_hints 
consistent with the last state of the window and then uses it on 
subsequent maps no matter what has intervened.

re -2:  I agree that "that's the way it is, tough!" is not an answer.
Incidentally, that's also what was said about even being able to 
change the iconifiable (lower and resize, too) on the fly.  Changing 
the gizmos, by the way, seems to work fine as long as the map to make 
it take effect doesn't get crossed up with wm_hints being confused.

>    The suggestions/ideas "to be able to iconify a window
>    whether the iconify button exists or not" have been noted.

That's ok, but the user can keep track of whether or not there is a 
button pretty easily.  The problem is with manual deiconification 
leaving wm_hints inconsistent.
      
I think Motif makes it all moot, anyway.

Bruce    

1513.15DECWIN::KLEINThu Oct 12 1989 19:1210
re: .-1

>>I agree that "that's the way it is, tough!" is not an answer.
>>...
>>I think Motif makes it all moot, anyway.

Don't you see a connection here?

-steve-

1513.16Motif........STAR::CYPRYCHFri Oct 13 1989 12:5124
    re: .14
    
    2)
    
    The initial_state in WM_HINTS is being used to
    define the initial state of the window.  This
    is settable by the client, not the window manager.
    
    "The value of the initial_state field determines the
    state the client wishes to be in at the time the
    top-level window is mapped from Withdrawn state." -
    p. 22 Inter-Client Communication Conventions Manual,
    Public Review Report dated 11th May 1989.
    
    Motif wm does the same thing in regard
    to initial_state field.  I am reporting this so you
    know what to expect when you pick up a copy of
    a Motif wm - don't beat up the messenger :-).
    
    Motif wm should be setting a property called
    WM_STATE to reflect current state. (at least
    the spec. says so)  So,  in that sense, Motif
    "makes it all moot, anyway".