Skip to content

Commit

Permalink
CtrlCore: Mouse forward/backward buttons support in Win32 (K_MOUSE_FO…
Browse files Browse the repository at this point in the history
…RWARD, K_MOUSE_BACKWARD)

git-svn-id: svn://ultimatepp.org/upp/trunk@15451 f0d560ea-af0d-0410-9eb7-867de7ffcac7
  • Loading branch information
cxl committed Nov 19, 2020
1 parent 6d66313 commit b5f6128
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions uppsrc/CtrlCore/CtrlCore.h
Expand Up @@ -104,6 +104,9 @@ enum {
#endif

IK_DBL_CLICK = 0x40000001, // this is just to get the info that the entry is equal to dbl-click to the menu

K_MOUSE_FORWARD = 0x80000001,
K_MOUSE_BACKWARD = 0x80000002,
};

#include "MKeys.h"
Expand Down
2 changes: 2 additions & 0 deletions uppsrc/CtrlCore/CtrlKbd.cpp
Expand Up @@ -393,6 +393,8 @@ Tuple<dword, const char *> KeyNames__[ ] = {
{ K_OPTION_KEY, tt_("key\vOption") },
#endif
{ IK_DBL_CLICK, tt_("key\v[double-click]") },
{ K_MOUSE_FORWARD, tt_("key\v[Forward]") },
{ K_MOUSE_BACKWARD, tt_("key\v[Backward]") },
{ 0, NULL }
};

Expand Down
16 changes: 16 additions & 0 deletions uppsrc/CtrlCore/Win32Proc.cpp
Expand Up @@ -297,6 +297,22 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
// case WM_GETDLGCODE:
// return wantfocus ? 0 : DLGC_STATIC;
case WM_XBUTTONDOWN: {
UINT button = GET_XBUTTON_WPARAM(wParam);
if(button == XBUTTON2)
DispatchKey(K_MOUSE_FORWARD, 1);
if(button == XBUTTON1)
DispatchKey(K_MOUSE_BACKWARD, 1);
return 0L;
}
case WM_XBUTTONUP: {
UINT button = GET_XBUTTON_WPARAM(wParam);
if(button == XBUTTON2)
DispatchKey(K_MOUSE_FORWARD|K_KEYUP, 1);
if(button == XBUTTON1)
DispatchKey(K_MOUSE_BACKWARD|K_KEYUP, 1);
return 0L;
}
case WM_ERASEBKGND:
return 1L;
case WM_DESTROY:
Expand Down
2 changes: 1 addition & 1 deletion uppsrc/CtrlCore/Win32Wnd.cpp
Expand Up @@ -8,7 +8,7 @@ namespace Upp {
#define LOGTIMING 0

#ifdef _DEBUG
#define LOGMESSAGES 0
#define LOGMESSAGES 1
#endif

#define ELOGW(x) // RLOG(GetSysTime() << ": " << x) // Only activate in MT!
Expand Down

0 comments on commit b5f6128

Please sign in to comment.