mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 21:46:20 +00:00
Fix problems generating mouse messages with pos=0,0
This commit is contained in:
parent
cbb70c8279
commit
47b6df19ee
@ -480,7 +480,7 @@ void Manager::generateMessagesFromSheEvents()
|
|||||||
jmouse_set_cursor(kNoCursor);
|
jmouse_set_cursor(kNoCursor);
|
||||||
setMouse(NULL);
|
setMouse(NULL);
|
||||||
|
|
||||||
_internal_set_mouse_position(gfx::Point(-1, -1));
|
_internal_no_mouse_position();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,9 +541,9 @@ void Manager::generateMessagesFromSheEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lastMouseMoveEvent.type() != she::Event::None) {
|
if (lastMouseMoveEvent.type() != she::Event::None) {
|
||||||
_internal_set_mouse_position(sheEvent.position());
|
_internal_set_mouse_position(lastMouseMoveEvent.position());
|
||||||
|
|
||||||
handleMouseMove(sheEvent.position(), m_mouseButtons);
|
handleMouseMove(lastMouseMoveEvent.position(), m_mouseButtons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,14 +71,17 @@ static void clock_inc()
|
|||||||
|
|
||||||
END_OF_STATIC_FUNCTION(clock_inc);
|
END_OF_STATIC_FUNCTION(clock_inc);
|
||||||
|
|
||||||
static void set_mouse_cursor(Cursor* cursor)
|
static void update_mouse_overlay(Cursor* cursor)
|
||||||
{
|
{
|
||||||
mouse_cursor = cursor;
|
mouse_cursor = cursor;
|
||||||
|
|
||||||
if (mouse_cursor) {
|
if (mouse_cursor && mouse_scares == 0) {
|
||||||
if (!mouse_cursor_overlay) {
|
if (!mouse_cursor_overlay) {
|
||||||
mouse_cursor_overlay = new Overlay(mouse_cursor->getSurface(),
|
mouse_cursor_overlay = new Overlay(
|
||||||
gfx::Point(), Overlay::MouseZOrder);
|
mouse_cursor->getSurface(),
|
||||||
|
gfx::Point(m_x[0], m_y[0]),
|
||||||
|
Overlay::MouseZOrder);
|
||||||
|
|
||||||
OverlayManager::instance()->addOverlay(mouse_cursor_overlay);
|
OverlayManager::instance()->addOverlay(mouse_cursor_overlay);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -94,6 +97,18 @@ static void set_mouse_cursor(Cursor* cursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_mouse_cursor()
|
||||||
|
{
|
||||||
|
show_mouse(NULL);
|
||||||
|
|
||||||
|
if (mouse_cursor_type == kNoCursor)
|
||||||
|
update_mouse_overlay(NULL);
|
||||||
|
else
|
||||||
|
update_mouse_overlay(CurrentTheme::get()->getCursor(mouse_cursor_type));
|
||||||
|
|
||||||
|
dirty_display_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
int _ji_system_init()
|
int _ji_system_init()
|
||||||
{
|
{
|
||||||
/* Install timer related stuff. */
|
/* Install timer related stuff. */
|
||||||
@ -116,7 +131,7 @@ int _ji_system_init()
|
|||||||
void _ji_system_exit()
|
void _ji_system_exit()
|
||||||
{
|
{
|
||||||
SetDisplay(NULL);
|
SetDisplay(NULL);
|
||||||
set_mouse_cursor(NULL);
|
update_mouse_overlay(NULL);
|
||||||
|
|
||||||
remove_int(clock_inc);
|
remove_int(clock_inc);
|
||||||
}
|
}
|
||||||
@ -170,19 +185,8 @@ void jmouse_set_cursor(CursorType type)
|
|||||||
if (mouse_cursor_type == type)
|
if (mouse_cursor_type == type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Theme* theme = CurrentTheme::get();
|
|
||||||
mouse_cursor_type = type;
|
mouse_cursor_type = type;
|
||||||
|
update_mouse_cursor();
|
||||||
if (type == kNoCursor) {
|
|
||||||
show_mouse(NULL);
|
|
||||||
set_mouse_cursor(NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
show_mouse(NULL);
|
|
||||||
set_mouse_cursor(theme->getCursor(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
dirty_display_flag = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jmouse_hide()
|
void jmouse_hide()
|
||||||
@ -195,6 +199,9 @@ void jmouse_show()
|
|||||||
{
|
{
|
||||||
ASSERT(mouse_scares > 0);
|
ASSERT(mouse_scares > 0);
|
||||||
mouse_scares--;
|
mouse_scares--;
|
||||||
|
|
||||||
|
if (mouse_scares == 0)
|
||||||
|
update_mouse_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jmouse_is_hidden()
|
bool jmouse_is_hidden()
|
||||||
@ -252,10 +259,7 @@ bool jmouse_poll()
|
|||||||
void _internal_no_mouse_position()
|
void _internal_no_mouse_position()
|
||||||
{
|
{
|
||||||
moved = true;
|
moved = true;
|
||||||
m_x[1] = -1;
|
update_mouse_overlay(NULL);
|
||||||
m_y[1] = -1;
|
|
||||||
m_x[0] = -1;
|
|
||||||
m_y[0] = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _internal_set_mouse_position(const gfx::Point& newPos)
|
void _internal_set_mouse_position(const gfx::Point& newPos)
|
||||||
|
Loading…
Reference in New Issue
Block a user