mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Merge revision 1226 changes:
Mac: Add off-screen rendering support (issue #518). - Build with the 10.7 SDK (set GYP_DEFINES='mac_sdk=10.7') to include Retina support in the cefclient OSR example. git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1227 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -35,7 +35,9 @@ bool CefMenuCreatorRunnerMac::RunContextMenu(CefMenuCreator* manager) {
|
||||
// [NSApp currentEvent] will return a valid event.
|
||||
NSEvent* currentEvent = [NSApp currentEvent];
|
||||
NSWindow* window = [parent_view window];
|
||||
|
||||
NSPoint position = [window mouseLocationOutsideOfEventStream];
|
||||
|
||||
NSTimeInterval eventTime = [currentEvent timestamp];
|
||||
NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown
|
||||
location:position
|
||||
@@ -59,9 +61,33 @@ bool CefMenuCreatorRunnerMac::RunContextMenu(CefMenuCreator* manager) {
|
||||
base::mac::ScopedSendingEvent sendingEventScoper;
|
||||
|
||||
// Show the menu. Blocks until the menu is dismissed.
|
||||
[NSMenu popUpContextMenu:[menu_controller_ menu]
|
||||
withEvent:clickEvent
|
||||
forView:parent_view];
|
||||
if (manager->browser()->IsWindowRenderingDisabled()) {
|
||||
// Showing the menu in OSR is pretty much self contained, only using
|
||||
// the initialized menu_controller_ in this function, and the scoped
|
||||
// variables in this block.
|
||||
int screenX = 0, screenY = 0;
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
manager->browser()->GetClient()->GetRenderHandler();
|
||||
if (!handler->GetScreenPoint(manager->browser(),
|
||||
manager->params().x, manager->params().y,
|
||||
screenX, screenY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't show the menu unless there is a parent native window to tie it to
|
||||
if (!manager->browser()->GetWindowHandle())
|
||||
return false;
|
||||
|
||||
NSPoint screen_position =
|
||||
NSPointFromCGPoint(gfx::Point(screenX, screenY).ToCGPoint());
|
||||
[[menu_controller_ menu] popUpMenuPositioningItem:nil
|
||||
atLocation:screen_position
|
||||
inView:nil];
|
||||
} else {
|
||||
[NSMenu popUpContextMenu:[menu_controller_ menu]
|
||||
withEvent:clickEvent
|
||||
forView:parent_view];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user