1 parent 23a6c62 commit c23bc2dCopy full SHA for c23bc2d
1 file changed
src/handlers/keyboard_handler.pyx
@@ -90,7 +90,20 @@ cdef public cpp_bool KeyboardHandler_OnKeyEvent(
90
browser=pyBrowser,
91
event=pyEvent,
92
event_handle=<object>PyLong_FromVoidPtr(cefEventHandle))
93
- return bool(returnValue)
+ # If returnValue is False then handle copy/paste on Mac
94
+ if returnValue:
95
+ return bool(returnValue)
96
+ if platform.system() == "Darwin":
97
+ # Handle copy: command + c
98
+ if pyEvent["modifiers"] == 128 \
99
+ and pyEvent["native_key_code"] == 8:
100
+ pyBrowser.GetFocusedFrame().Copy()
101
+ return True
102
+ # Handle paste: command + v
103
+ elif pyEvent["modifiers"] == 128 \
104
+ and pyEvent["native_key_code"] == 9:
105
+ pyBrowser.GetFocusedFrame().Paste()
106
107
return False
108
except:
109
(exc_type, exc_value, exc_trace) = sys.exc_info()
0 commit comments