| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 window_title_ = title; | 567 window_title_ = title; |
| 568 std::string utf8str = base::UTF16ToUTF8(title); | 568 std::string utf8str = base::UTF16ToUTF8(title); |
| 569 XChangeProperty(xdisplay_, | 569 XChangeProperty(xdisplay_, |
| 570 xwindow_, | 570 xwindow_, |
| 571 atom_cache_.GetAtom("_NET_WM_NAME"), | 571 atom_cache_.GetAtom("_NET_WM_NAME"), |
| 572 atom_cache_.GetAtom("UTF8_STRING"), | 572 atom_cache_.GetAtom("UTF8_STRING"), |
| 573 8, | 573 8, |
| 574 PropModeReplace, | 574 PropModeReplace, |
| 575 reinterpret_cast<const unsigned char*>(utf8str.c_str()), | 575 reinterpret_cast<const unsigned char*>(utf8str.c_str()), |
| 576 utf8str.size()); | 576 utf8str.size()); |
| 577 XTextProperty xtp; | 577 // TODO(erg): This is technically wrong. So XStoreName and friends expect |
| 578 char *c_utf8_str = const_cast<char *>(utf8str.c_str()); | 578 // this in Host Portable Character Encoding instead of UTF-8, which I believe |
| 579 const int err = | 579 // is Compound Text. This shouldn't matter 90% of the time since this is the |
| 580 Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, | 580 // fallback to the UTF8 property above. |
| 581 XCompoundTextStyle, &xtp); | 581 XStoreName(xdisplay_, xwindow_, utf8str.c_str()); |
| 582 if (err != Success) { | |
| 583 const std::string ascii_str = base::UTF16ToASCII(title); | |
| 584 xtp.encoding = XA_STRING; | |
| 585 xtp.format = 8; | |
| 586 xtp.value = reinterpret_cast<unsigned char *> | |
| 587 (const_cast<char *>(ascii_str.c_str())); | |
| 588 xtp.nitems = ascii_str.size(); | |
| 589 XSetWMName(xdisplay_, xwindow_, &xtp); | |
| 590 } else { | |
| 591 XSetWMName(xdisplay_, xwindow_, &xtp); | |
| 592 } | |
| 593 return true; | 582 return true; |
| 594 } | 583 } |
| 595 | 584 |
| 596 void DesktopWindowTreeHostX11::ClearNativeFocus() { | 585 void DesktopWindowTreeHostX11::ClearNativeFocus() { |
| 597 // This method is weird and misnamed. Instead of clearing the native focus, | 586 // This method is weird and misnamed. Instead of clearing the native focus, |
| 598 // it sets the focus to our |content_window_|, which will trigger a cascade | 587 // it sets the focus to our |content_window_|, which will trigger a cascade |
| 599 // of focus changes into views. | 588 // of focus changes into views. |
| 600 if (content_window_ && aura::client::GetFocusClient(content_window_) && | 589 if (content_window_ && aura::client::GetFocusClient(content_window_) && |
| 601 content_window_->Contains( | 590 content_window_->Contains( |
| 602 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { | 591 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 if (linux_ui) { | 1717 if (linux_ui) { |
| 1729 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1718 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1730 if (native_theme) | 1719 if (native_theme) |
| 1731 return native_theme; | 1720 return native_theme; |
| 1732 } | 1721 } |
| 1733 | 1722 |
| 1734 return ui::NativeTheme::instance(); | 1723 return ui::NativeTheme::instance(); |
| 1735 } | 1724 } |
| 1736 | 1725 |
| 1737 } // namespace views | 1726 } // namespace views |
| OLD | NEW |