diff options
| -rw-r--r-- | lisp/frame.el | 120 | ||||
| -rw-r--r-- | src/nsfns.m | 8 | ||||
| -rw-r--r-- | src/w32fns.c | 20 |
3 files changed, 130 insertions, 18 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 391f23922f8..3abb72cb859 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -1312,6 +1312,80 @@ live frame and defaults to the selected one." | |||
| 1312 | (setq vertical default-frame-scroll-bars)) | 1312 | (setq vertical default-frame-scroll-bars)) |
| 1313 | (cons vertical (and horizontal 'bottom)))) | 1313 | (cons vertical (and horizontal 'bottom)))) |
| 1314 | 1314 | ||
| 1315 | (declare-function x-frame-geometry "xfns.c" (&optional frame)) | ||
| 1316 | (declare-function w32-frame-geometry "w32fns.c" (&optional frame)) | ||
| 1317 | (declare-function ns-frame-geometry "nsfns.m" (&optional frame)) | ||
| 1318 | |||
| 1319 | (defun frame-geometry (&optional frame) | ||
| 1320 | "Return geometric attributes of FRAME. | ||
| 1321 | FRAME must be a live frame and defaults to the selected one. The return | ||
| 1322 | value is an association list of the attributes listed below. All height | ||
| 1323 | and width values are in pixels. | ||
| 1324 | |||
| 1325 | `outer-position' is a cons of the outer left and top edges of FRAME | ||
| 1326 | relative to the origin - the position (0, 0) - of FRAME's display. | ||
| 1327 | |||
| 1328 | `outer-size' is a cons of the outer width and height of FRAME. The | ||
| 1329 | outer size includes the title bar and the external borders as well as | ||
| 1330 | any menu and/or tool bar of frame. | ||
| 1331 | |||
| 1332 | `external-border-size' is a cons of the horizontal and vertical width of | ||
| 1333 | FRAME's external borders as supplied by the window manager. | ||
| 1334 | |||
| 1335 | `title-bar-size' is a cons of the width and height of the title bar of | ||
| 1336 | FRAME as supplied by the window manager. If both of them are zero, | ||
| 1337 | FRAME has no title bar. If only the width is zero, Emacs was not | ||
| 1338 | able to retrieve the width information. | ||
| 1339 | |||
| 1340 | `menu-bar-external', if non-nil, means the menu bar is external (never | ||
| 1341 | included in the inner edges of FRAME). | ||
| 1342 | |||
| 1343 | `menu-bar-size' is a cons of the width and height of the menu bar of | ||
| 1344 | FRAME. | ||
| 1345 | |||
| 1346 | `tool-bar-external', if non-nil, means the tool bar is external (never | ||
| 1347 | included in the inner edges of FRAME). | ||
| 1348 | |||
| 1349 | `tool-bar-position' tells on which side the tool bar on FRAME is and can | ||
| 1350 | be one of `left', `top', `right' or `bottom'. If this is nil, FRAME | ||
| 1351 | has no tool bar. | ||
| 1352 | |||
| 1353 | `tool-bar-size' is a cons of the width and height of the tool bar of | ||
| 1354 | FRAME. | ||
| 1355 | |||
| 1356 | `internal-border-width' is the width of the internal border of | ||
| 1357 | FRAME." | ||
| 1358 | (let* ((frame (window-normalize-frame frame)) | ||
| 1359 | (frame-type (framep-on-display frame))) | ||
| 1360 | (cond | ||
| 1361 | ((eq frame-type 'x) | ||
| 1362 | (x-frame-geometry frame)) | ||
| 1363 | ((eq frame-type 'w32) | ||
| 1364 | (w32-frame-geometry frame)) | ||
| 1365 | ((eq frame-type 'ns) | ||
| 1366 | (ns-frame-geometry frame)) | ||
| 1367 | (t | ||
| 1368 | (list | ||
| 1369 | '(outer-position 0 . 0) | ||
| 1370 | (cons 'outer-size (cons (frame-width frame) (frame-height frame))) | ||
| 1371 | '(external-border-size 0 . 0) | ||
| 1372 | '(title-bar-size 0 . 0) | ||
| 1373 | '(menu-bar-external . nil) | ||
| 1374 | (let ((menu-bar-lines (frame-parameter frame 'menu-bar-lines))) | ||
| 1375 | (cons 'menu-bar-size | ||
| 1376 | (if menu-bar-lines | ||
| 1377 | (cons (frame-width frame) 1) | ||
| 1378 | 1 0))) | ||
| 1379 | '(tool-bar-external . nil) | ||
| 1380 | '(tool-bar-position . nil) | ||
| 1381 | '(tool-bar-size 0 . 0) | ||
| 1382 | (cons 'internal-border-width | ||
| 1383 | (frame-parameter frame 'internal-border-width))))))) | ||
| 1384 | |||
| 1385 | (declare-function x-frame-edges "xfns.c" (&optional frame type)) | ||
| 1386 | (declare-function w32-frame-edges "w32fns.c" (&optional frame type)) | ||
| 1387 | (declare-function ns-frame-edges "nsfns.m" (&optional frame type)) | ||
| 1388 | |||
| 1315 | (defun frame-edges (&optional frame type) | 1389 | (defun frame-edges (&optional frame type) |
| 1316 | "Return coordinates of FRAME's edges. | 1390 | "Return coordinates of FRAME's edges. |
| 1317 | FRAME must be a live frame and defaults to the selected one. The | 1391 | FRAME must be a live frame and defaults to the selected one. The |
| @@ -1325,10 +1399,48 @@ Optional argument TYPE specifies the type of the edges. TYPE | |||
| 1325 | `native-edges' (or nil) means to return the native edges of | 1399 | `native-edges' (or nil) means to return the native edges of |
| 1326 | FRAME. TYPE `inner-edges' means to return the inner edges of | 1400 | FRAME. TYPE `inner-edges' means to return the inner edges of |
| 1327 | FRAME." | 1401 | FRAME." |
| 1328 | (let ((frame (window-normalize-frame frame))) | 1402 | (let* ((frame (window-normalize-frame frame)) |
| 1329 | (if (display-graphic-p (frame-parameter nil 'display)) | 1403 | (frame-type (framep-on-display frame))) |
| 1330 | (x-frame-edges frame (or type 'native-edges)) | 1404 | (cond |
| 1331 | (list 0 0 (frame-width frame) (frame-height frame))))) | 1405 | ((eq frame-type 'x) |
| 1406 | (x-frame-edges frame type)) | ||
| 1407 | ((eq frame-type 'w32) | ||
| 1408 | (w32-frame-edges frame type)) | ||
| 1409 | ((eq frame-type 'ns) | ||
| 1410 | (ns-frame-edges frame type)) | ||
| 1411 | (t | ||
| 1412 | (list 0 0 (frame-width frame) (frame-height frame)))))) | ||
| 1413 | |||
| 1414 | (declare-function w32-mouse-absolute-pixel-position "w32fns.c") | ||
| 1415 | (declare-function x-mouse-absolute-pixel-position "xfns.c") | ||
| 1416 | |||
| 1417 | (defun mouse-absolute-pixel-position () | ||
| 1418 | "Return absolute position of mouse cursor in pixels. | ||
| 1419 | The position is returned as a cons cell (X . Y) of the | ||
| 1420 | coordinates of the mouse cursor position in pixels relative to a | ||
| 1421 | position (0, 0) of the selected frame's terminal." | ||
| 1422 | (let ((frame-type (framep-on-display))) | ||
| 1423 | (cond | ||
| 1424 | ((eq frame-type 'x) | ||
| 1425 | (x-mouse-absolute-pixel-position)) | ||
| 1426 | ((eq frame-type 'w32) | ||
| 1427 | (w32-mouse-absolute-pixel-position)) | ||
| 1428 | (t | ||
| 1429 | (cons 0 0))))) | ||
| 1430 | |||
| 1431 | (declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y)) | ||
| 1432 | (declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y)) | ||
| 1433 | |||
| 1434 | (defun set-mouse-absolute-pixel-position (x y) | ||
| 1435 | "Move mouse pointer to absolute pixel position (X, Y). | ||
| 1436 | The coordinates X and Y are interpreted in pixels relative to a | ||
| 1437 | position (0, 0) of the selected frame's terminal." | ||
| 1438 | (let ((frame-type (framep-on-display))) | ||
| 1439 | (cond | ||
| 1440 | ((eq frame-type 'x) | ||
| 1441 | (x-set-mouse-absolute-pixel-position x y)) | ||
| 1442 | ((eq frame-type 'w32) | ||
| 1443 | (w32-set-mouse-absolute-pixel-position x y))))) | ||
| 1332 | 1444 | ||
| 1333 | (defun frame-monitor-attributes (&optional frame) | 1445 | (defun frame-monitor-attributes (&optional frame) |
| 1334 | "Return the attributes of the physical monitor dominating FRAME. | 1446 | "Return the attributes of the physical monitor dominating FRAME. |
diff --git a/src/nsfns.m b/src/nsfns.m index e9453604592..d317d48608c 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -2906,7 +2906,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) | |||
| 2906 | make_number (internal_border_width))); | 2906 | make_number (internal_border_width))); |
| 2907 | } | 2907 | } |
| 2908 | 2908 | ||
| 2909 | DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0, | 2909 | DEFUN ("ns-frame-geometry", Fns_frame_geometry, Sns_frame_geometry, 0, 1, 0, |
| 2910 | doc: /* Return geometric attributes of FRAME. | 2910 | doc: /* Return geometric attributes of FRAME. |
| 2911 | FRAME must be a live frame and defaults to the selected one. The return | 2911 | FRAME must be a live frame and defaults to the selected one. The return |
| 2912 | value is an association list of the attributes listed below. All height | 2912 | value is an association list of the attributes listed below. All height |
| @@ -2950,7 +2950,7 @@ and width values are in pixels. | |||
| 2950 | return frame_geometry (frame, Qnil); | 2950 | return frame_geometry (frame, Qnil); |
| 2951 | } | 2951 | } |
| 2952 | 2952 | ||
| 2953 | DEFUN ("x-frame-edges", Fx_frame_edges, Sx_frame_edges, 0, 2, 0, | 2953 | DEFUN ("ns-frame-edges", Fns_frame_edges, Sns_frame_edges, 0, 2, 0, |
| 2954 | doc: /* Return edge coordinates of FRAME. | 2954 | doc: /* Return edge coordinates of FRAME. |
| 2955 | FRAME must be a live frame and defaults to the selected one. The return | 2955 | FRAME must be a live frame and defaults to the selected one. The return |
| 2956 | value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are | 2956 | value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are |
| @@ -3156,8 +3156,8 @@ be used as the image of the icon representing the frame. */); | |||
| 3156 | defsubr (&Sx_display_pixel_width); | 3156 | defsubr (&Sx_display_pixel_width); |
| 3157 | defsubr (&Sx_display_pixel_height); | 3157 | defsubr (&Sx_display_pixel_height); |
| 3158 | defsubr (&Sns_display_monitor_attributes_list); | 3158 | defsubr (&Sns_display_monitor_attributes_list); |
| 3159 | defsubr (&Sx_frame_geometry); | 3159 | defsubr (&Sns_frame_geometry); |
| 3160 | defsubr (&Sx_frame_edges); | 3160 | defsubr (&Sns_frame_edges); |
| 3161 | defsubr (&Sx_display_mm_width); | 3161 | defsubr (&Sx_display_mm_width); |
| 3162 | defsubr (&Sx_display_mm_height); | 3162 | defsubr (&Sx_display_mm_height); |
| 3163 | defsubr (&Sx_display_screens); | 3163 | defsubr (&Sx_display_screens); |
diff --git a/src/w32fns.c b/src/w32fns.c index a47f3f9a8dc..f16bf762127 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -8002,7 +8002,7 @@ This is a direct interface to the Windows API FindWindow function. */) | |||
| 8002 | return Qt; | 8002 | return Qt; |
| 8003 | } | 8003 | } |
| 8004 | 8004 | ||
| 8005 | DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0, | 8005 | DEFUN ("w32-frame-geometry", Fw32_frame_geometry, Sw32_frame_geometry, 0, 1, 0, |
| 8006 | doc: /* Return geometric attributes of FRAME. | 8006 | doc: /* Return geometric attributes of FRAME. |
| 8007 | FRAME must be a live frame and defaults to the selected one. The return | 8007 | FRAME must be a live frame and defaults to the selected one. The return |
| 8008 | value is an association list of the attributes listed below. All height | 8008 | value is an association list of the attributes listed below. All height |
| @@ -8138,7 +8138,7 @@ and width values are in pixels. | |||
| 8138 | make_number (internal_border_width))); | 8138 | make_number (internal_border_width))); |
| 8139 | } | 8139 | } |
| 8140 | 8140 | ||
| 8141 | DEFUN ("x-frame-edges", Fx_frame_edges, Sx_frame_edges, 0, 2, 0, | 8141 | DEFUN ("w32-frame-edges", Fw32_frame_edges, Sw32_frame_edges, 0, 2, 0, |
| 8142 | doc: /* Return edge coordinates of FRAME. | 8142 | doc: /* Return edge coordinates of FRAME. |
| 8143 | FRAME must be a live frame and defaults to the selected one. The return | 8143 | FRAME must be a live frame and defaults to the selected one. The return |
| 8144 | value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are | 8144 | value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are |
| @@ -8213,8 +8213,8 @@ menu bar or tool bar of FRAME. */) | |||
| 8213 | } | 8213 | } |
| 8214 | } | 8214 | } |
| 8215 | 8215 | ||
| 8216 | DEFUN ("x-mouse-absolute-pixel-position", Fx_mouse_absolute_pixel_position, | 8216 | DEFUN ("w32-mouse-absolute-pixel-position", Fw32_mouse_absolute_pixel_position, |
| 8217 | Sx_mouse_absolute_pixel_position, 0, 0, 0, | 8217 | Sw32_mouse_absolute_pixel_position, 0, 0, 0, |
| 8218 | doc: /* Return absolute position of mouse cursor in pixels. | 8218 | doc: /* Return absolute position of mouse cursor in pixels. |
| 8219 | The position is returned as a cons cell (X . Y) of the coordinates of | 8219 | The position is returned as a cons cell (X . Y) of the coordinates of |
| 8220 | the mouse cursor position in pixels relative to a position (0, 0) of the | 8220 | the mouse cursor position in pixels relative to a position (0, 0) of the |
| @@ -8230,8 +8230,8 @@ selected frame's display. */) | |||
| 8230 | return Fcons (make_number (pt.x), make_number (pt.y)); | 8230 | return Fcons (make_number (pt.x), make_number (pt.y)); |
| 8231 | } | 8231 | } |
| 8232 | 8232 | ||
| 8233 | DEFUN ("x-set-mouse-absolute-pixel-position", Fx_set_mouse_absolute_pixel_position, | 8233 | DEFUN ("w32-set-mouse-absolute-pixel-position", Fw32_set_mouse_absolute_pixel_position, |
| 8234 | Sx_set_mouse_absolute_pixel_position, 2, 2, 0, | 8234 | Sw32_set_mouse_absolute_pixel_position, 2, 2, 0, |
| 8235 | doc: /* Move mouse pointer to absolute pixel position (X, Y). | 8235 | doc: /* Move mouse pointer to absolute pixel position (X, Y). |
| 8236 | The coordinates X and Y are interpreted in pixels relative to a position | 8236 | The coordinates X and Y are interpreted in pixels relative to a position |
| 8237 | (0, 0) of the selected frame's display. */) | 8237 | (0, 0) of the selected frame's display. */) |
| @@ -9280,10 +9280,10 @@ This variable has effect only on Windows Vista and later. */); | |||
| 9280 | defsubr (&Sx_open_connection); | 9280 | defsubr (&Sx_open_connection); |
| 9281 | defsubr (&Sx_close_connection); | 9281 | defsubr (&Sx_close_connection); |
| 9282 | defsubr (&Sx_display_list); | 9282 | defsubr (&Sx_display_list); |
| 9283 | defsubr (&Sx_frame_geometry); | 9283 | defsubr (&Sw32_frame_geometry); |
| 9284 | defsubr (&Sx_frame_edges); | 9284 | defsubr (&Sw32_frame_edges); |
| 9285 | defsubr (&Sx_mouse_absolute_pixel_position); | 9285 | defsubr (&Sw32_mouse_absolute_pixel_position); |
| 9286 | defsubr (&Sx_set_mouse_absolute_pixel_position); | 9286 | defsubr (&Sw32_set_mouse_absolute_pixel_position); |
| 9287 | defsubr (&Sx_synchronize); | 9287 | defsubr (&Sx_synchronize); |
| 9288 | 9288 | ||
| 9289 | /* W32 specific functions */ | 9289 | /* W32 specific functions */ |