diff --git a/src/hexeditor.cc b/src/hexeditor.cc index a9215c9..44fc427 100644 --- a/src/hexeditor.cc +++ b/src/hexeditor.cc @@ -102,7 +102,13 @@ HexEditor::HexEditor(const std::string &filename) start_color(); // マウス対応 +#ifdef _WIN32 + mousemask(ALL_MOUSE_EVENTS, nullptr); + mouse_set(ALL_MOUSE_EVENTS); + request_mouse_pos(); +#else mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr); +#endif isMouse = true; init_pair(1, COLOR_BLACK, COLOR_WHITE); // カーソル @@ -764,17 +770,24 @@ void HexEditor::handleReplace() { void HexEditor::handleMouse() { #ifdef _WIN32 - if (getmouse() == 0) return; + request_mouse_pos(); int mx = Mouse_status.x; int my = Mouse_status.y; - if (!(Mouse_status.button[0] & BUTTON1_PRESSED) - || (Mouse_status.changes & 0x01)) return; + bool click = false; + for (int i = 0; i < 3; ++i) { + if ((Mouse_status.button[i] & BUTTON1_PRESSED) + || (Mouse_status.button[i] & BUTTON1_CLICKED)) { + click = true; + break; + } + } + if (!click) return; #else MEVENT event; if (getmouse(&event) != OK) return; - if (!(event.bstate & BUTTON1_PRESSED)) return; + if (!(event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED))) return; int mx = event.x; int my = event.y;