diff options
author | Glenn Morris <rgm@gnu.org> | 2018-12-10 09:43:05 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-12-10 09:43:05 -0800 |
commit | 3d353ce585e4f9726b59b054218aaa0923d77fea (patch) | |
tree | 985b48667adc151eff87dfd85ac598c2c23c3fd0 | |
parent | 874f69acecf0c6c3c4886375c092fb389d207241 (diff) | |
parent | 908af9dfc46f783c89d06cb48d9499eb6a582d3e (diff) | |
download | emacs-3d353ce585e4f9726b59b054218aaa0923d77fea.tar.gz |
Merge from origin/emacs-26
908af9d Indexing followup to recent changes
505ac9a Improve documentation of cursor-sensor.el (bug#33664)
d817d2c * doc/lispref/commands.texi (Adjusting Point): Bug#33662
18442da Tramp multi-hop methods must be inline
1e3e24d ; * src/xterm.c (x_update_begin): Fix whitespace.
1d743d2 Fix scaling problem in Cairo builds
2b9e993 ; * doc/lispref/text.texi (Special Properties): Fix wording. ...
e568202 * lisp/simple.el (next-line-or-history-element): Use current-...
c7897c2 A few further fixes of window internals description
# Conflicts:
# doc/misc/tramp.texi
-rw-r--r-- | doc/lispref/commands.texi | 3 | ||||
-rw-r--r-- | doc/lispref/internals.texi | 96 | ||||
-rw-r--r-- | doc/lispref/text.texi | 10 | ||||
-rw-r--r-- | doc/misc/tramp.texi | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/cursor-sensor.el | 26 | ||||
-rw-r--r-- | lisp/simple.el | 22 | ||||
-rw-r--r-- | src/window.h | 142 | ||||
-rw-r--r-- | src/xterm.c | 14 |
8 files changed, 210 insertions, 105 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 427379bc79c..b6749d0a0cc 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -1012,7 +1012,8 @@ If the last event came from a keyboard macro, the value is @code{macro}. sequence of text that has the @code{display} or @code{composition} property, or is invisible. Therefore, after a command finishes and returns to the command loop, if point is within such a sequence, the -command loop normally moves point to the edge of the sequence. +command loop normally moves point to the edge of the sequence, making this +sequence effectively intangible. A command can inhibit this feature by setting the variable @code{disable-point-adjustment}: diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index a2f7e8c792b..dddbf38c591 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -2033,45 +2033,76 @@ if that window no longer displays this buffer. The frame that this window is on, as a Lisp object. @item mini -Non-zero if this window is a minibuffer window. +Non-zero if this window is a minibuffer window, a window showing the +minibuffer or the echo area. + +@item pseudo_window_p +@cindex pseudo window +Non-zero if this window is a @dfn{pseudo window}. A pseudo window is +either a window used to display the menu bar or the tool bar (when +Emacs uses toolkits that don't display their own menu bar and tool +bar) or a window showing a tooltip on a tooltip frame. Pseudo windows +are in general not accessible from Lisp code. @item parent -Internally, Emacs arranges windows in a tree; each group of siblings has -a parent window whose area includes all the siblings. This field points -to a window's parent, as a Lisp object. +Internally, Emacs arranges windows in a tree; each group of siblings +has a parent window whose area includes all the siblings. This field +points to the window's parent in that tree, as a Lisp object. For the +root window of the tree and a minibuffer window this is always +@code{nil}. Parent windows do not display buffers, and play little role in display -except to shape their child windows. Emacs Lisp programs usually have -no access to the parent windows; they operate on the windows at the +except to shape their child windows. Emacs Lisp programs cannot +directly manipulate parent windows; they operate on the windows at the leaves of the tree, which actually display buffers. +@item contents +For a leaf window and windows showing a tooltip, this is the buffer, +as a Lisp object, that the window is displaying. For an internal +(``parent'') window, this is its first child window. For a pseudo +window showing a menu or tool bar this is @code{nil}. It is also +@code{nil} for a window that has been deleted. + @item next @itemx prev -The next sibling and previous sibling of this window. @code{next} is -@code{nil} if the window is the right-most or bottom-most in its group; -@code{prev} is @code{nil} if it is the left-most or top-most in its -group. Whether the sibling is left/right or up/down is determined by -the @code{horizontal} field: if it's non-zero, the siblings are -arranged horizontally. +The next and previous sibling of this window as Lisp objects. +@code{next} is @code{nil} if the window is the right-most or +bottom-most in its group; @code{prev} is @code{nil} if it is the +left-most or top-most in its group. Whether the sibling is left/right +or up/down is determined by the @code{horizontal} field of the +sibling's parent: if it's non-zero, the siblings are arranged +horizontally. + +As a special case, @code{next} of a frame's root window points to the +frame's minibuffer window, provided this is not a minibuffer-only or +minibuffer-less frame. On such frames @code{prev} of the minibuffer +window points to that frame's root window. In any other case, the +root window's @code{next} and the minibuffer window's (if present) +@code{prev} fields are @code{nil}. @item left_col The left-hand edge of the window, measured in columns, relative to the -leftmost column in the frame (column 0). +leftmost column (column 0) of the window's native frame. @item top_line The top edge of the window, measured in lines, relative to the topmost -line in the frame (line 0). +line (line 0) of the window's native frame. + +@item pixel_left +@itemx pixel_top +The left-hand and top edges of this window, measured in pixels, +relative to the top-left corner (0, 0) of the window's native frame. @item total_cols @itemx total_lines -The width and height of the window, measured in columns and lines -respectively. The width includes the scroll bar and fringes, and/or -the separator line on the right of the window (if any). +The total width and height of the window, measured in columns and +lines respectively. The values include scroll bars and fringes, +dividers and/or the separator line on the right of the window (if +any). -@item contents -For leaf windows, this is the buffer, as a Lisp object, that the -window is displaying. For an internal (``parent'') window, this is -its child window. It can also be @code{nil}, for a pseudo-window. +@item pixel_width; +@itemx pixel_height; +The total width and height of the window measured in pixels. @item start A marker pointing to the position in the buffer that is the first @@ -2125,8 +2156,14 @@ in this window. A non-zero value means the window's buffer was modified when the window was last updated. -@item vertical_scroll_bar -This window's vertical scroll bar, a Lisp object. +@item vertical_scroll_bar_type +@itemx horizontal_scroll_bar_type +The types of this window's vertical and horizontal scroll bars. + +@item scroll_bar_width +@itemx scroll_bar_height +The width of this window's vertical scroll bar and the height of this +window's horizontal scroll bar, in pixels. @item left_margin_cols @itemx right_margin_cols @@ -2210,6 +2247,14 @@ Vertical scroll amount, in pixels. Normally, this is 0. @item dedicated Non-@code{nil} if this window is dedicated to its buffer. +@item combination_limit +This window's combination limit, meaningful only for a parent window. +If this is @code{t}, then it is not allowed to delete this window and +recombine its child windows with other siblings of this window. + +@item window_parameters +The alist of this window's parameters. + @item display_table The window's display table, or @code{nil} if none is specified for it. @@ -2234,11 +2279,6 @@ the line number as long as the window shows that buffer. The column number currently displayed in this window's mode line, or @minus{}1 if column numbers are not being displayed. -@item pseudo_window_p -This is non-zero for windows that display the menu bar and the tool -bar (when Emacs uses toolkits that don't display their own menu bar -and tool bar). - @item current_matrix @itemx desired_matrix Glyph matrices describing the current and desired display of this window. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 51d2753f404..6d93264758f 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3496,9 +3496,14 @@ property is obsolete; use the @code{cursor-intangible} property instead. @kindex cursor-intangible @r{(text property)} @findex cursor-intangible-mode When the minor mode @code{cursor-intangible-mode} is turned on, point -is moved away of any position that has a non-@code{nil} +is moved away from any position that has a non-@code{nil} @code{cursor-intangible} property, just before redisplay happens. +@vindex cursor-sensor-inhibit +When the variable @code{cursor-sensor-inhibit} is non-@code{nil}, the +@code{cursor-intangible} property and the +@code{cursor-sensor-functions} property (described below) are ignored. + @item field @kindex field @r{(text property)} Consecutive characters with the same @code{field} property constitute a @@ -3680,6 +3685,9 @@ depending on whether the cursor is entering the text that has this property or leaving it. The functions are called only when the minor mode @code{cursor-sensor-mode} is turned on. +When the variable @code{cursor-sensor-inhibit} is non-@code{nil}, the +@code{cursor-sensor-functions} property is ignored. + @item composition @kindex composition @r{(text property)} This text property is used to display a sequence of characters as a diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index d5a45ad27c6..5c5402133a7 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2739,6 +2739,8 @@ proxy @samp{bird@@bastion} to a remote file on @samp{you@@remotehost}: @kbd{C-x C-f @value{prefix}ssh@value{postfixhop}bird@@bastion|ssh@value{postfixhop}you@@remotehost@value{postfix}/path @key{RET}} @end example +Each involved method must be an inline method (@pxref{Inline methods}). + @value{tramp} adds the ad-hoc definitions on the fly to @code{tramp-default-proxies-alist} and is available for re-use during that Emacs session. Subsequent @value{tramp} connections to diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el index 7e3088dd91e..21c48f830f2 100644 --- a/lisp/emacs-lisp/cursor-sensor.el +++ b/lisp/emacs-lisp/cursor-sensor.el @@ -22,17 +22,29 @@ ;;; Commentary: -;; This package implements the `cursor-intangible' property, which is -;; meant to replace the old `intangible' property. To use it, just enable the -;; `cursor-intangible-mode', after which this package will move point away from -;; any position that has a non-nil `cursor-intangible' property. This is only -;; done just before redisplay happens, contrary to the old `intangible' -;; property which was done at a much lower level. +;; This package implements the `cursor-intangible' and +;; `cursor-sensor-functions' properties, which are meant to replace +;; the old `intangible', `point-entered', and `point-left' properties. + +;; To use `cursor-intangible', just enable the +;; `cursor-intangible-mode' minor mode, after which this package will +;; move point away from any position that has a non-nil +;; `cursor-intangible' property. This is only done just before +;; redisplay happens, contrary to the old `intangible' property which +;; was done at a much lower level. + +;; To use `cursor-sensor-functions', enable the `cursor-sensor-mode' +;; minor mode, after which the `cursor-sensor-functions' will be +;; called just before redisplay happens, according to the movement of +;; the cursor since the last redisplay. ;;; Code: ;;;###autoload -(defvar cursor-sensor-inhibit nil) +(defvar cursor-sensor-inhibit nil + "When non-nil, suspend `cursor-sensor-mode' and `cursor-intangible-mode'. +By convention, this is a list of symbols where each symbol stands for the +\"cause\" of the suspension.") (defun cursor-sensor--intangible-p (pos) (let ((p (get-pos-property pos 'cursor-intangible))) diff --git a/lisp/simple.el b/lisp/simple.el index db59b9f5bc3..6eb56b73c09 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2172,7 +2172,11 @@ next element of the minibuffer history in the minibuffer." (prompt-end (minibuffer-prompt-end)) (old-column (unless (and (eolp) (> (point) prompt-end)) (if (= (line-number-at-pos) 1) - (max (- (current-column) (1- prompt-end)) 0) + (max (- (current-column) + (save-excursion + (goto-char (1- prompt-end)) + (current-column))) + 0) (current-column))))) (condition-case nil (with-no-warnings @@ -2191,7 +2195,10 @@ next element of the minibuffer history in the minibuffer." (goto-char (point-max)) (when old-column (if (= (line-number-at-pos) 1) - (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column (+ old-column + (save-excursion + (goto-char (1- (minibuffer-prompt-end))) + (current-column)))) (move-to-column old-column))))))) (defun previous-line-or-history-element (&optional arg) @@ -2206,7 +2213,11 @@ previous element of the minibuffer history in the minibuffer." (prompt-end (minibuffer-prompt-end)) (old-column (unless (and (eolp) (> (point) prompt-end)) (if (= (line-number-at-pos) 1) - (max (- (current-column) (1- prompt-end)) 0) + (max (- (current-column) + (save-excursion + (goto-char (1- prompt-end)) + (current-column))) + 0) (current-column))))) (condition-case nil (with-no-warnings @@ -2225,7 +2236,10 @@ previous element of the minibuffer history in the minibuffer." (goto-char (minibuffer-prompt-end)) (if old-column (if (= (line-number-at-pos) 1) - (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column (+ old-column + (save-excursion + (goto-char (1- (minibuffer-prompt-end))) + (current-column)))) (move-to-column old-column)) ;; Put the cursor at the end of the visual line instead of the ;; logical line, so the next `previous-line-or-history-element' diff --git a/src/window.h b/src/window.h index b3673a0b454..4bb6293435c 100644 --- a/src/window.h +++ b/src/window.h @@ -24,57 +24,69 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ INLINE_HEADER_BEGIN -/* Windows are allocated as if they were vectors, but then the -Lisp data type is changed to Lisp_Window. They are garbage -collected along with the vectors. +/* Windows are allocated as if they were vectors, but then the Lisp +data type is changed to Lisp_Window. They are garbage collected along +with the vectors. All windows in use are arranged into a tree, with pointers up and down. -Windows that are leaves of the tree are actually displayed -and show the contents of buffers. Windows that are not leaves -are used for representing the way groups of leaf windows are -arranged on the frame. Leaf windows never become non-leaves. -They are deleted only by calling delete-window on them (but -this can be done implicitly). Combination windows can be created -and deleted at any time. - -A leaf window has a buffer stored in contents field and markers in its start -and pointm fields. Non-leaf windows have nil in the latter two fields. - -Non-leaf windows are either vertical or horizontal combinations. - -A vertical combination window has children that are arranged on the frame -one above the next. Its contents field points to the uppermost child. -The parent field of each of the children points to the vertical -combination window. The next field of each child points to the -child below it, or is nil for the lowest child. The prev field -of each child points to the child above it, or is nil for the -highest child. - -A horizontal combination window has children that are side by side. -Its contents field points to the leftmost child. In each child -the next field points to the child to the right and the prev field -points to the child to the left. - -The children of a vertical combination window may be leaf windows -or horizontal combination windows. The children of a horizontal -combination window may be leaf windows or vertical combination windows. - -At the top of the tree are two windows which have nil as parent. -The second of these is minibuf_window. The first one manages all -the frame area that is not minibuffer, and is called the root window. -Different windows can be the root at different times; -initially the root window is a leaf window, but if more windows -are created then that leaf window ceases to be root and a newly -made combination window becomes root instead. - -In any case, on screens which have an ordinary window and a -minibuffer, prev of the minibuf window is the root window and next of -the root window is the minibuf window. On minibufferless screens or -minibuffer-only screens, the root window and the minibuffer window are -one and the same, so its prev and next members are nil. - -A dead window has its contents field set to nil. */ +Windows that are leaves of the tree are actually displayed and show +the contents of buffers. Windows that are not leaves are used for +representing the way groups of leaf windows are arranged on the frame. +Leaf windows never become non-leaves. They are deleted only by +calling `delete-window' on them (but this can be done implicitly). +Non-leaf windows never become leaf windows and can be created and +deleted at any time by the window management code. Non-leaf windows +can be seen but not directly manipulated by Lisp functions. + +A leaf window has a buffer stored in its contents field and markers in +its 'start' and 'pointm' fields. Non-leaf windows have nil in the +latter two fields. Non-leaf windows are either vertical or horizontal +combinations. + +A vertical combination window has children that are arranged on the +frame one above the next. Its 'contents' field points to the +uppermost child. The 'parent' field of each of the children points to +the vertical combination window. The 'next' field of each child +points to the child below it, or is nil for the lowest child. The +'prev' field of each child points to the child above it, or is nil for +the highest child. + +A horizontal combination window has children that are arranged side by +side. Its 'contents' field points to the leftmost child. In each +child the 'next' field points to the child to the right and the 'prev' +field points to the child to the left. + +On each frame there are at least one and at most two windows which +have nil as parent. The second of these, if present, is the frame's +minibuffer window and shows the minibuffer or the echo area. The +first one manages the remaining frame area and is called the frame's +root window. Different windows can be the root at different times; +initially the root window is a leaf window, but if more windows are +created, then that leaf window ceases to be root and a newly made +combination window becomes the root instead. + +On frames which have an ordinary window and a minibuffer window, +'prev' of the minibuffer window is the root window and 'next' of the +root window is the minibuffer window. On minibuffer-less frames there +is only a root window and 'next' of the root window is nil. On +minibuffer-only frames, the root window and the minibuffer window are +one and the same, so its 'prev' and 'next' members are nil. In any +case, 'prev' of a root window and 'next' of a minibuffer window are +always nil. + +In Lisp parlance, leaf windows are called "live windows" and non-leaf +windows are called "internal windows". Together, live and internal +windows form the set of "valid windows". A window that has been +deleted is considered "dead" regardless of whether it formerly was a +leaf or a non-leaf window. A dead window has its 'contents' field set +to nil. + +Frames may also contain pseudo windows, windows that are not exposed +directly to Lisp code. Pseudo windows are currently either used to +display the menu bar or the tool bar (when Emacs uses toolkits that +don't display their own menu bar and tool bar) or a tooltip in a +tooltip frame (when tooltips are not display by the toolkit). */ struct cursor_pos { @@ -95,29 +107,39 @@ struct window /* Following (to right or down) and preceding (to left or up) child at same level of tree. Whether this is left/right or - up/down is determined by the 'horizontal' flag, see below. - A minibuffer window has the frame's root window pointed by 'prev'. */ + up/down is determined by the parent window's 'horizontal' flag, + see below. On a frame that is neither a minibuffer-only nor a + minibuffer-less frame, 'next' of the root window points to the + frame's minibuffer window and 'prev' of the minibuffer window + points to the frame's root window. In all other cases, 'next' + of the root window and 'prev' of the minibuffer window, if + present, are nil. 'prev' of the root window and 'next' of the + minibuffer window are always nil. */ Lisp_Object next; Lisp_Object prev; - /* The window this one is a child of. For a minibuffer window: nil. */ + /* The window this one is a child of. For the root and a + minibuffer window this is always nil. */ Lisp_Object parent; - /* The normal size of the window. These are fractions, but we do - not use C doubles to avoid creating new Lisp_Float objects while - interfacing Lisp in Fwindow_normal_size. */ + /* The "normal" size of the window. These are fractions, but we + do not use C doubles to avoid creating new Lisp_Float objects + while interfacing Lisp in Fwindow_normal_size. */ Lisp_Object normal_lines; Lisp_Object normal_cols; - /* New sizes of the window. Note that Lisp code may set new_normal - to something beyond an integer, so C int can't be used here. */ + /* The new sizes of the window as proposed by the window resizing + functions. Note that Lisp code may set new_normal to something + beyond an integer, so C int can't be used here. */ Lisp_Object new_total; Lisp_Object new_normal; Lisp_Object new_pixel; - /* For a leaf window: a buffer; for an internal window: a window; - for a pseudo-window (such as menu bar or tool bar): nil. It is - a buffer for a minibuffer window as well. */ + /* For a leaf window or a tooltip window this is the buffer shown + in the window; for a combination window this is the first of + its child windows; for a pseudo window showing the menu bar or + tool bar this is nil. It is a buffer for a minibuffer window + as well. */ Lisp_Object contents; /* A marker pointing to where in the text to start displaying. @@ -195,7 +217,7 @@ struct window /* The two Lisp_Object fields below are marked in a special way, which is why they're placed after `current_matrix'. */ - /* Alist of <buffer, window-start, window-point> triples listing + /* A list of <buffer, window-start, window-point> triples listing buffers previously shown in this window. */ Lisp_Object prev_buffers; /* List of buffers re-shown in this window. */ diff --git a/src/xterm.c b/src/xterm.c index 3a7e31e7129..943f4c3b3d8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,10 +360,15 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { + int scale = 1; +#ifdef USE_GTK + scale = xg_get_scale (f); +#endif + FRAME_CR_SURFACE (f) = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); + scale * FRAME_PIXEL_WIDTH (f), + scale * FRAME_PIXEL_HEIGHT (f)); } cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; @@ -999,8 +1004,9 @@ x_update_begin (struct frame *f) if (FRAME_GTK_WIDGET (f)) { GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - width = gdk_window_get_width (w); - height = gdk_window_get_height (w); + int scale = xg_get_scale (f); + width = scale * gdk_window_get_width (w); + height = scale * gdk_window_get_height (w); } else #endif |