Subject: Re: bug#7048: 24.0.50; frame position calculation with vertical tool bar (Gtk+)

From: Jan Djärv <[email-masked]>
Date: Fri, 17 Sep 2010 11:07:37 +0200

Checked in with one change:
#ifdef HAVE_WINDOW_SYSTEM
replaced with
#ifdef FRAME_TOOLBAR_WIDTH

as not all window systems define FRAME_TOOLBAR_WIDTH.

	Jan D.

Stephen Berman skrev 2010-09-16 22.00:
> 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''
>