summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el88
1 files changed, 71 insertions, 17 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 39e8a4c88b8..ba5d1caafa2 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1653,6 +1653,7 @@ live frame and defaults to the selected one."
(declare-function ns-frame-geometry "nsfns.m" (&optional frame))
(declare-function pgtk-frame-geometry "pgtkfns.c" (&optional frame))
(declare-function haiku-frame-geometry "haikufns.c" (&optional frame))
+(declare-function android-frame-geometry "androidfns.c" (&optional frame))
(defun frame-geometry (&optional frame)
"Return geometric attributes of FRAME.
@@ -1706,6 +1707,8 @@ and width values are in pixels.
(pgtk-frame-geometry frame))
((eq frame-type 'haiku)
(haiku-frame-geometry frame))
+ ((eq frame-type 'android)
+ (android-frame-geometry frame))
(t
(list
'(outer-position 0 . 0)
@@ -1832,6 +1835,7 @@ of frames like calls to map a frame or change its visibility."
(declare-function ns-frame-edges "nsfns.m" (&optional frame type))
(declare-function pgtk-frame-edges "pgtkfns.c" (&optional frame type))
(declare-function haiku-frame-edges "haikufns.c" (&optional frame type))
+(declare-function android-frame-edges "androidfns.c" (&optional frame type))
(defun frame-edges (&optional frame type)
"Return coordinates of FRAME's edges.
@@ -1859,6 +1863,8 @@ FRAME."
(pgtk-frame-edges frame type))
((eq frame-type 'haiku)
(haiku-frame-edges frame type))
+ ((eq frame-type 'android)
+ (android-frame-edges frame type))
(t
(list 0 0 (frame-width frame) (frame-height frame))))))
@@ -1867,6 +1873,7 @@ FRAME."
(declare-function ns-mouse-absolute-pixel-position "nsfns.m")
(declare-function pgtk-mouse-absolute-pixel-position "pgtkfns.c")
(declare-function haiku-mouse-absolute-pixel-position "haikufns.c")
+(declare-function android-mouse-absolute-pixel-position "androidfns.c")
(defun mouse-absolute-pixel-position ()
"Return absolute position of mouse cursor in pixels.
@@ -1885,6 +1892,8 @@ position (0, 0) of the selected frame's terminal."
(pgtk-mouse-absolute-pixel-position))
((eq frame-type 'haiku)
(haiku-mouse-absolute-pixel-position))
+ ((eq frame-type 'android)
+ (android-mouse-absolute-pixel-position))
(t
(cons 0 0)))))
@@ -1893,6 +1902,8 @@ position (0, 0) of the selected frame's terminal."
(declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y))
(declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y))
(declare-function haiku-set-mouse-absolute-pixel-position "haikufns.c" (x y))
+(declare-function android-set-mouse-absolute-pixel-position
+ "androidfns.c" (x y))
(defun set-mouse-absolute-pixel-position (x y)
"Move mouse pointer to absolute pixel position (X, Y).
@@ -1909,7 +1920,9 @@ position (0, 0) of the selected frame's terminal."
((eq frame-type 'w32)
(w32-set-mouse-absolute-pixel-position x y))
((eq frame-type 'haiku)
- (haiku-set-mouse-absolute-pixel-position x y)))))
+ (haiku-set-mouse-absolute-pixel-position x y))
+ ((eq frame-type 'android)
+ (android-set-mouse-absolute-pixel-position x y)))))
(defun frame-monitor-attributes (&optional frame)
"Return the attributes of the physical monitor dominating FRAME.
@@ -2005,6 +2018,7 @@ workarea attribute."
;; TODO: implement this on PGTK.
;; (declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display))
(declare-function haiku-frame-list-z-order "haikufns.c" (&optional display))
+(declare-function android-frame-list-z-order "androidfns.c" (&optional display))
(defun frame-list-z-order (&optional display)
"Return list of Emacs' frames, in Z (stacking) order.
@@ -2030,13 +2044,17 @@ Return nil if DISPLAY contains no Emacs frame."
;; (pgtk-frame-list-z-order display)
nil)
((eq frame-type 'haiku)
- (haiku-frame-list-z-order display)))))
+ (haiku-frame-list-z-order display))
+ ((eq frame-type 'android)
+ (android-frame-list-z-order display)))))
(declare-function x-frame-restack "xfns.c" (frame1 frame2 &optional above))
(declare-function w32-frame-restack "w32fns.c" (frame1 frame2 &optional above))
(declare-function ns-frame-restack "nsfns.m" (frame1 frame2 &optional above))
(declare-function pgtk-frame-restack "pgtkfns.c" (frame1 frame2 &optional above))
(declare-function haiku-frame-restack "haikufns.c" (frame1 frame2 &optional above))
+(declare-function android-frame-restack "androidfns.c" (frame1 frame2
+ &optional above))
(defun frame-restack (frame1 frame2 &optional above)
"Restack FRAME1 below FRAME2.
@@ -2070,7 +2088,9 @@ Some window managers may refuse to restack windows."
((eq frame-type 'haiku)
(haiku-frame-restack frame1 frame2 above))
((eq frame-type 'pgtk)
- (pgtk-frame-restack frame1 frame2 above))))
+ (pgtk-frame-restack frame1 frame2 above))
+ ((eq frame-type 'android)
+ (android-frame-restack frame1 frame2 above))))
(error "Cannot restack frames")))
(defun frame-size-changed-p (&optional frame)
@@ -2105,6 +2125,7 @@ for FRAME."
;; or in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35058#17.
(declare-function msdos-mouse-p "dosfns.c")
+(declare-function android-detect-mouse "androidfns.c")
(defun display-mouse-p (&optional display)
"Return non-nil if DISPLAY has a mouse available.
@@ -2119,6 +2140,8 @@ frame's display)."
(> w32-num-mouse-buttons 0)))
((memq frame-type '(x ns haiku pgtk))
t) ;; We assume X, NeXTstep, GTK, and Haiku *always* have a pointing device
+ ((eq frame-type 'android)
+ (android-detect-mouse))
(t
(or (and (featurep 'xt-mouse)
xterm-mouse-mode)
@@ -2134,8 +2157,12 @@ frame's display)."
"Return non-nil if popup menus are supported on DISPLAY.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display).
-Support for popup menus requires that the mouse be available."
- (display-mouse-p display))
+Support for popup menus requires that a suitable pointing device
+be available."
+ ;; Android menus work fine with touch screens as well, and one must
+ ;; be present.
+ (or (eq (framep-on-display display) 'android)
+ (display-mouse-p display)))
(defun display-graphic-p (&optional display)
"Return non-nil if DISPLAY is a graphic display.
@@ -2144,7 +2171,8 @@ frames and several different fonts at once. This is true for displays
that use a window system such as X, and false for text-only terminals.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display)."
- (not (null (memq (framep-on-display display) '(x w32 ns pgtk haiku)))))
+ (not (null (memq (framep-on-display display) '(x w32 ns pgtk haiku
+ android)))))
(defun display-images-p (&optional display)
"Return non-nil if DISPLAY can display images.
@@ -2196,7 +2224,7 @@ frame's display)."
This means that, for example, DISPLAY can differentiate between
the keybinding RET and [return]."
(let ((frame-type (framep-on-display display)))
- (or (memq frame-type '(x w32 ns pc pgtk haiku))
+ (or (memq frame-type '(x w32 ns pc pgtk haiku android))
;; MS-DOS and MS-Windows terminals have built-in support for
;; function (symbol) keys
(memq system-type '(ms-dos windows-nt)))))
@@ -2209,7 +2237,7 @@ DISPLAY should be either a frame or a display name (a string).
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-screens display))
(t
1))))
@@ -2229,7 +2257,7 @@ with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-pixel-height display))
(t
(frame-height (if (framep display) display (selected-frame)))))))
@@ -2249,7 +2277,7 @@ with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-pixel-width display))
(t
(frame-width (if (framep display) display (selected-frame)))))))
@@ -2287,7 +2315,7 @@ For graphical terminals, note that on \"multi-monitor\" setups this
refers to the height in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
- (and (memq (framep-on-display display) '(x w32 ns haiku pgtk))
+ (and (memq (framep-on-display display) '(x w32 ns haiku pgtk android))
(or (cddr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
(cddr (assoc t display-mm-dimensions-alist))
@@ -2308,7 +2336,7 @@ For graphical terminals, note that on \"multi-monitor\" setups this
refers to the width in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
- (and (memq (framep-on-display display) '(x w32 ns haiku pgtk))
+ (and (memq (framep-on-display display) '(x w32 ns haiku pgtk android))
(or (cadr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
(cadr (assoc t display-mm-dimensions-alist))
@@ -2326,7 +2354,7 @@ DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-backing-store display))
(t
'not-useful))))
@@ -2339,7 +2367,7 @@ DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-save-under display))
(t
'not-useful))))
@@ -2352,7 +2380,7 @@ DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-planes display))
((eq frame-type 'pc)
4)
@@ -2367,7 +2395,7 @@ DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-color-cells display))
((eq frame-type 'pc)
16)
@@ -2384,7 +2412,7 @@ DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(let ((frame-type (framep-on-display display)))
(cond
- ((memq frame-type '(x w32 ns haiku pgtk))
+ ((memq frame-type '(x w32 ns haiku pgtk android))
(x-display-visual-class display))
((and (memq frame-type '(pc t))
(tty-display-color-p display))
@@ -2402,6 +2430,8 @@ If DISPLAY is omitted or nil, it defaults to the selected frame's display."
(&optional terminal))
(declare-function haiku-display-monitor-attributes-list "haikufns.c"
(&optional terminal))
+(declare-function android-display-monitor-attributes-list "androidfns.c"
+ (&optional terminal))
(defun display-monitor-attributes-list (&optional display)
"Return a list of physical monitor attributes on DISPLAY.
@@ -2455,6 +2485,8 @@ monitors."
(pgtk-display-monitor-attributes-list display))
((eq frame-type 'haiku)
(haiku-display-monitor-attributes-list display))
+ ((eq frame-type 'android)
+ (android-display-monitor-attributes-list display))
(t
(let ((geometry (list 0 0 (display-pixel-width display)
(display-pixel-height display))))
@@ -2530,6 +2562,28 @@ symbols."
'core-keyboard))))))
+;;;; On-screen keyboard management.
+
+(declare-function android-toggle-on-screen-keyboard "androidfns.c")
+
+(defun frame-toggle-on-screen-keyboard (frame hide)
+ "Display or hide the on-screen keyboard.
+On systems with an on-screen keyboard, display the on screen
+keyboard on behalf of the frame FRAME if HIDE is nil. Else, hide
+the on screen keyboard.
+
+Return whether or not the on screen keyboard may have been
+displayed; that is, return t on systems with an on screen
+keyboard, and nil on those without.
+
+FRAME must already have the input focus for this to work
+ reliably."
+ (let ((frame-type (framep-on-display frame)))
+ (cond ((eq frame-type 'android)
+ (android-toggle-on-screen-keyboard frame hide) t)
+ (t nil))))
+
+
;;;; Frame geometry values
(defun frame-geom-value-cons (type value &optional frame)