emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

size hints and tiling window managers


From: Jonas Bernoulli
Subject: size hints and tiling window managers
Date: Thu, 06 Dec 2012 19:55:30 +0100
User-agent: mu4e 0.9.9.5-dev4; emacs 24.3.50.1

Hello

On X11 Emacs provides size hints to the window manager, which the latter
may choose to ignore.  When that happens Emacs paints the extra space at
the right and/or bottom with the background color of the default face.

There are legitimate reasons why a window manager chooses to ignore size
hints.  E.g. tiling window managers (dwm, awesome, xmonad, wmii, i3...)
place windows next to each using all available space and without any
window covering part of another window.

In other words tiling wms arrange (X11) windows as Emacs arranges
(Emacs) windows in an (Emacs) frame.

A tiling wm has several options how to deal with windows that provide
size hints.

1. Respect the hints and make the borders thicker, so that the window +
   the borders fill up the intended space.  Ugly.

2. Respect the hints, draw the border around it, and fill the space that
   is left using some "in between windows" color.  Also quite ugly.

3. Ignore the hints leaving it to the client to do something with the
   extra space.  This is what most tiling wms do, because the result
   *usually* looks good enough.

4. Respect the size hints and paint the extra space using some color
   instead of letting the client do it.  I am not aware of a wm that
   does this (it might have to use different colors for different
   clients).

When a terminal emulators is forced to paint some extra space because
the wm does not respect the size hints it does so using the background
color.

Emacs does the same thing: it paints the extra space using the
background color of the default face.  The problem is that Emacs frames
may also have fringes which usually don't have the same background
color.  As a result Emacs draws a "line" with the same color as *the*
background color to the right of the right fringe (and below the echo
area).

To work around the resulting ugliness I just did not use a right fringe,
but I don't want to do that any longer.

There are at least two better ways in which Emacs could deal with wms
not respecting size hints:

1. A quick (and not so bad) work-around would be to make the color used
   to paint the extra space independent of the background color of the
   default face.  This way users of tiling wms could just set it to the
   background color of the fringe instead.  Currently the following does
   not work:

   (set-frame-parameter (selected-frame)
                        'background-color
                        (face-attribute 'fringe :background))

   as it also changes the default background.

2. However I think it would be better if Emacs would just use any window
   size without having to paint some extra space to the right and below
   of the "actual" content.  One way of doing that could be to
   dynamically adjust the width of the fringes (and the height of the
   minibuffer/echo area).

I understand that implementing the latter probably isn't easy to do, so
I am already happy if someone could separate the default and "extra
space" backgrounds as suggested first.

But please also consider the second suggestion.  Since buffers can
contain text that have a different width than that of the default face
relying on size hints does not guarantee that text is never cut of in
the middle of a character.  And keep in mind that you would be doing
this for the benefit of tiling wms - the Emacsen among the window
managers :-)

  Best regards,
  Jonas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]