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 |
/* There seems to be some differences in event reporting between Decwindows Version 1 and Decwindows EFT 2.0 on VMS 5.2,image file DECW T2.0-FT1.The GravityNotify event seems to have been lost. In version 1 if you resized a window you received the following events, GravityNotify,GravityNotify,ConfigureNotify and Expose. Under EFT 2 you receive just ConfigureNotify and Expose. In version 1 a move event generates GravityNotify and ClientMessage. With EFT 2 you just get the ClientMessage. These are the differences that I have discovered.Are there others and are they documented.?? VMS Decwindows V2.0 release notes doesn't mention any changes. The following is the source to a program which prints out events which demonstrate the above behaviour.I know of customers software that will have to change because of this and other that may exist. The build command follows. regards Mark $cc 'p1' $define/nolog c$include decw$examples.decw$include,sys$library $define/nolog vaxc$include c$include $link 'p1',sys$input/opt sys$share:decw$xlibshr/share sys$share:vaxcrtl/share sys$share:decw$dwtlibshr/share */ #include signal #include <decw$include/xlib.h> #include <decw$include/x.h> #define screenNumber DefaultScreen(dp) #define depth DefaultDepth(dp,screenNumber) #define blackPixel BlackPixel (dp,screenNumber) #define whitePixel WhitePixel (dp,screenNumber) XSetWindowAttributes window_attributes; Display *dp = 0; unsigned long attribute_mask; int main (ac,av) int ac; char **av; { Window wd; int i; --ac,++av; dp = XOpenDisplay ("0::0,0"); for (i = 0 ; i < 1; ++i) { wd = XCreateSimpleWindow (dp,RootWindow (dp, DefaultScreen (dp)), 100 + i * 10,100+i*20,300,200,depth,blackPixel,whitePixel); printf ("Created Window %d handle %x\n",i,wd); XSelectInput (dp,wd,ButtonPressMask | ButtonReleaseMask | ExposureMask | EnterWindowMask | LeaveWindowMask | ExposureMask | VisibilityChangeMask | StructureNotifyMask | FocusChangeMask ); XMapWindow (dp, wd); } while (1) { XMapEvent event_ptr; printf ("hello,event type = %d\n",event_ptr.type); XNextEvent (dp,&event_ptr); switch (event_ptr.type) { case MapNotify : XSetInputFocus (dp,event_ptr.window, RevertToParent,CurrentTime); printf ("Focus set Window handle %x\n",event_ptr.window); } } return (1); }
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
1414.1 | DECWIN::ADAMS | Wed Sep 13 1989 15:16 | 9 | ||
Thanks, there is a problem with gravity notify for FT2. Both developers and users of DECwindows would greatly benefit if QARs reporting these problems are filed. The QAR system is the mechanism in place to report problems. Please help us. Thanks, Bill Adams | |||||
1414.2 | DECWIN::ADAMS | Wed Sep 13 1989 18:11 | 235 | ||
I'll retract my statement in my previous reply about there being a problem with gravity notification. I thought I had missed sending gravity events when a window moved, but a check of the protocol indicates gravity events should only be generated if a window has moved due to the resizing of its parent. The V2 FT1 and FT2 server does generate gravity events correctly and I have attached a program which demonstrates this. Please feel free to modify the code to find a problem area with gravity notification. As far your sample code is concerned I did not see any call to XConfigureWindow and therefore would not expect a GravityEvent to be generated. Bill Adams #include "xlib.h" #define X 0 #define Y 1 #define HEIGHT 2 #define WIDTH 3 #define BW 4 Window root; Window parent; Window w1; Display *pDisplay; char *GetWid(win_id) Window win_id; { if (win_id == root) return("root"); if (win_id == parent) return("parent"); if (win_id == w1) return("w1"); return("NOT FOUND"); } main() { void DspEvent(); int parent_x = 10; /* x origin */ int parent_y = 10; /* y origin */ int parent_height = 400; /* height */ int parent_width = 400; /* width */ int parent_bw = 3; /* border width */ int w1_value[5] = { 100, 200, 200, 200, 2}; int border; /* border */ int background; /* background */ int i,j; int depth; int white; int black; int num_win=0; XSetWindowAttributes win_values; XWindowChanges win_config; pDisplay = XOpenDisplay(0); depth = XDefaultDepth(pDisplay,0); white = XWhitePixel(pDisplay,0); black = XBlackPixel(pDisplay,0); border = white; background = black; root = XRootWindow( pDisplay, 0 ); parent = XCreateSimpleWindow(pDisplay, root, parent_x, parent_y, parent_width, parent_height, parent_bw, border, background); XSelectAsyncinput(pDisplay, parent, ExposureMask | VisibilityChangeMask | StructureNotifyMask|SubstructureNotifyMask, DspEvent, parent); win_values.event_mask = ExposureMask | VisibilityChangeMask | StructureNotifyMask|SubstructureNotifyMask; XChangeWindowAttributes(pDisplay,parent,CWEventMask, &win_values); XMapWindow(pDisplay,parent); XFlush(pDisplay); /* ** create w1 */ w1 = XCreateSimpleWindow(pDisplay, parent, w1_value[X],w1_value[Y],w1_value[WIDTH], w1_value[HEIGHT],w1_value[BW],border, background); XSelectAsyncinput(pDisplay, w1, ExposureMask | VisibilityChangeMask | StructureNotifyMask|SubstructureNotifyMask, DspEvent, w1); win_values.win_gravity = NorthGravity; XChangeWindowAttributes(pDisplay,w1,CWEventMask|CWWinGravity, &win_values); XMapWindow(pDisplay, w1); XFlush(pDisplay); win_config.height = parent_height+200; win_config.width = parent_width+200; XConfigureWindow(pDisplay, parent, CWWidth|CWHeight, &win_config); XFlush(pDisplay); while (1) ; } void DspEvent(ev_window) Window ev_window; { XEvent event; XCrossingEvent *pCross; XVisibilityEvent *pVis; XCreateWindowEvent *pCreate; XMapEvent *pMap; XMapRequestEvent *pMapReq; XExposeEvent *pExpose; XResizeRequestEvent *pResizeReq; XReparentEvent *pReparent; XGravityEvent *pGravity; XConfigureEvent *pConfigure; XCirculateEvent *pCirculate; XDestroyWindowEvent *pDestroy; XUnmapEvent *pUnmap; XNextEvent(pDisplay,&event); printf("\n"); switch (event.type) { case (Expose): pExpose = ( XExposeEvent *) &event; printf("expose event window = %s x = %d y = %d w = %d h = %d \n", GetWid(pExpose->window),pExpose->x,pExpose->y, pExpose->width,pExpose->height); break; case (VisibilityNotify): pVis = ( XVisibilityEvent *) &event; printf("visibility event window = %s ",GetWid( pVis->window)); if (pVis->state == VisibilityUnobscured) printf ("VisibilityUnobscured\n"); if (pVis->state == VisibilityPartiallyObscured) printf ("VisibilityPartiallyObscured\n"); if (pVis->state == VisibilityFullyObscured) printf ("VisibilityFullyObscured\n"); break; case (CreateNotify): pCreate = ( XCreateWindowEvent *) &event; printf("create window event window = %s parent = %s\n", GetWid( pCreate->window),GetWid( pCreate->parent)); break; case (MapNotify): pMap = ( XMapEvent *) &event; printf("map window event window = %s \n", GetWid( pMap->window)); break; case (MapRequest): pMapReq = ( XMapRequestEvent *) &event; printf("map request event window = %s parent = %s\n", GetWid( pMapReq->window),GetWid( pMapReq->parent)); break; case (ResizeRequest): pResizeReq = ( XResizeRequestEvent *) &event; printf("resize request event window = %s \n", GetWid( pResizeReq->window)); break; case (ReparentNotify): pReparent = ( XReparentEvent *) &event; printf("reparent request event window = %s parent = %s\n", GetWid( pReparent->window),GetWid( pReparent->parent)); break; case (GravityNotify): pGravity = ( XGravityEvent *) &event; printf("gravity event window = %s x = %d y = %d\n", GetWid( pGravity->window),pGravity->x,pGravity->y); break; case (ConfigureNotify): pConfigure = ( XConfigureEvent *) &event; printf("configure event window = %s x = %d y = %d\n", GetWid( pConfigure->window),pConfigure->x,pConfigure->y); printf("width = %d height = %d bw = %d \n", pConfigure->width,pConfigure->height, pConfigure->border_width); break; case (CirculateNotify): pCirculate = ( XCirculateEvent *) &event; printf("circulate event window = %s ", GetWid( pCirculate->window)); if (pCirculate->place == PlaceOnTop) printf(" PlaceOnTop \n"); else printf(" PlaceOnBottom \n"); break; case (DestroyNotify): pDestroy = ( XDestroyWindowEvent *) &event; printf("destroy event window = %s \n ", GetWid( pDestroy->window)); break; case (UnmapNotify): pUnmap = ( XUnmapEvent *) &event; printf("unmap event window = %s \n ", GetWid( pUnmap->window)); break; default: printf("type %d\n",event.type); } } | |||||
1414.3 | Move window detection? | LARVAE::BULLARD | Thu Sep 14 1989 14:08 | 10 | |
It looks as if Decwindows version 1 generated a false GravityNotify when a window is moved.This seems to be corrected now.The problem that my customer has is that having empirically discovered that this event was generated he is using it to detect window movement.Is there any other way of being told of window movement that doesn't involve a resize ? regards Mark | |||||
1414.4 | ConfigureNotify Event | DECWIN::KLEIN | Thu Sep 14 1989 16:06 | 4 | |
A ConfigureNotify event is sent when a window is moved, if you ask for it. -steve- | |||||
1414.5 | PUFFER::FERLAN | We only tried once... or maybe twice | Fri Mar 30 1990 14:34 | 35 | |
>>> <<< Note 1414.4 by DECWIN::KLEIN >>> >>> -< ConfigureNotify Event >- >>> >>> A ConfigureNotify event is sent when a window is moved, if you ask for it. >>> >>> -steve- Does this still hold true for V2.0? I have have asked for structure notify events, yet the only time the event is given to me is when I try to resize the window. When I pick up and move the window, no event is passed to me. This happens even when I select all events. This is true for a V5.3 and T5.4-4ET systems. This is for UISX, which was originally developed under V1.0 of DECwindows, where I could get the movement from the gravity event. We only use straight XLIB calls, so please don't even try to talk using the toolkit to me. Am I missing something basic or what? Sorry if this has been discussed elsewhere after this discussion but I did a sho key/full and found nothing and then did a dir/title=gravity and found only this not, and it really does apply to what we are doing. John | |||||
1414.6 | Yes | 4GL::SCHOELLER | Who's on first? | Mon Apr 02 1990 22:07 | 9 |
>>> A ConfigureNotify event is sent when a window is moved, if you ask for it. > Does this still hold true for V2.0? I have have asked for structure Yes. However, when you drag a window around with the window manager, you are changing the location of the wrapper the window manager puts around your window. In replationship to its parent, your window doesn't move. You have to select for configure notification on an ancestor of your window (which ancestor is window manager specific). Dick | |||||
1414.7 | Gosh, you'd hope it would be easier than that! | PUFFER::FERLAN | We only tried once... or maybe twice | Tue Apr 03 1990 11:10 | 11 |
re: .6 So, you're saying when I have to set up my x$select_input I should get the 'last' parent id (from x$query_tree) and use that as the 'windowid' parameter for obtaining configure notify events?? John | |||||
1414.8 | sounds right | CLTMAX::dick | Schoeller - Failed Xperiment | Tue Apr 03 1990 15:03 | 5 |
That sounds right. Remember, this is not the window with no parent. It is the first level below the window manager's root (or the real root depending on your wm). Dick | |||||
1414.9 | Still can't get it... | PUFFER::FERLAN | We only tried once... or maybe twice | Thu Apr 05 1990 10:08 | 34 |
Well I've tried doing as suggested, but I still don't get gravity events when I move the window. I have looked in DW_EXAMPLES and DECWINDOWS_PROGRAMMING notes files as well for anything to do with gravity events (I even tried the program from this note) and I still don't get *ANY* event when I pick up and move the window. For UISX when we create our window (x$create_window), we have to use the x$root_window_of_screen as the parent (for reasons of compatibility with the HPWM from what I understand). We use X$SELECT_ASYNC_EVENT and X$SELECT_EVENT as the mechanism to trap the events. Normally we don't ask for all events, but I did try that and still when the window is moved there is no event. I even tried doing X$SELECT_EVENT for configure notify events on the parent window of the current window, and then it's parent, and so on, until I reached the root_window, yet I *still* couldn't get any event to come forth when I moved the window. So I ask anyone, does anyone have a working example of an event being triggerred when the window is picked up and moved. I would prefer that it be written in pure XLIB, but I will try to parse through any TOOLKIT routines that are submitted. You can either mail them to me at the above address or post them here (I'm sure some day someone may come along with the same problem) thanks in advance, John | |||||
1414.10 | Another approach | DECWIN::KLEIN | Thu Apr 05 1990 11:57 | 22 | |
If you are trying to find out about the moving of a shell window, you need to trap ClientMessages. The window manager sends a ClientMessage to the shell window when it is moved by the user. Since the shell window was reparented by the window manager into a close-fitting frame window, and the frame is the window that is actually being moved, the shell window does not receive any normal event notification from the server. Knowing *which* client message means "you moved" and which ones don't is tricky, since it changes from window manager to window manager. My approach is to assume that any (unrecognized) client message sent to the shell is a "tap on the shoulder" indicating that the shell might have moved. A quick XTranslateCoordinates call lets the shell find out where it now is (relative to the root) and we're back in synch. Resize can be trapped by calling for ConfigureNotify events on the shell window. Using anything having to do with gravity events is a very iffy approach, especially since there have been some server bugs found in this code and not all servers handle gravity the same way. -steve- | |||||
1414.11 | Still no luck.. | PUFFER::FERLAN | We only tried once... or maybe twice | Thu Apr 05 1990 12:46 | 24 |
re: .10 OK, but how can I do this... I have tried selecting all events for the current window and its parent then I have run UISX in DEBUG mode setting a break point at the AST routine set up by X$SELECT_ASYNC_EVENT. The I let it rip. Once I clear through all the initial events for window creation, I try to pick up the window and move, but I don't get any event notification from that. Maybe I am missing something obvious, but I can't figure it out from any of the responses so far and from any of the reading I've done in other notesfiles and the documentation. Personally I would figure that this would be something asked for quite often, especially in applications that like to know where windows are at any one point in time. Oh well, John | |||||
1414.12 | It really should work | DECWIN::KLEIN | Thu Apr 05 1990 12:52 | 18 | |
How are you selecting for all events? What is the event mask you are using? (There are other notes related to the use of -1 as an event mask. It may work today but won't work tomorrow.) Are you sure that you are selecting on the *shell* (top level) window? This is the window whose owner window is the root window (on creation). Maybe you could post some relevant code. > Maybe I am missing something obvious, but I can't figure it out from > any of the responses so far and from any of the reading I've done in > other notesfiles and the documentation. Personally I would figure that > this would be something asked for quite often, especially in > applications that like to know where windows are at any one point in > time. You aren't, you can't, and you're right. -steve- | |||||
1414.13 | STAR::KLEINSORGE | Fred Kleinsorge, VMS Development | Thu Apr 05 1990 13:33 | 11 | |
John, what Steve is saying is that the window that UISX created is reparented by the window manager. That is, it is not the decendent of the root. The WM creates a window and makes the window UISX sees the child of this window. It's this "shell" window that actually moved, the UISX window is still at the same location relative to the shell window. You need to get the event on the shell. I haven't looked at the UISX movement/resize code in about 3 weeks, but last time I did I assure you it would never work. | |||||
1414.14 | Eeeks, so confusing, yet so simple... | PUFFER::FERLAN | We only tried once... or maybe twice | Thu Apr 05 1990 14:41 | 36 |
Yeah, that's what I'm trying to get the id of the shell window and then set up whichever event I can on that window to get the event to tell me that the window has moved!!! When I do an X$QUERY_TREE, I get 5 'parent_id''s returned to me until I reach the 'root_window_of_screen' as the parent_id. Fred, the UISX movement/resize/etc code hasn't changed in the time since you last looked at it and I know it doesn't work the way it is designed now. I believe this also effects the mapping event and the shrink to/ expand from icon AST notification, but I am not sure. Once I get this one, I will probably have a better chance at that one. Setting the event flag to -1 was used for testing purposes only, we normally will OR the various events we are interested in to get our event mask. As for a code sample, it's gonna be kind of difficult because things are spread out over a few modules, but I might be able to just get the code path out. One of the reasons I'm being kind of persistant on this, is that SIGHT uses this feature to make sure you don't move any of the 'windows' around on the screen. SIGHT will move your window back to where it wants it when it receives a UIS$SET_MOVE_INFO_AST notification. There are probably customers out there that do the same thing (I don't know for sure, but...). In any case think of a trader type environment, where the trader knows the top windows are for selling and bottom windows are for buying, now if someone is allowed to move their windows around without an application moving the windows back to the original spot, we could have mayhem on the market... John | |||||
1414.15 | STAR::KLEINSORGE | Fred Kleinsorge, VMS Development | Thu Apr 05 1990 18:38 | 5 | |
I'll talk offline later. I started hacking a code fix locally some time ago and never finished it. |