Skip to content

Commit

Permalink
linux: Default to custom frame for EWMH-supporting WMs.
Browse files Browse the repository at this point in the history
Change the logic for determining if we should default to
custom window frames (as opposed to using WM-drawn
titlebars):

a) Don't use custom frames for window managers that don't
   support EWMH (Extended Window Manager Hints).
b) Don't use custom frames for EWMH-supporting tiling WMs and
   a few other WMs that don't play well with custom frames.
c) Otherwise, use custom frames.

Previously, custom frames were only used for a hardcoded set
of EWMH-supporting window managers.

BUG=345482

Review URL: https://codereview.chromium.org/578443004

Cr-Commit-Position: refs/heads/master@{#295975}
  • Loading branch information
derat authored and Commit bot committed Sep 22, 2014
1 parent b245438 commit 8d3a769
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions ui/base/x/x11_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -994,23 +994,34 @@ void SetWindowRole(XDisplay* display, XID window, const std::string& role) {
}

bool GetCustomFramePrefDefault() {
// Ideally, we'd use the custom frame by default and just fall back on using
// system decorations for the few (?) tiling window managers where the custom
// frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or
// other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH
// _NET_SUPPORTING_WM property makes it easy to look up a name for the current
// WM, but at least some of the WMs in the latter group don't set it.
// Instead, we default to using system decorations for all WMs and
// special-case the ones where the custom frame should be used.
ui::WindowManagerName wm_type = GuessWindowManager();
return (wm_type == WM_BLACKBOX ||
wm_type == WM_COMPIZ ||
wm_type == WM_ENLIGHTENMENT ||
wm_type == WM_METACITY ||
wm_type == WM_MUFFIN ||
wm_type == WM_MUTTER ||
wm_type == WM_OPENBOX ||
wm_type == WM_XFWM4);
// If the window manager doesn't support enough of EWMH to tell us its name,
// assume that it doesn't want custom frames. For example, _NET_WM_MOVERESIZE
// is needed for frame-drag-initiated window movement.
std::string wm_name;
if (!GetWindowManagerName(&wm_name))
return false;

// Also disable custom frames for (at-least-partially-)EWMH-supporting tiling
// window managers.
ui::WindowManagerName wm = GuessWindowManager();
if (wm == WM_AWESOME ||
wm == WM_I3 ||
wm == WM_ION3 ||
wm == WM_MATCHBOX ||
wm == WM_NOTION ||
wm == WM_QTILE ||
wm == WM_RATPOISON ||
wm == WM_STUMPWM)
return false;

// Handle a few more window managers that don't get along well with custom
// frames.
if (wm == WM_ICE_WM ||
wm == WM_KWIN)
return false;

// For everything else, use custom frames.
return true;
}

bool GetWindowDesktop(XID window, int* desktop) {
Expand Down

0 comments on commit 8d3a769

Please sign in to comment.