mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Fix problem losing the mouse capture on Windows platform when the mouse leaves the windows.
This commit is contained in:
parent
dd65f0cf7f
commit
2b95ba58d2
@ -251,6 +251,8 @@ static int mouse_winapi_select_system_cursor(int cursor)
|
||||
|
||||
void _al_win_mouse_handle_button(HWND hwnd, int button, BOOL down, int x, int y, BOOL abs)
|
||||
{
|
||||
int last_mouse_b;
|
||||
|
||||
_enter_critical();
|
||||
|
||||
if (down)
|
||||
@ -258,8 +260,21 @@ void _al_win_mouse_handle_button(HWND hwnd, int button, BOOL down, int x, int y,
|
||||
else
|
||||
_mouse_b &= ~(1 << (button-1));
|
||||
|
||||
last_mouse_b = _mouse_b;
|
||||
|
||||
_exit_critical();
|
||||
|
||||
/* If there is a mouse button pressed we capture the mouse, in any
|
||||
other cases we release it. */
|
||||
if (last_mouse_b) {
|
||||
if (GetCapture() != hwnd)
|
||||
SetCapture(hwnd);
|
||||
}
|
||||
else {
|
||||
if (GetCapture() == hwnd)
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
_handle_mouse_input();
|
||||
}
|
||||
|
||||
|
@ -366,11 +366,7 @@ void jmouse_set_position(int x, int y)
|
||||
|
||||
void jmouse_capture()
|
||||
{
|
||||
#if defined(ALLEGRO_WINDOWS)
|
||||
|
||||
SetCapture(win_get_window());
|
||||
|
||||
#elif defined(ALLEGRO_UNIX)
|
||||
#if defined(ALLEGRO_UNIX)
|
||||
|
||||
XGrabPointer(_xwin.display, _xwin.window, False,
|
||||
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
|
||||
@ -382,11 +378,7 @@ void jmouse_capture()
|
||||
|
||||
void jmouse_release()
|
||||
{
|
||||
#if defined(ALLEGRO_WINDOWS)
|
||||
|
||||
::ReleaseCapture();
|
||||
|
||||
#elif defined(ALLEGRO_UNIX)
|
||||
#if defined(ALLEGRO_UNIX)
|
||||
|
||||
XUngrabPointer(_xwin.display, CurrentTime);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user