| 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/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 None); | 708 None); |
| 709 | 709 |
| 710 int new_desktop = 0; | 710 int new_desktop = 0; |
| 711 if (always_visible) { | 711 if (always_visible) { |
| 712 new_desktop = kAllDesktops; | 712 new_desktop = kAllDesktops; |
| 713 } else { | 713 } else { |
| 714 if (!ui::GetCurrentDesktop(&new_desktop)) | 714 if (!ui::GetCurrentDesktop(&new_desktop)) |
| 715 return; | 715 return; |
| 716 } | 716 } |
| 717 | 717 |
| 718 workspace_ = base::IntToString(kAllDesktops); |
| 718 XEvent xevent; | 719 XEvent xevent; |
| 719 memset (&xevent, 0, sizeof (xevent)); | 720 memset (&xevent, 0, sizeof (xevent)); |
| 720 xevent.type = ClientMessage; | 721 xevent.type = ClientMessage; |
| 721 xevent.xclient.window = xwindow_; | 722 xevent.xclient.window = xwindow_; |
| 722 xevent.xclient.message_type = atom_cache_.GetAtom("_NET_WM_DESKTOP"); | 723 xevent.xclient.message_type = atom_cache_.GetAtom("_NET_WM_DESKTOP"); |
| 723 xevent.xclient.format = 32; | 724 xevent.xclient.format = 32; |
| 724 xevent.xclient.data.l[0] = new_desktop; | 725 xevent.xclient.data.l[0] = new_desktop; |
| 725 xevent.xclient.data.l[1] = 0; | 726 xevent.xclient.data.l[1] = 0; |
| 726 xevent.xclient.data.l[2] = 0; | 727 xevent.xclient.data.l[2] = 0; |
| 727 xevent.xclient.data.l[3] = 0; | 728 xevent.xclient.data.l[3] = 0; |
| 728 xevent.xclient.data.l[4] = 0; | 729 xevent.xclient.data.l[4] = 0; |
| 729 XSendEvent(xdisplay_, x_root_window_, False, | 730 XSendEvent(xdisplay_, x_root_window_, False, |
| 730 SubstructureRedirectMask | SubstructureNotifyMask, | 731 SubstructureRedirectMask | SubstructureNotifyMask, |
| 731 &xevent); | 732 &xevent); |
| 732 } | 733 } |
| 733 | 734 |
| 735 bool DesktopWindowTreeHostX11::IsVisibleOnAllWorkspaces() const { |
| 736 // We don't need a check for _NET_WM_STATE_STICKY because that would specify |
| 737 // that the window remain in a fixed position even if the viewport scrolls. |
| 738 // This is different from the type of workspace that's associated with |
| 739 // _NET_WM_DESKTOP. |
| 740 return GetWorkspace() == base::IntToString(kAllDesktops); |
| 741 } |
| 742 |
| 734 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { | 743 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { |
| 735 if (window_title_ == title) | 744 if (window_title_ == title) |
| 736 return false; | 745 return false; |
| 737 window_title_ = title; | 746 window_title_ = title; |
| 738 std::string utf8str = base::UTF16ToUTF8(title); | 747 std::string utf8str = base::UTF16ToUTF8(title); |
| 739 XChangeProperty(xdisplay_, | 748 XChangeProperty(xdisplay_, |
| 740 xwindow_, | 749 xwindow_, |
| 741 atom_cache_.GetAtom("_NET_WM_NAME"), | 750 atom_cache_.GetAtom("_NET_WM_NAME"), |
| 742 atom_cache_.GetAtom("UTF8_STRING"), | 751 atom_cache_.GetAtom("UTF8_STRING"), |
| 743 8, | 752 8, |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 if (linux_ui) { | 2092 if (linux_ui) { |
| 2084 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2093 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2085 if (native_theme) | 2094 if (native_theme) |
| 2086 return native_theme; | 2095 return native_theme; |
| 2087 } | 2096 } |
| 2088 | 2097 |
| 2089 return ui::NativeThemeAura::instance(); | 2098 return ui::NativeThemeAura::instance(); |
| 2090 } | 2099 } |
| 2091 | 2100 |
| 2092 } // namespace views | 2101 } // namespace views |
| OLD | NEW |