ggaliens, it will not work since only the coordinate returned by this function is used by wings_menu module (called in two places).
I took a look on it and it needs to be managed in the popup_events handler. There, the second bind option for receive will process the mouse button for the item selected and it's processing only the three buttons returned in the #wxMouse{type=What} => What -> left_up,middle_up and right_up.
As I believe it should to process the mouse buttons as in the preferences, we need to check for num_buttons value and handle the translations to One and Two buttons (not only Two).
The workaround/fix I did works fine, but we can get a side effect when using One button: Alt+click in Flip command is intend to duplicate the object before flip it.
Here is the code from wings_menu.erl in case you want to evaluate it. The changes/adds are signed with [*** xxxx ***].
I took a look on it and it needs to be managed in the popup_events handler. There, the second bind option for receive will process the mouse button for the item selected and it's processing only the three buttons returned in the #wxMouse{type=What} => What -> left_up,middle_up and right_up.
As I believe it should to process the mouse buttons as in the preferences, we need to check for num_buttons value and handle the translations to One and Two buttons (not only Two).
The workaround/fix I did works fine, but we can get a side effect when using One button: Alt+click in Flip command is intend to duplicate the object before flip it.
Here is the code from wings_menu.erl in case you want to evaluate it. The changes/adds are signed with [*** xxxx ***].
Code:
:
popup_events(Dialog, Panel, Entries, Magnet, Previous, Ns, Owner) ->
receive
#wx{id=Id, obj=Obj, event=#wxMouse{type=enter_window}} ->
Set = fun() ->
:
#wx{id=Id0, event=Ev=#wxMouse{type=_What, y=Y, x=X}} -> [*** changes here ***]
Id = case Id0 > 0 orelse find_active_panel(Panel, X, Y) of
true -> Id0;
{false, _} = No -> No;
{AId, _} -> AId
end,
What = mouse_button(Ev), [*** That is new ***]
case Id of
{false, outside} when What =:= right_up ->
wxPopupTransientWindow:dismiss(Dialog),
wings_wm:psend(Owner, restart_menu);
{false, _} ->
:
end;
#wx{event=#wxShow{}} ->
:
end.
:
:
mouse_index(left_up) -> 1;
mouse_index(middle_up) -> 2;
mouse_index(right_up) -> 3.
[*** That is new ***]
mouse_button(#wxMouse{type=What, controlDown = Ctrl, altDown = Alt, metaDown = Meta}) ->
case wings_pref:get_value(num_buttons) of
1 ->
case {What,Alt,Ctrl} of
{left_up,true,false} -> middle_up;
{left_up,false,true} -> right_up;
_ -> What
end;
2 ->
case {What,(Ctrl or Meta)} of
{right_up,true} -> middle_up;
_ -> What
end;
_ -> What
end.