Hi,
I have rebased and rewritten the patches from #330 against the current 1.9 branch. I also added a few additional changes. Please note that those patches have not yet been thoroughly tested.
Below is an overview of the patches in order:
Fix dangling pointer in getTextFromClipboard
Resolves a dangling pointer issue in getTextFromClipboard by using a static string buffer on Windows and macOS to safely store clipboard data.
Simplify logging in CZipReader
Replacing swprintf_irr calls with os::Printer::log.
Use snprintf_irr instead of sprintf
Replaces sprintf calls with snprintf_irr across multiple files.
Fix creating NSMenu with a null bundle name (macOS)
Prevents a potential crash when creating NSMenu by falling back to "Irrlicht" if the bundle name is null.
Avoid forced chdir in CIrrDeviceMacOSX
Prevents creating device from changing the working directory unless the application is running from a valid .app bundle.
Set activation policy to Regular on macOS
Explicitly sets the macOS application activation policy to Regular, ensuring the application appears in the Dock and has a functional menu bar.
Fix GetDC/ReleaseDC mismatch in CIrrDeviceWin32
Ensures that GetDC is called with the window handle (HWnd) rather than the screen handle, matching the corresponding ReleaseDC call and preventing a resource mismatch.
Fix keyboard selection in CGUIListBox
Fixes an issue where typing a letter would trigger EGET_LISTBOX_CHANGED before the selected item was actually updated. The patch ensures that the selection state is updated first and the event is emitted afterwards. It also merges two loops used in the selection logic.
Prevent changing selection while pressing a list item
Improves touch interaction in CGUIListBox by preventing unintended selection changes during drag operations.
Do not send EGET_EDITBOX_CHANGED when no character is input
Updates CGUIEditBox to emit the change event and recalculate layout only when an actual character is entered, ignoring non-character key presses.
Ignore additional non-text keys in CGUIEditBox
Extends key filtering in CGUIEditBox to ignore modifier keys (Shift, Alt, Win) and function keys so they are not processed as text input.
Fix UTF-8 parsing in utf8codepoint
Corrects the parsing logic to properly skip invalid bytes, preventing potential infinite loops when encountering malformed UTF-8 sequences.
Add toWideChar and toMultiByte helpers
Introduces toWideChar and toMultiByte wrapper functions in irrString.h to provide more consistent, platform-independent UTF-8 string conversions.
Refactor clipboard to support UTF-8 on Windows, macOS, and Linux
Refactors clipboard handling to provide proper UTF-8 support across platforms, including correct string conversions and use of modern APIs (e.g., the UTF8_STRING atom on X11).
This patch assumes that patch 1 has already been applied.
Fix macOS special keys and Command shortcuts handling
Corrects macOS key event handling to properly recognize special keys (e.g., arrow and function keys) and to correctly process standard shortcuts such as Command+C/V/X/A.
Please feel free to point out any issues or areas that need refinement.
Thanks. I've not given up on your original 1.8 patches yet, probably will apply some more there, just got ill last days.
it seems that [r6765] didn't change the code, just changed the changelog.
Related
Commit: [r6765]
Oh strange, thanks for checking! I'll fix it again in the evening.
About string conversion wrappers in 13: Was there some reason why you create a string for a null pointer instead of just return a null pointer again?
I'm considering that one as I'm also using similar wrappers in my projects. Thought I'm going to change it a bit.
Hm, I see now - you got influenced by the other multibyte functions at the end of the string header (I didn't remember those...). Thought those are really multibyte (as in - the format is not specified any futher unlike in this case).
I was wrong about using IRRLICHT_API . This would make likely cause memory allocation to cross dll borders. Actually risky functions - this would be the first functions in Irrlicht to return something not reference counted which is allocated with new.
I also think that, when retrieving clipboard content, it would be appropriate to introduce a new API or an overload that accepts a caller-provided pointer to a char[] buffer for output, instead of returning the output.
BTW, the comments for
IImage::lock()andIImage::unlock()should be updated to remove the “Be sure to call unlock()” note, as it has already been clarified in [r5168] that callingunlock()do nothing.Related
Commit: [r5168]