Merge pull request #1203 from bbbradsmith/force-critical-input-trickle
Force ImGui event trickling for sparse but critical input events
This commit is contained in:
commit
511e3315a8
|
@ -9522,6 +9522,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
|
|||
}
|
||||
else if (e->Type == ImGuiInputEventType_MouseButton)
|
||||
{
|
||||
bool trickle_fast_inputs = true; // forcing trickle for MouseButton event
|
||||
|
||||
// Trickling Rule: Stop processing queued events if we got multiple action on the same button
|
||||
const ImGuiMouseButton button = e->MouseButton.Button;
|
||||
IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT);
|
||||
|
@ -9549,6 +9551,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
|
|||
}
|
||||
else if (e->Type == ImGuiInputEventType_Key)
|
||||
{
|
||||
bool trickle_fast_inputs = true; // forcing trickle for Key event
|
||||
|
||||
// Trickling Rule: Stop processing queued events if we got multiple action on the same button
|
||||
ImGuiKey key = e->Key.Key;
|
||||
IM_ASSERT(key != ImGuiKey_None);
|
||||
|
@ -9570,6 +9574,10 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
|
|||
}
|
||||
else if (e->Type == ImGuiInputEventType_Text)
|
||||
{
|
||||
// forcing trickle for Text event, but only when interacting with keydown or mouse button
|
||||
if ((key_changed && trickle_interleaved_keys_and_text) || mouse_button_changed != 0)
|
||||
break;
|
||||
|
||||
// Trickling Rule: Stop processing queued events if keys/mouse have been interacted with
|
||||
if (trickle_fast_inputs && ((key_changed && trickle_interleaved_keys_and_text) || mouse_button_changed != 0 || mouse_moved || mouse_wheeled))
|
||||
break;
|
||||
|
|
|
@ -3287,19 +3287,6 @@ void FurnaceGUI::pointUp(int x, int y, int button) {
|
|||
if (dragMobileEditButton) {
|
||||
dragMobileEditButton=false;
|
||||
}
|
||||
if (selecting) {
|
||||
if (!selectingFull) cursor=selEnd;
|
||||
finishSelection();
|
||||
if (!mobileUI) {
|
||||
demandScrollX=true;
|
||||
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
|
||||
cursor.xCoarse==selEnd.xCoarse && cursor.xFine==selEnd.xFine && cursor.y==selEnd.y) {
|
||||
if (!settings.cursorMoveNoScroll) {
|
||||
updateScroll(cursor.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) {
|
||||
|
@ -4558,6 +4545,21 @@ bool FurnaceGUI::loop() {
|
|||
MEASURE(effectList,drawEffectList());
|
||||
}
|
||||
|
||||
// release selection if mouse released
|
||||
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && selecting) {
|
||||
if (!selectingFull) cursor=selEnd;
|
||||
finishSelection();
|
||||
if (!mobileUI) {
|
||||
demandScrollX=true;
|
||||
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
|
||||
cursor.xCoarse==selEnd.xCoarse && cursor.xFine==selEnd.xFine && cursor.y==selEnd.y) {
|
||||
if (!settings.cursorMoveNoScroll) {
|
||||
updateScroll(cursor.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<e->getTotalChannelCount(); i++) {
|
||||
keyHit1[i]-=0.2f;
|
||||
if (keyHit1[i]<0.0f) keyHit1[i]=0.0f;
|
||||
|
|
|
@ -933,6 +933,7 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::TableNextColumn();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
ImGui::PopStyleVar();
|
||||
oldRow=curRow;
|
||||
|
|
Loading…
Reference in New Issue