diff --git a/README.md b/README.md index b874114..8d80326 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,4 @@ mouse.on('move', function(x, y) { The program will not terminate as long as a mouse listener is active. To allow the program to exit, either call `mouse.unref` (works as `unref`/`ref` on a TCP server) or `mouse.destroy()`. -The events emitted are: `move`, `left-down`, `left-up`, `left-drag`, `right-up`, `right-down` and `right-drag`. For each event the screen coordinates are passed to the handler function. +The events emitted are: `middle-up`, `middle-down`, `move`, `left-down`, `left-up`, `left-drag`, `right-up`, `right-down` and `right-drag`. For each event the screen coordinates are passed to the handler function. diff --git a/source/mouse.cc b/source/mouse.cc index e0352d9..8dab6f3 100644 --- a/source/mouse.cc +++ b/source/mouse.cc @@ -4,6 +4,8 @@ const char* LEFT_DOWN = "left-down"; const char* LEFT_UP = "left-up"; const char* RIGHT_DOWN = "right-down"; const char* RIGHT_UP = "right-up"; +const char* MIDDLE_DOWN = "middle-down"; +const char* MIDDLE_UP = "middle-up"; const char* MOVE = "move"; bool IsMouseEvent(WPARAM type) { @@ -11,6 +13,8 @@ bool IsMouseEvent(WPARAM type) { type == WM_LBUTTONUP || type == WM_RBUTTONDOWN || type == WM_RBUTTONUP || + type == WM_MBUTTONDOWN || + type == WM_MBUTTONUP || type == WM_MOUSEMOVE; } @@ -131,6 +135,8 @@ void Mouse::HandleSend() { if (e.type == WM_LBUTTONUP) name = LEFT_UP; if (e.type == WM_RBUTTONDOWN) name = RIGHT_DOWN; if (e.type == WM_RBUTTONUP) name = RIGHT_UP; + if (e.type == WM_MBUTTONDOWN) name = MIDDLE_DOWN; + if (e.type == WM_MBUTTONUP) name = MIDDLE_UP; if (e.type == WM_MOUSEMOVE) name = MOVE; Local argv[] = {