Chromium Code Reviews| 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 const int err = |
| 638 // fallback to the UTF8 property above. | 638 Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, |
| 639 XStoreName(xdisplay_, xwindow_, utf8str.c_str()); | 639 XCompoundTextStyle, &xtp); |
|
sadrul
2014/08/13 02:28:19
Looks like XICCEncodingStyle can be = XUTF8StringS
| |
| 640 if (err != Success) { | |
| 641 XFree(xtp.value); | |
| 642 const std::string ascii_str = base::UTF16ToASCII(title); | |
|
sadrul
2014/08/13 02:28:19
The doc for UTF16ToASCII() states "The result must
| |
| 643 xtp.encoding = XA_STRING; | |
| 644 xtp.format = 8; | |
| 645 xtp.value = reinterpret_cast<unsigned char *> | |
| 646 (const_cast<char *>(ascii_str.c_str())); | |
| 647 xtp.nitems = ascii_str.size(); | |
| 648 XSetWMName(xdisplay_, xwindow_, &xtp); | |
| 649 } else { | |
| 650 XSetWMName(xdisplay_, xwindow_, &xtp); | |
| 651 XFree(xtp.value); | |
| 652 } | |
| 640 return true; | 653 return true; |
| 641 } | 654 } |
| 642 | 655 |
| 643 void DesktopWindowTreeHostX11::ClearNativeFocus() { | 656 void DesktopWindowTreeHostX11::ClearNativeFocus() { |
| 644 // This method is weird and misnamed. Instead of clearing the native focus, | 657 // 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 | 658 // it sets the focus to our |content_window_|, which will trigger a cascade |
| 646 // of focus changes into views. | 659 // of focus changes into views. |
| 647 if (content_window_ && aura::client::GetFocusClient(content_window_) && | 660 if (content_window_ && aura::client::GetFocusClient(content_window_) && |
| 648 content_window_->Contains( | 661 content_window_->Contains( |
| 649 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { | 662 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1908 if (linux_ui) { | 1921 if (linux_ui) { |
| 1909 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1922 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1910 if (native_theme) | 1923 if (native_theme) |
| 1911 return native_theme; | 1924 return native_theme; |
| 1912 } | 1925 } |
| 1913 | 1926 |
| 1914 return ui::NativeTheme::instance(); | 1927 return ui::NativeTheme::instance(); |
| 1915 } | 1928 } |
| 1916 | 1929 |
| 1917 } // namespace views | 1930 } // namespace views |
| OLD | NEW |