Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2009333002: Converts Widget::SetOpacity from char to float (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698