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

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

Issue 68523019: linux_aura: Set the UTF-8 version of the window title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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_root_window_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Standard Linux mouse buttons for going back and forward. 66 // Standard Linux mouse buttons for going back and forward.
67 const int kBackMouseButton = 8; 67 const int kBackMouseButton = 8;
68 const int kForwardMouseButton = 9; 68 const int kForwardMouseButton = 9;
69 69
70 // Constants that are part of EWMH. 70 // Constants that are part of EWMH.
71 const int k_NET_WM_STATE_ADD = 1; 71 const int k_NET_WM_STATE_ADD = 1;
72 const int k_NET_WM_STATE_REMOVE = 0; 72 const int k_NET_WM_STATE_REMOVE = 0;
73 73
74 const char* kAtomsToCache[] = { 74 const char* kAtomsToCache[] = {
75 "UTF8_STRING",
75 "WM_DELETE_WINDOW", 76 "WM_DELETE_WINDOW",
76 "WM_PROTOCOLS", 77 "WM_PROTOCOLS",
77 "WM_S0", 78 "WM_S0",
78 "_NET_WM_ICON", 79 "_NET_WM_ICON",
80 "_NET_WM_NAME",
79 "_NET_WM_PID", 81 "_NET_WM_PID",
80 "_NET_WM_PING", 82 "_NET_WM_PING",
81 "_NET_WM_STATE", 83 "_NET_WM_STATE",
82 "_NET_WM_STATE_ABOVE", 84 "_NET_WM_STATE_ABOVE",
83 "_NET_WM_STATE_FULLSCREEN", 85 "_NET_WM_STATE_FULLSCREEN",
84 "_NET_WM_STATE_HIDDEN", 86 "_NET_WM_STATE_HIDDEN",
85 "_NET_WM_STATE_MAXIMIZED_HORZ", 87 "_NET_WM_STATE_MAXIMIZED_HORZ",
86 "_NET_WM_STATE_MAXIMIZED_VERT", 88 "_NET_WM_STATE_MAXIMIZED_VERT",
87 "_NET_WM_STATE_SKIP_TASKBAR", 89 "_NET_WM_STATE_SKIP_TASKBAR",
88 "_NET_WM_WINDOW_OPACITY", 90 "_NET_WM_WINDOW_OPACITY",
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 SetWMSpecState(always_on_top, 507 SetWMSpecState(always_on_top,
506 atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"), 508 atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"),
507 None); 509 None);
508 } 510 }
509 511
510 bool DesktopRootWindowHostX11::IsAlwaysOnTop() const { 512 bool DesktopRootWindowHostX11::IsAlwaysOnTop() const {
511 return is_always_on_top_; 513 return is_always_on_top_;
512 } 514 }
513 515
514 void DesktopRootWindowHostX11::SetWindowTitle(const string16& title) { 516 void DesktopRootWindowHostX11::SetWindowTitle(const string16& title) {
515 XStoreName(xdisplay_, xwindow_, UTF16ToUTF8(title).c_str()); 517 std::string utf8str = UTF16ToUTF8(title);
518
519 XChangeProperty(xdisplay_,
520 xwindow_,
521 atom_cache_.GetAtom("_NET_WM_NAME"),
522 atom_cache_.GetAtom("UTF8_STRING"),
523 8,
524 PropModeReplace,
525 reinterpret_cast<const unsigned char*>(utf8str.c_str()),
526 utf8str.size());
527
528 // TODO(erg): This is technically wrong. So XStoreName and friends expect
529 // this in Host Portable Character Encoding instead of UTF-8, which I believe
530 // is Compound Text. This shouldn't matter 90% of the time since this is the
531 // fallback to the UTF8 property above.
532 XStoreName(xdisplay_, xwindow_, utf8str.c_str());
516 } 533 }
517 534
518 void DesktopRootWindowHostX11::ClearNativeFocus() { 535 void DesktopRootWindowHostX11::ClearNativeFocus() {
519 // This method is weird and misnamed. Instead of clearing the native focus, 536 // This method is weird and misnamed. Instead of clearing the native focus,
520 // it sets the focus to our |content_window_|, which will trigger a cascade 537 // it sets the focus to our |content_window_|, which will trigger a cascade
521 // of focus changes into views. 538 // of focus changes into views.
522 if (content_window_ && aura::client::GetFocusClient(content_window_) && 539 if (content_window_ && aura::client::GetFocusClient(content_window_) &&
523 content_window_->Contains( 540 content_window_->Contains(
524 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { 541 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) {
525 aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_); 542 aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_);
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 if (linux_ui) { 1504 if (linux_ui) {
1488 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); 1505 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
1489 if (native_theme) 1506 if (native_theme)
1490 return native_theme; 1507 return native_theme;
1491 } 1508 }
1492 1509
1493 return ui::NativeTheme::instance(); 1510 return ui::NativeTheme::instance();
1494 } 1511 }
1495 1512
1496 } // namespace views 1513 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698