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

Side by Side Diff: ui/base/x/x11_util.cc

Issue 578443004: linux: Default to custom frame for EWMH-supporting WMs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add to a comment Created 6 years, 3 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
« 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 // This file defines utility functions for X11 (Linux only). This code has been 5 // This file defines utility functions for X11 (Linux only). This code has been
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
7 // remains woefully incomplete. 7 // remains woefully incomplete.
8 8
9 #include "ui/base/x/x11_util.h" 9 #include "ui/base/x/x11_util.h"
10 10
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } else { 987 } else {
988 char* role_c = const_cast<char*>(role.c_str()); 988 char* role_c = const_cast<char*>(role.c_str());
989 XChangeProperty(display, window, GetAtom("WM_WINDOW_ROLE"), XA_STRING, 8, 989 XChangeProperty(display, window, GetAtom("WM_WINDOW_ROLE"), XA_STRING, 8,
990 PropModeReplace, 990 PropModeReplace,
991 reinterpret_cast<unsigned char*>(role_c), 991 reinterpret_cast<unsigned char*>(role_c),
992 role.size()); 992 role.size());
993 } 993 }
994 } 994 }
995 995
996 bool GetCustomFramePrefDefault() { 996 bool GetCustomFramePrefDefault() {
997 // Ideally, we'd use the custom frame by default and just fall back on using 997 // If the window manager doesn't support enough of EWMH to tell us its name,
998 // system decorations for the few (?) tiling window managers where the custom 998 // assume that it doesn't want custom frames. For example, _NET_WM_MOVERESIZE
999 // frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or 999 // is needed for titlebar-dragging-initiated window movement.
Daniel Erat 2014/09/19 16:59:55 will change this to "frame-dragging-initiated" for
1000 // other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH 1000 std::string wm_name;
1001 // _NET_SUPPORTING_WM property makes it easy to look up a name for the current 1001 if (!GetWindowManagerName(&wm_name))
1002 // WM, but at least some of the WMs in the latter group don't set it. 1002 return false;
1003 // Instead, we default to using system decorations for all WMs and 1003
1004 // special-case the ones where the custom frame should be used. 1004 // Also disable custom frames for (at-least-partially-)EWMH-supporting tiling
1005 ui::WindowManagerName wm_type = GuessWindowManager(); 1005 // window managers.
1006 return (wm_type == WM_BLACKBOX || 1006 ui::WindowManagerName wm = GuessWindowManager();
1007 wm_type == WM_COMPIZ || 1007 if (wm == WM_AWESOME ||
1008 wm_type == WM_ENLIGHTENMENT || 1008 wm == WM_I3 ||
1009 wm_type == WM_METACITY || 1009 wm == WM_ION3 ||
1010 wm_type == WM_MUFFIN || 1010 wm == WM_MATCHBOX ||
1011 wm_type == WM_MUTTER || 1011 wm == WM_NOTION ||
1012 wm_type == WM_OPENBOX || 1012 wm == WM_QTILE ||
1013 wm_type == WM_XFWM4); 1013 wm == WM_RATPOISON ||
1014 wm == WM_STUMPWM)
1015 return false;
1016
1017 // Handle a few more window managers that don't get along well with custom
1018 // frames.
1019 if (wm == WM_ICE_WM ||
1020 wm == WM_KWIN)
1021 return false;
1022
1023 // For everything else, use custom frames.
1024 return true;
1014 } 1025 }
1015 1026
1016 bool GetWindowDesktop(XID window, int* desktop) { 1027 bool GetWindowDesktop(XID window, int* desktop) {
1017 return GetIntProperty(window, "_NET_WM_DESKTOP", desktop); 1028 return GetIntProperty(window, "_NET_WM_DESKTOP", desktop);
1018 } 1029 }
1019 1030
1020 std::string GetX11ErrorString(XDisplay* display, int err) { 1031 std::string GetX11ErrorString(XDisplay* display, int err) {
1021 char buffer[256]; 1032 char buffer[256];
1022 XGetErrorText(display, err, buffer, arraysize(buffer)); 1033 XGetErrorText(display, err, buffer, arraysize(buffer));
1023 return buffer; 1034 return buffer;
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1445 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1435 << "minor_code " << static_cast<int>(error_event.minor_code) 1446 << "minor_code " << static_cast<int>(error_event.minor_code)
1436 << " (" << request_str << ")"; 1447 << " (" << request_str << ")";
1437 } 1448 }
1438 1449
1439 // ---------------------------------------------------------------------------- 1450 // ----------------------------------------------------------------------------
1440 // End of x11_util_internal.h 1451 // End of x11_util_internal.h
1441 1452
1442 1453
1443 } // namespace ui 1454 } // namespace ui
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