Remove jmouse_[xyz]() functions

This commit is contained in:
David Capello 2014-11-25 22:10:28 -03:00
parent 376fd0a23c
commit 752faf11f2
10 changed files with 21 additions and 46 deletions

View File

@ -129,7 +129,7 @@ protected:
MouseMessage mouseMsg(
(msg->type() == kKeyDownMessage ? kMouseDownMessage: kMouseUpMessage),
(lmb->isPressed(msg) ? kButtonLeft: kButtonRight),
gfx::Point(jmouse_x(0), jmouse_y(0)));
ui::get_mouse_position());
sendMessage(&mouseMsg);
return true;

View File

@ -129,8 +129,8 @@ bool SelectBoxState::onSetCursor(Editor* editor)
}
}
int x = jmouse_x(0);
int y = jmouse_y(0);
int x = ui::get_mouse_position().x;
int y = ui::get_mouse_position().y;
for (Rulers::iterator it = m_rulers.begin(), end = m_rulers.end(); it != end; ++it) {
if (touchRuler(editor, *it, x, y)) {

View File

@ -625,8 +625,7 @@ bool StandbyState::Decorator::onSetCursor(Editor* editor)
const gfx::Transformation transformation(m_standbyState->getTransformation(editor));
TransformHandles* tr = getTransformHandles(editor);
HandleType handle = tr->getHandleAtPoint(editor,
gfx::Point(jmouse_x(0), jmouse_y(0)),
transformation);
ui::get_mouse_position(), transformation);
CursorType newCursor = kArrowCursor;

View File

@ -644,7 +644,7 @@ void Tabs::calculateHot()
box.w = tab->width;
if (box.contains(gfx::Point(jmouse_x(0), jmouse_y(0)))) {
if (box.contains(ui::get_mouse_position())) {
hot = tab;
break;
}

View File

@ -722,7 +722,7 @@ bool Timeline::onProcessMessage(Message* msg)
}
updateHotByMousePos(msg,
gfx::Point(jmouse_x(0), jmouse_y(0)) - getBounds().getOrigin());
ui::get_mouse_position() - getBounds().getOrigin());
if (used)
return true;
@ -746,7 +746,7 @@ bool Timeline::onProcessMessage(Message* msg)
}
updateHotByMousePos(msg,
gfx::Point(jmouse_x(0), jmouse_y(0)) - getBounds().getOrigin());
ui::get_mouse_position() - getBounds().getOrigin());
if (used)
return true;

View File

@ -447,7 +447,7 @@ void Manager::dispatchMessages()
{
// Add the "Queue Processing" message for the manager.
enqueueMessage(newMouseMessage(kQueueProcessingMessage, this,
gfx::Point(jmouse_x(0), jmouse_y(0)), currentMouseButtons()));
get_mouse_position(), currentMouseButtons()));
pumpQueue();
}
@ -660,7 +660,7 @@ void Manager::setMouse(Widget* widget)
it = widget_parents.begin();
Message* msg = newMouseMessage(kMouseEnterMessage, NULL,
gfx::Point(jmouse_x(0), jmouse_y(0)), currentMouseButtons());
get_mouse_position(), currentMouseButtons());
for (; it != widget_parents.end(); ++it) {
(*it)->flags |= JI_HASMOUSE;
@ -668,7 +668,7 @@ void Manager::setMouse(Widget* widget)
}
enqueueMessage(msg);
generateSetCursorMessage(gfx::Point(jmouse_x(0), jmouse_y(0)));
generateSetCursorMessage(get_mouse_position());
}
}
}

View File

@ -38,9 +38,7 @@ static bool native_cursor_set = false; // If we displayed a native cursor
/* Mouse information (button and position). */
static volatile MouseButtons m_buttons;
static int m_x[2];
static int m_y[2];
static int m_z[2];
static gfx::Point m_mouse_pos;
static int mouse_scares = 0;
@ -52,7 +50,7 @@ static void update_mouse_overlay(Cursor* cursor)
if (!mouse_cursor_overlay) {
mouse_cursor_overlay = new Overlay(
mouse_cursor->getSurface(),
gfx::Point(m_x[0], m_y[0]),
get_mouse_position(),
Overlay::MouseZOrder);
OverlayManager::instance()->addOverlay(mouse_cursor_overlay);
@ -205,8 +203,8 @@ int display_h()
void update_cursor_overlay()
{
if (mouse_cursor_overlay != NULL && mouse_scares == 0) {
gfx::Point newPos(m_x[0]-mouse_cursor->getFocus().x,
m_y[0]-mouse_cursor->getFocus().y);
gfx::Point newPos =
get_mouse_position() - mouse_cursor->getFocus();
if (newPos != mouse_cursor_overlay->getPosition()) {
mouse_cursor_overlay->moveOverlay(newPos);
@ -256,16 +254,7 @@ void _internal_no_mouse_position()
void _internal_set_mouse_position(const gfx::Point& newPos)
{
if (m_x[0] >= 0) {
m_x[1] = m_x[0];
m_y[1] = m_y[0];
}
else {
m_x[1] = newPos.x;
m_y[1] = newPos.y;
}
m_x[0] = newPos.x;
m_y[0] = newPos.y;
m_mouse_pos = newPos;
}
void _internal_set_mouse_buttons(MouseButtons buttons)
@ -278,9 +267,9 @@ MouseButtons _internal_get_mouse_buttons()
return m_buttons;
}
gfx::Point get_mouse_position()
const gfx::Point& get_mouse_position()
{
return gfx::Point(jmouse_x(0), jmouse_y(0));
return m_mouse_pos;
}
void set_mouse_position(const gfx::Point& newPos)
@ -291,8 +280,4 @@ void set_mouse_position(const gfx::Point& newPos)
_internal_set_mouse_position(newPos);
}
int jmouse_x(int antique) { return m_x[antique & 1]; }
int jmouse_y(int antique) { return m_y[antique & 1]; }
int jmouse_z(int antique) { return m_z[antique & 1]; }
} // namespace ui

View File

@ -49,13 +49,9 @@ namespace ui {
void _internal_set_mouse_buttons(MouseButtons buttons);
MouseButtons _internal_get_mouse_buttons();
gfx::Point get_mouse_position();
const gfx::Point& get_mouse_position();
void set_mouse_position(const gfx::Point& newPos);
int jmouse_x(int antique);
int jmouse_y(int antique);
int jmouse_z(int antique);
} // namespace ui
#endif

View File

@ -91,8 +91,8 @@ void TooltipManager::onTick()
if (!m_tipWindow) {
m_tipWindow.reset(new TipWindow(m_target.tipInfo.text.c_str()));
gfx::Rect bounds = m_target.widget->getBounds();
int x = jmouse_x(0)+12*jguiscale();
int y = jmouse_y(0)+12*jguiscale();
int x = get_mouse_position().x+12*jguiscale();
int y = get_mouse_position().y+12*jguiscale();
int w, h;
m_tipWindow->setArrowAlign(m_target.tipInfo.arrowAlign);
@ -136,11 +136,6 @@ void TooltipManager::onTick()
break;
}
// if (x+w > ui::display_w()) {
// x = jmouse_x(0) - w - 4*jguiscale();
// y = jmouse_y(0);
// }
m_tipWindow->positionWindow(
MID(0, x, ui::display_w()-w),
MID(0, y, ui::display_h()-h));

View File

@ -1281,7 +1281,7 @@ bool Widget::hasMouse()
bool Widget::hasMouseOver()
{
return (this == this->pick(gfx::Point(jmouse_x(0), jmouse_y(0))));
return (this == pick(get_mouse_position()));
}
bool Widget::hasCapture()