[haiku-commits] haiku: hrev53967 - src/apps/deskbar

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 11 Mar 2020 06:32:09 -0400 (EDT)

hrev53967 adds 1 changeset to branch 'master'
old head: 175120903178ca2d9a25515720a6a49aef6967e0
new head: 910651da23313caed7fdbe0f9e4fedb0a3d60f8e
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=910651da2331+%5E175120903178

----------------------------------------------------------------------------

910651da2331: Deskbar: add middle click shortcut
  
  * Middle click on team item launch new instance of team.
  * Shift+middle click on window item closes window.
  
  Change-Id: Iaf201b8fe87dcc4430afd451a7ad3654178389a0
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2337
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
  Reviewed-by: John Scipione <jscipione@xxxxxxxxx>
  Reviewed-by: Sergei Reznikov <diver@xxxxxxxxxx>

                                              [ X512 <danger_mail@xxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53967
Commit:      910651da23313caed7fdbe0f9e4fedb0a3d60f8e
URL:         https://git.haiku-os.org/haiku/commit/?id=910651da2331
Author:      X512 <danger_mail@xxxxxxx>
Date:        Tue Mar 10 09:29:28 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Mar 11 10:32:04 2020 UTC

----------------------------------------------------------------------------

1 file changed, 26 insertions(+)
src/apps/deskbar/ExpandoMenuBar.cpp | 26 ++++++++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index 70445d2a3c..038080ba2b 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -46,6 +46,7 @@ All rights reserved.
 #include <ControlLook.h>
 #include <Debug.h>
 #include <MenuPrivate.h>
+#include <MessengerPrivate.h>
 #include <NodeInfo.h>
 #include <Roster.h>
 #include <Screen.h>
@@ -263,7 +264,9 @@ TExpandoMenuBar::MouseDown(BPoint where)
        }
 
        int32 modifiers = 0;
+       int32 buttons = 0;
        message->FindInt32("modifiers", &modifiers);
+       message->FindInt32("buttons", &buttons);
 
        // check for three finger salute, a.k.a. Vulcan Death Grip
        if ((modifiers & B_COMMAND_KEY) != 0
@@ -280,6 +283,29 @@ TExpandoMenuBar::MouseDown(BPoint where)
                }
                return;
                        // absorb the message
+       } else if (item != NULL
+               && (modifiers & B_SHIFT_KEY) == 0
+               && (buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
+               be_roster->Launch(item->Signature());
+               return;
+                       // absorb the message
+       } else {
+               TWindowMenuItem* wndItem = 
dynamic_cast<TWindowMenuItem*>(menuItem);
+               if (wndItem != NULL
+                       && (modifiers & B_SHIFT_KEY) != 0
+                       && (buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
+                       // close window
+                       client_window_info* info;
+                       BMessenger wnd;
+                       info = get_window_info(wndItem->ID());
+                       if (info == NULL) return;
+                       BMessenger::Private(wnd).SetTo(
+                               info->team, info->client_port, 
info->client_token);
+                       free(info); info = NULL;
+                       wnd.SendMessage(B_QUIT_REQUESTED);
+                       return;
+                               // absorb the message
+               }
        }
 
        // control click - show all/hide all shortcut


Other related posts:

  • » [haiku-commits] haiku: hrev53967 - src/apps/deskbar - Adrien Destugues