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 <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
67b05100d2
commit
75504052d6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user