cefclient: Standardize osr-related file names and move to the `client` namespace (issue #1500).
cefclient: Windows: Move OSRWindow static methods to util_win (issue #1500). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1988 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
986e6fb939
commit
87c41bf99f
|
@ -162,7 +162,6 @@
|
||||||
'tests/cefclient/client_switches.h',
|
'tests/cefclient/client_switches.h',
|
||||||
'tests/cefclient/dialog_test.cc',
|
'tests/cefclient/dialog_test.cc',
|
||||||
'tests/cefclient/dialog_test.h',
|
'tests/cefclient/dialog_test.h',
|
||||||
'tests/cefclient/dragdrop_events.h',
|
|
||||||
'tests/cefclient/main_context.cc',
|
'tests/cefclient/main_context.cc',
|
||||||
'tests/cefclient/main_context.h',
|
'tests/cefclient/main_context.h',
|
||||||
'tests/cefclient/main_context_impl.cc',
|
'tests/cefclient/main_context_impl.cc',
|
||||||
|
@ -171,8 +170,9 @@
|
||||||
'tests/cefclient/main_message_loop.cc',
|
'tests/cefclient/main_message_loop.cc',
|
||||||
'tests/cefclient/main_message_loop_std.h',
|
'tests/cefclient/main_message_loop_std.h',
|
||||||
'tests/cefclient/main_message_loop_std.cc',
|
'tests/cefclient/main_message_loop_std.cc',
|
||||||
'tests/cefclient/osrenderer.h',
|
'tests/cefclient/osr_dragdrop_events.h',
|
||||||
'tests/cefclient/osrenderer.cc',
|
'tests/cefclient/osr_renderer.h',
|
||||||
|
'tests/cefclient/osr_renderer.cc',
|
||||||
'tests/cefclient/performance_test.cc',
|
'tests/cefclient/performance_test.cc',
|
||||||
'tests/cefclient/performance_test.h',
|
'tests/cefclient/performance_test.h',
|
||||||
'tests/cefclient/performance_test_setup.h',
|
'tests/cefclient/performance_test_setup.h',
|
||||||
|
@ -189,15 +189,15 @@
|
||||||
'cefclient_sources_win': [
|
'cefclient_sources_win': [
|
||||||
'tests/cefclient/cefclient.exe.manifest',
|
'tests/cefclient/cefclient.exe.manifest',
|
||||||
'tests/cefclient/cefclient.rc',
|
'tests/cefclient/cefclient.rc',
|
||||||
'tests/cefclient/cefclient_osr_dragdrop_win.h',
|
|
||||||
'tests/cefclient/cefclient_osr_dragdrop_win.cc',
|
|
||||||
'tests/cefclient/cefclient_osr_widget_win.h',
|
|
||||||
'tests/cefclient/cefclient_osr_widget_win.cc',
|
|
||||||
'tests/cefclient/cefclient_win.cc',
|
'tests/cefclient/cefclient_win.cc',
|
||||||
'tests/cefclient/client_handler_win.cc',
|
'tests/cefclient/client_handler_win.cc',
|
||||||
'tests/cefclient/main_context_impl_win.cc',
|
'tests/cefclient/main_context_impl_win.cc',
|
||||||
'tests/cefclient/main_message_loop_multithreaded_win.h',
|
'tests/cefclient/main_message_loop_multithreaded_win.h',
|
||||||
'tests/cefclient/main_message_loop_multithreaded_win.cc',
|
'tests/cefclient/main_message_loop_multithreaded_win.cc',
|
||||||
|
'tests/cefclient/osr_dragdrop_win.h',
|
||||||
|
'tests/cefclient/osr_dragdrop_win.cc',
|
||||||
|
'tests/cefclient/osr_widget_win.h',
|
||||||
|
'tests/cefclient/osr_widget_win.cc',
|
||||||
'tests/cefclient/resource.h',
|
'tests/cefclient/resource.h',
|
||||||
'tests/cefclient/res/cefclient.ico',
|
'tests/cefclient/res/cefclient.ico',
|
||||||
'tests/cefclient/res/small.ico',
|
'tests/cefclient/res/small.ico',
|
||||||
|
@ -208,10 +208,10 @@
|
||||||
],
|
],
|
||||||
'cefclient_sources_mac': [
|
'cefclient_sources_mac': [
|
||||||
'tests/cefclient/cefclient_mac.mm',
|
'tests/cefclient/cefclient_mac.mm',
|
||||||
'tests/cefclient/cefclient_osr_widget_mac.h',
|
|
||||||
'tests/cefclient/cefclient_osr_widget_mac.mm',
|
|
||||||
'tests/cefclient/client_handler_mac.mm',
|
'tests/cefclient/client_handler_mac.mm',
|
||||||
'tests/cefclient/main_context_impl_posix.cc',
|
'tests/cefclient/main_context_impl_posix.cc',
|
||||||
|
'tests/cefclient/osr_widget_mac.h',
|
||||||
|
'tests/cefclient/osr_widget_mac.mm',
|
||||||
'tests/cefclient/resource_util_mac.mm',
|
'tests/cefclient/resource_util_mac.mm',
|
||||||
'tests/cefclient/resource_util_posix.cc',
|
'tests/cefclient/resource_util_posix.cc',
|
||||||
'tests/cefclient/window_test_mac.mm',
|
'tests/cefclient/window_test_mac.mm',
|
||||||
|
@ -260,10 +260,10 @@
|
||||||
],
|
],
|
||||||
'cefclient_sources_linux': [
|
'cefclient_sources_linux': [
|
||||||
'tests/cefclient/cefclient_gtk.cc',
|
'tests/cefclient/cefclient_gtk.cc',
|
||||||
'tests/cefclient/cefclient_osr_widget_gtk.h',
|
|
||||||
'tests/cefclient/cefclient_osr_widget_gtk.cc',
|
|
||||||
'tests/cefclient/client_handler_gtk.cc',
|
'tests/cefclient/client_handler_gtk.cc',
|
||||||
'tests/cefclient/main_context_impl_posix.cc',
|
'tests/cefclient/main_context_impl_posix.cc',
|
||||||
|
'tests/cefclient/osr_widget_gtk.h',
|
||||||
|
'tests/cefclient/osr_widget_gtk.cc',
|
||||||
'tests/cefclient/print_handler_gtk.cc',
|
'tests/cefclient/print_handler_gtk.cc',
|
||||||
'tests/cefclient/print_handler_gtk.h',
|
'tests/cefclient/print_handler_gtk.h',
|
||||||
'tests/cefclient/resource_util_linux.cc',
|
'tests/cefclient/resource_util_linux.cc',
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/cefclient_osr_widget_gtk.h"
|
|
||||||
#include "cefclient/client_app.h"
|
#include "cefclient/client_app.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/client_switches.h"
|
#include "cefclient/client_switches.h"
|
||||||
#include "cefclient/main_context_impl.h"
|
#include "cefclient/main_context_impl.h"
|
||||||
#include "cefclient/main_message_loop_std.h"
|
#include "cefclient/main_message_loop_std.h"
|
||||||
|
#include "cefclient/osr_widget_gtk.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/test_runner.h"
|
#include "cefclient/test_runner.h"
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ int g_toolbar_height = 0;
|
||||||
// Height of the integrated menu bar (if any) at the top of the GTK window.
|
// Height of the integrated menu bar (if any) at the top of the GTK window.
|
||||||
int g_menubar_height = 0;
|
int g_menubar_height = 0;
|
||||||
|
|
||||||
class MainBrowserProvider : public OSRBrowserProvider {
|
class MainBrowserProvider : public client::OSRBrowserProvider {
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
||||||
if (g_handler.get())
|
if (g_handler.get())
|
||||||
return g_handler->GetBrowser();
|
return g_handler->GetBrowser();
|
||||||
|
@ -450,8 +450,8 @@ int main(int argc, char* argv[]) {
|
||||||
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
||||||
|
|
||||||
// Create the GTKGL surface.
|
// Create the GTKGL surface.
|
||||||
CefRefPtr<OSRWindow> osr_window =
|
CefRefPtr<client::OSRWindow> osr_window =
|
||||||
OSRWindow::Create(&g_main_browser_provider, transparent,
|
client::OSRWindow::Create(&g_main_browser_provider, transparent,
|
||||||
show_update_rect, vbox);
|
show_update_rect, vbox);
|
||||||
|
|
||||||
// Show the GTK window.
|
// Show the GTK window.
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
#import "include/cef_application_mac.h"
|
#import "include/cef_application_mac.h"
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "cefclient/cefclient_osr_widget_mac.h"
|
|
||||||
#include "cefclient/client_app.h"
|
#include "cefclient/client_app.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/client_switches.h"
|
#include "cefclient/client_switches.h"
|
||||||
#include "cefclient/main_context_impl.h"
|
#include "cefclient/main_context_impl.h"
|
||||||
#include "cefclient/main_message_loop_std.h"
|
#include "cefclient/main_message_loop_std.h"
|
||||||
|
#include "cefclient/osr_widget_mac.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include "cefclient/test_runner.h"
|
#include "cefclient/test_runner.h"
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
// The global ClientHandler reference.
|
// The global ClientHandler reference.
|
||||||
CefRefPtr<ClientHandler> g_handler;
|
CefRefPtr<ClientHandler> g_handler;
|
||||||
|
|
||||||
class MainBrowserProvider : public OSRBrowserProvider {
|
class MainBrowserProvider : public client::OSRBrowserProvider {
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
||||||
if (g_handler.get())
|
if (g_handler.get())
|
||||||
return g_handler->GetBrowser();
|
return g_handler->GetBrowser();
|
||||||
|
@ -443,8 +443,8 @@ void AddMenuItem(NSMenu *menu, NSString* label, int idval) {
|
||||||
const bool show_update_rect =
|
const bool show_update_rect =
|
||||||
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
||||||
|
|
||||||
CefRefPtr<OSRWindow> osr_window =
|
CefRefPtr<client::OSRWindow> osr_window =
|
||||||
OSRWindow::Create(&g_main_browser_provider, transparent,
|
client::OSRWindow::Create(&g_main_browser_provider, transparent,
|
||||||
show_update_rect, contentView,
|
show_update_rect, contentView,
|
||||||
CefRect(0, 0, kWindowWidth, kWindowHeight));
|
CefRect(0, 0, kWindowWidth, kWindowHeight));
|
||||||
window_info.SetAsWindowless(osr_window->GetWindowHandle(), transparent);
|
window_info.SetAsWindowless(osr_window->GetWindowHandle(), transparent);
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_sandbox_win.h"
|
#include "include/cef_sandbox_win.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "cefclient/cefclient_osr_widget_win.h"
|
|
||||||
#include "cefclient/client_app.h"
|
#include "cefclient/client_app.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/client_switches.h"
|
#include "cefclient/client_switches.h"
|
||||||
#include "cefclient/main_context_impl.h"
|
#include "cefclient/main_context_impl.h"
|
||||||
#include "cefclient/main_message_loop_multithreaded_win.h"
|
#include "cefclient/main_message_loop_multithreaded_win.h"
|
||||||
#include "cefclient/main_message_loop_std.h"
|
#include "cefclient/main_message_loop_std.h"
|
||||||
|
#include "cefclient/osr_widget_win.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/test_runner.h"
|
#include "cefclient/test_runner.h"
|
||||||
#include "cefclient/util_win.h"
|
#include "cefclient/util_win.h"
|
||||||
|
@ -64,7 +64,7 @@ INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||||
// The global ClientHandler reference.
|
// The global ClientHandler reference.
|
||||||
CefRefPtr<ClientHandler> g_handler;
|
CefRefPtr<ClientHandler> g_handler;
|
||||||
|
|
||||||
class MainBrowserProvider : public OSRBrowserProvider {
|
class MainBrowserProvider : public client::OSRBrowserProvider {
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
virtual CefRefPtr<CefBrowser> GetBrowser() {
|
||||||
if (g_handler.get())
|
if (g_handler.get())
|
||||||
return g_handler->GetBrowser();
|
return g_handler->GetBrowser();
|
||||||
|
@ -225,8 +225,8 @@ static void SetFocusToBrowser(CefRefPtr<CefBrowser> browser) {
|
||||||
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
|
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
|
||||||
cefclient::kOffScreenRenderingEnabled)) {
|
cefclient::kOffScreenRenderingEnabled)) {
|
||||||
// Give focus to the OSR window.
|
// Give focus to the OSR window.
|
||||||
CefRefPtr<OSRWindow> osr_window =
|
CefRefPtr<client::OSRWindow> osr_window =
|
||||||
static_cast<OSRWindow*>(g_handler->GetOSRHandler().get());
|
static_cast<client::OSRWindow*>(g_handler->GetOSRHandler().get());
|
||||||
if (osr_window)
|
if (osr_window)
|
||||||
::SetFocus(osr_window->hwnd());
|
::SetFocus(osr_window->hwnd());
|
||||||
} else {
|
} else {
|
||||||
|
@ -391,8 +391,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
const bool show_update_rect =
|
const bool show_update_rect =
|
||||||
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
command_line->HasSwitch(cefclient::kShowUpdateRect);
|
||||||
|
|
||||||
CefRefPtr<OSRWindow> osr_window =
|
CefRefPtr<client::OSRWindow> osr_window =
|
||||||
OSRWindow::Create(&g_main_browser_provider, transparent,
|
client::OSRWindow::Create(&g_main_browser_provider, transparent,
|
||||||
show_update_rect);
|
show_update_rect);
|
||||||
osr_window->CreateWidget(hWnd, rect, hInst, szOSRWindowClass);
|
osr_window->CreateWidget(hWnd, rect, hInst, szOSRWindowClass);
|
||||||
info.SetAsWindowless(osr_window->hwnd(), transparent);
|
info.SetAsWindowless(osr_window->hwnd(), transparent);
|
||||||
|
@ -495,8 +495,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
const bool offscreen = CefCommandLine::GetGlobalCommandLine()->HasSwitch(
|
const bool offscreen = CefCommandLine::GetGlobalCommandLine()->HasSwitch(
|
||||||
cefclient::kOffScreenRenderingEnabled);
|
cefclient::kOffScreenRenderingEnabled);
|
||||||
if (offscreen) {
|
if (offscreen) {
|
||||||
CefRefPtr<OSRWindow> osr_window =
|
CefRefPtr<client::OSRWindow> osr_window =
|
||||||
static_cast<OSRWindow*>(g_handler->GetOSRHandler().get());
|
static_cast<client::OSRWindow*>(g_handler->GetOSRHandler().get());
|
||||||
if (osr_window)
|
if (osr_window)
|
||||||
osr_window->WasHidden(wParam == SIZE_MINIMIZED);
|
osr_window->WasHidden(wParam == SIZE_MINIMIZED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,35 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_DRAGDROP_EVENTS_H_
|
#ifndef CEF_TESTS_CEFCLIENT_OSR_DRAGDROP_EVENTS_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_DRAGDROP_EVENTS_H_
|
#define CEF_TESTS_CEFCLIENT_OSR_DRAGDROP_EVENTS_H_
|
||||||
#pragma once
|
|
||||||
#include "include/cef_render_handler.h"
|
#include "include/cef_render_handler.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
|
|
||||||
class DragEvents {
|
namespace client {
|
||||||
|
|
||||||
|
class OsrDragEvents {
|
||||||
public:
|
public:
|
||||||
virtual CefBrowserHost::DragOperationsMask OnDragEnter(
|
virtual CefBrowserHost::DragOperationsMask OnDragEnter(
|
||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
CefMouseEvent ev,
|
CefMouseEvent ev,
|
||||||
CefBrowserHost::DragOperationsMask effect) = 0;
|
CefBrowserHost::DragOperationsMask effect) = 0;
|
||||||
virtual CefBrowserHost::DragOperationsMask OnDragOver(CefMouseEvent ev,
|
|
||||||
|
virtual CefBrowserHost::DragOperationsMask OnDragOver(
|
||||||
|
CefMouseEvent ev,
|
||||||
CefBrowserHost::DragOperationsMask effect) = 0;
|
CefBrowserHost::DragOperationsMask effect) = 0;
|
||||||
|
|
||||||
virtual void OnDragLeave() = 0;
|
virtual void OnDragLeave() = 0;
|
||||||
virtual CefBrowserHost::DragOperationsMask OnDrop(CefMouseEvent ev,
|
|
||||||
|
virtual CefBrowserHost::DragOperationsMask OnDrop(
|
||||||
|
CefMouseEvent ev,
|
||||||
CefBrowserHost::DragOperationsMask effect) = 0;
|
CefBrowserHost::DragOperationsMask effect) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~OsrDragEvents() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_DRAGDROP_EVENTS_H_
|
} // namespace client
|
||||||
|
|
||||||
|
#endif // CEF_TESTS_CEFCLIENT_OSR_DRAGDROP_EVENTS_H_
|
|
@ -2,7 +2,7 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/cefclient_osr_dragdrop_win.h"
|
#include "cefclient/osr_dragdrop_win.h"
|
||||||
|
|
||||||
#if defined(CEF_USE_ATL)
|
#if defined(CEF_USE_ATL)
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@
|
||||||
|
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/bytes_write_handler.h"
|
#include "cefclient/bytes_write_handler.h"
|
||||||
#include "cefclient/cefclient_osr_widget_win.h"
|
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
|
#include "cefclient/util_win.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ CefMouseEvent ToMouseEvent(POINTL p, DWORD key_state, HWND hWnd) {
|
||||||
ScreenToClient(hWnd, &screen_point);
|
ScreenToClient(hWnd, &screen_point);
|
||||||
ev.x = screen_point.x;
|
ev.x = screen_point.x;
|
||||||
ev.y = screen_point.y;
|
ev.y = screen_point.y;
|
||||||
ev.modifiers = OSRWindow::GetCefMouseModifiers(key_state);
|
ev.modifiers = GetCefMouseModifiers(key_state);
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +360,8 @@ CefRefPtr<CefDragData> DataObjectToDragData(IDataObject* data_object) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
CComPtr<DropTargetWin> DropTargetWin::Create(DragEvents* callback, HWND hWnd) {
|
CComPtr<DropTargetWin> DropTargetWin::Create(OsrDragEvents* callback,
|
||||||
|
HWND hWnd) {
|
||||||
return CComPtr<DropTargetWin>(new DropTargetWin(callback, hWnd));
|
return CComPtr<DropTargetWin>(new DropTargetWin(callback, hWnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,4 +652,6 @@ DataObjectWin::DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
||||||
|
|
||||||
#endif // defined(CEF_USE_ATL)
|
#endif // defined(CEF_USE_ATL)
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// When generating projects with CMake the CEF_USE_ATL value will be defined
|
// When generating projects with CMake the CEF_USE_ATL value will be defined
|
||||||
// automatically if using a supported Visual Studio version. Pass -DUSE_ATL=OFF
|
// automatically if using a supported Visual Studio version. Pass -DUSE_ATL=OFF
|
||||||
|
@ -18,7 +17,9 @@
|
||||||
#include <objidl.h>
|
#include <objidl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "cefclient/dragdrop_events.h"
|
#include "cefclient/osr_dragdrop_events.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
#define DEFAULT_QUERY_INTERFACE(__Class) \
|
#define DEFAULT_QUERY_INTERFACE(__Class) \
|
||||||
HRESULT __stdcall QueryInterface(const IID& iid, void** object) { \
|
HRESULT __stdcall QueryInterface(const IID& iid, void** object) { \
|
||||||
|
@ -52,7 +53,7 @@
|
||||||
|
|
||||||
class DropTargetWin : public IDropTarget {
|
class DropTargetWin : public IDropTarget {
|
||||||
public:
|
public:
|
||||||
static CComPtr<DropTargetWin> Create(DragEvents* callback, HWND hWnd);
|
static CComPtr<DropTargetWin> Create(OsrDragEvents* callback, HWND hWnd);
|
||||||
|
|
||||||
CefBrowserHost::DragOperationsMask StartDragging(
|
CefBrowserHost::DragOperationsMask StartDragging(
|
||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
@ -81,14 +82,14 @@ class DropTargetWin : public IDropTarget {
|
||||||
IUNKNOWN_IMPLEMENTATION()
|
IUNKNOWN_IMPLEMENTATION()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit DropTargetWin(DragEvents* callback, HWND hWnd) :
|
DropTargetWin(OsrDragEvents* callback, HWND hWnd)
|
||||||
ref_count_(0),
|
: ref_count_(0),
|
||||||
callback_(callback),
|
callback_(callback),
|
||||||
hWnd_(hWnd) {}
|
hWnd_(hWnd) {}
|
||||||
virtual ~DropTargetWin() {}
|
virtual ~DropTargetWin() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DragEvents* callback_;
|
OsrDragEvents* callback_;
|
||||||
HWND hWnd_;
|
HWND hWnd_;
|
||||||
|
|
||||||
CefRefPtr<CefDragData> current_drag_data_;
|
CefRefPtr<CefDragData> current_drag_data_;
|
||||||
|
@ -183,6 +184,8 @@ class DataObjectWin : public IDataObject {
|
||||||
explicit DataObjectWin(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
|
explicit DataObjectWin(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace client
|
||||||
|
|
||||||
#endif // defined(CEF_USE_ATL)
|
#endif // defined(CEF_USE_ATL)
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
|
@ -2,7 +2,7 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license
|
// reserved. Use of this source code is governed by a BSD-style license
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/osr_renderer.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include <gl/gl.h>
|
#include <gl/gl.h>
|
||||||
|
@ -39,7 +39,9 @@
|
||||||
#define VERIFY_NO_ERROR
|
#define VERIFY_NO_ERROR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ClientOSRenderer::ClientOSRenderer(bool transparent,
|
namespace client {
|
||||||
|
|
||||||
|
OsrRenderer::OsrRenderer(bool transparent,
|
||||||
bool show_update_rect)
|
bool show_update_rect)
|
||||||
: transparent_(transparent),
|
: transparent_(transparent),
|
||||||
show_update_rect_(show_update_rect),
|
show_update_rect_(show_update_rect),
|
||||||
|
@ -51,11 +53,11 @@ ClientOSRenderer::ClientOSRenderer(bool transparent,
|
||||||
spin_y_(0) {
|
spin_y_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientOSRenderer::~ClientOSRenderer() {
|
OsrRenderer::~OsrRenderer() {
|
||||||
Cleanup();
|
Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::Initialize() {
|
void OsrRenderer::Initialize() {
|
||||||
if (initialized_)
|
if (initialized_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -80,12 +82,12 @@ void ClientOSRenderer::Initialize() {
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::Cleanup() {
|
void OsrRenderer::Cleanup() {
|
||||||
if (texture_id_ != 0)
|
if (texture_id_ != 0)
|
||||||
glDeleteTextures(1, &texture_id_);
|
glDeleteTextures(1, &texture_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::Render() {
|
void OsrRenderer::Render() {
|
||||||
if (view_width_ == 0 || view_height_ == 0)
|
if (view_width_ == 0 || view_height_ == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -196,7 +198,7 @@ void ClientOSRenderer::Render() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
void OsrRenderer::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||||
bool show) {
|
bool show) {
|
||||||
if (!show) {
|
if (!show) {
|
||||||
// Clear the popup rectangle.
|
// Clear the popup rectangle.
|
||||||
|
@ -204,7 +206,7 @@ void ClientOSRenderer::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
void OsrRenderer::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||||
const CefRect& rect) {
|
const CefRect& rect) {
|
||||||
if (rect.width <= 0 || rect.height <= 0)
|
if (rect.width <= 0 || rect.height <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -212,7 +214,7 @@ void ClientOSRenderer::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||||
popup_rect_ = GetPopupRectInWebView(original_popup_rect_);
|
popup_rect_ = GetPopupRectInWebView(original_popup_rect_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRect ClientOSRenderer::GetPopupRectInWebView(const CefRect& original_rect) {
|
CefRect OsrRenderer::GetPopupRectInWebView(const CefRect& original_rect) {
|
||||||
CefRect rc(original_rect);
|
CefRect rc(original_rect);
|
||||||
// if x or y are negative, move them to 0.
|
// if x or y are negative, move them to 0.
|
||||||
if (rc.x < 0)
|
if (rc.x < 0)
|
||||||
|
@ -232,12 +234,12 @@ CefRect ClientOSRenderer::GetPopupRectInWebView(const CefRect& original_rect) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::ClearPopupRects() {
|
void OsrRenderer::ClearPopupRects() {
|
||||||
popup_rect_.Set(0, 0, 0, 0);
|
popup_rect_.Set(0, 0, 0, 0);
|
||||||
original_popup_rect_.Set(0, 0, 0, 0);
|
original_popup_rect_.Set(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
void OsrRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
||||||
CefRenderHandler::PaintElementType type,
|
CefRenderHandler::PaintElementType type,
|
||||||
const CefRenderHandler::RectList& dirtyRects,
|
const CefRenderHandler::RectList& dirtyRects,
|
||||||
const void* buffer, int width, int height) {
|
const void* buffer, int width, int height) {
|
||||||
|
@ -326,12 +328,14 @@ void ClientOSRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::SetSpin(float spinX, float spinY) {
|
void OsrRenderer::SetSpin(float spinX, float spinY) {
|
||||||
spin_x_ = spinX;
|
spin_x_ = spinX;
|
||||||
spin_y_ = spinY;
|
spin_y_ = spinY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientOSRenderer::IncrementSpin(float spinDX, float spinDY) {
|
void OsrRenderer::IncrementSpin(float spinDX, float spinDY) {
|
||||||
spin_x_ -= spinDX;
|
spin_x_ -= spinDX;
|
||||||
spin_y_ -= spinDY;
|
spin_y_ -= spinDY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
|
@ -2,18 +2,20 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license
|
// reserved. Use of this source code is governed by a BSD-style license
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_OSRENDERER_H_
|
#ifndef CEF_TESTS_CEFCLIENT_OSR_RENDERER_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_OSRENDERER_H_
|
#define CEF_TESTS_CEFCLIENT_OSR_RENDERER_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_render_handler.h"
|
#include "include/cef_render_handler.h"
|
||||||
|
|
||||||
class ClientOSRenderer {
|
namespace client {
|
||||||
|
|
||||||
|
class OsrRenderer {
|
||||||
public:
|
public:
|
||||||
ClientOSRenderer(bool transparent,
|
OsrRenderer(bool transparent,
|
||||||
bool show_update_rect);
|
bool show_update_rect);
|
||||||
virtual ~ClientOSRenderer();
|
virtual ~OsrRenderer();
|
||||||
|
|
||||||
// Initialize the OpenGL environment.
|
// Initialize the OpenGL environment.
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
@ -64,5 +66,7 @@ class ClientOSRenderer {
|
||||||
CefRect update_rect_;
|
CefRect update_rect_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_OSRENDERER_H_
|
} // namespace client
|
||||||
|
|
||||||
|
#endif // CEF_TESTS_CEFCLIENT_OSR_RENDERER_H_
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/cefclient_osr_widget_gtk.h"
|
#include "cefclient/osr_widget_gtk.h"
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
#include "include/base/cef_bind.h"
|
#include "include/base/cef_bind.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
gint glarea_size_allocation(GtkWidget* widget,
|
gint glarea_size_allocation(GtkWidget* widget,
|
||||||
|
@ -1348,3 +1350,5 @@ void OSRWindow::DisableGL() {
|
||||||
|
|
||||||
gl_enabled_ = false;
|
gl_enabled_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
|
@ -2,13 +2,15 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_GTK_H_
|
#ifndef CEF_TESTS_CEFCLIENT_OSR_WIDGET_GTK_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_GTK_H_
|
#define CEF_TESTS_CEFCLIENT_OSR_WIDGET_GTK_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_render_handler.h"
|
#include "include/cef_render_handler.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/osr_renderer.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
class OSRBrowserProvider {
|
class OSRBrowserProvider {
|
||||||
public:
|
public:
|
||||||
|
@ -82,7 +84,7 @@ class OSRWindow : public ClientHandler::RenderHandler {
|
||||||
void EnableGL();
|
void EnableGL();
|
||||||
void DisableGL();
|
void DisableGL();
|
||||||
|
|
||||||
ClientOSRenderer renderer_;
|
OsrRenderer renderer_;
|
||||||
OSRBrowserProvider* browser_provider_;
|
OSRBrowserProvider* browser_provider_;
|
||||||
ClientWindowHandle glarea_;
|
ClientWindowHandle glarea_;
|
||||||
bool gl_enabled_;
|
bool gl_enabled_;
|
||||||
|
@ -93,4 +95,6 @@ class OSRWindow : public ClientHandler::RenderHandler {
|
||||||
IMPLEMENT_REFCOUNTING(OSRWindow);
|
IMPLEMENT_REFCOUNTING(OSRWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_GTK_H_
|
} // namespace client
|
||||||
|
|
||||||
|
#endif // CEF_TESTS_CEFCLIENT_OSR_WIDGET_GTK_H_
|
|
@ -2,29 +2,24 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license
|
// reserved. Use of this source code is governed by a BSD-style license
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_MAC_H_
|
#ifndef CEF_TESTS_CEFCLIENT_OSR_WIDGET_MAC_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_MAC_H_
|
#define CEF_TESTS_CEFCLIENT_OSR_WIDGET_MAC_H_
|
||||||
|
|
||||||
#include "include/cef_client.h"
|
#include "include/cef_client.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
|
|
||||||
class ClientOSRenderer;
|
namespace client {
|
||||||
|
class OSRBrowserProvider;
|
||||||
class OSRBrowserProvider {
|
class OsrRenderer;
|
||||||
public:
|
}
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() =0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~OSRBrowserProvider() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// The client OpenGL view.
|
// The client OpenGL view.
|
||||||
@interface ClientOpenGLView
|
@interface ClientOpenGLView
|
||||||
: NSOpenGLView <NSDraggingSource, NSDraggingDestination> {
|
: NSOpenGLView <NSDraggingSource, NSDraggingDestination> {
|
||||||
@public
|
@public
|
||||||
NSTrackingArea* tracking_area_;
|
NSTrackingArea* tracking_area_;
|
||||||
OSRBrowserProvider* browser_provider_;
|
client::OSRBrowserProvider* browser_provider_;
|
||||||
ClientOSRenderer* renderer_;
|
client::OsrRenderer* renderer_;
|
||||||
NSPoint last_mouse_pos_;
|
NSPoint last_mouse_pos_;
|
||||||
NSPoint cur_mouse_pos_;
|
NSPoint cur_mouse_pos_;
|
||||||
bool rotating_;
|
bool rotating_;
|
||||||
|
@ -55,6 +50,16 @@ class OSRBrowserProvider {
|
||||||
allowed_ops:(NSDragOperation)ops point:(NSPoint)p;
|
allowed_ops:(NSDragOperation)ops point:(NSPoint)p;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
|
class OSRBrowserProvider {
|
||||||
|
public:
|
||||||
|
virtual CefRefPtr<CefBrowser> GetBrowser() =0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~OSRBrowserProvider() {}
|
||||||
|
};
|
||||||
|
|
||||||
// Handler for off-screen rendering windows.
|
// Handler for off-screen rendering windows.
|
||||||
class ClientOSRHandler : public ClientHandler::RenderHandler {
|
class ClientOSRHandler : public ClientHandler::RenderHandler {
|
||||||
public:
|
public:
|
||||||
|
@ -139,5 +144,7 @@ class OSRWindow {
|
||||||
IMPLEMENT_REFCOUNTING(OSRWindow);
|
IMPLEMENT_REFCOUNTING(OSRWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_MAC_H_
|
} // namespace client
|
||||||
|
|
||||||
|
#endif // CEF_TESTS_CEFCLIENT_OSR_WIDGET_MAC_H_
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cefclient/cefclient_osr_widget_mac.h"
|
#include "cefclient/osr_widget_mac.h"
|
||||||
|
|
||||||
#include "include/cef_application_mac.h"
|
#include "include/cef_application_mac.h"
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_url.h"
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/bytes_write_handler.h"
|
#include "cefclient/bytes_write_handler.h"
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/osr_renderer.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -103,6 +103,8 @@ static NSString* const kNSURLTitlePboardType = @"public.url-name";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
ClientOSRHandler::ClientOSRHandler(ClientOpenGLView* view,
|
ClientOSRHandler::ClientOSRHandler(ClientOpenGLView* view,
|
||||||
OSRBrowserProvider* browser_provider)
|
OSRBrowserProvider* browser_provider)
|
||||||
: view_(view),
|
: view_(view),
|
||||||
|
@ -298,6 +300,8 @@ void ClientOSRHandler::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||||
void ClientOSRHandler::SetLoading(bool isLoading) {
|
void ClientOSRHandler::SetLoading(bool isLoading) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
||||||
|
|
||||||
@implementation ClientOpenGLView
|
@implementation ClientOpenGLView
|
||||||
|
|
||||||
@synthesize was_last_mouse_down_on_view = was_last_mouse_down_on_view_;
|
@synthesize was_last_mouse_down_on_view = was_last_mouse_down_on_view_;
|
||||||
|
@ -316,7 +320,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
||||||
|
|
||||||
self = [super initWithFrame:frame pixelFormat:pixelFormat];
|
self = [super initWithFrame:frame pixelFormat:pixelFormat];
|
||||||
if (self) {
|
if (self) {
|
||||||
renderer_ = new ClientOSRenderer(transparency, show_update_rect);
|
renderer_ = new client::OsrRenderer(transparency, show_update_rect);
|
||||||
rotating_ = false;
|
rotating_ = false;
|
||||||
endWheelMonitor_ = nil;
|
endWheelMonitor_ = nil;
|
||||||
|
|
||||||
|
@ -352,7 +356,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
CefRefPtr<CefBrowser> browser = [self getBrowser];
|
CefRefPtr<CefBrowser> browser = [self getBrowser];
|
||||||
if (browser) {
|
if (browser) {
|
||||||
static_cast<ClientOSRHandler*>(
|
static_cast<client::ClientOSRHandler*>(
|
||||||
browser->GetHost()->GetClient()->GetRenderHandler().get())->Disconnect();
|
browser->GetHost()->GetClient()->GetRenderHandler().get())->Disconnect();
|
||||||
browser->GetHost()->CloseBrowser(true);
|
browser->GetHost()->CloseBrowser(true);
|
||||||
browser = NULL;
|
browser = NULL;
|
||||||
|
@ -1221,6 +1225,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
||||||
bool transparent,
|
bool transparent,
|
||||||
|
@ -1251,3 +1256,5 @@ OSRWindow::OSRWindow(OSRBrowserProvider* browser_provider,
|
||||||
|
|
||||||
OSRWindow::~OSRWindow() {
|
OSRWindow::~OSRWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
|
@ -2,7 +2,7 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/cefclient_osr_widget_win.h"
|
#include "cefclient/osr_widget_win.h"
|
||||||
|
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
|
#include "cefclient/util_win.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -387,113 +390,6 @@ ATOM OSRWindow::RegisterOSRClass(HINSTANCE hInstance, LPCTSTR className) {
|
||||||
return RegisterClassEx(&wcex);
|
return RegisterClassEx(&wcex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSRWindow::isKeyDown(WPARAM wparam) {
|
|
||||||
return (GetKeyState(wparam) & 0x8000) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OSRWindow::GetCefMouseModifiers(WPARAM wparam) {
|
|
||||||
int modifiers = 0;
|
|
||||||
if (wparam & MK_CONTROL)
|
|
||||||
modifiers |= EVENTFLAG_CONTROL_DOWN;
|
|
||||||
if (wparam & MK_SHIFT)
|
|
||||||
modifiers |= EVENTFLAG_SHIFT_DOWN;
|
|
||||||
if (isKeyDown(VK_MENU))
|
|
||||||
modifiers |= EVENTFLAG_ALT_DOWN;
|
|
||||||
if (wparam & MK_LBUTTON)
|
|
||||||
modifiers |= EVENTFLAG_LEFT_MOUSE_BUTTON;
|
|
||||||
if (wparam & MK_MBUTTON)
|
|
||||||
modifiers |= EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
|
||||||
if (wparam & MK_RBUTTON)
|
|
||||||
modifiers |= EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
|
||||||
|
|
||||||
// Low bit set from GetKeyState indicates "toggled".
|
|
||||||
if (::GetKeyState(VK_NUMLOCK) & 1)
|
|
||||||
modifiers |= EVENTFLAG_NUM_LOCK_ON;
|
|
||||||
if (::GetKeyState(VK_CAPITAL) & 1)
|
|
||||||
modifiers |= EVENTFLAG_CAPS_LOCK_ON;
|
|
||||||
return modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OSRWindow::GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam) {
|
|
||||||
int modifiers = 0;
|
|
||||||
if (isKeyDown(VK_SHIFT))
|
|
||||||
modifiers |= EVENTFLAG_SHIFT_DOWN;
|
|
||||||
if (isKeyDown(VK_CONTROL))
|
|
||||||
modifiers |= EVENTFLAG_CONTROL_DOWN;
|
|
||||||
if (isKeyDown(VK_MENU))
|
|
||||||
modifiers |= EVENTFLAG_ALT_DOWN;
|
|
||||||
|
|
||||||
// Low bit set from GetKeyState indicates "toggled".
|
|
||||||
if (::GetKeyState(VK_NUMLOCK) & 1)
|
|
||||||
modifiers |= EVENTFLAG_NUM_LOCK_ON;
|
|
||||||
if (::GetKeyState(VK_CAPITAL) & 1)
|
|
||||||
modifiers |= EVENTFLAG_CAPS_LOCK_ON;
|
|
||||||
|
|
||||||
switch (wparam) {
|
|
||||||
case VK_RETURN:
|
|
||||||
if ((lparam >> 16) & KF_EXTENDED)
|
|
||||||
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
|
||||||
break;
|
|
||||||
case VK_INSERT:
|
|
||||||
case VK_DELETE:
|
|
||||||
case VK_HOME:
|
|
||||||
case VK_END:
|
|
||||||
case VK_PRIOR:
|
|
||||||
case VK_NEXT:
|
|
||||||
case VK_UP:
|
|
||||||
case VK_DOWN:
|
|
||||||
case VK_LEFT:
|
|
||||||
case VK_RIGHT:
|
|
||||||
if (!((lparam >> 16) & KF_EXTENDED))
|
|
||||||
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
|
||||||
break;
|
|
||||||
case VK_NUMLOCK:
|
|
||||||
case VK_NUMPAD0:
|
|
||||||
case VK_NUMPAD1:
|
|
||||||
case VK_NUMPAD2:
|
|
||||||
case VK_NUMPAD3:
|
|
||||||
case VK_NUMPAD4:
|
|
||||||
case VK_NUMPAD5:
|
|
||||||
case VK_NUMPAD6:
|
|
||||||
case VK_NUMPAD7:
|
|
||||||
case VK_NUMPAD8:
|
|
||||||
case VK_NUMPAD9:
|
|
||||||
case VK_DIVIDE:
|
|
||||||
case VK_MULTIPLY:
|
|
||||||
case VK_SUBTRACT:
|
|
||||||
case VK_ADD:
|
|
||||||
case VK_DECIMAL:
|
|
||||||
case VK_CLEAR:
|
|
||||||
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
|
||||||
break;
|
|
||||||
case VK_SHIFT:
|
|
||||||
if (isKeyDown(VK_LSHIFT))
|
|
||||||
modifiers |= EVENTFLAG_IS_LEFT;
|
|
||||||
else if (isKeyDown(VK_RSHIFT))
|
|
||||||
modifiers |= EVENTFLAG_IS_RIGHT;
|
|
||||||
break;
|
|
||||||
case VK_CONTROL:
|
|
||||||
if (isKeyDown(VK_LCONTROL))
|
|
||||||
modifiers |= EVENTFLAG_IS_LEFT;
|
|
||||||
else if (isKeyDown(VK_RCONTROL))
|
|
||||||
modifiers |= EVENTFLAG_IS_RIGHT;
|
|
||||||
break;
|
|
||||||
case VK_MENU:
|
|
||||||
if (isKeyDown(VK_LMENU))
|
|
||||||
modifiers |= EVENTFLAG_IS_LEFT;
|
|
||||||
else if (isKeyDown(VK_RMENU))
|
|
||||||
modifiers |= EVENTFLAG_IS_RIGHT;
|
|
||||||
break;
|
|
||||||
case VK_LWIN:
|
|
||||||
modifiers |= EVENTFLAG_IS_LEFT;
|
|
||||||
break;
|
|
||||||
case VK_RWIN:
|
|
||||||
modifiers |= EVENTFLAG_IS_RIGHT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSRWindow::IsOverPopupWidget(int x, int y) const {
|
bool OSRWindow::IsOverPopupWidget(int x, int y) const {
|
||||||
const CefRect& rc = renderer_.popup_rect();
|
const CefRect& rc = renderer_.popup_rect();
|
||||||
int popup_right = rc.x + rc.width;
|
int popup_right = rc.x + rc.width;
|
||||||
|
@ -716,8 +612,8 @@ LRESULT CALLBACK OSRWindow::WndProc(HWND hWnd, UINT message,
|
||||||
mouse_event.modifiers = GetCefMouseModifiers(wParam);
|
mouse_event.modifiers = GetCefMouseModifiers(wParam);
|
||||||
|
|
||||||
browser->SendMouseWheelEvent(mouse_event,
|
browser->SendMouseWheelEvent(mouse_event,
|
||||||
isKeyDown(VK_SHIFT) ? delta : 0,
|
IsKeyDown(VK_SHIFT) ? delta : 0,
|
||||||
!isKeyDown(VK_SHIFT) ? delta : 0);
|
!IsKeyDown(VK_SHIFT) ? delta : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -781,3 +677,5 @@ LRESULT CALLBACK OSRWindow::WndProc(HWND hWnd, UINT message,
|
||||||
|
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace client
|
|
@ -2,14 +2,16 @@
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
|
#ifndef CEF_TESTS_CEFCLIENT_OSR_WIDGET_WIN_H_
|
||||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
|
#define CEF_TESTS_CEFCLIENT_OSR_WIDGET_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_render_handler.h"
|
#include "include/cef_render_handler.h"
|
||||||
#include "cefclient/cefclient_osr_dragdrop_win.h"
|
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/osr_dragdrop_win.h"
|
||||||
|
#include "cefclient/osr_renderer.h"
|
||||||
|
|
||||||
|
namespace client {
|
||||||
|
|
||||||
class OSRBrowserProvider {
|
class OSRBrowserProvider {
|
||||||
public:
|
public:
|
||||||
|
@ -21,7 +23,7 @@ class OSRBrowserProvider {
|
||||||
|
|
||||||
class OSRWindow : public ClientHandler::RenderHandler
|
class OSRWindow : public ClientHandler::RenderHandler
|
||||||
#if defined(CEF_USE_ATL)
|
#if defined(CEF_USE_ATL)
|
||||||
, public DragEvents
|
, public OsrDragEvents
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -81,7 +83,7 @@ class OSRWindow : public ClientHandler::RenderHandler
|
||||||
CefRenderHandler::DragOperation operation) OVERRIDE;
|
CefRenderHandler::DragOperation operation) OVERRIDE;
|
||||||
|
|
||||||
#if defined(CEF_USE_ATL)
|
#if defined(CEF_USE_ATL)
|
||||||
// DragEvents methods
|
// OsrDragEvents methods
|
||||||
CefBrowserHost::DragOperationsMask OnDragEnter(
|
CefBrowserHost::DragOperationsMask OnDragEnter(
|
||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
CefMouseEvent ev,
|
CefMouseEvent ev,
|
||||||
|
@ -96,9 +98,6 @@ class OSRWindow : public ClientHandler::RenderHandler
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
void WasHidden(bool hidden);
|
void WasHidden(bool hidden);
|
||||||
|
|
||||||
static int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
|
|
||||||
static int GetCefMouseModifiers(WPARAM wparam);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSRWindow(OSRBrowserProvider* browser_provider,
|
OSRWindow(OSRBrowserProvider* browser_provider,
|
||||||
bool transparent,
|
bool transparent,
|
||||||
|
@ -112,13 +111,12 @@ class OSRWindow : public ClientHandler::RenderHandler
|
||||||
static ATOM RegisterOSRClass(HINSTANCE hInstance, LPCTSTR className);
|
static ATOM RegisterOSRClass(HINSTANCE hInstance, LPCTSTR className);
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
static bool isKeyDown(WPARAM wparam);
|
|
||||||
bool IsOverPopupWidget(int x, int y) const;
|
bool IsOverPopupWidget(int x, int y) const;
|
||||||
int GetPopupXOffset() const;
|
int GetPopupXOffset() const;
|
||||||
int GetPopupYOffset() const;
|
int GetPopupYOffset() const;
|
||||||
void ApplyPopupOffset(int& x, int& y) const;
|
void ApplyPopupOffset(int& x, int& y) const;
|
||||||
|
|
||||||
ClientOSRenderer renderer_;
|
OsrRenderer renderer_;
|
||||||
OSRBrowserProvider* browser_provider_;
|
OSRBrowserProvider* browser_provider_;
|
||||||
HWND hWnd_;
|
HWND hWnd_;
|
||||||
HDC hDC_;
|
HDC hDC_;
|
||||||
|
@ -136,4 +134,6 @@ class OSRWindow : public ClientHandler::RenderHandler
|
||||||
IMPLEMENT_REFCOUNTING(OSRWindow);
|
IMPLEMENT_REFCOUNTING(OSRWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
|
} // namespace client
|
||||||
|
|
||||||
|
#endif // CEF_TESTS_CEFCLIENT_OSR_WIDGET_WIN_H_
|
|
@ -26,4 +26,111 @@ WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc) {
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetCefMouseModifiers(WPARAM wparam) {
|
||||||
|
int modifiers = 0;
|
||||||
|
if (wparam & MK_CONTROL)
|
||||||
|
modifiers |= EVENTFLAG_CONTROL_DOWN;
|
||||||
|
if (wparam & MK_SHIFT)
|
||||||
|
modifiers |= EVENTFLAG_SHIFT_DOWN;
|
||||||
|
if (IsKeyDown(VK_MENU))
|
||||||
|
modifiers |= EVENTFLAG_ALT_DOWN;
|
||||||
|
if (wparam & MK_LBUTTON)
|
||||||
|
modifiers |= EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||||
|
if (wparam & MK_MBUTTON)
|
||||||
|
modifiers |= EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||||
|
if (wparam & MK_RBUTTON)
|
||||||
|
modifiers |= EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
// Low bit set from GetKeyState indicates "toggled".
|
||||||
|
if (::GetKeyState(VK_NUMLOCK) & 1)
|
||||||
|
modifiers |= EVENTFLAG_NUM_LOCK_ON;
|
||||||
|
if (::GetKeyState(VK_CAPITAL) & 1)
|
||||||
|
modifiers |= EVENTFLAG_CAPS_LOCK_ON;
|
||||||
|
return modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam) {
|
||||||
|
int modifiers = 0;
|
||||||
|
if (IsKeyDown(VK_SHIFT))
|
||||||
|
modifiers |= EVENTFLAG_SHIFT_DOWN;
|
||||||
|
if (IsKeyDown(VK_CONTROL))
|
||||||
|
modifiers |= EVENTFLAG_CONTROL_DOWN;
|
||||||
|
if (IsKeyDown(VK_MENU))
|
||||||
|
modifiers |= EVENTFLAG_ALT_DOWN;
|
||||||
|
|
||||||
|
// Low bit set from GetKeyState indicates "toggled".
|
||||||
|
if (::GetKeyState(VK_NUMLOCK) & 1)
|
||||||
|
modifiers |= EVENTFLAG_NUM_LOCK_ON;
|
||||||
|
if (::GetKeyState(VK_CAPITAL) & 1)
|
||||||
|
modifiers |= EVENTFLAG_CAPS_LOCK_ON;
|
||||||
|
|
||||||
|
switch (wparam) {
|
||||||
|
case VK_RETURN:
|
||||||
|
if ((lparam >> 16) & KF_EXTENDED)
|
||||||
|
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
||||||
|
break;
|
||||||
|
case VK_INSERT:
|
||||||
|
case VK_DELETE:
|
||||||
|
case VK_HOME:
|
||||||
|
case VK_END:
|
||||||
|
case VK_PRIOR:
|
||||||
|
case VK_NEXT:
|
||||||
|
case VK_UP:
|
||||||
|
case VK_DOWN:
|
||||||
|
case VK_LEFT:
|
||||||
|
case VK_RIGHT:
|
||||||
|
if (!((lparam >> 16) & KF_EXTENDED))
|
||||||
|
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
||||||
|
break;
|
||||||
|
case VK_NUMLOCK:
|
||||||
|
case VK_NUMPAD0:
|
||||||
|
case VK_NUMPAD1:
|
||||||
|
case VK_NUMPAD2:
|
||||||
|
case VK_NUMPAD3:
|
||||||
|
case VK_NUMPAD4:
|
||||||
|
case VK_NUMPAD5:
|
||||||
|
case VK_NUMPAD6:
|
||||||
|
case VK_NUMPAD7:
|
||||||
|
case VK_NUMPAD8:
|
||||||
|
case VK_NUMPAD9:
|
||||||
|
case VK_DIVIDE:
|
||||||
|
case VK_MULTIPLY:
|
||||||
|
case VK_SUBTRACT:
|
||||||
|
case VK_ADD:
|
||||||
|
case VK_DECIMAL:
|
||||||
|
case VK_CLEAR:
|
||||||
|
modifiers |= EVENTFLAG_IS_KEY_PAD;
|
||||||
|
break;
|
||||||
|
case VK_SHIFT:
|
||||||
|
if (IsKeyDown(VK_LSHIFT))
|
||||||
|
modifiers |= EVENTFLAG_IS_LEFT;
|
||||||
|
else if (IsKeyDown(VK_RSHIFT))
|
||||||
|
modifiers |= EVENTFLAG_IS_RIGHT;
|
||||||
|
break;
|
||||||
|
case VK_CONTROL:
|
||||||
|
if (IsKeyDown(VK_LCONTROL))
|
||||||
|
modifiers |= EVENTFLAG_IS_LEFT;
|
||||||
|
else if (IsKeyDown(VK_RCONTROL))
|
||||||
|
modifiers |= EVENTFLAG_IS_RIGHT;
|
||||||
|
break;
|
||||||
|
case VK_MENU:
|
||||||
|
if (IsKeyDown(VK_LMENU))
|
||||||
|
modifiers |= EVENTFLAG_IS_LEFT;
|
||||||
|
else if (IsKeyDown(VK_RMENU))
|
||||||
|
modifiers |= EVENTFLAG_IS_RIGHT;
|
||||||
|
break;
|
||||||
|
case VK_LWIN:
|
||||||
|
modifiers |= EVENTFLAG_IS_LEFT;
|
||||||
|
break;
|
||||||
|
case VK_RWIN:
|
||||||
|
modifiers |= EVENTFLAG_IS_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsKeyDown(WPARAM wparam) {
|
||||||
|
return (GetKeyState(wparam) & 0x8000) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
|
|
@ -19,4 +19,8 @@ T GetUserDataPtr(HWND hWnd) {
|
||||||
// Set the window's window procedure pointer and return the old value.
|
// Set the window's window procedure pointer and return the old value.
|
||||||
WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc);
|
WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc);
|
||||||
|
|
||||||
|
int GetCefMouseModifiers(WPARAM wparam);
|
||||||
|
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
|
||||||
|
bool IsKeyDown(WPARAM wparam);
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
|
Loading…
Reference in New Issue