[macOS] Use native window drag for the custom editor title bars.
This commit is contained in:
parent
d741a646a5
commit
b248d66265
6 changed files with 36 additions and 2 deletions
|
|
@ -402,6 +402,8 @@ public:
|
|||
virtual bool window_maximize_on_title_dbl_click() const override;
|
||||
virtual bool window_minimize_on_title_dbl_click() const override;
|
||||
|
||||
virtual void window_start_drag(WindowID p_window = MAIN_WINDOW_ID) override;
|
||||
|
||||
virtual void window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window = MAIN_WINDOW_ID) override;
|
||||
virtual Vector3i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -765,6 +765,7 @@ bool DisplayServerMacOS::has_feature(Feature p_feature) const {
|
|||
case FEATURE_SCREEN_CAPTURE:
|
||||
case FEATURE_STATUS_INDICATOR:
|
||||
case FEATURE_NATIVE_HELP:
|
||||
case FEATURE_WINDOW_DRAG:
|
||||
return true;
|
||||
default: {
|
||||
}
|
||||
|
|
@ -2342,6 +2343,16 @@ bool DisplayServerMacOS::window_minimize_on_title_dbl_click() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::window_start_drag(WindowID p_window) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDown location:((NSWindow *)wd.window_object).mouseLocationOutsideOfEventStream modifierFlags:0 timestamp:[[NSProcessInfo processInfo] systemUptime] windowNumber:((NSWindow *)wd.window_object).windowNumber context:nil eventNumber:0 clickCount:1 pressure:1.0f];
|
||||
[wd.window_object performWindowDragWithEvent:event];
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue