diff options
| author | Martin Rudalics | 2015-08-19 11:20:44 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2015-08-19 11:20:44 +0200 |
| commit | f5a14da109b1ddbcf0e9e31cf0f1d385a95c0b60 (patch) | |
| tree | bab0b1c449a884f341d4bbc8e3c4a7c0e71ee10a /src | |
| parent | a83be20b2f3b1ad499c7584caa08434cc66bb98f (diff) | |
| download | emacs-f5a14da109b1ddbcf0e9e31cf0f1d385a95c0b60.tar.gz emacs-f5a14da109b1ddbcf0e9e31cf0f1d385a95c0b60.zip | |
Move window edge functions to Elisp.
* src/window.c (Fwindow_edges, Fwindow_pixel_edges)
(Fwindow_absolute_pixel_edges, Fwindow_inside_edges)
(Fwindow_inside_pixel_edges, Fwindow_inside_absolute_pixel_edges):
Move to window.el.
(calc_absolute_offset): Remove.
* lisp/frame.el (frame-edges): New function.
* lisp/window.el (window-edges, window-pixel-edges)
(window-absolute-pixel-edges): Move here from window.c.
(window-body-edges, window-body-pixel-edges)
(window-absolute-body-pixel-edges): Move here from window.c and
rename "inside" to "body". Keep old names as aliases.
(window-absolute-pixel-position): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/src/window.c b/src/window.c index ad5ac79bd8e..863a7926a1e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1101,186 +1101,6 @@ end-trigger value is reset to nil. */) | |||
| 1101 | return value; | 1101 | return value; |
| 1102 | } | 1102 | } |
| 1103 | 1103 | ||
| 1104 | DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, | ||
| 1105 | doc: /* Return a list of the edge coordinates of WINDOW. | ||
| 1106 | WINDOW must be a valid window and defaults to the selected one. | ||
| 1107 | |||
| 1108 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM | ||
| 1109 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | ||
| 1110 | 0 at top left corner of frame. | ||
| 1111 | |||
| 1112 | RIGHT is one more than the rightmost column occupied by WINDOW. BOTTOM | ||
| 1113 | is one more than the bottommost row occupied by WINDOW. The edges | ||
| 1114 | include the space used by WINDOW's scroll bar, display margins, fringes, | ||
| 1115 | header line, and/or mode line. For the edges of just the text area, use | ||
| 1116 | `window-inside-edges'. */) | ||
| 1117 | (Lisp_Object window) | ||
| 1118 | { | ||
| 1119 | register struct window *w = decode_valid_window (window); | ||
| 1120 | |||
| 1121 | return list4i (WINDOW_LEFT_EDGE_COL (w), WINDOW_TOP_EDGE_LINE (w), | ||
| 1122 | WINDOW_RIGHT_EDGE_COL (w), WINDOW_BOTTOM_EDGE_LINE (w)); | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, | ||
| 1126 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | ||
| 1127 | WINDOW must be a valid window and defaults to the selected one. | ||
| 1128 | |||
| 1129 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 1130 | 0, 0 at the top left corner of the frame. | ||
| 1131 | |||
| 1132 | RIGHT is one more than the rightmost x position occupied by WINDOW. | ||
| 1133 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | ||
| 1134 | The pixel edges include the space used by WINDOW's scroll bar, display | ||
| 1135 | margins, fringes, header line, and/or mode line. For the pixel edges | ||
| 1136 | of just the text area, use `window-inside-pixel-edges'. */) | ||
| 1137 | (Lisp_Object window) | ||
| 1138 | { | ||
| 1139 | register struct window *w = decode_valid_window (window); | ||
| 1140 | |||
| 1141 | return list4i (WINDOW_LEFT_EDGE_X (w), WINDOW_TOP_EDGE_Y (w), | ||
| 1142 | WINDOW_RIGHT_EDGE_X (w), WINDOW_BOTTOM_EDGE_Y (w)); | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | static void | ||
| 1146 | calc_absolute_offset (struct window *w, int *add_x, int *add_y) | ||
| 1147 | { | ||
| 1148 | struct frame *f = XFRAME (w->frame); | ||
| 1149 | *add_y = f->top_pos; | ||
| 1150 | #ifdef FRAME_MENUBAR_HEIGHT | ||
| 1151 | *add_y += FRAME_MENUBAR_HEIGHT (f); | ||
| 1152 | #endif | ||
| 1153 | #ifdef FRAME_TOOLBAR_TOP_HEIGHT | ||
| 1154 | *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f); | ||
| 1155 | #elif defined (FRAME_TOOLBAR_HEIGHT) | ||
| 1156 | *add_y += FRAME_TOOLBAR_HEIGHT (f); | ||
| 1157 | #endif | ||
| 1158 | #ifdef FRAME_NS_TITLEBAR_HEIGHT | ||
| 1159 | *add_y += FRAME_NS_TITLEBAR_HEIGHT (f); | ||
| 1160 | #endif | ||
| 1161 | *add_x = f->left_pos; | ||
| 1162 | #ifdef FRAME_TOOLBAR_LEFT_WIDTH | ||
| 1163 | *add_x += FRAME_TOOLBAR_LEFT_WIDTH (f); | ||
| 1164 | #endif | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, | ||
| 1168 | Swindow_absolute_pixel_edges, 0, 1, 0, | ||
| 1169 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | ||
| 1170 | WINDOW must be a valid window and defaults to the selected one. | ||
| 1171 | |||
| 1172 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 1173 | 0, 0 at the top left corner of the display. | ||
| 1174 | |||
| 1175 | RIGHT is one more than the rightmost x position occupied by WINDOW. | ||
| 1176 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | ||
| 1177 | The pixel edges include the space used by WINDOW's scroll bar, display | ||
| 1178 | margins, fringes, header line, and/or mode line. For the pixel edges | ||
| 1179 | of just the text area, use `window-inside-absolute-pixel-edges'. */) | ||
| 1180 | (Lisp_Object window) | ||
| 1181 | { | ||
| 1182 | register struct window *w = decode_valid_window (window); | ||
| 1183 | int add_x, add_y; | ||
| 1184 | |||
| 1185 | calc_absolute_offset (w, &add_x, &add_y); | ||
| 1186 | |||
| 1187 | return list4i (WINDOW_LEFT_EDGE_X (w) + add_x, | ||
| 1188 | WINDOW_TOP_EDGE_Y (w) + add_y, | ||
| 1189 | WINDOW_RIGHT_EDGE_X (w) + add_x, | ||
| 1190 | WINDOW_BOTTOM_EDGE_Y (w) + add_y); | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, | ||
| 1194 | doc: /* Return a list of the edge coordinates of WINDOW. | ||
| 1195 | WINDOW must be a live window and defaults to the selected one. | ||
| 1196 | |||
| 1197 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM | ||
| 1198 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | ||
| 1199 | 0 at top left corner of frame. | ||
| 1200 | |||
| 1201 | RIGHT is one more than the rightmost column of WINDOW's text area. | ||
| 1202 | BOTTOM is one more than the bottommost row of WINDOW's text area. The | ||
| 1203 | inside edges do not include the space used by the WINDOW's scroll bar, | ||
| 1204 | display margins, fringes, header line, and/or mode line. */) | ||
| 1205 | (Lisp_Object window) | ||
| 1206 | { | ||
| 1207 | register struct window *w = decode_live_window (window); | ||
| 1208 | |||
| 1209 | return list4i ((WINDOW_BOX_LEFT_EDGE_COL (w) | ||
| 1210 | + WINDOW_LEFT_MARGIN_COLS (w) | ||
| 1211 | + ((WINDOW_LEFT_FRINGE_WIDTH (w) | ||
| 1212 | + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) | ||
| 1213 | / WINDOW_FRAME_COLUMN_WIDTH (w))), | ||
| 1214 | (WINDOW_TOP_EDGE_LINE (w) | ||
| 1215 | + WINDOW_HEADER_LINE_LINES (w)), | ||
| 1216 | (WINDOW_BOX_RIGHT_EDGE_COL (w) | ||
| 1217 | - WINDOW_RIGHT_MARGIN_COLS (w) | ||
| 1218 | - ((WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 1219 | + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) | ||
| 1220 | / WINDOW_FRAME_COLUMN_WIDTH (w))), | ||
| 1221 | (WINDOW_BOTTOM_EDGE_LINE (w) | ||
| 1222 | - WINDOW_MODE_LINE_LINES (w))); | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, | ||
| 1226 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | ||
| 1227 | WINDOW must be a live window and defaults to the selected one. | ||
| 1228 | |||
| 1229 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 1230 | (0,0) at the top left corner of the frame's window area. | ||
| 1231 | |||
| 1232 | RIGHT is one more than the rightmost x position of WINDOW's text area. | ||
| 1233 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | ||
| 1234 | The inside edges do not include the space used by WINDOW's scroll bar, | ||
| 1235 | display margins, fringes, header line, and/or mode line. */) | ||
| 1236 | (Lisp_Object window) | ||
| 1237 | { | ||
| 1238 | register struct window *w = decode_live_window (window); | ||
| 1239 | |||
| 1240 | return list4i ((WINDOW_BOX_LEFT_EDGE_X (w) | ||
| 1241 | + WINDOW_LEFT_MARGIN_WIDTH (w) | ||
| 1242 | + WINDOW_LEFT_FRINGE_WIDTH (w)), | ||
| 1243 | (WINDOW_TOP_EDGE_Y (w) | ||
| 1244 | + WINDOW_HEADER_LINE_HEIGHT (w)), | ||
| 1245 | (WINDOW_BOX_RIGHT_EDGE_X (w) | ||
| 1246 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | ||
| 1247 | - WINDOW_RIGHT_FRINGE_WIDTH (w)), | ||
| 1248 | (WINDOW_BOTTOM_EDGE_Y (w) | ||
| 1249 | - WINDOW_MODE_LINE_HEIGHT (w))); | ||
| 1250 | } | ||
| 1251 | |||
| 1252 | DEFUN ("window-inside-absolute-pixel-edges", | ||
| 1253 | Fwindow_inside_absolute_pixel_edges, | ||
| 1254 | Swindow_inside_absolute_pixel_edges, 0, 1, 0, | ||
| 1255 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | ||
| 1256 | WINDOW must be a live window and defaults to the selected one. | ||
| 1257 | |||
| 1258 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 1259 | (0,0) at the top left corner of the frame's window area. | ||
| 1260 | |||
| 1261 | RIGHT is one more than the rightmost x position of WINDOW's text area. | ||
| 1262 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | ||
| 1263 | The inside edges do not include the space used by WINDOW's scroll bar, | ||
| 1264 | display margins, fringes, header line, and/or mode line. */) | ||
| 1265 | (Lisp_Object window) | ||
| 1266 | { | ||
| 1267 | register struct window *w = decode_live_window (window); | ||
| 1268 | int add_x, add_y; | ||
| 1269 | |||
| 1270 | calc_absolute_offset (w, &add_x, &add_y); | ||
| 1271 | |||
| 1272 | return list4i ((WINDOW_BOX_LEFT_EDGE_X (w) | ||
| 1273 | + WINDOW_LEFT_MARGIN_WIDTH (w) | ||
| 1274 | + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), | ||
| 1275 | (WINDOW_TOP_EDGE_Y (w) | ||
| 1276 | + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), | ||
| 1277 | (WINDOW_BOX_RIGHT_EDGE_X (w) | ||
| 1278 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | ||
| 1279 | - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), | ||
| 1280 | (WINDOW_BOTTOM_EDGE_Y (w) | ||
| 1281 | - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | /* Test if the character at column X, row Y is within window W. | 1104 | /* Test if the character at column X, row Y is within window W. |
| 1285 | If it is not, return ON_NOTHING; | 1105 | If it is not, return ON_NOTHING; |
| 1286 | if it is on the window's vertical divider, return | 1106 | if it is on the window's vertical divider, return |
| @@ -7548,18 +7368,12 @@ displayed after a scrolling operation to be somewhat inaccurate. */); | |||
| 7548 | defsubr (&Sset_window_hscroll); | 7368 | defsubr (&Sset_window_hscroll); |
| 7549 | defsubr (&Swindow_redisplay_end_trigger); | 7369 | defsubr (&Swindow_redisplay_end_trigger); |
| 7550 | defsubr (&Sset_window_redisplay_end_trigger); | 7370 | defsubr (&Sset_window_redisplay_end_trigger); |
| 7551 | defsubr (&Swindow_edges); | ||
| 7552 | defsubr (&Swindow_pixel_edges); | ||
| 7553 | defsubr (&Swindow_absolute_pixel_edges); | ||
| 7554 | defsubr (&Swindow_mode_line_height); | 7371 | defsubr (&Swindow_mode_line_height); |
| 7555 | defsubr (&Swindow_header_line_height); | 7372 | defsubr (&Swindow_header_line_height); |
| 7556 | defsubr (&Swindow_right_divider_width); | 7373 | defsubr (&Swindow_right_divider_width); |
| 7557 | defsubr (&Swindow_bottom_divider_width); | 7374 | defsubr (&Swindow_bottom_divider_width); |
| 7558 | defsubr (&Swindow_scroll_bar_width); | 7375 | defsubr (&Swindow_scroll_bar_width); |
| 7559 | defsubr (&Swindow_scroll_bar_height); | 7376 | defsubr (&Swindow_scroll_bar_height); |
| 7560 | defsubr (&Swindow_inside_edges); | ||
| 7561 | defsubr (&Swindow_inside_pixel_edges); | ||
| 7562 | defsubr (&Swindow_inside_absolute_pixel_edges); | ||
| 7563 | defsubr (&Scoordinates_in_window_p); | 7377 | defsubr (&Scoordinates_in_window_p); |
| 7564 | defsubr (&Swindow_at); | 7378 | defsubr (&Swindow_at); |
| 7565 | defsubr (&Swindow_point); | 7379 | defsubr (&Swindow_point); |