mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Use CMake configuration to detect ATL support (issue #1328).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1888 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
43dac54b44
commit
a0f5f9c6c8
@ -480,6 +480,22 @@ if(OS_WINDOWS)
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
||||
endif()
|
||||
|
||||
# Configure use of ATL.
|
||||
option(USE_ATL "Enable or disable use of ATL." ON)
|
||||
if(USE_ATL)
|
||||
# Determine if the Visual Studio install supports ATL.
|
||||
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
|
||||
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||
set(USE_ATL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_ATL)
|
||||
# Definition used by apps to test if ATL support is enabled.
|
||||
add_definitions(-DCEF_USE_ATL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@ -531,6 +547,7 @@ endif()
|
||||
|
||||
if(OS_WINDOWS)
|
||||
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
||||
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
|
||||
endif()
|
||||
|
||||
set(LIBRARIES ${CEF_STANDARD_LIBS})
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "cefclient/cefclient_osr_dragdrop_win.h"
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <windowsx.h>
|
||||
@ -646,3 +648,5 @@ DataObjectWin::DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count)
|
||||
m_pStgMedium[i] = stgmed[i];
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(CEF_USE_ATL)
|
||||
|
@ -6,6 +6,14 @@
|
||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
// to the CMake command-line to disable use of ATL.
|
||||
// Uncomment this line to manually enable ATL support.
|
||||
// #define CEF_USE_ATL 1
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
|
||||
#include <atlcomcli.h>
|
||||
#include <objidl.h>
|
||||
#include <stdio.h>
|
||||
@ -175,4 +183,6 @@ class DataObjectWin : public IDataObject {
|
||||
explicit DataObjectWin(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
|
||||
};
|
||||
|
||||
#endif // defined(CEF_USE_ATL)
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||
|
@ -44,9 +44,12 @@ bool OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect,
|
||||
// Reference released in OnDestroyed().
|
||||
AddRef();
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
drop_target_ = DropTargetWin::Create(this, hWnd_);
|
||||
HRESULT register_res = RegisterDragDrop(hWnd_, drop_target_);
|
||||
DCHECK_EQ(register_res, S_OK);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,8 +59,11 @@ void OSRWindow::DestroyWidget() {
|
||||
}
|
||||
|
||||
void OSRWindow::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
#if defined(CEF_USE_ATL)
|
||||
RevokeDragDrop(hWnd_);
|
||||
drop_target_ = NULL;
|
||||
#endif
|
||||
|
||||
DisableGL();
|
||||
::DestroyWindow(hWnd_);
|
||||
}
|
||||
@ -155,6 +161,7 @@ bool OSRWindow::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||
int x, int y) {
|
||||
#if defined(CEF_USE_ATL)
|
||||
if (!drop_target_)
|
||||
return false;
|
||||
current_drag_op_ = DRAG_OPERATION_NONE;
|
||||
@ -167,11 +174,17 @@ bool OSRWindow::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
browser->GetHost()->DragSourceEndedAt(pt.x, pt.y, result);
|
||||
browser->GetHost()->DragSourceSystemDragEnded();
|
||||
return true;
|
||||
#else
|
||||
// Cancel the drag. The dragging implementation requires ATL support.
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OSRWindow::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||
CefRenderHandler::DragOperation operation) {
|
||||
#if defined(CEF_USE_ATL)
|
||||
current_drag_op_ = operation;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OSRWindow::Invalidate() {
|
||||
@ -202,6 +215,8 @@ void OSRWindow::WasHidden(bool hidden) {
|
||||
hidden_ = hidden;
|
||||
}
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
|
||||
CefBrowserHost::DragOperationsMask
|
||||
OSRWindow::OnDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
CefMouseEvent ev,
|
||||
@ -230,13 +245,17 @@ CefBrowserHost::DragOperationsMask
|
||||
return current_drag_op_;
|
||||
}
|
||||
|
||||
#endif // defined(CEF_USE_ATL)
|
||||
|
||||
OSRWindow::OSRWindow(OSRBrowserProvider* browser_provider, bool transparent)
|
||||
: renderer_(transparent),
|
||||
browser_provider_(browser_provider),
|
||||
hWnd_(NULL),
|
||||
hDC_(NULL),
|
||||
hRC_(NULL),
|
||||
#if defined(CEF_USE_ATL)
|
||||
current_drag_op_(DRAG_OPERATION_NONE),
|
||||
#endif
|
||||
painting_popup_(false),
|
||||
render_task_pending_(false),
|
||||
hidden_(false) {
|
||||
|
@ -19,8 +19,11 @@ class OSRBrowserProvider {
|
||||
virtual ~OSRBrowserProvider() {}
|
||||
};
|
||||
|
||||
class OSRWindow : public ClientHandler::RenderHandler,
|
||||
public DragEvents {
|
||||
class OSRWindow : public ClientHandler::RenderHandler
|
||||
#if defined(CEF_USE_ATL)
|
||||
, public DragEvents
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
// Create a new OSRWindow instance. |browser_provider| must outlive this
|
||||
// object.
|
||||
@ -75,6 +78,7 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRenderHandler::DragOperation operation) OVERRIDE;
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
// DragEvents methods
|
||||
virtual CefBrowserHost::DragOperationsMask OnDragEnter(
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
@ -85,6 +89,7 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
||||
virtual void OnDragLeave() OVERRIDE;
|
||||
virtual CefBrowserHost::DragOperationsMask OnDrop(CefMouseEvent ev,
|
||||
CefBrowserHost::DragOperationsMask effect) OVERRIDE;
|
||||
#endif // defined(CEF_USE_ATL)
|
||||
|
||||
void Invalidate();
|
||||
void WasHidden(bool hidden);
|
||||
@ -115,8 +120,10 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
||||
HDC hDC_;
|
||||
HGLRC hRC_;
|
||||
|
||||
#if defined(CEF_USE_ATL)
|
||||
CComPtr<DropTargetWin> drop_target_;
|
||||
CefRenderHandler::DragOperation current_drag_op_;
|
||||
#endif
|
||||
|
||||
bool painting_popup_;
|
||||
bool render_task_pending_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user