diff src/frame.c @ 110391:bbc922c0cfa8

Expose tool-bar pixel width to lisp and use it for speedbar (Bug#7048) * 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.
author Jan D <jan.h.d@swipnet.se>
date Fri, 17 Sep 2010 11:04:35 +0200
parents 8949aad5e992
children 18b3ea98b1f4
line wrap: on
line diff
--- a/src/frame.c	Fri Sep 17 09:58:07 2010 +0200
+++ b/src/frame.c	Fri Sep 17 11:04:35 2010 +0200
@@ -2649,6 +2649,28 @@
 #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;
+}
 
 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 @@
   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);