Target will be informed when we press modifier keys.
This gives applications like GWorkspace a change
of changing the default action.

Also, to protect against badly written clients, we only
attempt to drop when target and source and the user 
(with modifier keys) agree that something can be dropped.
This improves a fix of Fred Kiefer.



2001-12-23  Willem Rein Oudshoorn  <[EMAIL PROTECTED]>

        * xgps/Source/SharedX/XGDragView.m ([XGDragView -_handleDrag:]): Now only
        deposit drop when source and target agree.
        ([XGDragView -_handleEventDuringDragging:theEvent]): send draggingUpdated event
        when user changes mask by pressing modifier keys.


Index: XGDragView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/xgps/Source/SharedX/XGDragView.m,v
retrieving revision 1.4
diff -c -r1.4 XGDragView.m
*** XGDragView.m	21 Dec 2001 00:43:46 -0000	1.4
--- XGDragView.m	23 Dec 2001 15:59:12 -0000
***************
*** 671,677 ****
  
    // --- Deposit the drop ----------------------------------------------
    
!   if ((targetMask != NSDragOperationNone) && 
        (targetWindow != (Window) None))
      {
        NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
--- 671,677 ----
  
    // --- Deposit the drop ----------------------------------------------
    
!   if ((targetMask & dragMask & operationMask) && 
        (targetWindow != (Window) None))
      {
        NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
***************
*** 778,783 ****
--- 778,800 ----
      case NSFlagsChanged:
        if ([self _updateOperationMask: theEvent])
          {
+           // If flags change, send update to allow
+           // destination to take note.
+           if (dragWindow)
+             {
+               [self _sendLocalEvent: GSAppKitDraggingUpdate
+                     action: dragMask & operationMask
+                     position: NSMakePoint (wx + offset.x, wy + offset.y)
+                     timestamp: CurrentTime
+                     toWindow: dragWindow];
+             }
+           else
+             {
+               xdnd_send_position(&dnd,
+                                  targetWindow, dragWindev->ident,
+                                  GSActionForDragOperation (dragMask & operationMask), wx + offset.x, 
+                                  wy + offset.y, CurrentTime);
+             }
            [self _setCursor];
          }
        break;

Reply via email to