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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 window_title_ = title; | 625 window_title_ = title; |
626 std::string utf8str = base::UTF16ToUTF8(title); | 626 std::string utf8str = base::UTF16ToUTF8(title); |
627 XChangeProperty(xdisplay_, | 627 XChangeProperty(xdisplay_, |
628 xwindow_, | 628 xwindow_, |
629 atom_cache_.GetAtom("_NET_WM_NAME"), | 629 atom_cache_.GetAtom("_NET_WM_NAME"), |
630 atom_cache_.GetAtom("UTF8_STRING"), | 630 atom_cache_.GetAtom("UTF8_STRING"), |
631 8, | 631 8, |
632 PropModeReplace, | 632 PropModeReplace, |
633 reinterpret_cast<const unsigned char*>(utf8str.c_str()), | 633 reinterpret_cast<const unsigned char*>(utf8str.c_str()), |
634 utf8str.size()); | 634 utf8str.size()); |
635 // TODO(erg): This is technically wrong. So XStoreName and friends expect | 635 XTextProperty xtp; |
636 // this in Host Portable Character Encoding instead of UTF-8, which I believe | 636 char *c_utf8_str = const_cast<char *>(utf8str.c_str()); |
637 // is Compound Text. This shouldn't matter 90% of the time since this is the | 637 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, |
638 // fallback to the UTF8 property above. | 638 XUTF8StringStyle, &xtp) == Success) { |
639 XStoreName(xdisplay_, xwindow_, utf8str.c_str()); | 639 XSetWMName(xdisplay_, xwindow_, &xtp); |
| 640 XFree(xtp.value); |
| 641 } |
640 return true; | 642 return true; |
641 } | 643 } |
642 | 644 |
643 void DesktopWindowTreeHostX11::ClearNativeFocus() { | 645 void DesktopWindowTreeHostX11::ClearNativeFocus() { |
644 // This method is weird and misnamed. Instead of clearing the native focus, | 646 // This method is weird and misnamed. Instead of clearing the native focus, |
645 // it sets the focus to our |content_window_|, which will trigger a cascade | 647 // it sets the focus to our |content_window_|, which will trigger a cascade |
646 // of focus changes into views. | 648 // of focus changes into views. |
647 if (content_window_ && aura::client::GetFocusClient(content_window_) && | 649 if (content_window_ && aura::client::GetFocusClient(content_window_) && |
648 content_window_->Contains( | 650 content_window_->Contains( |
649 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { | 651 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 if (linux_ui) { | 1910 if (linux_ui) { |
1909 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1911 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1910 if (native_theme) | 1912 if (native_theme) |
1911 return native_theme; | 1913 return native_theme; |
1912 } | 1914 } |
1913 | 1915 |
1914 return ui::NativeTheme::instance(); | 1916 return ui::NativeTheme::instance(); |
1915 } | 1917 } |
1916 | 1918 |
1917 } // namespace views | 1919 } // namespace views |
OLD | NEW |