Tk Source Code

Artifact [996c90b1]
Login

Artifact 996c90b1ccaef9c0d1fcf5d47860546dbc6de1f6:

Attachment "tkUnixWm833.diff" to ticket [220260ff] added by hobbs 2001-08-29 02:23:01.
*** tkUnixWm.c	Tue Aug 28 12:21:33 2001
--- /home2/jeffh/scratch/patches/tkUnixWm.c	Fri Aug 24 17:58:37 2001
***************
*** 300,306 ****
--- 300,310 ----
  
  typedef struct WaitRestrictInfo {
      Display *display;		/* Window belongs to this display. */
+ #if 1 /* TNB */
+ 	WmInfo *wmInfoPtr;
+ #else /* TNB */
      Window window;		/* We're waiting for events on this window. */
+ #endif /* TNB */
      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
***************
*** 334,341 ****
--- 338,350 ----
  static void		UpdateWmProtocols _ANSI_ARGS_((WmInfo *wmPtr));
  static void		WaitForConfigureNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    unsigned long serial));
+ #if 1 /* TNB */
+ static int		WaitForEvent _ANSI_ARGS_((Display *display,
+ 			    WmInfo *wmInfoPtr, int type, XEvent *eventPtr));
+ #else /* TNB */
  static int		WaitForEvent _ANSI_ARGS_((Display *display,
  			    Window window, int type, XEvent *eventPtr));
+ #endif /* TNB */
  static void		WaitForMapNotify _ANSI_ARGS_((TkWindow *winPtr,
  			    int mapped));
  static Tk_RestrictAction
***************
*** 2411,2416 ****
--- 2420,2429 ----
  	wmPtr->xInParent = wmPtr->yInParent = 0;
  	wrapperPtr->changes.x = reparentEventPtr->x;
  	wrapperPtr->changes.y = reparentEventPtr->y;
+ #if 1 /* TNB */
+ 	wmPtr->winPtr->changes.x = reparentEventPtr->x;
+ 	wmPtr->winPtr->changes.y = reparentEventPtr->y + wmPtr->menuHeight;
+ #endif /* TNB */
  	return;
      }
  
***************
*** 2851,2857 ****
--- 2864,2875 ----
      serial = NextRequest(winPtr->display);
      height += wmPtr->menuHeight;
      if (wmPtr->flags & WM_MOVE_PENDING) {
+ #if 1 /* TNB */
+ 	if ((x + wmPtr->xInParent == winPtr->changes.x) &&
+ 		(y + wmPtr->yInParent + wmPtr->menuHeight == winPtr->changes.y)
+ #else /* TNB */
  	if ((x == winPtr->changes.x) && (y == winPtr->changes.y)
+ #endif /* TNB */
  		&& (width == wmPtr->wrapperPtr->changes.width)
  		&& (height == wmPtr->wrapperPtr->changes.height)) {
  	    /*
***************
*** 3084,3091 ****
--- 3102,3114 ----
  
      while (!gotConfig) {
  	wmPtr->flags |= WM_SYNC_PENDING;
+ #if 1 /* TNB */
+ 	code = WaitForEvent(winPtr->display, wmPtr,
+ 		ConfigureNotify, &event);
+ #else /* TNB */
  	code = WaitForEvent(winPtr->display, wmPtr->wrapperPtr->window,
  		ConfigureNotify, &event);
+ #endif /* TNB */
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
  	    if (winPtr->dispPtr->wmTracing) {
***************
*** 3131,3139 ****
--- 3154,3168 ----
   */
  
  static int
+ #if 0 /* TNB */
  WaitForEvent(display, window, type, eventPtr)
      Display *display;		/* Display event is coming from. */
      Window window;		/* Window for which event is desired. */
+ #else /* TNB */
+ WaitForEvent(display, wmInfoPtr, type, eventPtr)
+     Display *display;		/* Display event is coming from. */
+     WmInfo *wmInfoPtr;		/* Window for which event is desired. */
+ #endif /* TNB */
      int type;			/* Type of event that is wanted. */
      XEvent *eventPtr;		/* Place to store event. */
  {
***************
*** 3149,3155 ****
--- 3178,3188 ----
       */
  
      info.display = display;
+ #if 1 /* TNB */
+ 	info.wmInfoPtr = wmInfoPtr;
+ #else /* TNB */
      info.window = window;
+ #endif /* TNB */
      info.type = type;
      info.eventPtr = eventPtr;
      info.foundEvent = 0;
***************
*** 3203,3209 ****
--- 3236,3247 ----
      if (eventPtr->type == ReparentNotify) {
  	return TK_PROCESS_EVENT;
      }
+ #if 1 /* TNB */
+ 	if (((eventPtr->xany.window != infoPtr->wmInfoPtr->wrapperPtr->window)
+ 		&& (eventPtr->xany.window != infoPtr->wmInfoPtr->reparent))
+ #else /* TNB */
      if ((eventPtr->xany.window != infoPtr->window)
+ #endif /* TNB */
  	    || (eventPtr->xany.display != infoPtr->display)) {
  	return TK_DEFER_EVENT;
      }
***************
*** 3265,3272 ****
--- 3303,3315 ----
  	    break;
  	}
  	wmPtr->flags |= WM_SYNC_PENDING;
+ #if 1 /* TNB */
+ 	code = WaitForEvent(winPtr->display, wmPtr,
+ 		mapped ? MapNotify : UnmapNotify, &event);
+ #else /* TNB */
  	code = WaitForEvent(winPtr->display, wmPtr->wrapperPtr->window,
  		mapped ? MapNotify : UnmapNotify, &event);
+ #endif /* TNB */
  	wmPtr->flags &= ~WM_SYNC_PENDING;
  	if (code != TCL_OK) {
  	    /*
***************
*** 4254,4263 ****
       * is tricky if winPtr has been reparented, since the window getting
       * the event isn't one that Tk owns.
       */
- 
      if (window == wrapperPtr->window) {
  	WaitForConfigureNotify(winPtr, serial);
      } else {
  	while (1) {
  	    if (WaitForEvent(winPtr->display, window, ConfigureNotify,
  		    &event) != TCL_OK) {
--- 4297,4308 ----
       * is tricky if winPtr has been reparented, since the window getting
       * the event isn't one that Tk owns.
       */
      if (window == wrapperPtr->window) {
  	WaitForConfigureNotify(winPtr, serial);
      } else {
+ #if 1 /* TNB */
+ 	WaitForConfigureNotify(winPtr, serial);
+ #else /* TNB */
  	while (1) {
  	    if (WaitForEvent(winPtr->display, window, ConfigureNotify,
  		    &event) != TCL_OK) {
***************
*** 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
--- 4313,4319 ----
  		break;
  	    }
  	}
! #endif /* TNB */
  	/*
  	 * Ignore errors that occur when we are de-selecting events on
  	 * window, since it's possible that the window doesn't exist