| 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 |
Greetings,
I've a question about event trapping :
XCreateSimpleWindow creates a window with the DECW banner and the icons
for iconify/push/resize. Whilst it is OK to use the DWM routines to do
the iconify/push/resize, it is desirable to notify a the program of the
event(s). I believe that it is possible to trap the move & resize hits,
and that you can even use Expose to give a form of "restore from icon"
event [ although this isn't ideal ] but the iconify event has appeared
untrappable so far.
1) Is it possible ? If so, how ?
2) If not, any bright ideas as to the best workaround ?
3) If there is an easy way to do the whole set, please tell me ! :-)
Grateful for any assistance,
Frank
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 131.1 | Hello, World! (with icon-state tracking) | TBD1::BURLEIGH | Human life begins at conception | Mon Feb 06 1989 13:57 | 107 |
#include <stdio.h>
#include <decw$include/DwtWidget.h>
#include <decw$include/Vendor.h>
#define MAXARGS 4
static XtCallbackProc ButtonArmed(),
ButtonActivated();
static XtEventHandler CheckIconState();
static DwtCallback arm_callback[] = {
{ButtonArmed, NULL},
{NULL, NULL}
},
activate_callback[] = {
{ButtonActivated, NULL},
{NULL, NULL}
};
Atom icon_state_atom;
main(argc,argv)
unsigned int argc;
char *argv[];
{
Widget top_level,push_button;
Arg args[MAXARGS];
int n;
/* Initialize the toolkit, and create the top-level widget */
top_level = XtInitialize("Hi!","Example",NULL,0,&argc,argv);
n = 0;
XtSetArg(args[n],DwtNx,340); ++n;
XtSetArg(args[n],DwtNy,288); ++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? */
/* Install an event handler to check property changes */
XtAddEventHandler(top_level,PropertyChangeMask,False,CheckIconState,0);
/* Create 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],DwtNshadow,False); ++n;
XtSetArg(args[n],DwtNlabel,DwtLatin1String("Hello, World!")); ++n;
push_button = DwtPushButtonCreate(top_level,"pushButton",args,n);
XtManageChild(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;
{
exit(1);
}
static XtEventHandler CheckIconState(widget,closure,event)
Widget widget;
caddr_t closure;
XPropertyEvent *event;
{
WmIconStateRec icon_state_rec;
Arg arg;
if (event->type == PropertyNotify) {
if (event->atom == icon_state_atom) {
XtSetArg(arg,XtNiconState,&icon_state_rec);
XtGetValues (widget,&arg,1);
printf("Application state: %s\n",
icon_state_rec.state == WmNormalState ? "normal"
: "iconic");
}
}
}
| |||||
| 131.2 | I'll give it a try ... thanks | COMICS::BELL | Mirror or window ? | Tue Feb 07 1989 05:29 | 6 |
Re .1
Thanks for the speed and quality of the reply. It looks good.
Frank
| |||||
| 131.3 | what about grab-n-move? | GSRC::WEST | I'm just visiting this planet. | Tue Apr 18 1989 14:59 | 12 |
I have been able to turn off/blacken out these three buttons that
appear on the title banner of the windows. What I am trying to do
'disable' the grab and move of windows that still have the title
banner.
Does anyone know if this can be done??
ADVthanksANCE
-=> Jim <=-
| |||||
| 131.4 | disable grab and move of windows | STAR::CYPRYCH | Tue Apr 18 1989 15:06 | 11 | |
What do you mean by "disable grab and move of windows".
The window manager passive grab I assume is the grab
you want to disable?
What about this disable move of windows?
Are you trying to eliminate window manager involvement
entirely? If so, override redirect windows would
work - you wouldn't get a title bar.
| |||||
| 131.5 | Cake and Eat too?? | GSRC::WEST | I'm just visiting this planet. | Tue Apr 18 1989 16:03 | 13 |
Maybe I want to have my cake and eat it too.
I would possibly like to prevent the user from moving windows but
still have some window manager control, i.e. not use override
redirect.
Now, if I do use the override redirect what kind of things do I want
to watch out for? In other words, what does the window manager do for
me that I will now have to do myself?
-=> Jim <=-
| |||||
| 131.6 | So you want to argue with the window manager? | DECWIN::KLEIN | Tue Apr 18 1989 16:19 | 40 | |
>> I would possibly like to prevent the user from moving windows but >> still have some window manager control, i.e. not use override >> redirect. You could always keep your window from being moved by allowing it to move, but immediately moving it back to where you think it should be. Of course, many people would say that this is the behavior of an anti-social application, but if you're really insistent... There are two steps to this solution. First you need to detect when the shell has been moved away from its "proper" position, and then you need to put it back where it belongs. Let's assume that the window is in the proper position when it is first mapped. You could trap the MapNotify event on your shell widget and then do an XTranslateCoordinates to figure out where on the screen the window really is. Save this as the "proper" position. Remember that the window manager may not even put the window where you want initially - since there may be rules about initial visibility, etc. Whenever the window manager moves an application's window, it sends a client message to the affected shell widget. Rather than counting on the particular atom used as the client message type, I assume that whenever I hear from the window manager, then the window might have been moved. Do another XTranslateCoordinates to see if the shell really has moved, and if so, ask the window manager to move it back (by setting x and y on the shell widget using XtSetValues). The things you lose with override redirect include: iconification push-to-back resize movability bring to front on MB1 click nice borders assignment of focus (maybe) -steve- | |||||
| 131.7 | What's one more field among friends? | SDSVAX::SWEENEY | Wall Street is my beat | Tue Apr 18 1989 19:11 | 6 |
is this a suggestion for
Bool title_bar_has_no_move_semantics;
to be added as a field to the DECWmHintsRec?
| |||||
| 131.8 | By george, he's onto something... | GSRC::WEST | I'm just visiting this planet. | Tue Apr 18 1989 23:25 | 7 |
Wouldn't that be swell ?!?!?!
| |||||
| 131.9 | I'll see Pat and raise him 1+ | 19763::HALLYB | The Smart Money was on Goliath | Fri Apr 21 1989 14:49 | 11 |
.7> is this a suggestion for
.7>
.7> Bool title_bar_has_no_move_semantics;
Nope, it's really a mask of movement in 3 dimensions: x, y, and z.
The z dimension of course refers to the stacking of windows, i.e.,
push-to-back and pop-to-front. (Any calls for "direction" as well
as "dimension"? :-)
John
| |||||