-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for window transparency #949
Conversation
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
The native window shadow does not show for transparent window on Mac when the window is created, the shadow only shows after the focus is switched to/from other windows. This is strange, but since we can draw shadows directly in HTML, we just disable native window shadow for now. |
Another problem with transparent window is that you can not click through the transparent areas in the window, because the web page's underlying view still covers the whole window. One solution is to calculate whether the point is transparent when user clicks on the page, and then decide whether to ignore the mouse event, but this solution is quite expensive and needs some more patches in Chromium. In Chromium they also have support for transparent background in web pages (but without support on Mac), and they also have the same problem with us. What they did to solve it is to provide a API to specify the shape of window, so instead of calculating which area can be clicked through, they just let the users decide. I think we should take this approach too. |
One limitation of transparent window is you can not apply blur effects on background, the blur effect is only calculated on HTML elements, so you can not implement Yosemite style toolbar with pure HTML. I am not sure whether this is a operating system limitation or a Chrome bug. An example without blur: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css" media="screen">
.back {
-webkit-app-region: drag;
width: 400px;
height: 80px;
text-align: center;
background-color: #555;
border-radius: 10px;
box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.7);
-webkit-filter: blur(4px);
opacity: 0.4;
}
.title {
float: left;
margin: 30px 0 0 170px;
}
</style>
</head>
<body>
<div class="title">Atom Shell</div>
<div class="back"></div>
</body>
</html> After we add following style rule: .back {
-webkit-filter: blur(4px);
} |
80bb71c
to
85685fe
Compare
I have made transparent window work on Windows and Linux, and we need no patch to libchromiumcontent, which is quite good. But to use transparent window on Linux we have to disable GPU acceleration, and users must put |
😍 |
your the man zcbenz ! +1 |
Enabling clicking through the transparent areas is possible, but it requires disabling GPU acceleration on all platforms, which doesn't seems a solution to me. So I'll choose to add API to set window shape. |
Clipping a window on Mac into a custom shape seems quite difficult in Chromium, traditional ways only work if we have GPU acceleration turned off, and I'm not familiar with how GPU acceleration works in Chromium. In upstream there is an issue to implement window shape API on Mac, I think we should wait for it instead of spending too much time hacking on it. |
@zcbenz Can you keep this PR open while we wait? We're using this version at the moment and since we don't care too much about clickthrough it works for us quite well |
@paulcbetts Sure, feedbacks are welcomed! |
@zcbenz So far, everything is 💎 |
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995 5. Disable beeps when pressing certain keys. electron/electron#2617
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
1. Avoid capturing key event to menu. electron/electron#170 2. Enable accepting first mouse event. electron/electron#212 3. Enable using transparent window. electron/electron#949 4. Enable turning off auto hide cursor. electron/electron#995
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
TODO: Restore support of transparent windows, see electron/electron#949. https://chromium-review.googlesource.com/c/chromium/src/+/607608
WindowsLinuxWindow shadow on MacClick through transparent parts of windowResizable transparent windowSet window shapePatches in libchromiumcontent:
https://github.com/brightray/libchromiumcontent/blob/atom/patches/use_transparent_window.patch
https://github.com/brightray/libchromiumcontent/blob/atom/patches/render_widget_host_view_mac.patch
Fixes #381.