From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.devel Subject: size hints and tiling window managers Date: Thu, 06 Dec 2012 19:55:30 +0100 Message-ID: <87zk1r104d.fsf@bernoul.li> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354820142 24349 80.91.229.3 (6 Dec 2012 18:55:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2012 18:55:42 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 06 19:55:56 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tggby-0001jW-Sw for ged-emacs-devel@m.gmane.org; Thu, 06 Dec 2012 19:55:55 +0100 Original-Received: from localhost ([::1]:47284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tggbm-00046b-V5 for ged-emacs-devel@m.gmane.org; Thu, 06 Dec 2012 13:55:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tggbh-00046M-MX for emacs-devel@gnu.org; Thu, 06 Dec 2012 13:55:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tggbe-0000ov-Qi for emacs-devel@gnu.org; Thu, 06 Dec 2012 13:55:37 -0500 Original-Received: from mail-ea0-f169.google.com ([209.85.215.169]:52519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tggbe-0000oh-Kp for emacs-devel@gnu.org; Thu, 06 Dec 2012 13:55:34 -0500 Original-Received: by mail-ea0-f169.google.com with SMTP id a12so3003703eaa.0 for ; Thu, 06 Dec 2012 10:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:user-agent:date:message-id:mime-version :content-type; bh=OATuNrrcew3QsZIeGW3a2DJS7B9F6EeGOvk9Bcr7Ru4=; b=FUMorKZEhRP+uGtXDWZJ9bsNAg+PS08OeK6NC/0lcvf7wDRYkpx87BMj7kGzxcWh/B lk03E7dNczzlZQmhFazed1HmlYC9GklBKi/kBB4XCZls7G+CZJqiH4mZlC07aT1pEkry rYl9WLNzQBPAn/fEmhrfCkMtIJjNEefUoqJrLI69rmge/xRv1GMaspadOIWt0pQ5sL4l Azpt6Sk5r8df2EL8f1oC+CYMLaQ0onIzSXdUrXFwqJBclkwIVe/bJPvWrnWTiTtUP754 kGLfa4FTd+JPd8WVTPH9m8/l35aNasWIpTNEprYDJ+6DqAolMm+BTB8VHShSe2WABzUw Qpfw== Original-Received: by 10.14.177.1 with SMTP id c1mr8429189eem.8.1354820132521; Thu, 06 Dec 2012 10:55:32 -0800 (PST) Original-Received: from lem (178-83-201-90.dynamic.hispeed.ch. [178.83.201.90]) by mx.google.com with ESMTPS id d3sm17536175eeo.13.2012.12.06.10.55.31 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Dec 2012 10:55:31 -0800 (PST) User-agent: mu4e 0.9.9.5-dev4; emacs 24.3.50.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:155321 Archived-At: 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