From ca9acc20e8829812353a19093c3e9cfa076a06b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 21 May 2010 21:50:26 +0000 Subject: [PATCH] * The Deskbar will now intercept control+alt-clicks, and will start to move the Deskbar around as other windows do (more or less), as suggested in ticket #6029. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36889 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BarView.h | 6 ++++-- src/apps/deskbar/BarWindow.cpp | 15 ++++++++++++--- src/apps/deskbar/StatusView.cpp | 22 +++++++++++----------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index fe2d61f287..a4814454d2 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -118,7 +118,7 @@ class TBarView : public BView { int32 CountItems(DeskbarShelf shelf); - status_t AddItem(BMessage* , DeskbarShelf shelf, int32* id); + status_t AddItem(BMessage* archive, DeskbarShelf shelf, int32* id); void RemoveItem(int32 id); void RemoveItem(const char* name, DeskbarShelf shelf); @@ -134,10 +134,12 @@ class TBarView : public BView { TExpandoMenuBar* ExpandoMenuBar() const; TBarMenuBar* BarMenuBar() const; + TDragRegion* DragRegion() const { return fDragRegion; } + + private: friend class TBeMenu; friend class PreferencesWindow; - private: status_t SendDragMessage(const char* signature, entry_ref* ref = NULL); void PlaceBeMenu(); diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index f5d88d9bd8..246df37dd8 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -101,9 +101,18 @@ TBarWindow::DispatchMessage(BMessage* message, BHandler* handler) { // Activate the window when you click on it (ie. on the tray area, // the menu part will do this automatically) - if (message->what == B_MOUSE_DOWN - && !((TBarApp*)be_app)->Settings()->autoRaise) - Activate(true); + if (message->what == B_MOUSE_DOWN) { + if (!((TBarApp*)be_app)->Settings()->autoRaise) + Activate(true); + + if ((modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY)) + == B_CONTROL_KEY | B_COMMAND_KEY) { + // The window key was pressed - enter dragging code + fBarView->DragRegion()->MouseDown( + fBarView->DragRegion()->DragRegion().LeftTop()); + return; + } + } BWindow::DispatchMessage(message, handler); } diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 60353c1929..d97cd7d384 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -1419,16 +1419,16 @@ TReplicantTray::SetMultiRow(bool state) // #pragma mark - -/** draggable region that is asynchronous so that - * dragging does not block other activities - */ - +/*! Draggable region that is asynchronous so that dragging does not block + other activities. +*/ TDragRegion::TDragRegion(TBarView* parent, BView* child) - : BControl(BRect(0, 0, 0, 0), "", "", NULL, B_FOLLOW_NONE, - B_WILL_DRAW | B_FRAME_EVENTS), - fBarView(parent), - fChild(child), - fDragLocation(kAutoPlaceDragRegion) + : + BControl(BRect(0, 0, 0, 0), "", "", NULL, B_FOLLOW_NONE, + B_WILL_DRAW | B_FRAME_EVENTS), + fBarView(parent), + fChild(child), + fDragLocation(kAutoPlaceDragRegion) { } @@ -1464,8 +1464,8 @@ TDragRegion::GetPreferredSize(float* width, float* height) void TDragRegion::FrameMoved(BPoint) { - if (fBarView->Left() && fBarView->Vertical() && fDragLocation - != kNoDragRegion) + if (fBarView->Left() && fBarView->Vertical() + && fDragLocation != kNoDragRegion) fChild->MoveTo(5, 2); else fChild->MoveTo(2, 2);