summaryrefslogtreecommitdiffstats
path: root/chromium/build/patches/chromium_newwindowflash.patch
blob: 5a1f48777c4364524e2b1791bf419589346896e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From adc543fe6a7b3bae9522257e651205140615fecb Mon Sep 17 00:00:00 2001
From: Peng Huang <penghuang@chromium.org>
Date: Fri, 3 May 2019 20:40:41 +0000
Subject: [PATCH] Fix the flash for any new created window.

The flash is because the child window created by GLSurfaceGLX doesn't
match the visual of parent window. Fix the problem by always creating
parent window with the same visual.

Bug: 956061
Change-Id: I88cb65b4a0313be6fdea1bd8d6770d351500ccbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1591946
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656497}
---
 .../desktop_window_tree_host_x11.cc           | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 4dda760a4d..8bdb7b026d 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1426,24 +1426,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
   if (override_redirect_)
     attribute_mask |= CWOverrideRedirect;
 
-  bool enable_transparent_visuals;
-  switch (params.opacity) {
-    case Widget::InitParams::OPAQUE_WINDOW:
-      enable_transparent_visuals = false;
-      break;
-    case Widget::InitParams::TRANSLUCENT_WINDOW:
-      enable_transparent_visuals = true;
-      break;
-    case Widget::InitParams::INFER_OPACITY:
-    default:
-      enable_transparent_visuals = params.type == Widget::InitParams::TYPE_DRAG;
-  }
-
   Visual* visual = CopyFromParent;
   int depth = CopyFromParent;
   Colormap colormap = CopyFromParent;
+
+  // GLSurfaceGLX always create child window with alpha channel. If the parent
+  // window doesn't have alpha channel, it causes flash, so always request argb
+  // visual.
   ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
-      enable_transparent_visuals, &visual, &depth, &colormap,
+      true /* want_argb_visual */, &visual, &depth, &colormap,
       &use_argb_visual_);
 
   if (colormap != CopyFromParent) {