# HG changeset patch # User Katsumi Yamaoka # Date 1278024438 0 # Node ID bcedeeedc5fb2cbb0be7254f5b381e973bba96c5 # Parent 10cf940285f977058927df6b33c81d14cf144a14# Parent 43b10f3ac90cfba62c5f44b8894595f1a5eb1efe Merge from mainline. diff -r 10cf940285f9 -r bcedeeedc5fb lisp/ChangeLog --- a/lisp/ChangeLog Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/ChangeLog Thu Jul 01 22:47:18 2010 +0000 @@ -1,3 +1,23 @@ +2010-07-01 Chong Yidong + + * ruler-mode.el (ruler--save-header-line-format): Fix typos. + +2010-06-30 Chong Yidong + + * frame.el (make-frame): Add default-frame-alist to the PARAMETERS + argument passed to frame-creation-function (Bug#5378). + + * faces.el (x-handle-named-frame-geometry) + (x-handle-reverse-video, x-create-frame-with-faces) + (face-set-after-frame-default, tty-create-frame-with-faces): Don't + separately consult default-frame-alist. It is now passed as the + PARAMETER argument. + +2010-06-30 Andreas Schwab + + * startup.el (command-line): Don't call tool-bar-setup in a + tty-only build. + 2010-06-30 Chong Yidong * ruler-mode.el (ruler--save-header-line-format): New fun. @@ -973,7 +993,7 @@ (rcirc-user-name-history): Add variable. 2010-05-25 Ryan Yeske - Jonathan Rockway + Jonathan Rockway * net/rcirc.el (rcirc-server-alist): Add :pass. (rcirc): When prompting for connection parameters, also prompt for diff -r 10cf940285f9 -r bcedeeedc5fb lisp/faces.el --- a/lisp/faces.el Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/faces.el Thu Jul 01 22:47:18 2010 +0000 @@ -1948,8 +1948,7 @@ "Add geometry parameters for a named frame to parameter list PARAMETERS. Value is the new parameter list." ;; Note that `x-resource-name' has a global meaning. - (let ((x-resource-name (or (cdr (assq 'name parameters)) - (cdr (assq 'name default-frame-alist))))) + (let ((x-resource-name (cdr (assq 'name parameters)))) (when x-resource-name ;; Before checking X resources, we must have an X connection. (or (window-system) @@ -1960,7 +1959,7 @@ (and (setq res-geometry (x-get-resource "geometry" "Geometry")) (setq parsed (x-parse-geometry res-geometry)) (setq parameters - (append parameters default-frame-alist parsed + (append parameters parsed ;; If the resource specifies a position, ;; take note of that. (if (or (assq 'top parsed) (assq 'left parsed)) @@ -1972,7 +1971,6 @@ "Handle the reverse-video frame parameter and X resource. `x-create-frame' does not handle this one." (when (cdr (or (assq 'reverse parameters) - (assq 'reverse default-frame-alist) (let ((resource (x-get-resource "reverseVideo" "ReverseVideo"))) (if resource @@ -1998,13 +1996,10 @@ (declare-function x-setup-function-keys "term/x-win" (frame)) (defun x-create-frame-with-faces (&optional parameters) - "Create a frame from optional frame parameters PARAMETERS. -Parameters not specified by PARAMETERS are taken from -`default-frame-alist'. If PARAMETERS specify a frame name, -handle X geometry resources for that name. If either PARAMETERS -or `default-frame-alist' contains a `reverse' parameter, or -the X resource ``reverseVideo'' is present, handle that. -Value is the new frame created." + "Create and return a frame with frame parameters PARAMETERS. +If PARAMETERS specify a frame name, handle X geometry resources +for that name. If PARAMETERS includes a `reverse' parameter, or +the X resource ``reverseVideo'' is present, handle that." (setq parameters (x-handle-named-frame-geometry parameters)) (let* ((params (copy-tree parameters)) (visibility-spec (assq 'visibility parameters)) @@ -2035,7 +2030,7 @@ Calculate the face definitions using the face specs, custom theme settings, X resources, and `face-new-frame-defaults'. Finally, apply any relevant face attributes found amongst the -frame parameters in PARAMETERS and `default-frame-alist'." +frame parameters in PARAMETERS." (dolist (face (nreverse (face-list))) ;Why reverse? --Stef (condition-case () (progn @@ -2061,16 +2056,14 @@ (mouse-color mouse :background)))) (dolist (param face-params) (let* ((param-name (nth 0 param)) - (value (cdr (or (assq param-name parameters) - (assq param-name default-frame-alist))))) + (value (cdr (assq param-name parameters)))) (if value (set-face-attribute (nth 1 param) frame (nth 2 param) value)))))) (defun tty-handle-reverse-video (frame parameters) "Handle the reverse-video frame parameter for terminal frames." - (when (cdr (or (assq 'reverse parameters) - (assq 'reverse default-frame-alist))) + (when (cdr (assq 'reverse parameters)) (let* ((params (frame-parameters frame)) (bg (cdr (assq 'foreground-color params))) (fg (cdr (assq 'background-color params)))) @@ -2086,11 +2079,8 @@ (defun tty-create-frame-with-faces (&optional parameters) - "Create a frame from optional frame parameters PARAMETERS. -Parameters not specified by PARAMETERS are taken from -`default-frame-alist'. If either PARAMETERS or `default-frame-alist' -contains a `reverse' parameter, handle that. Value is the new frame -created." + "Create and return a frame from optional frame parameters PARAMETERS. +If PARAMETERS contains a `reverse' parameter, handle that." (let ((frame (make-terminal-frame parameters)) success) (unwind-protect diff -r 10cf940285f9 -r bcedeeedc5fb lisp/frame.el --- a/lisp/frame.el Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/frame.el Thu Jul 01 22:47:18 2010 +0000 @@ -683,15 +683,17 @@ (defun make-frame (&optional parameters) "Return a newly created frame displaying the current buffer. -Optional argument PARAMETERS is an alist of parameters for the new frame. -Each element of PARAMETERS should have the form (NAME . VALUE), for example: +Optional argument PARAMETERS is an alist of frame parameters for +the new frame. Each element of PARAMETERS should have the +form (NAME . VALUE), for example: (name . STRING) The frame should be named STRING. (width . NUMBER) The frame should be NUMBER characters in width. (height . NUMBER) The frame should be NUMBER text lines high. -You cannot specify either `width' or `height', you must use neither or both. +You cannot specify either `width' or `height', you must specify +neither or both. (minibuffer . t) The frame should have a minibuffer. (minibuffer . nil) The frame should have no minibuffer. @@ -703,15 +705,17 @@ (terminal . TERMINAL) The frame should use the terminal object TERMINAL. -Before the frame is created (via `frame-creation-function-alist'), functions on the -hook `before-make-frame-hook' are run. After the frame is created, functions -on `after-make-frame-functions' are run with one arg, the newly created frame. +In addition, any parameter specified in `default-frame-alist', +but not present in PARAMETERS, is applied. -This function itself does not make the new frame the selected frame. -The previously selected frame remains selected. However, the -window system may select the new frame for its own reasons, for -instance if the frame appears under the mouse pointer and your -setup is for focus to follow the pointer." +Before creating the frame (via `frame-creation-function-alist'), +this function runs the hook `before-make-frame-hook'. After +creating the frame, it runs the hook `after-make-frame-functions' +with one arg, the newly created frame. + +On graphical displays, this function does not itself make the new +frame the selected frame. However, the window system may select +the new frame according to its own rules." (interactive) (let* ((w (cond ((assq 'terminal parameters) @@ -726,14 +730,21 @@ (t window-system))) (frame-creation-function (cdr (assq w frame-creation-function-alist))) (oldframe (selected-frame)) + (params parameters) frame) (unless frame-creation-function (error "Don't know how to create a frame on window system %s" w)) + ;; Add parameters from `window-system-default-frame-alist'. + (dolist (p (cdr (assq w window-system-default-frame-alist))) + (unless (memq (car p) params) + (push p params))) + ;; Add parameters from `default-frame-alist'. + (dolist (p default-frame-alist) + (unless (memq (car p) params) + (push p params))) + ;; Now make the frame. (run-hooks 'before-make-frame-hook) - (setq frame - (funcall frame-creation-function - (append parameters - (cdr (assq w window-system-default-frame-alist))))) + (setq frame (funcall frame-creation-function params)) (normal-erase-is-backspace-setup-frame frame) ;; Inherit the original frame's parameters. (dolist (param frame-inherited-parameters) diff -r 10cf940285f9 -r bcedeeedc5fb lisp/ruler-mode.el --- a/lisp/ruler-mode.el Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/ruler-mode.el Thu Jul 01 22:47:18 2010 +0000 @@ -557,15 +557,14 @@ (defun ruler--save-header-line-format () "Install the header line format for Ruler mode. -Unless if Ruler mode is already enabled, save the old header line +Unless Ruler mode is already enabled, save the old header line format first." - (when enable - (when (and (not ruler-mode) - (local-variable-p 'header-line-format) - (not (local-variable-p 'ruler-mode-header-line-format-old))) - (set (make-local-variable 'ruler-mode-header-line-format-old) - header-line-format)) - (setq header-line-format ruler-mode-header-line-format))) + (when (and (not ruler-mode) + (local-variable-p 'header-line-format) + (not (local-variable-p 'ruler-mode-header-line-format-old))) + (set (make-local-variable 'ruler-mode-header-line-format-old) + header-line-format)) + (setq header-line-format ruler-mode-header-line-format)) ;;;###autoload (define-minor-mode ruler-mode diff -r 10cf940285f9 -r bcedeeedc5fb lisp/startup.el --- a/lisp/startup.el Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/startup.el Thu Jul 01 22:47:18 2010 +0000 @@ -899,10 +899,11 @@ (setq no-blinking-cursor t))))) (frame-initialize)) - ;; Set up the tool-bar (even in tty frames, since Emacs might open a - ;; graphical frame later). - (unless noninteractive - (tool-bar-setup)) + (when (fboundp 'x-create-frame) + ;; Set up the tool-bar (even in tty frames, since Emacs might open a + ;; graphical frame later). + (unless noninteractive + (tool-bar-setup))) ;; Turn off blinking cursor if so specified in X resources. This is here ;; only because all other settings of no-blinking-cursor are here. diff -r 10cf940285f9 -r bcedeeedc5fb lisp/url/ChangeLog --- a/lisp/url/ChangeLog Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/url/ChangeLog Thu Jul 01 22:47:18 2010 +0000 @@ -1,3 +1,9 @@ +2010-07-01 Mark A. Hershberger + + * url-http.el (url-http-create-request): Add a CRLF on the end so + that POSTs with content to https urls work. See + + 2010-06-22 Mark A. Hershberger * url-parse.el (url-user-for-url, url-password-for-url): diff -r 10cf940285f9 -r bcedeeedc5fb lisp/url/url-http.el --- a/lisp/url/url-http.el Wed Jun 30 22:57:08 2010 +0000 +++ b/lisp/url/url-http.el Thu Jul 01 22:47:18 2010 +0000 @@ -339,7 +339,7 @@ ;; End request "\r\n" ;; Any data - url-http-data)) + url-http-data "\r\n")) "")) (url-http-debug "Request is: \n%s" request) request)) diff -r 10cf940285f9 -r bcedeeedc5fb src/ChangeLog --- a/src/ChangeLog Wed Jun 30 22:57:08 2010 +0000 +++ b/src/ChangeLog Thu Jul 01 22:47:18 2010 +0000 @@ -1,3 +1,35 @@ +2010-07-01 Jan Djärv + + * window.c (Fwindow_absolute_pixel_edges): Doc fix. + + * window.c (calc_absolute_offset, Fwindow_absolute_pixel_edges) + (Fwindow_inside_absolute_pixel_edges): New functions (bug#5721). + + * nsfns.m (compute_tip_xy): Do not convert coordinates from frame + parameters, they are already absolute. + + * nsterm.m (x_set_window_size, initFrameFromEmacs): Renamed + FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT. + + * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGH + + * nsmenu.m (update_frame_tool_bar, free_frame_tool_bar): Update + FRAME_TOOLBAR_HEIGHT. + + * nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): Add + BLOCK/UNBLOCK_INPUT so asserts don't trigger. + +2010-06-30 Chong Yidong + + * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't + check default-frame-alist. + +2010-06-30 Andreas Schwab + + * process.c (create_process): Avoid using invalid file descriptors. + + * callproc.c (child_setup): Avoid closing a file descriptor twice. + 2010-06-30 Jan Djärv * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font): @@ -77,7 +109,7 @@ properties instead to get old x and y position. (xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size, gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size, - gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment. + gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment. (xg_get_tool_bar_widgets): New function. (xg_tool_bar_menu_proxy, xg_show_toolbar_item) (update_frame_tool_bar): Call xg_get_tool_bar_widgets. @@ -117,7 +149,7 @@ * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar. - * gtkutil.h (xg_show_scroll_bar): : Remove. + * gtkutil.h (xg_show_scroll_bar): Remove. * gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed if height is less than scroll bar min size. diff -r 10cf940285f9 -r bcedeeedc5fb src/callproc.c --- a/src/callproc.c Wed Jun 30 22:57:08 2010 +0000 +++ b/src/callproc.c Thu Jul 01 22:47:18 2010 +0000 @@ -1244,8 +1244,10 @@ dup2 (out, 1); dup2 (err, 2); emacs_close (in); - emacs_close (out); - emacs_close (err); + if (out != in) + emacs_close (out); + if (err != in && err != out) + emacs_close (err); #endif /* not MSDOS */ #endif /* not WINDOWSNT */ diff -r 10cf940285f9 -r bcedeeedc5fb src/frame.c --- a/src/frame.c Wed Jun 30 22:57:08 2010 +0000 +++ b/src/frame.c Thu Jul 01 22:47:18 2010 +0000 @@ -627,8 +627,7 @@ /* Get a suitable value for frame parameter PARAMETER for a newly created frame, based on (1) the user-supplied frame parameter - alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else - fails, (3) Vdefault_frame_alist. */ + alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */ static Lisp_Object get_future_frame_param (Lisp_Object parameter, @@ -642,8 +641,6 @@ result = Fassq (parameter, XFRAME (selected_frame)->param_alist); if (NILP (result) && current_value != NULL) result = build_string (current_value); - if (NILP (result)) - result = Fassq (parameter, Vdefault_frame_alist); if (!NILP (result) && !STRINGP (result)) result = XCDR (result); if (NILP (result) || !STRINGP (result)) @@ -748,7 +745,6 @@ adjust_glyphs (f); calculate_costs (f); XSETFRAME (frame, f); - Fmodify_frame_parameters (frame, Vdefault_frame_alist); Fmodify_frame_parameters (frame, parms); Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, build_string (t->display_info.tty->type)), diff -r 10cf940285f9 -r bcedeeedc5fb src/nsfns.m --- a/src/nsfns.m Wed Jun 30 22:57:08 2010 +0000 +++ b/src/nsfns.m Thu Jul 01 22:47:18 2010 +0000 @@ -2412,22 +2412,27 @@ /* Start with user-specified or mouse position. */ left = Fcdr (Fassq (Qleft, parms)); - if (INTEGERP (left)) - pt.x = XINT (left); - else - pt.x = last_mouse_motion_position.x; top = Fcdr (Fassq (Qtop, parms)); - if (INTEGERP (top)) - pt.y = XINT (top); + + if (!INTEGERP (left) || !INTEGERP (top)) + { + pt = last_mouse_motion_position; + /* Convert to screen coordinates */ + pt = [view convertPoint: pt toView: nil]; + pt = [[view window] convertBaseToScreen: pt]; + } else - pt.y = last_mouse_motion_position.y; - - /* Convert to screen coordinates */ - pt = [view convertPoint: pt toView: nil]; - pt = [[view window] convertBaseToScreen: pt]; - + { + /* Absolute coordinates. */ + pt.x = XINT (left); + pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top) + - height; + } + /* Ensure in bounds. (Note, screen origin = lower left.) */ - if (pt.x + XINT (dx) <= 0) + if (INTEGERP (left)) + *root_x = pt.x; + else if (pt.x + XINT (dx) <= 0) *root_x = 0; /* Can happen for negative dx */ else if (pt.x + XINT (dx) + width <= x_display_pixel_width (FRAME_NS_DISPLAY_INFO (f))) @@ -2440,7 +2445,9 @@ /* Put it left justified on the screen -- it ought to fit that way. */ *root_x = 0; - if (pt.y - XINT (dy) - height >= 0) + if (INTEGERP (top)) + *root_y = pt.y; + else if (pt.y - XINT (dy) - height >= 0) /* It fits below the pointer. */ *root_y = pt.y - height - XINT (dy); else if (pt.y + XINT (dy) + height diff -r 10cf940285f9 -r bcedeeedc5fb src/nsmenu.m --- a/src/nsmenu.m Wed Jun 30 22:57:08 2010 +0000 +++ b/src/nsmenu.m Thu Jul 01 22:47:18 2010 +0000 @@ -999,7 +999,10 @@ Under NS we just hide the toolbar until it might be needed again. -------------------------------------------------------------------------- */ { + BLOCK_INPUT; [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; + FRAME_TOOLBAR_HEIGHT (f) = 0; + UNBLOCK_INPUT; } void @@ -1009,8 +1012,11 @@ -------------------------------------------------------------------------- */ { int i; - EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; + EmacsView *view = FRAME_NS_VIEW (f); + NSWindow *window = [view window]; + EmacsToolbar *toolbar = [view toolbar]; + BLOCK_INPUT; [toolbar clearActive]; /* update EmacsToolbar as in GtkUtils, build items list */ @@ -1094,6 +1100,10 @@ [newDict release]; } + FRAME_TOOLBAR_HEIGHT (f) = + NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) + - FRAME_NS_TITLEBAR_HEIGHT (f); + UNBLOCK_INPUT; } diff -r 10cf940285f9 -r bcedeeedc5fb src/nsterm.h --- a/src/nsterm.h Wed Jun 30 22:57:08 2010 +0000 +++ b/src/nsterm.h Thu Jul 01 22:47:18 2010 +0000 @@ -606,7 +606,7 @@ #define NS_FACE_FOREGROUND(f) ((f)->foreground) #define NS_FACE_BACKGROUND(f) ((f)->background) #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) -#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) +#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) #define FONT_WIDTH(f) ((f)->max_width) #define FONT_HEIGHT(f) ((f)->height) diff -r 10cf940285f9 -r bcedeeedc5fb src/nsterm.m --- a/src/nsterm.m Wed Jun 30 22:57:08 2010 +0000 +++ b/src/nsterm.m Thu Jul 01 22:47:18 2010 +0000 @@ -1138,15 +1138,15 @@ /* NOTE: previously this would generate wrong result if toolbar not yet displayed and fixing toolbar_height=32 helped, but now (200903) seems no longer needed */ - FRAME_NS_TOOLBAR_HEIGHT (f) = + FRAME_TOOLBAR_HEIGHT (f) = NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) - FRAME_NS_TITLEBAR_HEIGHT (f); else - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; wr.size.width = pixelwidth + f->border_width; wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_NS_TOOLBAR_HEIGHT (f); + + FRAME_TOOLBAR_HEIGHT (f); /* constrain to screen if we can */ if (screen) @@ -4894,16 +4894,16 @@ rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height #ifdef NS_IMPL_GNUSTEP - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3 - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #else - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #endif if (rows < MINHEIGHT) rows = MINHEIGHT; frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) + FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - + FRAME_NS_TOOLBAR_HEIGHT (emacsframe); + + FRAME_TOOLBAR_HEIGHT (emacsframe); #ifdef NS_IMPL_COCOA { /* this sets window title to have size in it; the wm does this under GS */ @@ -5114,7 +5114,7 @@ [toggleButton setTarget: self]; [toggleButton setAction: @selector (toggleToolbar: )]; #endif - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; tem = f->icon_name; if (!NILP (tem)) diff -r 10cf940285f9 -r bcedeeedc5fb src/process.c --- a/src/process.c Wed Jun 30 22:57:08 2010 +0000 +++ b/src/process.c Thu Jul 01 22:47:18 2010 +0000 @@ -2038,7 +2038,7 @@ process_set_signal to fail on SGI when using a pipe. */ setsid (); /* Make the pty's terminal the controlling terminal. */ - if (pty_flag) + if (pty_flag && xforkin >= 0) { #ifdef TIOCSCTTY /* We ignore the return value @@ -2081,8 +2081,11 @@ /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? I can't test it since I don't have 4.3. */ int j = emacs_open ("/dev/tty", O_RDWR, 0); - ioctl (j, TIOCNOTTY, 0); - emacs_close (j); + if (j >= 0) + { + ioctl (j, TIOCNOTTY, 0); + emacs_close (j); + } #ifndef USG /* In order to get a controlling terminal on some versions of BSD, it is necessary to put the process in pgrp 0 diff -r 10cf940285f9 -r bcedeeedc5fb src/window.c --- a/src/window.c Wed Jun 30 22:57:08 2010 +0000 +++ b/src/window.c Thu Jul 01 22:47:18 2010 +0000 @@ -652,6 +652,48 @@ Qnil)))); } +static void +calc_absolute_offset(struct window *w, int *add_x, int *add_y) +{ + struct frame *f = XFRAME (w->frame); + *add_y = f->top_pos; +#ifdef FRAME_MENUBAR_HEIGHT + *add_y += FRAME_MENUBAR_HEIGHT (f); +#endif +#ifdef FRAME_TOOLBAR_HEIGHT + *add_y += FRAME_TOOLBAR_HEIGHT (f); +#endif +#ifdef FRAME_NS_TITLEBAR_HEIGHT + *add_y += FRAME_NS_TITLEBAR_HEIGHT (f); +#endif + *add_x = f->left_pos; +} + +DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, + Swindow_absolute_pixel_edges, 0, 1, 0, + doc: /* Return a list of the edge pixel coordinates of WINDOW. +The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at +the top left corner of the display. + +RIGHT is one more than the rightmost x position occupied by WINDOW. +BOTTOM is one more than the bottommost y position occupied by WINDOW. +The pixel edges include the space used by WINDOW's scroll bar, display +margins, fringes, header line, and/or mode line. For the pixel edges +of just the text area, use `window-inside-absolute-pixel-edges'. */) + (window) + Lisp_Object window; +{ + register struct window *w = decode_any_window (window); + int add_x, add_y; + calc_absolute_offset(w, &add_x, &add_y); + + return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), + Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y), + Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x), + Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y), + Qnil)))); +} + DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, doc: /* Return a list of the edge coordinates of WINDOW. The list has the form (LEFT TOP RIGHT BOTTOM). @@ -705,6 +747,36 @@ - WINDOW_MODE_LINE_HEIGHT (w))); } +DEFUN ("window-inside-absolute-pixel-edges", + Fwindow_inside_absolute_pixel_edges, + Swindow_inside_absolute_pixel_edges, 0, 1, 0, + doc: /* Return a list of the edge pixel coordinates of WINDOW. +The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at +the top left corner of the display. + +RIGHT is one more than the rightmost x position of WINDOW's text area. +BOTTOM is one more than the bottommost y position of WINDOW's text area. +The inside edges do not include the space used by WINDOW's scroll bar, +display margins, fringes, header line, and/or mode line. */) + (window) + Lisp_Object window; +{ + register struct window *w = decode_any_window (window); + int add_x, add_y; + calc_absolute_offset(w, &add_x, &add_y); + + return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) + + WINDOW_LEFT_MARGIN_WIDTH (w) + + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), + make_number (WINDOW_TOP_EDGE_Y (w) + + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), + make_number (WINDOW_BOX_RIGHT_EDGE_X (w) + - WINDOW_RIGHT_MARGIN_WIDTH (w) + - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), + make_number (WINDOW_BOTTOM_EDGE_Y (w) + - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); +} + /* Test if the character at column *X, row *Y is within window W. If it is not, return ON_NOTHING; if it is in the window's text area, @@ -7312,8 +7384,10 @@ defsubr (&Sset_window_redisplay_end_trigger); defsubr (&Swindow_edges); defsubr (&Swindow_pixel_edges); + defsubr (&Swindow_absolute_pixel_edges); defsubr (&Swindow_inside_edges); defsubr (&Swindow_inside_pixel_edges); + defsubr (&Swindow_inside_absolute_pixel_edges); defsubr (&Scoordinates_in_window_p); defsubr (&Swindow_at); defsubr (&Swindow_point);