mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	Made EndFrame() assertion for key modifiers being unchanged during the frame more lenient. (#3575)
This commit is contained in:
		@@ -71,6 +71,9 @@ Other Changes:
 | 
				
			|||||||
- Misc: Replaced UTF-8 decoder by branchless one by Christopher Wellons (30~40% faster). [@rokups]
 | 
					- Misc: Replaced UTF-8 decoder by branchless one by Christopher Wellons (30~40% faster). [@rokups]
 | 
				
			||||||
  Super minor fix handling incomplete UTF-8 contents: if input does not contain enough bytes, decoder
 | 
					  Super minor fix handling incomplete UTF-8 contents: if input does not contain enough bytes, decoder
 | 
				
			||||||
  returns IM_UNICODE_CODEPOINT_INVALID and consume remaining bytes (vs old decoded consumed only 1 byte).
 | 
					  returns IM_UNICODE_CODEPOINT_INVALID and consume remaining bytes (vs old decoded consumed only 1 byte).
 | 
				
			||||||
 | 
					- Misc: Made EndFrame() assertion for key modifiers being unchanged during the frame (added in 1.76) more
 | 
				
			||||||
 | 
					  lenient, allowing full mid-frame releases. This is to accommodate the use of mid-frame modal native
 | 
				
			||||||
 | 
					  windows calls, which leads backends such as GLFW to send key clearing events on focus loss. (#3575)
 | 
				
			||||||
- Backends: OpenGL3: Use glGetString(GL_VERSION) query instead of glGetIntegerv(GL_MAJOR_VERSION, ...)
 | 
					- Backends: OpenGL3: Use glGetString(GL_VERSION) query instead of glGetIntegerv(GL_MAJOR_VERSION, ...)
 | 
				
			||||||
  when the later returns zero (e.g. Desktop GL 2.x). (#3530) [@xndcn]
 | 
					  when the later returns zero (e.g. Desktop GL 2.x). (#3530) [@xndcn]
 | 
				
			||||||
- Backends: OpenGL3: Backup and restore GL_PRIMITIVE_RESTART state. (#3544) [@Xipiryon]
 | 
					- Backends: OpenGL3: Backup and restore GL_PRIMITIVE_RESTART state. (#3544) [@Xipiryon]
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -6905,9 +6905,13 @@ static void ImGui::ErrorCheckEndFrameSanityChecks()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()
 | 
					    // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()
 | 
				
			||||||
    // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().
 | 
					    // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().
 | 
				
			||||||
    const ImGuiKeyModFlags expected_key_mod_flags = GetMergedKeyModFlags();
 | 
					    // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will
 | 
				
			||||||
    IM_ASSERT(g.IO.KeyMods == expected_key_mod_flags && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods");
 | 
					    // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs.
 | 
				
			||||||
    IM_UNUSED(expected_key_mod_flags);
 | 
					    // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0),
 | 
				
			||||||
 | 
					    // while still correctly asserting on mid-frame key press events.
 | 
				
			||||||
 | 
					    const ImGuiKeyModFlags key_mod_flags = GetMergedKeyModFlags();
 | 
				
			||||||
 | 
					    IM_ASSERT((key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods");
 | 
				
			||||||
 | 
					    IM_UNUSED(key_mod_flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
 | 
					    // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
 | 
				
			||||||
    // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
 | 
					    // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user