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

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

Issue 464173002: Linux: Relanding a patch from an external contributor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes the memory leak. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698