Let the input system do it for us. That wy we can hopefully use calls to
unmarkText as a signal to commit the pre-edit text.
Hopefully not clearing the marked text on key down doesnt break anything
else.
Without this, kitty fails to compile:
```
glfw/cocoa_init.m:462:14: error: case value not in enumerated type
'NSEventModifierFlags' (aka 'enum NSEventModifierFlags')
[-Werror,-Wswitch]
case (NSEventModifierFlagShift | NSEventModifierFlagOption):
^
glfw/cocoa_init.m:465:14: error: case value not in enumerated type
'NSEventModifierFlags' (aka 'enum NSEventModifierFlags')
[-Werror,-Wswitch]
case (NSEventModifierFlagShift | NSEventModifierFlagCommand):
^
```
I thought about changing the type of the `modifierFlags` function parameter from `NSEventModifierFlags` to `NSUInteger` since `NSEventModifierFlags` is defined as an enum according to https://developer.apple.com/documentation/appkit/nseventmodifierflags?language=objc and is technically not the proper type for a bit field. But since Apple themselves define `modifierFlags` as `NSEventModifierFlags` according to https://developer.apple.com/documentation/appkit/nsevent/1534405-modifierflags?language=objc, I think the fix in this commit is better.
This warning was introduced with commit f9944e614088c4977ad9c9f1d1b44d97643e8d5b.
The ForwardKeyEvent ibus signal is used to maintain ordering between CommitText events and non-IME key events.
The ordering is important for Korean IMEs, where it automatically commits text whenever a character is fully composed. This is different from Chinese/Japanese IMEs, where user manually presses a key to commit each word.
Without this patch, kitty can't handle non-IME key events when used with ibus-hangul, which utilizes ForwardKeyEvent signal.
Without ForwardKeyEvent:
```
key | sequence of events from application's view
r | UpdatePreeditText 'ㄱ'
k | UpdatePreeditText '가'
1 | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 0")
| -> UpdatePreeditText ''
| -> CommitText '가'
```
Application receives "1가", which is incorrect.
With ForwardKeyEvent:
```
key | sequence of events from application's view
r | UpdatePreeditText 'ㄱ'
k | UpdatePreeditText '가'
1 | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 1", and kitty discards the event)
| -> UpdatePreeditText ''
| -> CommitText '가'
| -> ForwardKeyEvent keysym=0x31("1")
```
Application receives "가1", which is correct.
Relevant ibus-hangul github issue to implement ForwardKeyEvent: https://github.com/libhangul/ibus-hangul/issues/42
Relevant changes in Qt to handle ForwardKeyEvent: https://codereview.qt-project.org/c/qt/qtbase/+/212179, https://codereview.qt-project.org/c/qt/qtbase/+/255587
fcitx5 works fine with kitty, except that when you restart fcitx5, kitty stop working with fcitx5, because the dbus_connection_get_is_connected(ibus->conn) in #check_connection is always true when you use fcitx5.
this patch add a dbus name owner changed detection to detect the online status of ibus, in case the ibus backend uses the session bus, like fcitx5.
Try to ensure we have a functioning displaylink always.
GLFW skips over sleeping monitors during a poll and also
had a bug where the display link was not re-created for a monitor
that already had a glfw monitor entry.
Also add a bunch more debug reporting
Sway will send the next configure event (for example when focus changes)
with titlebar height added, so to avoid a sudden resize at that time,
bump the height by the titlebar.