void mouse_button(int bnumber, int state) { switch (bnumber) { case SDL_BUTTON_LEFT: mouse_button_left(state); break; case SDL_BUTTON_MIDDLE: mouse_button_middle(state); break; case SDL_BUTTON_RIGHT: mouse_button_right(state); break; case SDL_BUTTON_WHEELUP: mouse_button_up(state); break; case SDL_BUTTON_WHEELDOWN: mouse_button_down(state); break; default: break; } }
void mouse_button(HWND hwnd, ULONG msg, MPARAM mp1) { if (!_mouse_enabled) { return; } switch (msg) { case WM_MOUSEMOVE: _mouse_x = SHORT1FROMMP(mp1); _mouse_y = SHORT2FROMMP(mp1); mouse_timestamp = vsyncarch_gettime(); { SWP swp; WinQueryWindowPos(hwnd, &swp); // // check whether the pointer is outside or inside the window // if (FullscreenIsNow()) { visible = TRUE; } if (_mouse_x >= 0 && _mouse_x < swp.cx && _mouse_y >= 0 && _mouse_y < swp.cy) { // // FIXME: Don't capture the mouse pointer if it is in front // of a client dialog! // if (WinQueryCapture(HWND_DESKTOP)!= hwnd && hide_mouseptr && !FullscreenIsNow()) { WinSetCapture(HWND_DESKTOP, hwnd); } if (visible && hide_mouseptr && !FullscreenIsNow()) { WinShowPointer(HWND_DESKTOP, FALSE); visible = FALSE; } } else { if (WinQueryCapture(HWND_DESKTOP) == hwnd && !FullscreenIsNow()) { WinSetCapture(HWND_DESKTOP, NULLHANDLE); } if (!visible && !FullscreenIsNow()) { WinShowPointer(HWND_DESKTOP, TRUE); visible = TRUE; } // // don't use 'outside'-values which appears one times // if the mouse pointer leaves the window // if (_mouse_x < 0) { _mouse_x = 0; } else { if (_mouse_x >= swp.cx) { _mouse_x = swp.cx - 1; } } if (_mouse_y < 0) { _mouse_y = 0; } else { if (_mouse_y >= swp.cy) { _mouse_y = swp.cy - 1; } } } } return; case WM_BUTTON1DOWN: mouse_button_left(1); return; case WM_BUTTON1UP: mouse_button_left(0); return; case WM_BUTTON2DOWN: mouse_button_right(1); return; case WM_BUTTON2UP: mouse_button_right(0); return; case WM_BUTTON3DOWN: mouse_button_middle(1); return; case WM_BUTTON3UP: mouse_button_middle(0); return; } }