]> git.eshelyaron.com Git - emacs.git/commitdiff
Expose tool-bar pixel width to lisp and use it for speedbar (Bug#7048)
authorJan D <jan.h.d@swipnet.se>
Fri, 17 Sep 2010 09:04:35 +0000 (11:04 +0200)
committerJan D <jan.h.d@swipnet.se>
Fri, 17 Sep 2010 09:04:35 +0000 (11:04 +0200)
* 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.

* frame.c (Ftool_bar_pixel_width): New function to expose tool
bar's pixel width to Lisp.

lisp/ChangeLog
lisp/dframe.el
src/ChangeLog
src/frame.c

index 929204e5115329205f5e8d66ecdcdcae1d264a25..e6dc4c1dd01af02d894f839507c6c08a4a0503df 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-17  Stephen Berman  <stephen.berman@gmx.net>
+
+       * 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 (Bug#7048).
+
 2010-09-17  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp-compat.el (tramp-compat-with-temp-message): Make it a
index bfa672cdec5d66cd1d2da21344f6b98d97fbaf5a..2e550d8dd78fa2bebc7092f1c3508534bcb61ee4 100644 (file)
@@ -430,7 +430,8 @@ a cons cell indicating a position of the form (LEFT . TOP)."
   (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 @@ a cons cell indicating a position of the form (LEFT . TOP)."
                      (- (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 @@ a cons cell indicating a position of the form (LEFT . TOP)."
                   ;; 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)))
index 8aaa9255ab5c62c9838679ae6da9ca22322cc87a..71a1caa38e831f63e72030b5fbea8d8937a63b63 100644 (file)
@@ -1,3 +1,11 @@
+2010-09-17  Stephen Berman  <stephen.berman@gmx.net>
+
+       * frame.c (Ftool_bar_pixel_width): New function to expose tool
+       bar's pixel width to Lisp (Bug#7048).
+
+ 2010-09-14  Juanma Barranquero  <lekktu@gmail.com>
+
+       * cmds.c (syms_of_cmds) <post-self-insert-hook>: Fix typos in docstring.
 2010-09-17  Jan Djärv  <jan.h.d@swipnet.se>
 
        * gtkutil.c (xg_pack_tool_bar): Call gtk_handle_box_set_handle_position
index 93a6e898c9b852aebe31e248074bf9de172eaec6..eb37d723991d6be56abd5fdde232d848230772db 100644 (file)
@@ -2649,6 +2649,28 @@ If FRAME is omitted, the selected frame is used.  */)
 #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 FRAME_TOOLBAR_WIDTH
+  if (FRAME_WINDOW_P (f))
+    return make_number (FRAME_TOOLBAR_WIDTH (f));
+#endif
+  return 0;
+}
 \f
 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
        doc: /* Specify that the frame FRAME has LINES lines.
@@ -4596,6 +4618,7 @@ automatically.  See also `mouse-autoselect-window'.  */);
   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);