From 5443e035e83626db525aa21c9cd1aec90baef3d6 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Thu, 5 Jun 2014 17:55:42 -0400 Subject: [PATCH] DiskUsage: Open file/folder on cmd-click, zoom on regular click. --- src/apps/diskusage/PieView.cpp | 35 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/apps/diskusage/PieView.cpp b/src/apps/diskusage/PieView.cpp index bc0689650b..c1d67f1370 100644 --- a/src/apps/diskusage/PieView.cpp +++ b/src/apps/diskusage/PieView.cpp @@ -243,21 +243,32 @@ PieView::MouseDown(BPoint where) void PieView::MouseUp(BPoint where) { - // If the primary button was released and there was no dragging happening, - // just zoom in or out. if (fClicked && !fDragging) { + // The primary mouse button was released and there's no dragging happening. FileInfo* info = _FileAt(where); if (info != NULL) { - if (info == fScanner->CurrentDir()) { - fScanner->ChangeDir(info->parent); - fLastWhere = where; - fUpdateFileAt = true; - Invalidate(); - } else if (info->children.size() > 0) { - fScanner->ChangeDir(info); - fLastWhere = where; - fUpdateFileAt = true; - Invalidate(); + BMessage* current = Window()->CurrentMessage(); + + uint32 modifiers; + if (current->FindInt32("modifiers", (int32*)&modifiers) != B_OK) + modifiers = 0; + + if ((modifiers & B_COMMAND_KEY) != 0) { + // launch the app on command-click + _Launch(info); + } else { + // zoom in or out + if (info == fScanner->CurrentDir()) { + fScanner->ChangeDir(info->parent); + fLastWhere = where; + fUpdateFileAt = true; + Invalidate(); + } else if (info->children.size() > 0) { + fScanner->ChangeDir(info); + fLastWhere = where; + fUpdateFileAt = true; + Invalidate(); + } } } }