From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#16430: 24.3.50; When fullscreen is triggered from the window manager, I can't resize window (via M-x org-export RET) Date: Sun, 19 Jan 2014 18:31:11 +0100 Message-ID: <52DC0BDF.5020602@gmx.at> References: <87mwj0glf4.fsf@bzg.ath.cx> <52D427EA.5090609@gmx.at> <87txd7g0ew.fsf@bzg.ath.cx> <52D43FEA.7010602@gmx.at> <87y52jy52o.fsf@bzg.ath.cx> <52D4EBAE.2060903@gmx.at> <87iotmao4l.fsf@bzg.ath.cx> <52D51541.6040708@gmx.at> <87r48afrul.fsf@bzg.ath.cx> <52D57D3F.7090809@gmx.at> <877ga2iafk.fsf@bzg.ath.cx> <52D64215.7080805@gmx.at> <87sismherx.fsf@bzg.ath.cx> <52DA7149.60102@gmx.at> <878uucgcgc.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1390152736 22187 80.91.229.3 (19 Jan 2014 17:32:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Jan 2014 17:32:16 +0000 (UTC) Cc: 16430@debbugs.gnu.org To: Bastien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 19 18:32:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1W4wEP-0006Ad-3s for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Jan 2014 18:32:21 +0100 Original-Received: from localhost ([::1]:47146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4wEO-0005Tm-Me for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Jan 2014 12:32:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4wED-0005TR-OK for bug-gnu-emacs@gnu.org; Sun, 19 Jan 2014 12:32:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4wE6-0004bM-DW for bug-gnu-emacs@gnu.org; Sun, 19 Jan 2014 12:32:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4wE6-0004b3-95 for bug-gnu-emacs@gnu.org; Sun, 19 Jan 2014 12:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W4wE5-00016n-Tc for bug-gnu-emacs@gnu.org; Sun, 19 Jan 2014 12:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Jan 2014 17:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16430 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16430-submit@debbugs.gnu.org id=B16430.13901526824194 (code B ref 16430); Sun, 19 Jan 2014 17:32:01 +0000 Original-Received: (at 16430) by debbugs.gnu.org; 19 Jan 2014 17:31:22 +0000 Original-Received: from localhost ([127.0.0.1]:57295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W4wDR-00015X-BQ for submit@debbugs.gnu.org; Sun, 19 Jan 2014 12:31:22 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:53268) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W4wDO-00015N-NA for 16430@debbugs.gnu.org; Sun, 19 Jan 2014 12:31:19 -0500 Original-Received: from [62.47.40.156] ([62.47.40.156]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MTvUT-1VwW0421Yn-00QnFx for <16430@debbugs.gnu.org>; Sun, 19 Jan 2014 18:31:17 +0100 In-Reply-To: <878uucgcgc.fsf@bzg.ath.cx> X-Provags-ID: V03:K0:dtNUjcZ9R5w/QpsyAu762Ao1EtuPOniBW72vFChQ7Q9vQ+EHVJS WxaBCbofXCidUKSmib3necXVmWQdW+YSE8IEpgnZ9Auds8/uzWqXSQNRaqwmB/5E+bEyMlo jv/WtCHqVpJkCIgIJvWdH+HOgc8Si2f3rVjCUpitWvtvU3fbw1v8y5lxOF6uVX6ld7eM9AR FE/562Jbt/wiRYj3ZaKMg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83735 Archived-At: > With two windows on a wm-fullscreened frame: > ============================================ > > frame pixel: 1366 x 768 cols/lines: 151 x 42 units: 9 x 18 > frame text pixel: 1348 x 768 cols/lines: 149 x 42 ... > # parent: nil > pixel left: 0 top: 0 size: 1366 x 750 new: 750 ... > # parent: # > pixel left: 0 top: 0 size: 1366 x 372 new: 372 ... > # parent: # > pixel left: 0 top: 372 size: 1366 x 378 new: 378 ... > With two windows on a emacs-fullscreened frame: > =============================================== > > frame pixel: 1362 x 746 cols/lines: 151 x 41 units: 9 x 18 > frame text pixel: 1344 x 746 cols/lines: 149 x 41 ... > # parent: nil > pixel left: 0 top: 0 size: 1362 x 728 new: 1362 ... > # parent: # > pixel left: 0 top: 0 size: 1362 x 364 new: 1362 ... > # parent: # > pixel left: 0 top: 364 size: 1362 x 364 new: 1362 ... All these sum up well: 372 + 378 = 750 for the wm- and 364 + 364 = 728 for the emacs-fullscreened frame. What I now need is a bit more hairy: (1) You need frame-dump and window-dump evaluated. (2) Put the definition of `fit-window-to-buffer' below into say *scratch* and evaluate it. (3) Now do the usual dance to provoke the error in wm- and emacs-fullscreen. Post the two *frame-dump*s here. Thanks, martin (defun fit-window-to-buffer (&optional window max-height min-height max-width min-width) "Adjust size of WINDOW to display its buffer's contents exactly. WINDOW must be a live window and defaults to the selected one. If WINDOW is part of a vertical combination, adjust WINDOW's height. The new height is calculated from the number of lines of the accessible portion of its buffer. The optional argument MAX-HEIGHT specifies a maximum height and defaults to the height of WINDOW's frame. The optional argument MIN-HEIGHT specifies a minimum height and defaults to `window-min-height'. Both MAX-HEIGHT and MIN-HEIGHT are specified in lines and include the mode line and header line, if any. If WINDOW is part of a horizontal combination and the value of the option `fit-window-to-buffer-horizontally' is non-nil, adjust WINDOW's height. The new width of WINDOW is calculated from the maximum length of its buffer's lines that follow the current start position of WINDOW. The optional argument MAX-WIDTH specifies a maximum width and defaults to the width of WINDOW's frame. The optional argument MIN-WIDTH specifies a minimum width and defaults to `window-min-width'. Both MAX-WIDTH and MIN-WIDTH are specified in columns and include fringes, margins and scrollbars, if any. Fit pixelwise if the option `window-resize-pixelwise' is non-nil. If WINDOW is its frame's root window, then if the option `fit-frame-to-buffer' is non-nil, call `fit-frame-to-buffer' to adjust the frame's size. Note that even if this function makes WINDOW large enough to show _all_ parts of its buffer you might not see the first part when WINDOW was scrolled. If WINDOW is resized horizontally, you will not see the top of its buffer unless WINDOW starts at its minimum accessible position." (interactive) (setq window (window-normalize-window window t)) (if (eq window (frame-root-window window)) (when fit-frame-to-buffer ;; Fit WINDOW's frame to buffer. (fit-frame-to-buffer (window-frame window) max-height min-height max-width min-width)) (with-selected-window window (let* ((pixelwise window-resize-pixelwise) (char-height (frame-char-height)) (char-width (frame-char-width)) (total-height (window-size window nil pixelwise)) (body-height (window-body-height window pixelwise)) (body-width (window-body-width window pixelwise)) (min-height ;; Sanitize MIN-HEIGHT. (if (numberp min-height) ;; Can't get smaller than `window-safe-min-height'. (max (if pixelwise (* char-height min-height) min-height) (if pixelwise (window-safe-min-pixel-height window) window-safe-min-height)) ;; Preserve header and mode line if present. (max (if pixelwise (* char-height window-min-height) window-min-height) (window-min-size nil nil t pixelwise)))) (max-height ;; Sanitize MAX-HEIGHT. (if (numberp max-height) (min (+ total-height (window-max-delta window nil nil nil nil nil pixelwise)) (if pixelwise (* char-height max-height) max-height)) (+ total-height (window-max-delta window nil nil nil nil nil pixelwise)))) height) (cond ;; If WINDOW is vertically combined, try to resize it ;; vertically. ((and (not (eq fit-window-to-buffer-horizontally 'only)) (not (window-size-fixed-p window)) (window-combined-p)) ;; Vertically we always want to fit the entire buffer. ;; WINDOW'S height can't get larger than its frame's pixel ;; height. Its width remains fixed. (setq height (+ (cdr (window-text-pixel-size nil nil t nil (frame-pixel-height) t)) (window-bottom-divider-width))) ;; Round height. (unless pixelwise (setq height (+ (/ height char-height) (if (zerop (% height char-height)) 0 1)))) (unless (= height total-height) (frame-dump (window-frame window)) (with-current-buffer "*frame-dump*" (goto-char (point-max)) (insert (format "\n\nwindow %s height %s" window (- (max min-height (min max-height height)) total-height)))) (window-resize-no-error window (- (max min-height (min max-height height)) total-height) nil window pixelwise))) ;; If WINDOW is horizontally combined, try to resize it ;; horizontally. ((and fit-window-to-buffer-horizontally (not (window-size-fixed-p window t)) (window-combined-p nil t)) (let* ((total-width (window-size window nil pixelwise)) (min-width ;; Sanitize MIN-WIDTH. (if (numberp min-width) ;; Can't get smaller than `window-safe-min-width'. (max (if pixelwise (* char-width min-width) min-width) (if pixelwise (window-safe-min-pixel-width) window-safe-min-width)) ;; Preserve fringes, margins, scrollbars if present. (max (if pixelwise (* char-width window-min-width) window-min-width) (window-min-size nil nil t pixelwise)))) (max-width ;; Sanitize MAX-WIDTH. (if (numberp max-width) (min (+ total-width (window-max-delta nil t nil nil nil nil pixelwise)) (if pixelwise (* char-width max-width) max-width)) (+ total-width (window-max-delta nil t nil nil nil nil pixelwise)))) ;; When fitting vertically, assume that WINDOW's start ;; position remains unaltered. WINDOW can't get wider ;; than its frame's pixel width, its height remains ;; unaltered. (width (+ (car (window-text-pixel-size nil (window-start) (point-max) (frame-pixel-width) ;; Add one char-height to assure that ;; we're on the safe side. This ;; overshoots when the first line below ;; the bottom is wider than the window. (* body-height (if pixelwise char-height 1)))) (window-right-divider-width)))) (unless pixelwise (setq width (+ (/ width char-width) (if (zerop (% width char-width)) 0 1)))) (unless (= width body-width) (window-resize-no-error window (- (max min-width (min max-width (+ total-width (- width body-width)))) total-width) t window pixelwise)))))))))