Bug fix #302: Use more EWMH-compliant way to determine frame extents

Bug fix: Select the larger of the X window border width and
_NET_FRAME_EXTENTS, instead of adding them together, when determining
the frame extents. (Supposedly) more EWMH compliant, as EWMH
_NET_FRAME_EXTENTS should include the X window border width already. We
did not choose to completely rely on _NET_FRAME_EXTENTS to remove the
need to keep track of whether there is a _NET_FRAME_EXTENTS, and
(hopefully) take care of some cases when it is wrong. The commit should
fix awesomeWM/awesome#425. Thanks to psychon for the information. (#302)

The commit fixes the bug in win_get_region_noframe() that the X window
border width is not considered when determining the width/height of the
window without frame, as well.
This commit is contained in:
Richard Grenville
2015-09-06 21:40:51 +08:00
parent 50317f75c7
commit c156abb0e8
2 changed files with 24 additions and 8 deletions

View File

@ -507,6 +507,20 @@ win_has_frame(const win *w) {
|| w->frame_extents.right || w->frame_extents.bottom;
}
/**
* Calculate the extents of the frame of the given window based on EWMH
* _NET_FRAME_EXTENTS and the X window border width.
*/
static inline margin_t __attribute__((pure))
win_calc_frame_extents(session_t *ps, const win *w) {
margin_t result = w->frame_extents;
result.top = max_i(result.top, w->a.border_width);
result.left = max_i(result.left, w->a.border_width);
result.bottom = max_i(result.bottom, w->a.border_width);
result.right = max_i(result.right, w->a.border_width);
return result;
}
static inline void
wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) {
const unsigned long v = val;