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

Side by Side Diff: ui/aura/window_tree_host_x11.cc

Issue 2501763005: set WM_CLASS in X11 window host. (Closed)
Patch Set: Created 4 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
« 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/aura/window_tree_host_x11.h" 5 #include "ui/aura/window_tree_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 // TODO(erg): We currently only request window deletion events. We also 152 // TODO(erg): We currently only request window deletion events. We also
153 // should listen for activation events and anything else that GTK+ listens 153 // should listen for activation events and anything else that GTK+ listens
154 // for, and do something useful. 154 // for, and do something useful.
155 ::Atom protocols[2]; 155 ::Atom protocols[2];
156 protocols[0] = atom_cache_.GetAtom("WM_DELETE_WINDOW"); 156 protocols[0] = atom_cache_.GetAtom("WM_DELETE_WINDOW");
157 protocols[1] = atom_cache_.GetAtom("_NET_WM_PING"); 157 protocols[1] = atom_cache_.GetAtom("_NET_WM_PING");
158 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); 158 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
159 159
160 XClassHint* class_hint = XAllocClassHint();
161 class_hint->res_name = const_cast<char*>("chromiumos");
162 class_hint->res_class = const_cast<char*>("ChromiumOS");
160 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with 163 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
161 // the desktop environment. 164 // the desktop environment.
162 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); 165 XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL,
166 class_hint);
167 XFree(class_hint);
sadrul 2016/11/16 00:29:44 Can you use ui::SetWindowClassHint() instead?
Muyuan 2016/11/16 00:51:43 Done.
163 168
164 // Likewise, the X server needs to know this window's pid so it knows which 169 // Likewise, the X server needs to know this window's pid so it knows which
165 // program to kill if the window hangs. 170 // program to kill if the window hangs.
166 // XChangeProperty() expects "pid" to be long. 171 // XChangeProperty() expects "pid" to be long.
167 static_assert(sizeof(long) >= sizeof(pid_t), 172 static_assert(sizeof(long) >= sizeof(pid_t),
168 "pid_t should not be larger than long"); 173 "pid_t should not be larger than long");
169 long pid = getpid(); 174 long pid = getpid();
170 XChangeProperty(xdisplay_, 175 XChangeProperty(xdisplay_,
171 xwindow_, 176 xwindow_,
172 atom_cache_.GetAtom("_NET_WM_PID"), 177 atom_cache_.GetAtom("_NET_WM_PID"),
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 579 }
575 580
576 namespace test { 581 namespace test {
577 582
578 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 583 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
579 default_override_redirect = override_redirect; 584 default_override_redirect = override_redirect;
580 } 585 }
581 586
582 } // namespace test 587 } // namespace test
583 } // namespace aura 588 } // namespace aura
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