diff options
| author | Gerd Möllmann | 2024-10-05 18:55:18 +0200 |
|---|---|---|
| committer | Gerd Möllmann | 2024-10-05 18:55:18 +0200 |
| commit | beb5b77123619758c1def6b9f227fa7568516775 (patch) | |
| tree | 809e025df6a48b10f3022558f23840a8def6cbec /lisp | |
| parent | 069ecc9c4c3709246a6ff50d09af418444d427c3 (diff) | |
| download | emacs-tty-child-frames.tar.gz emacs-tty-child-frames.zip | |
Preview from my branch on githubtty-child-frames
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/frame.el | 47 | ||||
| -rw-r--r-- | lisp/xt-mouse.el | 11 |
2 files changed, 34 insertions, 24 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 1b5aa8cff08..161b5acc42e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -1495,6 +1495,13 @@ FRAME defaults to the selected frame." | |||
| 1495 | (let ((edges (frame-edges frame 'outer-edges))) | 1495 | (let ((edges (frame-edges frame 'outer-edges))) |
| 1496 | (- (nth 3 edges) (nth 1 edges)))) | 1496 | (- (nth 3 edges) (nth 1 edges)))) |
| 1497 | 1497 | ||
| 1498 | (defun frame-at (x y) | ||
| 1499 | "Return frame containing pixel position X, Y." | ||
| 1500 | (cl-loop for frame in (frame-list-z-order) | ||
| 1501 | as (x0 y0 x1 y1) = (frame-edges frame) | ||
| 1502 | when (and (<= x0 x (1- x1)) (<= y0 y (1- y1))) | ||
| 1503 | return frame)) | ||
| 1504 | |||
| 1498 | (declare-function x-list-fonts "xfaces.c" | 1505 | (declare-function x-list-fonts "xfaces.c" |
| 1499 | (pattern &optional face frame maximum width)) | 1506 | (pattern &optional face frame maximum width)) |
| 1500 | 1507 | ||
| @@ -1722,6 +1729,7 @@ live frame and defaults to the selected one." | |||
| 1722 | (declare-function pgtk-frame-geometry "pgtkfns.c" (&optional frame)) | 1729 | (declare-function pgtk-frame-geometry "pgtkfns.c" (&optional frame)) |
| 1723 | (declare-function haiku-frame-geometry "haikufns.c" (&optional frame)) | 1730 | (declare-function haiku-frame-geometry "haikufns.c" (&optional frame)) |
| 1724 | (declare-function android-frame-geometry "androidfns.c" (&optional frame)) | 1731 | (declare-function android-frame-geometry "androidfns.c" (&optional frame)) |
| 1732 | (declare-function tty-frame-geometry "term.c" (&optional frame)) | ||
| 1725 | 1733 | ||
| 1726 | (defun frame-geometry (&optional frame) | 1734 | (defun frame-geometry (&optional frame) |
| 1727 | "Return geometric attributes of FRAME. | 1735 | "Return geometric attributes of FRAME. |
| @@ -1778,24 +1786,7 @@ and width values are in pixels. | |||
| 1778 | ((eq frame-type 'android) | 1786 | ((eq frame-type 'android) |
| 1779 | (android-frame-geometry frame)) | 1787 | (android-frame-geometry frame)) |
| 1780 | (t | 1788 | (t |
| 1781 | (list | 1789 | (tty-frame-geometry frame))))) |
| 1782 | '(outer-position 0 . 0) | ||
| 1783 | (cons 'outer-size (cons (frame-width frame) (frame-height frame))) | ||
| 1784 | '(external-border-size 0 . 0) | ||
| 1785 | '(outer-border-width . 0) | ||
| 1786 | '(title-bar-size 0 . 0) | ||
| 1787 | '(menu-bar-external . nil) | ||
| 1788 | (let ((menu-bar-lines (frame-parameter frame 'menu-bar-lines))) | ||
| 1789 | (cons 'menu-bar-size | ||
| 1790 | (if menu-bar-lines | ||
| 1791 | (cons (frame-width frame) 1) | ||
| 1792 | 1 0))) | ||
| 1793 | '(tool-bar-external . nil) | ||
| 1794 | '(tool-bar-position . nil) | ||
| 1795 | '(tool-bar-size 0 . 0) | ||
| 1796 | '(tab-bar-size 0 . 0) | ||
| 1797 | (cons 'internal-border-width | ||
| 1798 | (frame-parameter frame 'internal-border-width))))))) | ||
| 1799 | 1790 | ||
| 1800 | (defun frame--size-history (&optional frame) | 1791 | (defun frame--size-history (&optional frame) |
| 1801 | "Print history of resize operations for FRAME. | 1792 | "Print history of resize operations for FRAME. |
| @@ -1904,6 +1895,7 @@ of frames like calls to map a frame or change its visibility." | |||
| 1904 | (declare-function pgtk-frame-edges "pgtkfns.c" (&optional frame type)) | 1895 | (declare-function pgtk-frame-edges "pgtkfns.c" (&optional frame type)) |
| 1905 | (declare-function haiku-frame-edges "haikufns.c" (&optional frame type)) | 1896 | (declare-function haiku-frame-edges "haikufns.c" (&optional frame type)) |
| 1906 | (declare-function android-frame-edges "androidfns.c" (&optional frame type)) | 1897 | (declare-function android-frame-edges "androidfns.c" (&optional frame type)) |
| 1898 | (declare-function tty-frame-edges "term.c" (&optional frame type)) | ||
| 1907 | 1899 | ||
| 1908 | (defun frame-edges (&optional frame type) | 1900 | (defun frame-edges (&optional frame type) |
| 1909 | "Return coordinates of FRAME's edges. | 1901 | "Return coordinates of FRAME's edges. |
| @@ -1934,7 +1926,7 @@ FRAME." | |||
| 1934 | ((eq frame-type 'android) | 1926 | ((eq frame-type 'android) |
| 1935 | (android-frame-edges frame type)) | 1927 | (android-frame-edges frame type)) |
| 1936 | (t | 1928 | (t |
| 1937 | (list 0 0 (frame-width frame) (frame-height frame)))))) | 1929 | (tty-frame-edges frame type))))) |
| 1938 | 1930 | ||
| 1939 | (declare-function w32-mouse-absolute-pixel-position "w32fns.c") | 1931 | (declare-function w32-mouse-absolute-pixel-position "w32fns.c") |
| 1940 | (declare-function x-mouse-absolute-pixel-position "xfns.c") | 1932 | (declare-function x-mouse-absolute-pixel-position "xfns.c") |
| @@ -2087,6 +2079,7 @@ workarea attribute." | |||
| 2087 | ;; (declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display)) | 2079 | ;; (declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display)) |
| 2088 | (declare-function haiku-frame-list-z-order "haikufns.c" (&optional display)) | 2080 | (declare-function haiku-frame-list-z-order "haikufns.c" (&optional display)) |
| 2089 | (declare-function android-frame-list-z-order "androidfns.c" (&optional display)) | 2081 | (declare-function android-frame-list-z-order "androidfns.c" (&optional display)) |
| 2082 | (declare-function tty-frame-list-z-order "term.c" (&optional display)) | ||
| 2090 | 2083 | ||
| 2091 | (defun frame-list-z-order (&optional display) | 2084 | (defun frame-list-z-order (&optional display) |
| 2092 | "Return list of Emacs's frames, in Z (stacking) order. | 2085 | "Return list of Emacs's frames, in Z (stacking) order. |
| @@ -2114,7 +2107,9 @@ Return nil if DISPLAY contains no Emacs frame." | |||
| 2114 | ((eq frame-type 'haiku) | 2107 | ((eq frame-type 'haiku) |
| 2115 | (haiku-frame-list-z-order display)) | 2108 | (haiku-frame-list-z-order display)) |
| 2116 | ((eq frame-type 'android) | 2109 | ((eq frame-type 'android) |
| 2117 | (android-frame-list-z-order display))))) | 2110 | (android-frame-list-z-order display)) |
| 2111 | (t | ||
| 2112 | (tty-frame-list-z-order display))))) | ||
| 2118 | 2113 | ||
| 2119 | (declare-function x-frame-restack "xfns.c" (frame1 frame2 &optional above)) | 2114 | (declare-function x-frame-restack "xfns.c" (frame1 frame2 &optional above)) |
| 2120 | (declare-function w32-frame-restack "w32fns.c" (frame1 frame2 &optional above)) | 2115 | (declare-function w32-frame-restack "w32fns.c" (frame1 frame2 &optional above)) |
| @@ -2123,6 +2118,7 @@ Return nil if DISPLAY contains no Emacs frame." | |||
| 2123 | (declare-function haiku-frame-restack "haikufns.c" (frame1 frame2 &optional above)) | 2118 | (declare-function haiku-frame-restack "haikufns.c" (frame1 frame2 &optional above)) |
| 2124 | (declare-function android-frame-restack "androidfns.c" (frame1 frame2 | 2119 | (declare-function android-frame-restack "androidfns.c" (frame1 frame2 |
| 2125 | &optional above)) | 2120 | &optional above)) |
| 2121 | (declare-function tty-frame-restack "term.c" (frame1 frame2 &optional above)) | ||
| 2126 | 2122 | ||
| 2127 | (defun frame-restack (frame1 frame2 &optional above) | 2123 | (defun frame-restack (frame1 frame2 &optional above) |
| 2128 | "Restack FRAME1 below FRAME2. | 2124 | "Restack FRAME1 below FRAME2. |
| @@ -2146,6 +2142,7 @@ Some window managers may refuse to restack windows." | |||
| 2146 | (equal (frame-parameter frame1 'display) | 2142 | (equal (frame-parameter frame1 'display) |
| 2147 | (frame-parameter frame2 'display))) | 2143 | (frame-parameter frame2 'display))) |
| 2148 | (let ((frame-type (framep-on-display frame1))) | 2144 | (let ((frame-type (framep-on-display frame1))) |
| 2145 | ;; FIXME/tty: not implemented for ttys. | ||
| 2149 | (cond | 2146 | (cond |
| 2150 | ((eq frame-type 'x) | 2147 | ((eq frame-type 'x) |
| 2151 | (x-frame-restack frame1 frame2 above)) | 2148 | (x-frame-restack frame1 frame2 above)) |
| @@ -2158,7 +2155,9 @@ Some window managers may refuse to restack windows." | |||
| 2158 | ((eq frame-type 'pgtk) | 2155 | ((eq frame-type 'pgtk) |
| 2159 | (pgtk-frame-restack frame1 frame2 above)) | 2156 | (pgtk-frame-restack frame1 frame2 above)) |
| 2160 | ((eq frame-type 'android) | 2157 | ((eq frame-type 'android) |
| 2161 | (android-frame-restack frame1 frame2 above)))) | 2158 | (android-frame-restack frame1 frame2 above)) |
| 2159 | (t | ||
| 2160 | (tty-frame-restack frame1 frame2 above)))) | ||
| 2162 | (error "Cannot restack frames"))) | 2161 | (error "Cannot restack frames"))) |
| 2163 | 2162 | ||
| 2164 | (defun frame-size-changed-p (&optional frame) | 2163 | (defun frame-size-changed-p (&optional frame) |
| @@ -2311,6 +2310,7 @@ If DISPLAY is omitted or nil, it defaults to the selected frame's display." | |||
| 2311 | 1)))) | 2310 | 1)))) |
| 2312 | 2311 | ||
| 2313 | (declare-function x-display-pixel-height "xfns.c" (&optional terminal)) | 2312 | (declare-function x-display-pixel-height "xfns.c" (&optional terminal)) |
| 2313 | (declare-function tty-display-pixel-height "term.c" (&optional terminal)) | ||
| 2314 | 2314 | ||
| 2315 | (defun display-pixel-height (&optional display) | 2315 | (defun display-pixel-height (&optional display) |
| 2316 | "Return the height of DISPLAY's screen in pixels. | 2316 | "Return the height of DISPLAY's screen in pixels. |
| @@ -2328,9 +2328,10 @@ with DISPLAY. To get information for each physical monitor, use | |||
| 2328 | ((memq frame-type '(x w32 ns haiku pgtk android)) | 2328 | ((memq frame-type '(x w32 ns haiku pgtk android)) |
| 2329 | (x-display-pixel-height display)) | 2329 | (x-display-pixel-height display)) |
| 2330 | (t | 2330 | (t |
| 2331 | (frame-height (if (framep display) display (selected-frame))))))) | 2331 | (tty-display-pixel-height display))))) |
| 2332 | 2332 | ||
| 2333 | (declare-function x-display-pixel-width "xfns.c" (&optional terminal)) | 2333 | (declare-function x-display-pixel-width "xfns.c" (&optional terminal)) |
| 2334 | (declare-function tty-display-pixel-width "term.c" (&optional terminal)) | ||
| 2334 | 2335 | ||
| 2335 | (defun display-pixel-width (&optional display) | 2336 | (defun display-pixel-width (&optional display) |
| 2336 | "Return the width of DISPLAY's screen in pixels. | 2337 | "Return the width of DISPLAY's screen in pixels. |
| @@ -2348,7 +2349,7 @@ with DISPLAY. To get information for each physical monitor, use | |||
| 2348 | ((memq frame-type '(x w32 ns haiku pgtk android)) | 2349 | ((memq frame-type '(x w32 ns haiku pgtk android)) |
| 2349 | (x-display-pixel-width display)) | 2350 | (x-display-pixel-width display)) |
| 2350 | (t | 2351 | (t |
| 2351 | (frame-width (if (framep display) display (selected-frame))))))) | 2352 | (tty-display-pixel-width display))))) |
| 2352 | 2353 | ||
| 2353 | (defcustom display-mm-dimensions-alist nil | 2354 | (defcustom display-mm-dimensions-alist nil |
| 2354 | "Alist for specifying screen dimensions in millimeters. | 2355 | "Alist for specifying screen dimensions in millimeters. |
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 8cbb44ece14..4f32d3b5fda 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el | |||
| @@ -293,7 +293,16 @@ which is the \"1006\" extension implemented in Xterm >= 277." | |||
| 293 | (progn (setq xt-mouse-epoch (float-time)) 0) | 293 | (progn (setq xt-mouse-epoch (float-time)) 0) |
| 294 | (car (time-convert (time-since xt-mouse-epoch) | 294 | (car (time-convert (time-since xt-mouse-epoch) |
| 295 | 1000)))) | 295 | 1000)))) |
| 296 | (w (window-at x y)) | 296 | (frame (frame-at x y)) |
| 297 | ;;(_ (message (format "*** %S" frame))) | ||
| 298 | (frame-pos (frame-position frame)) | ||
| 299 | ;;(_ (message (format "*** %S" frame-pos))) | ||
| 300 | (x (- x (car frame-pos))) | ||
| 301 | (y (- y (cdr frame-pos))) | ||
| 302 | ;;(_ (message (format "*** %S %S" x y))) | ||
| 303 | (w (window-at x y frame)) | ||
| 304 | ;;(_ (message (format "*** %S" w))) | ||
| 305 | |||
| 297 | (ltrb (window-edges w)) | 306 | (ltrb (window-edges w)) |
| 298 | (left (nth 0 ltrb)) | 307 | (left (nth 0 ltrb)) |
| 299 | (top (nth 1 ltrb)) | 308 | (top (nth 1 ltrb)) |