Compare commits

...

4 Commits

Author SHA1 Message Date
Martín Capello 145556a2ac
Merge 1e556678ba into de1ccb24dd 2025-07-25 09:22:59 -03:00
David Capello de1ccb24dd [win] Don't drop text when IME dialog composition is accepted w/Enter
build / build (Debug, macos-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, macos-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, noscripts, cli) (push) Waiting to run Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Waiting to run Details
build-auto / build-auto (Debug, macos-latest) (push) Has been cancelled Details
build-auto / build-auto (Debug, ubuntu-latest) (push) Has been cancelled Details
build-auto / build-auto (Debug, windows-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, macos-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, ubuntu-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, windows-latest) (push) Has been cancelled Details
With #5230, now that we can show the IME dialog on Windows, when we
are selecting a specific word/composition in the IME dialog, if we
press Enter we'll receive that Enter onKeyUp(). It's better if we
process the Enter key onKeyDown() (as the IME enter key is not
received in that case).
2025-07-25 09:19:50 -03:00
David Capello 7d91c4b9d9 [win] Fix dead keys on Windows 2025-07-24 17:45:46 -03:00
Martín Capello 1e556678ba Fix crash dropping file on timeline (fix #5289) 2025-07-23 17:56:07 -03:00
4 changed files with 37 additions and 9 deletions

2
laf

@ -1 +1 @@
Subproject commit a2bb9ec7fb98354279a2c49870a4a47a67a8e86e Subproject commit 8ec4b553f1618f7a4b47cdcf4cfc2663266111ac

View File

@ -443,12 +443,7 @@ bool WritingTextState::onSetCursor(Editor* editor, const gfx::Point& mouseScreen
return true; return true;
} }
bool WritingTextState::onKeyDown(Editor*, KeyMessage*) bool WritingTextState::onKeyDown(Editor*, KeyMessage* msg)
{
return false;
}
bool WritingTextState::onKeyUp(Editor*, KeyMessage* msg)
{ {
// Cancel loop pressing Esc key // Cancel loop pressing Esc key
if (msg->scancode() == ui::kKeyEsc) { if (msg->scancode() == ui::kKeyEsc) {
@ -457,7 +452,17 @@ bool WritingTextState::onKeyUp(Editor*, KeyMessage* msg)
// Drop text pressing Enter key // Drop text pressing Enter key
else if (msg->scancode() == ui::kKeyEnter) { else if (msg->scancode() == ui::kKeyEnter) {
drop(); drop();
return true;
} }
return false;
}
bool WritingTextState::onKeyUp(Editor*, KeyMessage* msg)
{
// Note: We cannot process kKeyEnter key here to drop the text as it
// could be received after the Enter key is pressed in the IME
// dialog to accept the composition (not to accept the text). So we
// process kKeyEnter in onKeyDown().
return true; return true;
} }

View File

@ -168,6 +168,21 @@ SelectLayerBoundariesOp get_select_layer_in_canvas_op(ui::Message* msg)
return SelectLayerBoundariesOp::REPLACE; return SelectLayerBoundariesOp::REPLACE;
} }
bool get_layer_index(LayerGroup* parent, const Layer* layer, layer_t& index)
{
for (Layer* child : parent->layers()) {
if (child->isGroup() && get_layer_index(static_cast<LayerGroup*>(child), layer, index)) {
return index;
}
if (child == layer) {
return true;
}
index++;
}
return false;
}
} // anonymous namespace } // anonymous namespace
Timeline::Hit::Hit(int part, layer_t layer, col_t frame, ObjectId tag, int band) Timeline::Hit::Hit(int part, layer_t layer, col_t frame, ObjectId tag, int band)
@ -4055,6 +4070,12 @@ layer_t Timeline::getLayerIndex(const Layer* layer) const
return -1; return -1;
} }
layer_t Timeline::getLayerIndexFromSprite(const Layer* layer) const
{
layer_t index = 0;
return get_layer_index(m_sprite->root(), layer, index) ? index : -1;
}
bool Timeline::isLayerActive(const layer_t layerIndex) const bool Timeline::isLayerActive(const layer_t layerIndex) const
{ {
Layer* layer = getLayer(layerIndex); Layer* layer = getLayer(layerIndex);
@ -4576,7 +4597,7 @@ void Timeline::onDrop(ui::DragEvent& e)
// Determine at which frame and layer the content was dropped on. // Determine at which frame and layer the content was dropped on.
frame_t frame = m_frame; frame_t frame = m_frame;
layer_t layerIndex = getLayerIndex(m_layer); layer_t layerIndex = getLayerIndexFromSprite(m_layer);
InsertionPoint insert = InsertionPoint::BeforeLayer; InsertionPoint insert = InsertionPoint::BeforeLayer;
DroppedOn droppedOn = DroppedOn::Unspecified; DroppedOn droppedOn = DroppedOn::Unspecified;
TRACE("m_dropRange.type() %d\n", m_dropRange.type()); TRACE("m_dropRange.type() %d\n", m_dropRange.type());
@ -4602,7 +4623,7 @@ void Timeline::onDrop(ui::DragEvent& e)
break; break;
case Range::kLayers: case Range::kLayers:
droppedOn = DroppedOn::Layer; droppedOn = DroppedOn::Layer;
if (m_dropTarget.vhit != DropTarget::VeryBottom) { if (m_dropTarget.vhit != DropTarget::VeryBottom && !m_dropRange.selectedLayers().empty()) {
auto* selectedLayer = *m_dropRange.selectedLayers().begin(); auto* selectedLayer = *m_dropRange.selectedLayers().begin();
layerIndex = getLayerIndex(selectedLayer); layerIndex = getLayerIndex(selectedLayer);
} }

View File

@ -355,6 +355,8 @@ private:
gfx::Point getMaxScrollablePos() const; gfx::Point getMaxScrollablePos() const;
doc::Layer* getLayer(int layerIndex) const; doc::Layer* getLayer(int layerIndex) const;
layer_t getLayerIndex(const Layer* layer) const; layer_t getLayerIndex(const Layer* layer) const;
// Get layer index regardless of visibility in the UI.
layer_t getLayerIndexFromSprite(const Layer* layer) const;
bool isLayerActive(const layer_t layerIdx) const; bool isLayerActive(const layer_t layerIdx) const;
bool isFrameActive(const col_t frame) const; bool isFrameActive(const col_t frame) const;
bool isCelActive(const layer_t layerIdx, const col_t frame) const; bool isCelActive(const layer_t layerIdx, const col_t frame) const;