mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement off-screen rendering support using delegated rendering (issue #1257).
This implementation supports both GPU compositing and software compositing (used when GPU is not supported or when passing `--disable-gpu --disable-gpu-compositing` command-line flags). GPU-accelerated features (WebGL and 3D CSS) that did not work with the previous off-screen rendering implementation do work with this implementation when GPU support is available. Rendering now operates on a per-frame basis. The frame rate is configurable via CefBrowserSettings.windowless_frame_rate up to a maximum of 60fps (potentially limited by how fast the system can generate new frames). CEF generates a bitmap from the compositor backing and passes it to CefRenderHandler::OnPaint. The previous CefRenderHandler/CefBrowserHost API for off-screen rendering has been restored mostly as-is with some minor changes: - CefBrowserHost::Invalidate no longer accepts a CefRect region argument. Instead of invalidating a specific region it now triggers generation of a new frame. - The |dirtyRects| argument to CefRenderHandler::OnPaint will now always be a single CefRect representing the whole view (frame) size. Previously, invalidated regions were listed separately. - Linux: CefBrowserHost::SendKeyEvent now expects X11 event information instead of GTK event information. See cefclient for an example of converting GTK events to the necessary format. - Sizes passed to the CefRenderHandler OnPaint and OnPopupSize methods are now already DPI scaled. Previously, the client had to perform DPI scaling. - Includes drag&drop implementation from issue #1032. - Includes unit test fixes from issue #1245. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1751 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_request_context_capi.h"
|
||||
@@ -357,6 +358,46 @@ typedef struct _cef_browser_host_t {
|
||||
int (CEF_CALLBACK *is_mouse_cursor_change_disabled)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if window rendering is disabled.
|
||||
///
|
||||
int (CEF_CALLBACK *is_window_rendering_disabled)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Notify the browser that the widget has been resized. The browser will first
|
||||
// call cef_render_handler_t::GetViewRect to get the new size and then call
|
||||
// cef_render_handler_t::OnPaint asynchronously with the updated regions. This
|
||||
// function is only used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *was_resized)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Notify the browser that it has been hidden or shown. Layouting and
|
||||
// cef_render_handler_t::OnPaint notification will stop when the browser is
|
||||
// hidden. This function is only used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *was_hidden)(struct _cef_browser_host_t* self, int hidden);
|
||||
|
||||
///
|
||||
// Send a notification to the browser that the screen info has changed. The
|
||||
// browser will then call cef_render_handler_t::GetScreenInfo to update the
|
||||
// screen information with the new values. This simulates moving the webview
|
||||
// window from one display to another, or changing the properties of the
|
||||
// current display. This function is only used when window rendering is
|
||||
// disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *notify_screen_info_changed)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Invalidate the view. The browser will call cef_render_handler_t::OnPaint
|
||||
// asynchronously. This function is only used when window rendering is
|
||||
// disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *invalidate)(struct _cef_browser_host_t* self,
|
||||
cef_paint_element_type_t type);
|
||||
|
||||
///
|
||||
// Send a key event to the browser.
|
||||
///
|
||||
@@ -382,6 +423,8 @@ typedef struct _cef_browser_host_t {
|
||||
// Send a mouse wheel event to the browser. The |x| and |y| coordinates are
|
||||
// relative to the upper-left corner of the view. The |deltaX| and |deltaY|
|
||||
// values represent the movement delta in the X and Y directions respectively.
|
||||
// In order to scroll inside select popups with window rendering disabled
|
||||
// cef_render_handler_t::GetScreenPoint should be implemented properly.
|
||||
///
|
||||
void (CEF_CALLBACK *send_mouse_wheel_event)(struct _cef_browser_host_t* self,
|
||||
const struct _cef_mouse_event_t* event, int deltaX, int deltaY);
|
||||
@@ -397,6 +440,90 @@ typedef struct _cef_browser_host_t {
|
||||
///
|
||||
void (CEF_CALLBACK *send_capture_lost_event)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Get the NSTextInputContext implementation for enabling IME on Mac when
|
||||
// window rendering is disabled.
|
||||
///
|
||||
cef_text_input_context_t (CEF_CALLBACK *get_nstext_input_context)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Handles a keyDown event prior to passing it through the NSTextInputClient
|
||||
// machinery.
|
||||
///
|
||||
void (CEF_CALLBACK *handle_key_event_before_text_input_client)(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
|
||||
|
||||
///
|
||||
// Performs any additional actions after NSTextInputClient handles the event.
|
||||
///
|
||||
void (CEF_CALLBACK *handle_key_event_after_text_input_client)(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
|
||||
|
||||
///
|
||||
// Call this function when the user drags the mouse into the web view (before
|
||||
// calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). |drag_data|
|
||||
// should not contain file contents as this type of data is not allowed to be
|
||||
// dragged into the web view. File contents can be removed using
|
||||
// cef_drag_data_t::ResetFileContents (for example, if |drag_data| comes from
|
||||
// cef_render_handler_t::StartDragging). This function is only used when
|
||||
// window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_target_drag_enter)(struct _cef_browser_host_t* self,
|
||||
struct _cef_drag_data_t* drag_data,
|
||||
const struct _cef_mouse_event_t* event,
|
||||
cef_drag_operations_mask_t allowed_ops);
|
||||
|
||||
///
|
||||
// Call this function each time the mouse is moved across the web view during
|
||||
// a drag operation (after calling DragTargetDragEnter and before calling
|
||||
// DragTargetDragLeave/DragTargetDrop). This function is only used when window
|
||||
// rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_target_drag_over)(struct _cef_browser_host_t* self,
|
||||
const struct _cef_mouse_event_t* event,
|
||||
cef_drag_operations_mask_t allowed_ops);
|
||||
|
||||
///
|
||||
// Call this function when the user drags the mouse out of the web view (after
|
||||
// calling DragTargetDragEnter). This function is only used when window
|
||||
// rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_target_drag_leave)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Call this function when the user completes the drag operation by dropping
|
||||
// the object onto the web view (after calling DragTargetDragEnter). The
|
||||
// object being dropped is |drag_data|, given as an argument to the previous
|
||||
// DragTargetDragEnter call. This function is only used when window rendering
|
||||
// is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_target_drop)(struct _cef_browser_host_t* self,
|
||||
const struct _cef_mouse_event_t* event);
|
||||
|
||||
///
|
||||
// Call this function when the drag operation started by a
|
||||
// cef_render_handler_t::StartDragging call has ended either in a drop or by
|
||||
// being cancelled. |x| and |y| are mouse coordinates relative to the upper-
|
||||
// left corner of the view. If the web view is both the drag source and the
|
||||
// drag target then all DragTarget* functions should be called before
|
||||
// DragSource* mthods. This function is only used when window rendering is
|
||||
// disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_source_ended_at)(struct _cef_browser_host_t* self,
|
||||
int x, int y, cef_drag_operations_mask_t op);
|
||||
|
||||
///
|
||||
// Call this function when the drag operation started by a
|
||||
// cef_render_handler_t::StartDragging call has completed. This function may
|
||||
// be called immediately without first calling DragSourceEndedAt to cancel a
|
||||
// drag operation. If the web view is both the drag source and the drag target
|
||||
// then all DragTarget* functions should be called before DragSource* mthods.
|
||||
// This function is only used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *drag_source_system_drag_ended)(
|
||||
struct _cef_browser_host_t* self);
|
||||
} cef_browser_host_t;
|
||||
|
||||
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include "include/capi/cef_life_span_handler_capi.h"
|
||||
#include "include/capi/cef_load_handler_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_render_handler_capi.h"
|
||||
#include "include/capi/cef_request_handler_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -138,6 +139,12 @@ typedef struct _cef_client_t {
|
||||
struct _cef_load_handler_t* (CEF_CALLBACK *get_load_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
///
|
||||
struct _cef_render_handler_t* (CEF_CALLBACK *get_render_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for browser request events.
|
||||
///
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_stream_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -55,6 +56,16 @@ typedef struct _cef_drag_data_t {
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Returns a copy of the current object.
|
||||
///
|
||||
struct _cef_drag_data_t* (CEF_CALLBACK *clone)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this object is read-only.
|
||||
///
|
||||
int (CEF_CALLBACK *is_read_only)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the drag data is a link.
|
||||
///
|
||||
@@ -120,15 +131,79 @@ typedef struct _cef_drag_data_t {
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_file_name)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Write the contents of the file being dragged out of the web view into
|
||||
// |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL
|
||||
// this function will return the size of the file contents in bytes. Call
|
||||
// get_file_name() to get a suggested name for the file.
|
||||
///
|
||||
size_t (CEF_CALLBACK *get_file_contents)(struct _cef_drag_data_t* self,
|
||||
struct _cef_stream_writer_t* writer);
|
||||
|
||||
///
|
||||
// Retrieve the list of file names that are being dragged into the browser
|
||||
// window.
|
||||
///
|
||||
int (CEF_CALLBACK *get_file_names)(struct _cef_drag_data_t* self,
|
||||
cef_string_list_t names);
|
||||
|
||||
///
|
||||
// Set the link URL that is being dragged.
|
||||
///
|
||||
void (CEF_CALLBACK *set_link_url)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* url);
|
||||
|
||||
///
|
||||
// Set the title associated with the link being dragged.
|
||||
///
|
||||
void (CEF_CALLBACK *set_link_title)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* title);
|
||||
|
||||
///
|
||||
// Set the metadata associated with the link being dragged.
|
||||
///
|
||||
void (CEF_CALLBACK *set_link_metadata)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* data);
|
||||
|
||||
///
|
||||
// Set the plain text fragment that is being dragged.
|
||||
///
|
||||
void (CEF_CALLBACK *set_fragment_text)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* text);
|
||||
|
||||
///
|
||||
// Set the text/html fragment that is being dragged.
|
||||
///
|
||||
void (CEF_CALLBACK *set_fragment_html)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* html);
|
||||
|
||||
///
|
||||
// Set the base URL that the fragment came from.
|
||||
///
|
||||
void (CEF_CALLBACK *set_fragment_base_url)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* base_url);
|
||||
|
||||
///
|
||||
// Reset the file contents. You should do this before calling
|
||||
// cef_browser_host_t::DragTargetDragEnter as the web view does not allow us
|
||||
// to drag in this kind of data.
|
||||
///
|
||||
void (CEF_CALLBACK *reset_file_contents)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Add a file that is being dragged into the webview.
|
||||
///
|
||||
void (CEF_CALLBACK *add_file)(struct _cef_drag_data_t* self,
|
||||
const cef_string_t* path, const cef_string_t* display_name);
|
||||
} cef_drag_data_t;
|
||||
|
||||
|
||||
///
|
||||
// Create a new cef_drag_data_t object.
|
||||
///
|
||||
CEF_EXPORT cef_drag_data_t* cef_drag_data_create();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
163
include/capi/cef_render_handler_capi.h
Normal file
163
include/capi/cef_render_handler_capi.h
Normal file
@@ -0,0 +1,163 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
///
|
||||
// Implement this structure to handle events when window rendering is disabled.
|
||||
// The functions of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_render_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Called to retrieve the root window rectangle in screen coordinates. Return
|
||||
// true (1) if the rectangle was provided.
|
||||
///
|
||||
int (CEF_CALLBACK *get_root_screen_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||
|
||||
///
|
||||
// Called to retrieve the view rectangle which is relative to screen
|
||||
// coordinates. Return true (1) if the rectangle was provided.
|
||||
///
|
||||
int (CEF_CALLBACK *get_view_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||
|
||||
///
|
||||
// Called to retrieve the translation from view coordinates to actual screen
|
||||
// coordinates. Return true (1) if the screen coordinates were provided.
|
||||
///
|
||||
int (CEF_CALLBACK *get_screen_point)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, int viewX, int viewY, int* screenX,
|
||||
int* screenY);
|
||||
|
||||
///
|
||||
// Called to allow the client to fill in the CefScreenInfo object with
|
||||
// appropriate values. Return true (1) if the |screen_info| structure has been
|
||||
// modified.
|
||||
//
|
||||
// If the screen info rectangle is left NULL the rectangle from GetViewRect
|
||||
// will be used. If the rectangle is still NULL or invalid popups may not be
|
||||
// drawn correctly.
|
||||
///
|
||||
int (CEF_CALLBACK *get_screen_info)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_screen_info_t* screen_info);
|
||||
|
||||
///
|
||||
// Called when the browser wants to show or hide the popup widget. The popup
|
||||
// should be shown if |show| is true (1) and hidden if |show| is false (0).
|
||||
///
|
||||
void (CEF_CALLBACK *on_popup_show)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, int show);
|
||||
|
||||
///
|
||||
// Called when the browser wants to move or resize the popup widget. |rect|
|
||||
// contains the new location and size.
|
||||
///
|
||||
void (CEF_CALLBACK *on_popup_size)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_rect_t* rect);
|
||||
|
||||
///
|
||||
// Called when an element should be painted. |type| indicates whether the
|
||||
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||
// for the whole image. |dirtyRects| contains the set of rectangles that need
|
||||
// to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes in
|
||||
// size and represents a BGRA image with an upper-left origin.
|
||||
///
|
||||
void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount, cef_rect_t const* dirtyRects, const void* buffer,
|
||||
int width, int height);
|
||||
|
||||
///
|
||||
// Called when the browser window's cursor has changed.
|
||||
///
|
||||
void (CEF_CALLBACK *on_cursor_change)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_cursor_handle_t cursor);
|
||||
|
||||
///
|
||||
// Called when the user starts dragging content in the web view. Contextual
|
||||
// information about the dragged content is supplied by |drag_data|. OS APIs
|
||||
// that run a system message loop may be used within the StartDragging call.
|
||||
//
|
||||
// Return false (0) to abort the drag operation. Don't call any of
|
||||
// cef_browser_host_t::DragSource*Ended* functions after returning false (0).
|
||||
//
|
||||
// Return true (1) to handle the drag operation. Call
|
||||
// cef_browser_host_t::DragSourceEndedAt and DragSourceSystemDragEnded either
|
||||
// synchronously or asynchronously to inform the web view that the drag
|
||||
// operation has ended.
|
||||
///
|
||||
int (CEF_CALLBACK *start_dragging)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_drag_data_t* drag_data,
|
||||
cef_drag_operations_mask_t allowed_ops, int x, int y);
|
||||
|
||||
///
|
||||
// Called when the web view wants to update the mouse cursor during a drag &
|
||||
// drop operation. |operation| describes the allowed operation (none, move,
|
||||
// copy, link).
|
||||
///
|
||||
void (CEF_CALLBACK *update_drag_cursor)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_drag_operations_mask_t operation);
|
||||
|
||||
///
|
||||
// Called when the scroll offset has changed.
|
||||
///
|
||||
void (CEF_CALLBACK *on_scroll_offset_changed)(
|
||||
struct _cef_render_handler_t* self, struct _cef_browser_t* browser);
|
||||
} cef_render_handler_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
@@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_request_context.h"
|
||||
@@ -218,8 +219,10 @@ class CefRunFileDialogCallback : public virtual CefBase {
|
||||
/*--cef(source=library)--*/
|
||||
class CefBrowserHost : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_drag_operations_mask_t DragOperationsMask;
|
||||
typedef cef_file_dialog_mode_t FileDialogMode;
|
||||
typedef cef_mouse_button_type_t MouseButtonType;
|
||||
typedef cef_paint_element_type_t PaintElementType;
|
||||
|
||||
///
|
||||
// Create a new browser window using the window parameters specified by
|
||||
@@ -401,6 +404,48 @@ class CefBrowserHost : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual bool IsMouseCursorChangeDisabled() =0;
|
||||
|
||||
///
|
||||
// Returns true if window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsWindowRenderingDisabled() =0;
|
||||
|
||||
///
|
||||
// Notify the browser that the widget has been resized. The browser will first
|
||||
// call CefRenderHandler::GetViewRect to get the new size and then call
|
||||
// CefRenderHandler::OnPaint asynchronously with the updated regions. This
|
||||
// method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void WasResized() =0;
|
||||
|
||||
///
|
||||
// Notify the browser that it has been hidden or shown. Layouting and
|
||||
// CefRenderHandler::OnPaint notification will stop when the browser is
|
||||
// hidden. This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void WasHidden(bool hidden) =0;
|
||||
|
||||
///
|
||||
// Send a notification to the browser that the screen info has changed. The
|
||||
// browser will then call CefRenderHandler::GetScreenInfo to update the
|
||||
// screen information with the new values. This simulates moving the webview
|
||||
// window from one display to another, or changing the properties of the
|
||||
// current display. This method is only used when window rendering is
|
||||
// disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyScreenInfoChanged() =0;
|
||||
|
||||
///
|
||||
// Invalidate the view. The browser will call CefRenderHandler::OnPaint
|
||||
// asynchronously. This method is only used when window rendering is
|
||||
// disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Invalidate(PaintElementType type) =0;
|
||||
|
||||
///
|
||||
// Send a key event to the browser.
|
||||
///
|
||||
@@ -428,6 +473,8 @@ class CefBrowserHost : public virtual CefBase {
|
||||
// Send a mouse wheel event to the browser. The |x| and |y| coordinates are
|
||||
// relative to the upper-left corner of the view. The |deltaX| and |deltaY|
|
||||
// values represent the movement delta in the X and Y directions respectively.
|
||||
// In order to scroll inside select popups with window rendering disabled
|
||||
// CefRenderHandler::GetScreenPoint should be implemented properly.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
@@ -444,6 +491,92 @@ class CefBrowserHost : public virtual CefBase {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendCaptureLostEvent() =0;
|
||||
|
||||
///
|
||||
// Get the NSTextInputContext implementation for enabling IME on Mac when
|
||||
// window rendering is disabled.
|
||||
///
|
||||
/*--cef(default_retval=NULL)--*/
|
||||
virtual CefTextInputContext GetNSTextInputContext() =0;
|
||||
|
||||
///
|
||||
// Handles a keyDown event prior to passing it through the NSTextInputClient
|
||||
// machinery.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void HandleKeyEventBeforeTextInputClient(CefEventHandle keyEvent) =0;
|
||||
|
||||
///
|
||||
// Performs any additional actions after NSTextInputClient handles the event.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void HandleKeyEventAfterTextInputClient(CefEventHandle keyEvent) =0;
|
||||
|
||||
///
|
||||
// Call this method when the user drags the mouse into the web view (before
|
||||
// calling DragTargetDragOver/DragTargetLeave/DragTargetDrop).
|
||||
// |drag_data| should not contain file contents as this type of data is not
|
||||
// allowed to be dragged into the web view. File contents can be removed using
|
||||
// CefDragData::ResetFileContents (for example, if |drag_data| comes from
|
||||
// CefRenderHandler::StartDragging).
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops) =0;
|
||||
|
||||
///
|
||||
// Call this method each time the mouse is moved across the web view during
|
||||
// a drag operation (after calling DragTargetDragEnter and before calling
|
||||
// DragTargetDragLeave/DragTargetDrop).
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragTargetDragOver(const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops) =0;
|
||||
|
||||
///
|
||||
// Call this method when the user drags the mouse out of the web view (after
|
||||
// calling DragTargetDragEnter).
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragTargetDragLeave() =0;
|
||||
|
||||
///
|
||||
// Call this method when the user completes the drag operation by dropping
|
||||
// the object onto the web view (after calling DragTargetDragEnter).
|
||||
// The object being dropped is |drag_data|, given as an argument to
|
||||
// the previous DragTargetDragEnter call.
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragTargetDrop(const CefMouseEvent& event) =0;
|
||||
|
||||
///
|
||||
// Call this method when the drag operation started by a
|
||||
// CefRenderHandler::StartDragging call has ended either in a drop or
|
||||
// by being cancelled. |x| and |y| are mouse coordinates relative to the
|
||||
// upper-left corner of the view. If the web view is both the drag source
|
||||
// and the drag target then all DragTarget* methods should be called before
|
||||
// DragSource* mthods.
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragSourceEndedAt(int x, int y, DragOperationsMask op) =0;
|
||||
|
||||
///
|
||||
// Call this method when the drag operation started by a
|
||||
// CefRenderHandler::StartDragging call has completed. This method may be
|
||||
// called immediately without first calling DragSourceEndedAt to cancel a
|
||||
// drag operation. If the web view is both the drag source and the drag
|
||||
// target then all DragTarget* methods should be called before DragSource*
|
||||
// mthods.
|
||||
// This method is only used when window rendering is disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DragSourceSystemDragEnded() =0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_BROWSER_H_
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include "include/cef_life_span_handler.h"
|
||||
#include "include/cef_load_handler.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_render_handler.h"
|
||||
#include "include/cef_request_handler.h"
|
||||
|
||||
///
|
||||
@@ -152,6 +153,14 @@ class CefClient : public virtual CefBase {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return the handler for browser request events.
|
||||
///
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include <vector>
|
||||
|
||||
///
|
||||
@@ -48,6 +49,24 @@
|
||||
/*--cef(source=library)--*/
|
||||
class CefDragData : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Create a new CefDragData object.
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefDragData> Create();
|
||||
|
||||
///
|
||||
// Returns a copy of the current object.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDragData> Clone() =0;
|
||||
|
||||
///
|
||||
// Returns true if this object is read-only.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsReadOnly() =0;
|
||||
|
||||
///
|
||||
// Returns true if the drag data is a link.
|
||||
///
|
||||
@@ -109,12 +128,71 @@ class CefDragData : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual CefString GetFileName() =0;
|
||||
|
||||
///
|
||||
// Write the contents of the file being dragged out of the web view into
|
||||
// |writer|. Returns the number of bytes sent to |writer|. If |writer| is
|
||||
// NULL this method will return the size of the file contents in bytes.
|
||||
// Call GetFileName() to get a suggested name for the file.
|
||||
///
|
||||
/*--cef(optional_param=writer)--*/
|
||||
virtual size_t GetFileContents(CefRefPtr<CefStreamWriter> writer) =0;
|
||||
|
||||
///
|
||||
// Retrieve the list of file names that are being dragged into the browser
|
||||
// window.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetFileNames(std::vector<CefString>& names) =0;
|
||||
|
||||
///
|
||||
// Set the link URL that is being dragged.
|
||||
///
|
||||
/*--cef(optional_param=url)--*/
|
||||
virtual void SetLinkURL(const CefString& url) =0;
|
||||
|
||||
///
|
||||
// Set the title associated with the link being dragged.
|
||||
///
|
||||
/*--cef(optional_param=title)--*/
|
||||
virtual void SetLinkTitle(const CefString& title) =0;
|
||||
|
||||
///
|
||||
// Set the metadata associated with the link being dragged.
|
||||
///
|
||||
/*--cef(optional_param=data)--*/
|
||||
virtual void SetLinkMetadata(const CefString& data) =0;
|
||||
|
||||
///
|
||||
// Set the plain text fragment that is being dragged.
|
||||
///
|
||||
/*--cef(optional_param=text)--*/
|
||||
virtual void SetFragmentText(const CefString& text) =0;
|
||||
|
||||
///
|
||||
// Set the text/html fragment that is being dragged.
|
||||
///
|
||||
/*--cef(optional_param=html)--*/
|
||||
virtual void SetFragmentHtml(const CefString& html) =0;
|
||||
|
||||
///
|
||||
// Set the base URL that the fragment came from.
|
||||
///
|
||||
/*--cef(optional_param=base_url)--*/
|
||||
virtual void SetFragmentBaseURL(const CefString& base_url) =0;
|
||||
|
||||
///
|
||||
// Reset the file contents. You should do this before calling
|
||||
// CefBrowserHost::DragTargetDragEnter as the web view does not allow us to
|
||||
// drag in this kind of data.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void ResetFileContents() =0;
|
||||
|
||||
///
|
||||
// Add a file that is being dragged into the webview.
|
||||
///
|
||||
/*--cef(optional_param=display_name)--*/
|
||||
virtual void AddFile(const CefString& path, const CefString& display_name) =0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DRAG_DATA_H_
|
||||
|
170
include/cef_render_handler.h
Normal file
170
include/cef_render_handler.h
Normal file
@@ -0,0 +1,170 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_RENDER_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_RENDER_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include <vector>
|
||||
|
||||
///
|
||||
// Implement this interface to handle events when window rendering is disabled.
|
||||
// The methods of this class will be called on the UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefRenderHandler : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_drag_operations_mask_t DragOperation;
|
||||
typedef cef_drag_operations_mask_t DragOperationsMask;
|
||||
typedef cef_paint_element_type_t PaintElementType;
|
||||
typedef std::vector<CefRect> RectList;
|
||||
|
||||
///
|
||||
// Called to retrieve the root window rectangle in screen coordinates. Return
|
||||
// true if the rectangle was provided.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) { return false; }
|
||||
|
||||
///
|
||||
// Called to retrieve the view rectangle which is relative to screen
|
||||
// coordinates. Return true if the rectangle was provided.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) =0;
|
||||
|
||||
///
|
||||
// Called to retrieve the translation from view coordinates to actual screen
|
||||
// coordinates. Return true if the screen coordinates were provided.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||
int viewX,
|
||||
int viewY,
|
||||
int& screenX,
|
||||
int& screenY) { return false; }
|
||||
|
||||
///
|
||||
// Called to allow the client to fill in the CefScreenInfo object with
|
||||
// appropriate values. Return true if the |screen_info| structure has been
|
||||
// modified.
|
||||
//
|
||||
// If the screen info rectangle is left empty the rectangle from GetViewRect
|
||||
// will be used. If the rectangle is still empty or invalid popups may not be
|
||||
// drawn correctly.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||
CefScreenInfo& screen_info) { return false; }
|
||||
|
||||
///
|
||||
// Called when the browser wants to show or hide the popup widget. The popup
|
||||
// should be shown if |show| is true and hidden if |show| is false.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||
bool show) {}
|
||||
|
||||
///
|
||||
// Called when the browser wants to move or resize the popup widget. |rect|
|
||||
// contains the new location and size.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||
const CefRect& rect) {}
|
||||
|
||||
///
|
||||
// Called when an element should be painted. |type| indicates whether the
|
||||
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||
// for the whole image. |dirtyRects| contains the set of rectangles that need
|
||||
// to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes
|
||||
// in size and represents a BGRA image with an upper-left origin.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
const void* buffer,
|
||||
int width, int height) =0;
|
||||
|
||||
///
|
||||
// Called when the browser window's cursor has changed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor) {}
|
||||
|
||||
///
|
||||
// Called when the user starts dragging content in the web view. Contextual
|
||||
// information about the dragged content is supplied by |drag_data|.
|
||||
// OS APIs that run a system message loop may be used within the
|
||||
// StartDragging call.
|
||||
//
|
||||
// Return false to abort the drag operation. Don't call any of
|
||||
// CefBrowserHost::DragSource*Ended* methods after returning false.
|
||||
//
|
||||
// Return true to handle the drag operation. Call
|
||||
// CefBrowserHost::DragSourceEndedAt and DragSourceSystemDragEnded either
|
||||
// synchronously or asynchronously to inform the web view that the drag
|
||||
// operation has ended.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
DragOperationsMask allowed_ops,
|
||||
int x, int y) { return false; }
|
||||
|
||||
///
|
||||
// Called when the web view wants to update the mouse cursor during a
|
||||
// drag & drop operation. |operation| describes the allowed operation
|
||||
// (none, move, copy, link).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||
DragOperation operation) {}
|
||||
|
||||
///
|
||||
// Called when the scroll offset has changed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_
|
@@ -72,6 +72,7 @@ class CefCriticalSection {
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
#define CefEventHandle cef_event_handle_t
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefTextInputContext cef_text_input_context_t
|
||||
|
||||
struct CefMainArgsTraits {
|
||||
typedef cef_main_args_t struct_type;
|
||||
@@ -113,6 +114,8 @@ struct CefWindowInfoTraits {
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
@@ -137,6 +140,24 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
width = windowRect.width;
|
||||
height = windowRect.height;
|
||||
}
|
||||
|
||||
///
|
||||
// Create the browser using windowless (off-screen) rendering. No window
|
||||
// will be created for the browser and all rendering will occur via the
|
||||
// CefRenderHandler interface. The |parent| value will be used to identify
|
||||
// monitor info and to act as the parent window for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent window may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_window = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OS_LINUX
|
||||
|
@@ -72,6 +72,7 @@ class CefCriticalSection {
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
#define CefEventHandle cef_event_handle_t
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefTextInputContext cef_text_input_context_t
|
||||
|
||||
struct CefMainArgsTraits {
|
||||
typedef cef_main_args_t struct_type;
|
||||
@@ -119,6 +120,8 @@ struct CefWindowInfoTraits {
|
||||
target->height = src->height;
|
||||
target->hidden = src->hidden;
|
||||
target->parent_view = src->parent_view;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->view = src->view;
|
||||
}
|
||||
};
|
||||
@@ -144,6 +147,24 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
this->height = height;
|
||||
hidden = false;
|
||||
}
|
||||
|
||||
///
|
||||
// Create the browser using windowless (off-screen) rendering. No view
|
||||
// will be created for the browser and all rendering will occur via the
|
||||
// CefRenderHandler interface. The |parent| value will be used to identify
|
||||
// monitor info and to act as the parent view for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent view may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_view = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OS_MACOSX
|
||||
|
@@ -223,6 +223,13 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
int multi_threaded_message_loop;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable windowless (off-screen) rendering support. Do not
|
||||
// enable this value if the application does not use windowless rendering as
|
||||
// it may reduce rendering performance on some systems.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to disable configuration of browser process features using
|
||||
// standard CEF and Chromium command-line arguments. Configuration can still
|
||||
@@ -393,6 +400,14 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
size_t size;
|
||||
|
||||
///
|
||||
// The maximum rate in frames per second (fps) that CefRenderHandler::OnPaint
|
||||
// will be called for a windowless browser. The actual fps may be lower if
|
||||
// the browser cannot generate frames at the requested rate. The minimum
|
||||
// value is 1 and the maximum value is 60 (default 30).
|
||||
///
|
||||
int windowless_frame_rate;
|
||||
|
||||
// The below values map to WebPreferences settings.
|
||||
|
||||
///
|
||||
@@ -1306,6 +1321,14 @@ typedef struct _cef_mouse_event_t {
|
||||
uint32 modifiers;
|
||||
} cef_mouse_event_t;
|
||||
|
||||
///
|
||||
// Paint element types.
|
||||
///
|
||||
typedef enum {
|
||||
PET_VIEW = 0,
|
||||
PET_POPUP,
|
||||
} cef_paint_element_type_t;
|
||||
|
||||
///
|
||||
// Supported event bit flags.
|
||||
///
|
||||
|
@@ -60,6 +60,7 @@ extern "C" {
|
||||
// thread-safe and must only be accessed on the browser process UI thread.
|
||||
///
|
||||
CEF_EXPORT XDisplay* cef_get_xdisplay();
|
||||
#define cef_text_input_context_t void*
|
||||
|
||||
///
|
||||
// Structure representing CefExecuteProcess arguments.
|
||||
@@ -83,6 +84,26 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
cef_window_handle_t parent_window;
|
||||
|
||||
///
|
||||
// Set to true (1) to create the browser using windowless (off-screen)
|
||||
// rendering. No window will be created for the browser and all rendering will
|
||||
// occur via the CefRenderHandler interface. The |parent_window| value will be
|
||||
// used to identify monitor info and to act as the parent window for dialogs,
|
||||
// context menus, etc. If |parent_window| is not provided then the main screen
|
||||
// monitor will be used and some functionality that requires a parent window
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// Pointer for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -43,18 +43,22 @@
|
||||
@class NSCursor;
|
||||
@class NSEvent;
|
||||
@class NSView;
|
||||
@class NSTextInputContext;
|
||||
#else
|
||||
class NSCursor;
|
||||
class NSEvent;
|
||||
struct NSView;
|
||||
class NSTextInputContext;
|
||||
#endif
|
||||
#define cef_cursor_handle_t NSCursor*
|
||||
#define cef_event_handle_t NSEvent*
|
||||
#define cef_window_handle_t NSView*
|
||||
#define cef_text_input_context_t NSTextInputContext*
|
||||
#else
|
||||
#define cef_cursor_handle_t void*
|
||||
#define cef_event_handle_t void*
|
||||
#define cef_window_handle_t void*
|
||||
#define cef_text_input_context_t void*
|
||||
#endif
|
||||
|
||||
#define kNullCursorHandle NULL
|
||||
@@ -93,6 +97,26 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
cef_window_handle_t parent_view;
|
||||
|
||||
///
|
||||
// Set to true (1) to create the browser using windowless (off-screen)
|
||||
// rendering. No view will be created for the browser and all rendering will
|
||||
// occur via the CefRenderHandler interface. The |parent_view| value will be
|
||||
// used to identify monitor info and to act as the parent view for dialogs,
|
||||
// context menus, etc. If |parent_view| is not provided then the main screen
|
||||
// monitor will be used and some functionality that requires a parent view
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// NSView pointer for the new browser view. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#define cef_cursor_handle_t HCURSOR
|
||||
#define cef_event_handle_t MSG*
|
||||
#define cef_window_handle_t HWND
|
||||
#define cef_text_input_context_t void*
|
||||
|
||||
#define kNullCursorHandle NULL
|
||||
#define kNullEventHandle NULL
|
||||
@@ -73,6 +74,26 @@ typedef struct _cef_window_info_t {
|
||||
cef_window_handle_t parent_window;
|
||||
HMENU menu;
|
||||
|
||||
///
|
||||
// Set to true (1) to create the browser using windowless (off-screen)
|
||||
// rendering. No window will be created for the browser and all rendering will
|
||||
// occur via the CefRenderHandler interface. The |parent_window| value will be
|
||||
// used to identify monitor info and to act as the parent window for dialogs,
|
||||
// context menus, etc. If |parent_window| is not provided then the main screen
|
||||
// monitor will be used and some functionality that requires a parent window
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// Handle for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -349,6 +349,7 @@ struct CefSettingsTraits {
|
||||
src->browser_subprocess_path.length,
|
||||
&target->browser_subprocess_path, copy);
|
||||
target->multi_threaded_message_loop = src->multi_threaded_message_loop;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->command_line_args_disabled = src->command_line_args_disabled;
|
||||
|
||||
cef_string_set(src->cache_path.str, src->cache_path.length,
|
||||
@@ -405,6 +406,8 @@ struct CefBrowserSettingsTraits {
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target,
|
||||
bool copy) {
|
||||
target->windowless_frame_rate = src->windowless_frame_rate;
|
||||
|
||||
cef_string_set(src->standard_font_family.str,
|
||||
src->standard_font_family.length, &target->standard_font_family, copy);
|
||||
cef_string_set(src->fixed_font_family.str, src->fixed_font_family.length,
|
||||
|
@@ -71,6 +71,7 @@ class CefCriticalSection {
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
#define CefEventHandle cef_event_handle_t
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefTextInputContext cef_text_input_context_t
|
||||
|
||||
struct CefMainArgsTraits {
|
||||
typedef cef_main_args_t struct_type;
|
||||
@@ -118,6 +119,8 @@ struct CefWindowInfoTraits {
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->menu = src->menu;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
@@ -160,6 +163,24 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
|
||||
cef_string_copy(windowName.c_str(), windowName.length(), &window_name);
|
||||
}
|
||||
|
||||
///
|
||||
// Create the browser using windowless (off-screen) rendering. No window
|
||||
// will be created for the browser and all rendering will occur via the
|
||||
// CefRenderHandler interface. The |parent| value will be used to identify
|
||||
// monitor info and to act as the parent window for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent window may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
windowless_rendering_enabled = TRUE;
|
||||
parent_window = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OS_WIN
|
||||
|
Reference in New Issue
Block a user