Skip to content

Commit f699c59

Browse files
committed
Change window transparency behavior (cztomczak#403)
1 parent 5f7a3f1 commit f699c59

File tree

8 files changed

+48
-35
lines changed

8 files changed

+48
-35
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ Additional information for v31.2 release:
257257
- [Tutorial](docs/Tutorial.md)
258258

259259

260-
### API categories
261-
260+
### API categories
261+
262262
#### Modules
263263

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

316-
317-
### API index
318-
316+
317+
### API index
318+
319319
* [Application settings](api/ApplicationSettings.md#application-settings)
320320
* [accept_language_list](api/ApplicationSettings.md#accept_language_list)
321321
* [app_user_model_id](api/ApplicationSettings.md#app_user_model_id)
@@ -748,7 +748,6 @@ Additional information for v31.2 release:
748748
* [SetAsChild](api/WindowInfo.md#setaschild)
749749
* [SetAsPopup](api/WindowInfo.md#setaspopup)
750750
* [SetAsOffscreen](api/WindowInfo.md#setasoffscreen)
751-
* [SetTransparentPainting](api/WindowInfo.md#settransparentpainting)
752751
* [WindowUtils (class)](api/WindowUtils.md#windowutils-class)
753752
* [OnSetFocus ](api/WindowUtils.md#onsetfocus-win)
754753
* [OnSize ](api/WindowUtils.md#onsize-win)

api/API-index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@
434434
* [SetAsChild](WindowInfo.md#setaschild)
435435
* [SetAsPopup](WindowInfo.md#setaspopup)
436436
* [SetAsOffscreen](WindowInfo.md#setasoffscreen)
437-
* [SetTransparentPainting](WindowInfo.md#settransparentpainting)
438437
* [WindowUtils (class)](WindowUtils.md#windowutils-class)
439438
* [OnSetFocus ](WindowUtils.md#onsetfocus-win)
440439
* [OnSize ](WindowUtils.md#onsize-win)

docs/Migration-guide.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Table of contents:
3939
* [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)
4040
* [v66+ DisplayHandler.OnConsoleMessage has a new param 'level'](#v66-displayhandleronconsolemessage-has-a-new-param-level)
4141
* [v66+ LifespanHandler.OnBeforePopup is now called on UI thread](#v66-lifespanhandleronbeforepopup-is-now-called-on-ui-thread)
42-
* [V66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'](#v66-requesthandleronbeforebrowse-has-a-new-param-user_gesture)
42+
* [v66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'](#v66-requesthandleronbeforebrowse-has-a-new-param-user_gesture)
43+
* [v66+ Window transparency changes](#v66-window-transparency-changes)
4344

4445

4546

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

326327

327-
## V66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'
328+
## v66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'
328329

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

333+
334+
## v66+ Window transparency changes
335+
336+
1. OSR windows (off-screen rendering, also known as windowless) are now
337+
transparent by default. You can control its transperency with
338+
ApplicationSettings.[background_color](../api/ApplicationSettings.md#background_color) and BrowserSettings.[background_color](../api/BrowserSettings.md#background_color) options.
339+
The WindowInfo.`SetTransparentPainting` method is now deprecated. Calling
340+
it with True will do nothing, and calling it with False **will result
341+
in exception**.
342+
343+
2. It is now possible to have
344+
transparent windows also in **windowed mode**. This seems to be working
345+
only on Linux (got it working on Fedora with just a change in window setting).
346+

src/cef_v59..v66_changes.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ BREAKAGE (needs updating Migration Guide doc)
2727
- + OnBeforeBrowse: new param 'user_gesture'
2828
- + update Migration Guide
2929

30-
internal/cef_linux.h
31-
internal/cef_types_linux.h
32-
internal/cef_mac.h
33-
internal/cef_types_mac.h
34-
internal/cef_win.h
35-
internal/cef_types_win.h
36-
- OSR windows are transparent by default. To change it set
37-
CefBrowserSettings.background_color .
38-
- CefWindowInfo (cef_window_info_t): transparent_painting_enabled option removed
39-
- CefWindowInfo.SetAsWindowless: 'transparent' param removed
40-
- Deprecate WindowInfo.SetTransparentPainting method. When set
41-
to True do nothing. If set to False then raise Exception
42-
and provide info on CefBrowserSettings.background_color.
43-
- Update Migration Guide doc
30+
+ internal/cef_linux.h
31+
+ internal/cef_types_linux.h
32+
+ internal/cef_mac.h
33+
+ internal/cef_types_mac.h
34+
+ internal/cef_win.h
35+
+ internal/cef_types_win.h
36+
- + OSR windows are transparent by default. To change it set
37+
CefBrowserSettings.background_color .
38+
- + CefWindowInfo (cef_window_info_t): transparent_painting_enabled option removed
39+
- + CefWindowInfo.SetAsWindowless: 'transparent' param removed
40+
- + Deprecate WindowInfo.SetTransparentPainting method. When set
41+
to True do nothing. If set to False then raise Exception
42+
and provide info on CefBrowserSettings.background_color.
43+
- + Update Migration Guide doc
4444

4545
internal/cef_types.h
4646
- cef_settings_t:

src/extern/cef/cef_linux.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ cdef extern from "include/internal/cef_linux.h":
1515
cdef cppclass CefWindowInfo:
1616
void SetAsChild(CefWindowHandle parent,
1717
const CefRect& windowRect)
18-
void SetAsWindowless(CefWindowHandle parent,
19-
cpp_bool transparent)
18+
void SetAsWindowless(CefWindowHandle parent)
2019

2120
cdef cppclass CefMainArgs:
2221
CefMainArgs()

src/extern/cef/cef_mac.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ cdef extern from "include/internal/cef_mac.h":
1414
cdef cppclass CefWindowInfo:
1515
void SetAsChild(CefWindowHandle parent,
1616
int x, int y, int width, int height)
17-
void SetAsWindowless(CefWindowHandle parent,
18-
cpp_bool transparent)
17+
void SetAsWindowless(CefWindowHandle parent)
1918

2019
cdef cppclass CefMainArgs:
2120
CefMainArgs()

src/extern/cef/cef_win.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ cdef extern from "include/internal/cef_win.h":
2121
RECT windowRect)
2222
void SetAsPopup(CefWindowHandle parent,
2323
const CefString& windowName)
24-
void SetAsWindowless(CefWindowHandle parent,
25-
cpp_bool transparent)
24+
void SetAsWindowless(CefWindowHandle parent)
2625

2726
cdef cppclass CefMainArgs:
2827
CefMainArgs()

src/window_info.pyx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,17 @@ cdef void SetCefWindowInfo(
6363
<CefWindowHandle>windowInfo.parentWindowHandle,
6464
windowName)
6565

66-
cdef cpp_bool transparent = bool(windowInfo.transparentPainting)
6766
if windowInfo.windowType == "offscreen":
6867
cefWindowInfo.SetAsWindowless(
69-
<CefWindowHandle>windowInfo.parentWindowHandle,
70-
transparent)
68+
<CefWindowHandle>windowInfo.parentWindowHandle)
7169

7270
cdef class WindowInfo:
7371
cdef public str windowType
7472
cdef public WindowHandle parentWindowHandle
7573
cdef public list windowRect # [left, top, right, bottom]
7674
cdef public py_string windowName
77-
cdef public py_bool transparentPainting
7875

7976
def __init__(self, title=""):
80-
self.transparentPainting = False
8177
self.windowName = ""
8278
if title:
8379
self.windowName = title
@@ -135,4 +131,11 @@ cdef class WindowInfo:
135131

136132
cpdef py_void SetTransparentPainting(self,
137133
py_bool transparentPainting):
138-
self.transparentPainting = transparentPainting
134+
"""Deprecated."""
135+
if transparentPainting:
136+
# Do nothing, since v66 OSR windows are transparent by default
137+
pass
138+
else:
139+
raise Exception("This method is deprecated since v66, see "
140+
"Migration Guide document.")
141+

0 commit comments

Comments
 (0)