Skip to content

Commit

Permalink
🚧 IO: Added io.ClearEventsQueue(). Obsoleted io.ClearInputCharacters(…
Browse files Browse the repository at this point in the history
…). (#4921)

               cc #2425 #1153 #1600
  • Loading branch information
elect86 committed Sep 3, 2023
1 parent 87f92ea commit 339a118
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions core/src/main/kotlin/imgui/classes/IO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ class IO(sharedFontAtlas: FontAtlas? = null) {
fun copy() = IO().also {
it.configFlags = configFlags; it.backendFlags = backendFlags; it.displaySize = displaySize; it.deltaTime = deltaTime; it.iniSavingRate = iniSavingRate
it.iniFilename = iniFilename; it.logFilename = logFilename; it.mouseDoubleClickTime = mouseDoubleClickTime; it.mouseDoubleClickMaxDist = mouseDoubleClickMaxDist
it.mouseDragThreshold = mouseDragThreshold; it.keyRepeatDelay = keyRepeatDelay; it.keyRepeatRate = keyRepeatRate;
it.mouseDragThreshold = mouseDragThreshold; it.keyRepeatDelay = keyRepeatDelay; it.keyRepeatRate = keyRepeatRate
it.fonts = fonts; it.fontGlobalScale = fontGlobalScale; it.fontAllowUserScaling = fontAllowUserScaling; it.fontDefault = fontDefault
it.displayFramebufferScale = displayFramebufferScale; it.mouseDrawCursor = mouseDrawCursor; it.configMacOSXBehaviors = configMacOSXBehaviors
it.configInputTrickleEventQueue = configInputTrickleEventQueue; it.configInputTextCursorBlink = configInputTextCursorBlink;
it.configInputTrickleEventQueue = configInputTrickleEventQueue; it.configInputTextCursorBlink = configInputTextCursorBlink
it.configInputTextEnterKeepActive = configInputTextEnterKeepActive; it.configDragClickToInputText = configDragClickToInputText
it.configWindowsResizeFromEdges = configWindowsResizeFromEdges; it.configWindowsMoveFromTitleBarOnly = configWindowsMoveFromTitleBarOnly
it.configMemoryCompactTimer = configMemoryCompactTimer; it.backendPlatformName = backendPlatformName; it.backendPlatformUserData = backendPlatformUserData
it.backendRendererUserData = backendRendererUserData; it.backendLanguageUserData = backendLanguageUserData; it.getClipboardTextFn = getClipboardTextFn
it.setClipboardTextFn = setClipboardTextFn; it.clipboardUserData = clipboardUserData /*it.setPlatformImeDataFn = setPlatformImeDataFn*/
it.ctx = ctx; /*it.mousePos put mousePos; repeat(5) { i -> it.mouseDown[i] = mouseDown[i] }; it.mouseWheel = mouseWheelH
it.ctx = ctx /*it.mousePos put mousePos; repeat(5) { i -> it.mouseDown[i] = mouseDown[i] }; it.mouseWheel = mouseWheelH
it.mouseWheelH = mouseWheelH; it.keyCtrl = keyCtrl; it.keyShift = keyShift; it.keyAlt = keyAlt; it.keySuper = keySuper; it.mouseSource
repeat(NavInput.COUNT) { i -> it.navInputs[i] = navInputs[i] }; it.keyMods = keyMods; repeat(Key.COUNT) {i -> it.keysData[i]}*/
}
Expand Down Expand Up @@ -405,14 +405,16 @@ class IO(sharedFontAtlas: FontAtlas? = null) {
appAcceptingEvents = acceptingEvents
}

/** [Internal] Clear the text input buffer manually
*
* FIXME: Perhaps we could clear queued events as well? */
fun clearInputCharacters() = inputQueueCharacters.clear()
// Clear all incoming events.
fun clearEventsQueue() {
// assert(ctx != null)
val g = ctx!!
g.inputEventsQueue.clear()
}

/** [Internal] Release all keys
*
* FIXME: Perhaps we could clear queued events as well? */
* Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons. */
fun clearInputKeys() {
for (keyData in keysData) {
keyData.down = false
Expand All @@ -427,6 +429,7 @@ class IO(sharedFontAtlas: FontAtlas? = null) {
mouseDownDuration[n] = -1f; mouseDownDurationPrev[n] = -1f
}
mouseWheel = 0f; mouseWheelH = 0f
inputQueueCharacters.clear() // Behavior of old ClearInputCharacters().
}


Expand Down
2 changes: 1 addition & 1 deletion core/src/main/kotlin/imgui/imgui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const val IMGUI_VERSION_BUILD = "$IMGUI_VERSION.$IMGUI_BUILD"

/** Integer encoded as XYYZZ for use in #if preprocessor conditionals.
Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) */
const val IMGUI_VERSION_NUM = 18971
const val IMGUI_VERSION_NUM = 18972


// Helpers macros to generate 32-bits encoded colors
Expand Down

0 comments on commit 339a118

Please sign in to comment.