mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-28 16:20:50 +00:00
Fix ColorButton color picking dragging the mouse without multiple displays
This commit is contained in:
parent
0c932779fb
commit
c1be8f6727
@ -151,20 +151,15 @@ bool ColorButton::onProcessMessage(Message* msg)
|
||||
gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
|
||||
app::Color color = m_color;
|
||||
|
||||
// Pick a color from a IColorSource
|
||||
Widget* picked = window()->pick(mousePos);
|
||||
IColorSource* colorSource = (picked != this ? dynamic_cast<IColorSource*>(picked): nullptr);
|
||||
|
||||
// If there is no color source, get the color from the display
|
||||
// surface, and finally from the desktop. The desktop must be
|
||||
// a last resource method, because in macOS it will ask for
|
||||
// permissions to record the screen.
|
||||
if (!colorSource && get_multiple_displays()) {
|
||||
os::Window* nativeWindow = display()->nativeWindow();
|
||||
// Try to pick a color from a IColorSource, then get the color
|
||||
// from the display surface, and finally from the desktop. The
|
||||
// desktop must be a last resource method, because in macOS it
|
||||
// will ask for permissions to record the screen.
|
||||
os::Window* nativeWindow = msg->display()->nativeWindow();
|
||||
gfx::Point screenPos = nativeWindow->pointToScreen(mousePos);
|
||||
|
||||
picked = manager()->pickFromScreenPos(screenPos);
|
||||
colorSource = (picked != this ? dynamic_cast<IColorSource*>(picked): nullptr);
|
||||
Widget* picked = manager()->pickFromScreenPos(screenPos);
|
||||
IColorSource* colorSource = (picked != this ? dynamic_cast<IColorSource*>(picked): nullptr);
|
||||
if (colorSource) {
|
||||
nativeWindow = picked->display()->nativeWindow();
|
||||
mousePos = nativeWindow->pointFromScreen(screenPos);
|
||||
@ -189,7 +184,6 @@ bool ColorButton::onProcessMessage(Message* msg)
|
||||
gfx::getb(gfxColor),
|
||||
gfx::geta(gfxColor));
|
||||
}
|
||||
}
|
||||
|
||||
if (colorSource) {
|
||||
color = colorSource->getColorByPosition(mousePos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user