From 5c4c8d9f276213d70d5c37cab5979ca2a4e6c938 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 16 May 2019 20:12:03 -0400 Subject: [PATCH] Enable hover by default for desktop shells (flutter/engine#8991) Fixes flutter/flutter#32835 --- .../platform/darwin/macos/framework/Headers/FLEViewController.h | 2 +- .../platform/darwin/macos/framework/Source/FLEViewController.mm | 1 + engine/src/flutter/shell/platform/glfw/flutter_glfw.cc | 2 +- engine/src/flutter/shell/platform/glfw/public/flutter_glfw.h | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h b/engine/src/flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h index c66cba2130..d591ececa6 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h @@ -48,7 +48,7 @@ FLUTTER_EXPORT /** * The style of mouse tracking to use for the view. Defaults to - * FlutterMouseTrackingModeNone. + * FlutterMouseTrackingModeInKeyWindow. */ @property(nonatomic) FlutterMouseTrackingMode mouseTrackingMode; diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FLEViewController.mm index 8c35e332ee..29bf82d377 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -204,6 +204,7 @@ static bool HeadlessOnMakeResourceCurrent(FLEViewController* controller) { static void CommonInit(FLEViewController* controller) { controller->_messageHandlers = [[NSMutableDictionary alloc] init]; controller->_additionalKeyResponders = [[NSMutableOrderedSet alloc] init]; + controller->_mouseTrackingMode = FlutterMouseTrackingModeInKeyWindow; } - (instancetype)initWithCoder:(NSCoder*)coder { diff --git a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc index 5e33f6d4c6..1dd37f5f3a 100644 --- a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc +++ b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc @@ -85,7 +85,7 @@ struct FlutterDesktopWindow { GLFWwindow* window; // Whether or not to track mouse movements to send kHover events. - bool hover_tracking_enabled = false; + bool hover_tracking_enabled = true; // The ratio of pixels per screen coordinate for the window. double pixels_per_screen_coordinate = 1.0; diff --git a/engine/src/flutter/shell/platform/glfw/public/flutter_glfw.h b/engine/src/flutter/shell/platform/glfw/public/flutter_glfw.h index 573c821346..f4c718fe8d 100644 --- a/engine/src/flutter/shell/platform/glfw/public/flutter_glfw.h +++ b/engine/src/flutter/shell/platform/glfw/public/flutter_glfw.h @@ -98,7 +98,7 @@ FlutterDesktopGetPluginRegistrar(FlutterDesktopWindowControllerRef controller, // // If hover is enabled, mouse movement will send hover events to the Flutter // engine, rather than only tracking the mouse while the button is pressed. -// Defaults to off. +// Defaults to on. FLUTTER_EXPORT void FlutterDesktopWindowSetHoverEnabled( FlutterDesktopWindowRef flutter_window, bool enabled);