| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xregion.h> | 8 #include <X11/Xregion.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 ResetWindowRegion(); | 843 ResetWindowRegion(); |
| 844 } | 844 } |
| 845 // Else: the widget will be relaid out either when the window bounds change or | 845 // Else: the widget will be relaid out either when the window bounds change or |
| 846 // when |xwindow_|'s fullscreen state changes. | 846 // when |xwindow_|'s fullscreen state changes. |
| 847 } | 847 } |
| 848 | 848 |
| 849 bool DesktopWindowTreeHostX11::IsFullscreen() const { | 849 bool DesktopWindowTreeHostX11::IsFullscreen() const { |
| 850 return is_fullscreen_; | 850 return is_fullscreen_; |
| 851 } | 851 } |
| 852 | 852 |
| 853 void DesktopWindowTreeHostX11::SetOpacity(unsigned char opacity) { | 853 void DesktopWindowTreeHostX11::SetOpacity(float opacity) { |
| 854 // X server opacity is in terms of 32 bit unsigned int space, and counts from | 854 // X server opacity is in terms of 32 bit unsigned int space, and counts from |
| 855 // the opposite direction. | 855 // the opposite direction. |
| 856 // XChangeProperty() expects "cardinality" to be long. | 856 // XChangeProperty() expects "cardinality" to be long. |
| 857 unsigned long cardinality = opacity * 0x1010101; | 857 unsigned long cardinality = static_cast<int>(opacity * 255) * 0x1010101; |
| 858 | 858 |
| 859 if (cardinality == 0xffffffff) { | 859 if (cardinality == 0xffffffff) { |
| 860 XDeleteProperty(xdisplay_, xwindow_, | 860 XDeleteProperty(xdisplay_, xwindow_, |
| 861 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY")); | 861 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY")); |
| 862 } else { | 862 } else { |
| 863 XChangeProperty(xdisplay_, xwindow_, | 863 XChangeProperty(xdisplay_, xwindow_, |
| 864 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY"), | 864 atom_cache_.GetAtom("_NET_WM_WINDOW_OPACITY"), |
| 865 XA_CARDINAL, 32, | 865 XA_CARDINAL, 32, |
| 866 PropModeReplace, | 866 PropModeReplace, |
| 867 reinterpret_cast<unsigned char*>(&cardinality), 1); | 867 reinterpret_cast<unsigned char*>(&cardinality), 1); |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 if (linux_ui) { | 2053 if (linux_ui) { |
| 2054 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2054 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2055 if (native_theme) | 2055 if (native_theme) |
| 2056 return native_theme; | 2056 return native_theme; |
| 2057 } | 2057 } |
| 2058 | 2058 |
| 2059 return ui::NativeThemeAura::instance(); | 2059 return ui::NativeThemeAura::instance(); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 } // namespace views | 2062 } // namespace views |
| OLD | NEW |