COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 11-28-2017, 07:30 AM   #1
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default Middle-button IMouseMod?

Hi there,

have anyone already cover this in WDL-OL?
I see I can only catch (R)right, (L)eft, (C)ontrol, (A)lt and (S)hift (when I mouse click occurs). Nothing about (M)iddle button click.

Would be hard and cross-compatible to implement?
Maybe there's already some code snippet around

Thanks
Nowhk is offline   Reply With Quote
Old 12-04-2017, 03:28 AM   #2
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default

I think I've done it quickly. Not sure why it wasn't already implemented in WDL-OL.

Anyway, that's the edit on IGraphicsWin.cpp:

Code:
inline IMouseMod GetMouseMod(WPARAM wParam)
{
  return IMouseMod((wParam & MK_LBUTTON), 
                   (wParam & MK_RBUTTON),
		   (wParam & MK_MBUTTON), // added here MIDDLE button
                   (wParam & MK_SHIFT), 
                   (wParam & MK_CONTROL), 
                   
#ifdef RTAS_API
                   IsOptionKeyDown()
#elif defined(AAX_API)
                   GetAsyncKeyState(VK_MENU) < 0
#else
                   GetKeyState(VK_MENU) < 0
#endif
                   );
}
And that's the new IMouseMod in IPlugStructs.h:

Code:
struct IMouseMod
{
  bool L, R, M, S, C, A;
  IMouseMod(bool l = false, bool r = false, bool m = false, bool s = false, bool c = false, bool a = false)
    : L(l), R(r), M(m), S(s), C(c), A(a) {}
};
And of course, wherever there are controls for MK_LBUTTON/MK_RBUTTON, WM_LBUTTONUP/WM_RBUTTONUP, WM_LBUTTONDOWN/WM_RBUTTONDOWN i've added the respective _M parameter, as well with WM_MBUTTONDBLCLK.

Tested with VST and Windows. Seems to works well. If you find any troubles on RTAS_API or AAX_API, please let me know so I can update the code

Last edited by Nowhk; 12-04-2017 at 03:47 AM.
Nowhk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.