[haiku-commits] haiku: hrev53066 - src/servers/app/decorator

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 13 Apr 2019 12:57:47 -0400 (EDT)

hrev53066 adds 1 changeset to branch 'master'
old head: 67b05100d24245964653dbd7e1efb518b1aee274
new head: 75504052d661c021e87c49d9b2ffc6d0f491c23f
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=75504052d661+%5E67b05100d242

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

75504052d661: DefaultWindowBehavior: Emulate right click and middle click
  
  ... based on mouse type setting in Mouse Preferences.
  
  for (default) 3 button mouse, nothing changes. #important
  
  for 1 button mouse,
        emulate right click by ctrl+click. This replicates Tracker
        behavior everwhere
  
  for 2 button mouse,
        add todo to emulate middle click by pushing both buttons at
        the same time. Unfortunately I was unsucessful getting this
        feature to work.
  
  Change-Id: I5377ed5b4967483096f7f185f434bced3f86cdb9
  Reviewed-on: https://review.haiku-os.org/c/303
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

Revision:    hrev53066
Commit:      75504052d661c021e87c49d9b2ffc6d0f491c23f
URL:         https://git.haiku-os.org/haiku/commit/?id=75504052d661
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Jan 10 07:05:20 2017 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Apr 13 16:57:41 2019 UTC

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

1 file changed, 21 insertions(+)
.../app/decorator/DefaultWindowBehaviour.cpp     | 21 ++++++++++++++++++++

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

diff --git a/src/servers/app/decorator/DefaultWindowBehaviour.cpp 
b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
index 4c6d35e3f2..8027483e08 100644
--- a/src/servers/app/decorator/DefaultWindowBehaviour.cpp
+++ b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
@@ -704,6 +704,27 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, 
BPoint where,
        fLastModifiers = message->FindInt32("modifiers");
        int32 buttons = message->FindInt32("buttons");
 
+       int32 numButtons;
+       if (get_mouse_type(&numButtons) == B_OK) {
+               switch (numButtons) {
+                       case 1:
+                               // 1 button mouse
+                               if ((fLastModifiers & B_CONTROL_KEY) != 0) {
+                                       // emulate right click by holding 
control
+                                       buttons = B_SECONDARY_MOUSE_BUTTON;
+                                       message->ReplaceInt32("buttons", 
buttons);
+                               }
+                               break;
+
+                       case 2:
+                               // TODO: 2 button mouse, pressing both buttons 
simultaneously
+                               // emulates middle click
+
+                       default:
+                               break;
+               }
+       }
+
        // if a state is active, let it do the job
        if (fState != NULL) {
                bool unhandled = false;


Other related posts:

  • » [haiku-commits] haiku: hrev53066 - src/servers/app/decorator - waddlesplash