From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#7048: 24.0.50; frame position calculation with vertical tool bar (Gtk+) Date: Thu, 16 Sep 2010 22:00:08 +0200 Message-ID: <87hbhpqx13.fsf@escher.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1284667857 3253 80.91.229.12 (16 Sep 2010 20:10:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 16 Sep 2010 20:10:57 +0000 (UTC) To: 7048@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 16 22:10:55 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKnF-00006E-4c for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Sep 2010 22:10:53 +0200 Original-Received: from localhost ([127.0.0.1]:46592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwKnE-0003Fl-BS for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Sep 2010 16:10:52 -0400 Original-Received: from [140.186.70.92] (port=52214 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwKn3-0003Eb-51 for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:10:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwKn1-0008N2-GQ for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:10:40 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34452) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKn1-0008My-DW for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:10:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OwKao-0001kd-Ks; Thu, 16 Sep 2010 15:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Sep 2010 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7048 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12846670816726 (code B ref -1); Thu, 16 Sep 2010 19:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Sep 2010 19:58:01 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKam-0001kO-Qt for submit@debbugs.gnu.org; Thu, 16 Sep 2010 15:58:01 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKai-0001kJ-LT for submit@debbugs.gnu.org; Thu, 16 Sep 2010 15:57:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwKcx-0006mf-PW for submit@debbugs.gnu.org; Thu, 16 Sep 2010 16:00:16 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:55692) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKcx-0006mZ-Ki for submit@debbugs.gnu.org; Thu, 16 Sep 2010 16:00:15 -0400 Original-Received: from [140.186.70.92] (port=54328 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwKcv-00009Z-T2 for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:00:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwKcu-0006lH-3N for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:00:13 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:56195 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OwKct-0006kk-HW for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2010 16:00:12 -0400 Original-Received: (qmail invoked by alias); 16 Sep 2010 20:00:09 -0000 Original-Received: from i59F570D6.versanet.de (EHLO escher.home) [89.245.112.214] by mail.gmx.net (mp051) with SMTP; 16 Sep 2010 22:00:09 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/RiLdifBrRGMoYAQGPyxIcK4g+cPVCcLbeRMYrMU ORQFm7ifM/hfWh Original-Received: by escher.home (Postfix, from userid 1000) id 9597510350; Thu, 16 Sep 2010 22:00:08 +0200 (CEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 16 Sep 2010 15:58:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40224 Archived-At: --=-=-= Content-Type: text/plain 1. emacs -Q 2. Click menu Options->Show/Hide->Tool-bar->On the left (or: ->On the right, it doesn't matter which). 3. Move the frame to the left edge of the monitor display. 4. M-x speedbar => The speedbar frame opens overlapping the right side of the main frame by the width of the vertical tool bar. The reason for the overlap is that only frame-pixel-width is used (in dframe-reposition-frame-emacs) to calculate the width, but this does not take the tool bar into account. That's innocuous with the default horizontal tool bar, but not when it's placed vertically. AFAICT there is no easy way in Lisp to get this number (you can calculate it using the (fullscreen . fullwidth) frame parameter with and without a vertical tool bar, but it would be absurd to do that in the middle of a program). But it seems straightforward to expose the value of FRAME_TOOLBAR_WIDTH to Lisp, following the example of frame-pixel-width. The attached patch does this (I did not bother to implement a wrapper like x_pixel_width in Fframe_pixel_width, since I don't see an additional use for it in the case of the tool bar width). This can then be used to make the correct frame repositioning in dframe-reposition-frame-emacs, as in the attached patch (I also increased the space on the right from 5 to 10 pixels, to make it the same as the space on the left; alternatively, both could be 5 pixels, which on my system appears to leave no space between the two frames). (This fixes the frame repositioning for the default value 'left-right of speedbar-default-position. I think there may be problems with the value 'left or 'right when the parent frame is too close to the display edge, but perhaps that can be regarded as a poor choice by the user, so I didn't bother with it.) In GNU Emacs 24.0.50.7 (i686-pc-linux-gnu, GTK+ Version 2.18.6) of 2010-09-16 on escher Windowing system distributor `The X.Org Foundation', version 11.0.10605000 configured using `configure '--with-imagemagick' '--without-toolkit-scroll-bars'' --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=bzr-diff Content-Description: tool bar width patch === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-09-15 15:30:43 +0000 +++ lisp/ChangeLog 2010-09-16 18:08:37 +0000 @@ -1,3 +1,9 @@ +2010-09-16 Stephen Berman + + * dframe.el (dframe-reposition-frame-emacs): Use tool-bar-pixel-width + in calculating new frame position. Add more space between new and + parent on the left. + 2010-09-15 Stefan Monnier * emacs-lisp/bytecomp.el (byte-compile-warning-types): New type === modified file 'lisp/dframe.el' --- lisp/dframe.el 2010-01-13 08:35:10 +0000 +++ lisp/dframe.el 2010-09-16 17:01:33 +0000 @@ -430,7 +430,8 @@ (unless (or (not window-system) (eq window-system 'pc)) (let* ((pfx (dframe-frame-parameter parent-frame 'left)) (pfy (dframe-frame-parameter parent-frame 'top)) - (pfw (frame-pixel-width parent-frame)) + (pfw (+ (tool-bar-pixel-width parent-frame) + (frame-pixel-width parent-frame))) (pfh (frame-pixel-height parent-frame)) (nfw (frame-pixel-width new-frame)) (nfh (frame-pixel-height new-frame)) @@ -459,7 +460,7 @@ (- (x-display-pixel-height) (car (cdr pfy)) pfh) (car (cdr pfy))))) (cond ((eq location 'right) - (setq newleft (+ pfx pfw 5) + (setq newleft (+ pfx pfw 10) newtop pfy)) ((eq location 'left) (setq newleft (- pfx 10 nfw) @@ -471,7 +472,7 @@ ;; extra 10 is just dressings for window ;; decorations. (let* ((left-guess (- pfx 10 nfw)) - (right-guess (+ pfx pfw 5)) + (right-guess (+ pfx pfw 10)) (left-margin left-guess) (right-margin (- (x-display-pixel-width) right-guess 5 nfw))) === modified file 'src/ChangeLog' --- src/ChangeLog 2010-09-14 20:32:35 +0000 +++ src/ChangeLog 2010-09-16 18:02:53 +0000 @@ -1,3 +1,8 @@ +2010-09-16 Stephen Berman + + * frame.c (Ftool_bar_pixel_width): New function to expose tool + bar's pixel width to Lisp. + 2010-09-14 Juanma Barranquero * cmds.c (syms_of_cmds) : Fix typos in docstring. === modified file 'src/frame.c' --- src/frame.c 2010-08-08 21:03:45 +0000 +++ src/frame.c 2010-09-16 12:22:21 +0000 @@ -2649,6 +2649,29 @@ #endif return make_number (FRAME_COLS (f)); } + +DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width, + Stool_bar_pixel_width, 0, 1, 0, + doc: /* Return width in pixels of FRAME's tool bar. +The result is greater than zero only when the tool bar is on the left +or right side of FRAME. If FRAME is omitted, the selected frame is +used. */) + (Lisp_Object frame) +{ + struct frame *f; + + if (NILP (frame)) + frame = selected_frame; + CHECK_FRAME (frame); + f = XFRAME (frame); + +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f)) + return make_number (FRAME_TOOLBAR_WIDTH (f)); + else +#endif + return 0; +} DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, doc: /* Specify that the frame FRAME has LINES lines. @@ -4596,6 +4619,7 @@ defsubr (&Sframe_char_width); defsubr (&Sframe_pixel_height); defsubr (&Sframe_pixel_width); + defsubr (&Stool_bar_pixel_width); defsubr (&Sset_frame_height); defsubr (&Sset_frame_width); defsubr (&Sset_frame_size); --=-=-=--