Skip to content

Commit

Permalink
Change window transparency behavior (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed May 25, 2018
1 parent 5f7a3f1 commit f699c59
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 35 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ Additional information for v31.2 release:
- [Tutorial](docs/Tutorial.md)


### API categories

### API categories

#### Modules

* [cefpython](api/cefpython.md#cefpython) module
Expand Down Expand Up @@ -313,9 +313,9 @@ Additional information for v31.2 release:
* [StringVisitor](api/StringVisitor.md#stringvisitor-interface) interface
* [WebRequestClient](api/WebRequestClient.md#webrequestclient-interface) interface


### API index


### API index

* [Application settings](api/ApplicationSettings.md#application-settings)
* [accept_language_list](api/ApplicationSettings.md#accept_language_list)
* [app_user_model_id](api/ApplicationSettings.md#app_user_model_id)
Expand Down Expand Up @@ -748,7 +748,6 @@ Additional information for v31.2 release:
* [SetAsChild](api/WindowInfo.md#setaschild)
* [SetAsPopup](api/WindowInfo.md#setaspopup)
* [SetAsOffscreen](api/WindowInfo.md#setasoffscreen)
* [SetTransparentPainting](api/WindowInfo.md#settransparentpainting)
* [WindowUtils (class)](api/WindowUtils.md#windowutils-class)
* [OnSetFocus ](api/WindowUtils.md#onsetfocus-win)
* [OnSize ](api/WindowUtils.md#onsize-win)
Expand Down
1 change: 0 additions & 1 deletion api/API-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@
* [SetAsChild](WindowInfo.md#setaschild)
* [SetAsPopup](WindowInfo.md#setaspopup)
* [SetAsOffscreen](WindowInfo.md#setasoffscreen)
* [SetTransparentPainting](WindowInfo.md#settransparentpainting)
* [WindowUtils (class)](WindowUtils.md#windowutils-class)
* [OnSetFocus ](WindowUtils.md#onsetfocus-win)
* [OnSize ](WindowUtils.md#onsize-win)
Expand Down
19 changes: 17 additions & 2 deletions docs/Migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Table of contents:
* [v66+ Linux patch that fixed HTTPS cache problems on pages with certificate errors was disabled](#v66-linux-patch-that-fixed-https-cache-problems-on-pages-with-certificate-errors-was-disabled)
* [v66+ DisplayHandler.OnConsoleMessage has a new param 'level'](#v66-displayhandleronconsolemessage-has-a-new-param-level)
* [v66+ LifespanHandler.OnBeforePopup is now called on UI thread](#v66-lifespanhandleronbeforepopup-is-now-called-on-ui-thread)
* [V66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'](#v66-requesthandleronbeforebrowse-has-a-new-param-user_gesture)
* [v66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'](#v66-requesthandleronbeforebrowse-has-a-new-param-user_gesture)
* [v66+ Window transparency changes](#v66-window-transparency-changes)



Expand Down Expand Up @@ -324,8 +325,22 @@ callback is now called on UI thread. Previously it was called on
IO thread.


## V66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'
## v66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'

The RequestHandler.[OnBeforeBrowse](../api/RequestHandler.md#onbeforebrowse)
callback has a new param `user_gesture`.


## v66+ Window transparency changes

1. OSR windows (off-screen rendering, also known as windowless) are now
transparent by default. You can control its transperency with
ApplicationSettings.[background_color](../api/ApplicationSettings.md#background_color) and BrowserSettings.[background_color](../api/BrowserSettings.md#background_color) options.
The WindowInfo.`SetTransparentPainting` method is now deprecated. Calling
it with True will do nothing, and calling it with False **will result
in exception**.

2. It is now possible to have
transparent windows also in **windowed mode**. This seems to be working
only on Linux (got it working on Fedora with just a change in window setting).

28 changes: 14 additions & 14 deletions src/cef_v59..v66_changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ BREAKAGE (needs updating Migration Guide doc)
- + OnBeforeBrowse: new param 'user_gesture'
- + update Migration Guide

internal/cef_linux.h
internal/cef_types_linux.h
internal/cef_mac.h
internal/cef_types_mac.h
internal/cef_win.h
internal/cef_types_win.h
- OSR windows are transparent by default. To change it set
CefBrowserSettings.background_color .
- CefWindowInfo (cef_window_info_t): transparent_painting_enabled option removed
- CefWindowInfo.SetAsWindowless: 'transparent' param removed
- Deprecate WindowInfo.SetTransparentPainting method. When set
to True do nothing. If set to False then raise Exception
and provide info on CefBrowserSettings.background_color.
- Update Migration Guide doc
+ internal/cef_linux.h
+ internal/cef_types_linux.h
+ internal/cef_mac.h
+ internal/cef_types_mac.h
+ internal/cef_win.h
+ internal/cef_types_win.h
- + OSR windows are transparent by default. To change it set
CefBrowserSettings.background_color .
- + CefWindowInfo (cef_window_info_t): transparent_painting_enabled option removed
- + CefWindowInfo.SetAsWindowless: 'transparent' param removed
- + Deprecate WindowInfo.SetTransparentPainting method. When set
to True do nothing. If set to False then raise Exception
and provide info on CefBrowserSettings.background_color.
- + Update Migration Guide doc

internal/cef_types.h
- cef_settings_t:
Expand Down
3 changes: 1 addition & 2 deletions src/extern/cef/cef_linux.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ cdef extern from "include/internal/cef_linux.h":
cdef cppclass CefWindowInfo:
void SetAsChild(CefWindowHandle parent,
const CefRect& windowRect)
void SetAsWindowless(CefWindowHandle parent,
cpp_bool transparent)
void SetAsWindowless(CefWindowHandle parent)

cdef cppclass CefMainArgs:
CefMainArgs()
Expand Down
3 changes: 1 addition & 2 deletions src/extern/cef/cef_mac.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ cdef extern from "include/internal/cef_mac.h":
cdef cppclass CefWindowInfo:
void SetAsChild(CefWindowHandle parent,
int x, int y, int width, int height)
void SetAsWindowless(CefWindowHandle parent,
cpp_bool transparent)
void SetAsWindowless(CefWindowHandle parent)

cdef cppclass CefMainArgs:
CefMainArgs()
Expand Down
3 changes: 1 addition & 2 deletions src/extern/cef/cef_win.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ cdef extern from "include/internal/cef_win.h":
RECT windowRect)
void SetAsPopup(CefWindowHandle parent,
const CefString& windowName)
void SetAsWindowless(CefWindowHandle parent,
cpp_bool transparent)
void SetAsWindowless(CefWindowHandle parent)

cdef cppclass CefMainArgs:
CefMainArgs()
Expand Down
15 changes: 9 additions & 6 deletions src/window_info.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,17 @@ cdef void SetCefWindowInfo(
<CefWindowHandle>windowInfo.parentWindowHandle,
windowName)

cdef cpp_bool transparent = bool(windowInfo.transparentPainting)
if windowInfo.windowType == "offscreen":
cefWindowInfo.SetAsWindowless(
<CefWindowHandle>windowInfo.parentWindowHandle,
transparent)
<CefWindowHandle>windowInfo.parentWindowHandle)

cdef class WindowInfo:
cdef public str windowType
cdef public WindowHandle parentWindowHandle
cdef public list windowRect # [left, top, right, bottom]
cdef public py_string windowName
cdef public py_bool transparentPainting

def __init__(self, title=""):
self.transparentPainting = False
self.windowName = ""
if title:
self.windowName = title
Expand Down Expand Up @@ -135,4 +131,11 @@ cdef class WindowInfo:

cpdef py_void SetTransparentPainting(self,
py_bool transparentPainting):
self.transparentPainting = transparentPainting
"""Deprecated."""
if transparentPainting:
# Do nothing, since v66 OSR windows are transparent by default
pass
else:
raise Exception("This method is deprecated since v66, see "
"Migration Guide document.")

0 comments on commit f699c59

Please sign in to comment.