Tk Source Code

Artifact [2da60018]
Login

Artifact 2da600187166aaecf263288759db4d18e88644b6:

Attachment "tkUnixWm833hobbs.diff" to ticket [220260ff] added by hobbs 2001-08-29 02:25:20.
Index: tkUnixWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixWm.c,v
retrieving revision 1.8
diff -b -c -r1.8 tkUnixWm.c
*** tkUnixWm.c	2000/03/27 18:02:59	1.8
--- tkUnixWm.c	2001/08/28 19:24:03
***************
*** 300,306 ****
  
  typedef struct WaitRestrictInfo {
      Display *display;		/* Window belongs to this display. */
!     Window window;		/* We're waiting for events on this window. */
      int type;			/* We only care about this type of event. */
      XEvent *eventPtr;		/* Where to store the event when it's found. */
      int foundEvent;		/* Non-zero means that an event of the
--- 300,306 ----
  
  typedef struct WaitRestrictInfo {
      Display *display;		/* Window belongs to this display. */
!     WmInfo *wmInfoPtr;
      int type;			/* We only care about this type of event. */
      XEvent *eventPtr;		/* Where to store the event when it's found. */
      int foundEvent;		/* Non-zero means that an event of the
***************
*** 335,341 ****
  static void		WaitForConfigureNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    unsigned long serial));
  static int		WaitForEvent _ANSI_ARGS_((Display *display,
! 			    Window window, int type, XEvent *eventPtr));
  static void		WaitForMapNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    int mapped));
  static Tk_RestrictAction
--- 335,341 ----
  static void		WaitForConfigureNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    unsigned long serial));
  static int		WaitForEvent _ANSI_ARGS_((Display *display,
! 			    WmInfo *wmInfoPtr, int type, XEvent *eventPtr));
  static void		WaitForMapNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    int mapped));
  static Tk_RestrictAction
***************
*** 2411,2416 ****
--- 2411,2418 ----
  	wmPtr->xInParent = wmPtr->yInParent = 0;
  	wrapperPtr->changes.x = reparentEventPtr->x;
  	wrapperPtr->changes.y = reparentEventPtr->y;
+ 	wmPtr->winPtr->changes.x = reparentEventPtr->x;
+ 	wmPtr->winPtr->changes.y = reparentEventPtr->y + wmPtr->menuHeight;
  	return;
      }
  
***************
*** 2851,2857 ****
      serial = NextRequest(winPtr->display);
      height += wmPtr->menuHeight;
      if (wmPtr->flags & WM_MOVE_PENDING) {
! 	if ((x == winPtr->changes.x) && (y == winPtr->changes.y)
  		&& (width == wmPtr->wrapperPtr->changes.width)
  		&& (height == wmPtr->wrapperPtr->changes.height)) {
  	    /*
--- 2853,2860 ----
      serial = NextRequest(winPtr->display);
      height += wmPtr->menuHeight;
      if (wmPtr->flags & WM_MOVE_PENDING) {
! 	if ((x + wmPtr->xInParent == winPtr->changes.x) &&
! 		(y + wmPtr->yInParent + wmPtr->menuHeight == winPtr->changes.y)
  		&& (width == wmPtr->wrapperPtr->changes.width)
  		&& (height == wmPtr->wrapperPtr->changes.height)) {
  	    /*
***************
*** 3084,3091 ****
  
      while (!gotConfig) {
  	wmPtr->flags |= WM_SYNC_PENDING;
! 	code = WaitForEvent(winPtr->display, wmPtr->wrapperPtr->window,
! 		ConfigureNotify, &event);
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
  	    if (winPtr->dispPtr->wmTracing) {
--- 3087,3093 ----
  
      while (!gotConfig) {
  	wmPtr->flags |= WM_SYNC_PENDING;
! 	code = WaitForEvent(winPtr->display, wmPtr, ConfigureNotify, &event);
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
  	    if (winPtr->dispPtr->wmTracing) {
***************
*** 3131,3139 ****
   */
  
  static int
! WaitForEvent(display, window, type, eventPtr)
      Display *display;		/* Display event is coming from. */
!     Window window;		/* Window for which event is desired. */
      int type;			/* Type of event that is wanted. */
      XEvent *eventPtr;		/* Place to store event. */
  {
--- 3133,3141 ----
   */
  
  static int
! WaitForEvent(display, wmInfoPtr, type, eventPtr)
      Display *display;		/* Display event is coming from. */
!     WmInfo *wmInfoPtr;		/* Window for which event is desired. */
      int type;			/* Type of event that is wanted. */
      XEvent *eventPtr;		/* Place to store event. */
  {
***************
*** 3149,3155 ****
       */
  
      info.display = display;
!     info.window = window;
      info.type = type;
      info.eventPtr = eventPtr;
      info.foundEvent = 0;
--- 3151,3157 ----
       */
  
      info.display = display;
!     info.wmInfoPtr = wmInfoPtr;
      info.type = type;
      info.eventPtr = eventPtr;
      info.foundEvent = 0;
***************
*** 3203,3209 ****
      if (eventPtr->type == ReparentNotify) {
  	return TK_PROCESS_EVENT;
      }
!     if ((eventPtr->xany.window != infoPtr->window)
  	    || (eventPtr->xany.display != infoPtr->display)) {
  	return TK_DEFER_EVENT;
      }
--- 3205,3212 ----
      if (eventPtr->type == ReparentNotify) {
  	return TK_PROCESS_EVENT;
      }
!     if (((eventPtr->xany.window != infoPtr->wmInfoPtr->wrapperPtr->window)
! 	    && (eventPtr->xany.window != infoPtr->wmInfoPtr->reparent))
  	    || (eventPtr->xany.display != infoPtr->display)) {
  	return TK_DEFER_EVENT;
      }
***************
*** 3265,3271 ****
  	    break;
  	}
  	wmPtr->flags |= WM_SYNC_PENDING;
! 	code = WaitForEvent(winPtr->display, wmPtr->wrapperPtr->window,
  		mapped ? MapNotify : UnmapNotify, &event);
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
--- 3268,3274 ----
  	    break;
  	}
  	wmPtr->flags |= WM_SYNC_PENDING;
! 	code = WaitForEvent(winPtr->display, wmPtr,
  		mapped ? MapNotify : UnmapNotify, &event);
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
***************
*** 4104,4111 ****
      int desiredIndex = 0;	/* Initialized to stop gcc warnings. */
      int ourIndex = 0;		/* Initialized to stop gcc warnings. */
      unsigned long serial;
-     XEvent event;
-     int diff;
      Tk_ErrorHandler handler;
      TkWindow *wrapperPtr;
  
--- 4107,4112 ----
***************
*** 4258,4266 ****
      if (window == wrapperPtr->window) {
  	WaitForConfigureNotify(winPtr, serial);
      } else {
  	while (1) {
! 	    if (WaitForEvent(winPtr->display, window, ConfigureNotify,
! 		    &event) != TCL_OK) {
  		break;
  	    }
  	    diff = event.xconfigure.serial - serial;
--- 4259,4270 ----
      if (window == wrapperPtr->window) {
  	WaitForConfigureNotify(winPtr, serial);
      } else {
+ 	XEvent event;
+ 	int diff;
+ 
  	while (1) {
! 	    if (WaitForEvent(winPtr->display, winPtr->wmInfoPtr,
! 		    ConfigureNotify, &event) != TCL_OK) {
  		break;
  	    }
  	    diff = event.xconfigure.serial - serial;
***************
*** 4268,4274 ****
  		break;
  	    }
  	}
- 
  	/*
  	 * Ignore errors that occur when we are de-selecting events on
  	 * window, since it's possible that the window doesn't exist
--- 4272,4277 ----