Ticket #2709: dskm.diff
File dskm.diff, 14.1 KB (added by shadow@…, 20 years ago) |
---|
-
ChangeLog
old new 2 2 # arch-tag: automatic-ChangeLog--richwareham@users.sourceforge.net--DesktopManager/DesktopManager--dev--0.5 3 3 # 4 4 5 2004-07-15 13:19:05 GMT Rich Wareham <richwareham@users.sourceforge.net> patch-97 6 7 Summary: 8 Added possibility of having Tab as hotkey 9 Revision: 10 DesktopManager--dev--0.5--patch-97 11 12 Added the possibility of Tab as a hot key. Unfortunately we can't capture Ctrl-Tab in the keyDown messages so we can't set it via preferences. Manual editting of prefs file should work however. 13 14 modified files: 15 ChangeLog DesktopManager.xcode/rjw57.pbxuser HotKeys/HotKey.m 16 Utility/MouseWatcher.m 17 18 19 2004-07-15 12:32:35 GMT Rich Wareham <richwareham@users.sourceforge.net> patch-96 20 21 Summary: 22 Move windows between desktops via pager 23 Revision: 24 DesktopManager--dev--0.5--patch-96 25 26 Can now drag windows between desktops using the desktop pager. 27 28 Based on main patch by Naveen Michaud-Agrawal <infinite8s@yahoo.com> 29 30 Modified by Ka-Hing Cheung <kahing@gmail.com> to only cause desktop switch on mouse up. 31 Modified by me to tidy up warnings / make cmore consistent with DM coding style. 32 33 modified files: 34 ChangeLog Core/ForeignWindow.m Core/WorkspaceController.m 35 DesktopManager.xcode/rjw57.pbxuser Include/ForeignWindow.h 36 Include/WindowControllerEvents.h Include/WorkspaceController.h 37 Plugins/DesktopPager/DesktopPagerCell.h 38 Plugins/DesktopPager/DesktopPagerCell.m 39 Plugins/DesktopPager/DesktopPagerView.m 40 Plugins/DockExtension/ControllerEventHandlers.c 41 Plugins/DockExtension/ControllerEventHandlers.h 42 Plugins/DockExtension/WindowController.c 43 Plugins/DockExtension/WindowController.h 44 Plugins/DockExtension/main.c 45 46 5 47 2004-07-12 16:09:15 GMT Rich Wareham <richwareham@users.sourceforge.net> patch-95 6 48 7 49 Summary: -
Core/ForeignWindow.m
old new 335 335 sendEvent(&theEvent); 336 336 } 337 337 338 - (void) hide { 339 AppleEvent theEvent; 340 341 makeEvent(kWindowControllerHideWindow, &theEvent); 342 addIntParm(wid, 'wid ', &theEvent); 343 344 sendEvent(&theEvent); 345 } 346 347 - (void) show { 348 AppleEvent theEvent; 349 350 makeEvent(kWindowControllerShowWindow, &theEvent); 351 addIntParm(wid, 'wid ', &theEvent); 352 353 sendEvent(&theEvent); 354 } 355 338 356 - (void) fade { 339 357 AppleEvent theEvent; 340 358 -
Core/WorkspaceController.m
old new 474 474 } 475 475 476 476 - (ForeignWindow*) windowContainingPoint: (NSPoint) mouseLoc { 477 return [self windowContainingPoint: mouseLoc inWorkspace: [self currentWorkspace]]; 478 } 477 479 478 479 // NSLog(@"Mouse at (%f,%f)", mouseLoc.x, mouseLoc.y); 480 480 - (ForeignWindow*) windowContainingPoint: (NSPoint) mouseLoc inWorkspace: (Workspace*) ws { 481 481 // Start walking trough the window list from top to bottom 482 482 // and return if we find a window. 483 int i=0; NSArray *windowList = [ [self currentWorkspace]windowList];483 int i=0; NSArray *windowList = [ws windowList]; 484 484 for(i=0; i<[windowList count]; i++) { 485 485 ForeignWindow *window = (ForeignWindow*) [windowList objectAtIndex: i]; 486 486 NSRect screenRect = [window screenRect]; 487 //NSLog(@"(%f,%f) +(%f,%f) - %@", screenRect.origin.x, screenRect.origin.y,488 // screenRect.size.width, screenRect.size.height, [window title]);489 487 490 488 if(NSMouseInRect(mouseLoc, screenRect, NO)) { 491 489 return window; -
HotKeys/HotKey.m
old new 254 254 return C2S(0x2196); 255 255 break; 256 256 case kSpaceCharCode: 257 return @" <Spc>";257 return @"Space"; 258 258 break; 259 259 case kReturnCharCode: 260 260 return C2S(0x23CE); … … 262 262 case kEscapeCharCode: 263 263 return C2S(0x238B); 264 264 break; 265 case kTabCharCode: 266 return @"Tab"; 267 break; 265 268 } 266 269 267 270 // NSLog(@"CharCode: %i", charCode); -
Include/ForeignWindow.h
old new 42 42 - (int) workspaceNumber; 43 43 - (CGSWindow) windowNumber; 44 44 - (ForeignWindow*) movementParent; 45 - (void) show; 46 - (void) hide; 45 47 - (void) fade; 46 48 - (void) unFade; 47 49 - (void) move: (NSPoint) to; … … 59 61 - (int) tags; 60 62 - (uint32_t) eventMask; 61 63 - (void) setEventMask: (uint32_t) mask; 64 - (void) moveToWorkspaceRepresentedBy: (id) represent; 62 65 63 66 @end -
Include/WindowControllerEvents.h
old new 23 23 }; 24 24 25 25 enum { 26 kWindowControllerHideWindow = 'hidw', 27 kWindowControllerShowWindow = 'show', 26 28 kWindowControllerFadeWindow = 'fdwn', 27 29 kWindowControllerUnFadeWindow = 'ufdw', 28 30 kWindowControllerMoveWindow = 'mvwn', -
Include/WorkspaceController.h
old new 51 51 - (int) currentWorkspaceIndex; 52 52 - (NSArray*) workspaceNames; 53 53 - (ForeignWindow*) windowContainingPoint: (NSPoint) screenPoint; 54 - (ForeignWindow*) windowContainingPoint: (NSPoint) screenPoint inWorkspace: (Workspace*) ws; 54 55 - (ForeignWindow*) windowUnderPointer; 55 56 - (void) collectWindows; 56 57 -
Plugins/DesktopPager/DesktopPagerCell.h
old new 25 25 BOOL dragging; 26 26 ForeignWindow *draggingWindow; 27 27 NSPoint delta; 28 29 /* These are for dragging windows between workspaces */ 30 Workspace* dragInWorkspace, *dragToWorkspace; 28 31 } 29 32 30 33 - (void) setTargetHeight: (int) height; 31 34 - (int) targetHeight; 32 35 - (DesktopPagerCell *) pointToCell:(NSView *)controlView point:(NSPoint)point; 33 36 34 37 @end -
Plugins/DesktopPager/DesktopPagerCell.m
old new 26 26 id mySelf = [super init]; 27 27 if(mySelf) { 28 28 targetHeight = 50; 29 // [self sendActionOn: (NSLeftMouseUpMask | NSLeftMouseDraggedMask)]; 29 30 } 30 31 return mySelf; 31 32 } … … 198 199 Workspace *ws = [self representedObject]; 199 200 200 201 if(!ws) { return NO; } 202 203 DesktopPagerCell *tmp = [self pointToCell: controlView point: startPoint]; 204 205 startPoint = [tmp cellPointToScreenPoint: startPoint cellFrame: lastCellFrame]; 206 draggingWindow = [wsController windowContainingPoint: startPoint inWorkspace: ws]; 201 207 202 if(ws && ![ws isSelected]) { [ws selectWithDefaultTransition]; } 203 204 startPoint = [self cellPointToScreenPoint: startPoint cellFrame: lastCellFrame]; 205 draggingWindow = [wsController windowContainingPoint: startPoint]; 206 207 if(!draggingWindow) { return nil; } 208 if(!draggingWindow) { 209 if(![ws isSelected]) { [ws selectWithDefaultTransition]; } 210 return nil; 211 } 208 212 209 213 delta.x = [draggingWindow screenRect].origin.x - startPoint.x; 210 214 delta.y = [draggingWindow screenRect].origin.y - startPoint.y; 211 215 [draggingWindow retain]; 212 dragging = YES; 216 217 dragInWorkspace = dragToWorkspace = [tmp representedObject]; 213 218 214 219 return YES; 215 220 } 216 221 217 222 - (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView*)controlView { 218 if(!dragging) { return NO; } 223 if(!draggingWindow) { return NO; } 224 dragging = YES; 219 225 220 if (!NSPointInRect(currentPoint, lastCellFrame)) {226 if (!NSPointInRect(currentPoint, [controlView bounds])) { 221 227 // Don't move windows out of the screen but 222 228 // keep tracking... 223 229 return YES; 224 230 } 231 232 int row, column; 233 NSMatrix *mControlView = (NSMatrix*) controlView; 234 BOOL inControlView = [mControlView getRow: &row column:&column forPoint: currentPoint]; 235 if(!inControlView) { 236 return NO; 237 } 225 238 226 currentPoint = [self cellPointToScreenPoint: currentPoint cellFrame: lastCellFrame]; 227 239 id cell = [mControlView cellAtRow: row column: column]; 240 dragToWorkspace = [cell representedObject]; 241 242 if ([dragToWorkspace workspaceNumber] != [dragInWorkspace workspaceNumber]) { 243 // We've moved to a new workspace 244 [draggingWindow hide]; 245 [draggingWindow moveToWorkspaceRepresentedBy: cell]; 246 [dragInWorkspace updateWindowList]; 247 [dragToWorkspace updateWindowList]; 248 } 249 250 // Move window to new coordinates 251 currentPoint = [cell cellPointToScreenPoint: currentPoint cellFrame: [mControlView cellFrameAtRow:row column:column]]; 252 228 253 NSPoint newPoint; 229 254 newPoint.x = currentPoint.x + delta.x; 230 255 newPoint.y = currentPoint.y + delta.y; 231 232 256 [draggingWindow move: newPoint]; 257 258 if ([dragToWorkspace workspaceNumber] != [dragInWorkspace workspaceNumber]) { 259 [draggingWindow show]; 260 [draggingWindow focusOwner]; 261 //[dragToWorkspace selectWithDefaultTransition]; 262 dragInWorkspace = dragToWorkspace; 263 } 264 233 265 [[self controlView] setNeedsDisplay: YES]; 234 266 235 267 return YES; 236 268 } 237 269 238 270 - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag { 271 if(!dragging) { 272 // if we are not dragging, and this is mouse up, switch workspace 273 Workspace *ws = [[self pointToCell: controlView point: lastPoint] representedObject]; 274 275 if(ws && ![ws isSelected]) { [ws selectWithDefaultTransition]; } 276 } 239 277 dragging = NO; 240 278 241 279 [draggingWindow release]; 280 draggingWindow = nil; 281 } 282 283 - (DesktopPagerCell *) pointToCell:(NSView *)controlView point:(NSPoint)point { 284 int row, column; 285 BOOL inControlView = [(NSMatrix*) controlView getRow: &row column:&column forPoint: point]; 286 if(!inControlView) { 287 return nil; 288 } 289 290 id cell = [(NSMatrix*) controlView cellAtRow: row column: column]; 291 292 return cell; 242 293 } 243 294 244 295 + (BOOL)prefersTrackingUntilMouseUp { return YES; } -
Plugins/DesktopPager/DesktopPagerView.m
old new 82 82 name: NOTIFICATION_WINDOWLAYOUTUPDATED 83 83 object: nil 84 84 ]; 85 85 86 86 [self readPreferences]; 87 87 } 88 88 -
Plugins/DockExtension/ControllerEventHandlers.c
old new 97 97 98 98 /* These are the various AppleEvent handlers, they are used to 99 99 * translate the events into calls to functions in WindowManipulation.c */ 100 100 101 /* Hide a window */ 102 OSErr hideWindowHandler( const AppleEvent *theEvent, 103 AppleEvent *reply, SInt32 handlerRefcon) { 104 int wid; 105 106 wid = getIntParam(theEvent, 'wid '); 107 hideWindow(wid); 108 109 return 0; 110 } 111 112 /* Show a window */ 113 OSErr showWindowHandler( const AppleEvent *theEvent, 114 AppleEvent *reply, SInt32 handlerRefcon) { 115 int wid; 116 117 wid = getIntParam(theEvent, 'wid '); 118 showWindow(wid); 119 120 return 0; 121 } 122 101 123 /* Fade a window */ 102 124 OSErr fadeWindowHandler( const AppleEvent *theEvent, 103 125 AppleEvent *reply, SInt32 handlerRefcon) { -
Plugins/DockExtension/ControllerEventHandlers.h
old new 18 18 19 19 #include <Carbon/Carbon.h> 20 20 21 OSErr hideWindowHandler( const AppleEvent *theEvent, 22 AppleEvent *reply, SInt32 handlerRefcon); 23 OSErr showWindowHandler( const AppleEvent *theEvent, 24 AppleEvent *reply, SInt32 handlerRefcon); 21 25 OSErr fadeWindowHandler( const AppleEvent *theEvent, 22 26 AppleEvent *reply, SInt32 handlerRefcon); 23 27 OSErr unFadeWindowHandler( const AppleEvent *theEvent, -
Plugins/DockExtension/WindowController.c
old new 22 22 #include <unistd.h> 23 23 #include <syslog.h> 24 24 25 void hideWindow(int wid) { 26 CGSConnection cid; 27 28 cid = _CGSDefaultConnection(); 29 CGSSetWindowAlpha(cid, wid, 0.0); 30 } 31 32 void showWindow(int wid) { 33 CGSConnection cid; 34 35 cid = _CGSDefaultConnection(); 36 CGSSetWindowAlpha(cid, wid, 1.0); 37 } 38 25 39 void fadeWindow(int wid) { 26 40 float alpha = 0; 27 41 CGSConnection cid; … … 57 71 CGSConnection cid; 58 72 CGPoint point; 59 73 CGSValue group = NULL; 60 int groupNo = 0;61 74 62 75 cid = _CGSDefaultConnection(); 63 76 point.x = x; point.y = y; … … 68 81 69 82 if(group) { 70 83 // CGSMoveWindowWithGroup(cid, wid, &point, groupNo); 84 //CGSMoveWindowWithGroup(cid, wid, &point, groupNo); 71 85 } else { 72 86 CGSMoveWindow(cid, wid, &point); 73 87 } -
Plugins/DockExtension/WindowController.h
old new 18 18 19 19 #include <Carbon/Carbon.h> 20 20 21 void hideWindow(int wid); 22 void showWindow(int wid); 21 23 void fadeWindow(int wid); 22 24 void unFadeWindow(int wid); 23 25 void moveWindow(int wid, float x, float y); -
Plugins/DockExtension/main.c
old new 53 53 /* Install event handlers */ 54 54 err = AEInstallEventHandler( 55 55 kWindowControllerClass, 56 kWindowControllerHideWindow, 57 NewAEEventHandlerUPP((&hideWindowHandler) + offset), 58 0, FALSE 59 ); 60 if(err) { syslog(LOG_ERR, "Error registering hide handler: %i", err); } 61 62 err = AEInstallEventHandler( 63 kWindowControllerClass, 64 kWindowControllerShowWindow, 65 NewAEEventHandlerUPP((&showWindowHandler) + offset), 66 0, FALSE 67 ); 68 if(err) { syslog(LOG_ERR, "Error registering show handler: %i", err); } 69 70 err = AEInstallEventHandler( 71 kWindowControllerClass, 56 72 kWindowControllerFadeWindow, 57 73 NewAEEventHandlerUPP((&fadeWindowHandler) + offset), 58 74 0, FALSE -
Utility/MouseWatcher.m
old new 51 51 } 52 52 53 53 - (MouseWatcherEdge) _edgeContainingPoint: (CGPoint) loc { 54 if((loc.x >= screenRect.origin.x) && (loc.x <= screenRect.origin.x + 3)) { 55 return LeftEdge; 56 } 57 if((loc.x <= screenRect.origin.x + screenRect.size.width) && 58 (loc.x >= screenRect.origin.x + screenRect.size.width - 3)) { 59 return RightEdge; 60 } 61 if((loc.y <= screenRect.origin.y + screenRect.size.height) && 62 (loc.y >= screenRect.origin.y + screenRect.size.height - 3)) { 63 return BottomEdge; 64 } 54 if((loc.y >= screenRect.origin.y + 10) && 55 (loc.y <= screenRect.origin.y + screenRect.size.height - 10)) { 56 if((loc.x >= screenRect.origin.x) && (loc.x <= screenRect.origin.x + 3)) { 57 return LeftEdge; 58 } 59 if((loc.x <= screenRect.origin.x + screenRect.size.width) && 60 (loc.x >= screenRect.origin.x + screenRect.size.width - 3)) { 61 return RightEdge; 62 } 63 } 64 if((loc.x >= screenRect.origin.x + 10) && 65 (loc.x <= screenRect.origin.x + screenRect.size.width - 10)) { 66 if((loc.y <= screenRect.origin.y + screenRect.size.height) && 67 (loc.y >= screenRect.origin.y + screenRect.size.height - 3)) { 68 return BottomEdge; 69 } 70 } 65 71 66 72 return None; 67 73 }