diff options
| author | Gerd Möllmann | 2024-10-21 18:32:04 +0200 |
|---|---|---|
| committer | Gerd Möllmann | 2024-10-22 06:40:19 +0200 |
| commit | 414de92a562e8912ffdc8ed2995e7ea10d05f13b (patch) | |
| tree | 9058dd00922ed14319e0e49eb216fcad7ea5fdd6 /src/term.c | |
| parent | 1854f2751e3f73e1e5f12f6de993b6357de1766b (diff) | |
| download | emacs-414de92a562e8912ffdc8ed2995e7ea10d05f13b.tar.gz emacs-414de92a562e8912ffdc8ed2995e7ea10d05f13b.zip | |
Initial child frames based on master
This is based on a diff from 2024-10-15 which still applied.
Since then, I've inadvertantly modified the igc branch so that
it is no longer possible to get a clean diff of what has changed
since I created the branch.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 266 |
1 files changed, 234 insertions, 32 deletions
diff --git a/src/term.c b/src/term.c index 1f524880054..330da251e18 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -65,11 +65,9 @@ static int been_here = -1; | |||
| 65 | #ifndef HAVE_ANDROID | 65 | #ifndef HAVE_ANDROID |
| 66 | 66 | ||
| 67 | static void tty_set_scroll_region (struct frame *f, int start, int stop); | 67 | static void tty_set_scroll_region (struct frame *f, int start, int stop); |
| 68 | static void turn_on_face (struct frame *, int face_id); | 68 | static void turn_on_face (struct frame *f, struct face *face); |
| 69 | static void turn_off_face (struct frame *, int face_id); | 69 | static void turn_off_face (struct frame *f, struct face *face); |
| 70 | static void tty_turn_off_highlight (struct tty_display_info *); | 70 | static void tty_turn_off_highlight (struct tty_display_info *); |
| 71 | static void tty_show_cursor (struct tty_display_info *); | ||
| 72 | static void tty_hide_cursor (struct tty_display_info *); | ||
| 73 | static void tty_background_highlight (struct tty_display_info *tty); | 71 | static void tty_background_highlight (struct tty_display_info *tty); |
| 74 | static void clear_tty_hooks (struct terminal *terminal); | 72 | static void clear_tty_hooks (struct terminal *terminal); |
| 75 | static void set_tty_hooks (struct terminal *terminal); | 73 | static void set_tty_hooks (struct terminal *terminal); |
| @@ -336,7 +334,7 @@ tty_toggle_highlight (struct tty_display_info *tty) | |||
| 336 | 334 | ||
| 337 | /* Make cursor invisible. */ | 335 | /* Make cursor invisible. */ |
| 338 | 336 | ||
| 339 | static void | 337 | void |
| 340 | tty_hide_cursor (struct tty_display_info *tty) | 338 | tty_hide_cursor (struct tty_display_info *tty) |
| 341 | { | 339 | { |
| 342 | if (tty->cursor_hidden == 0) | 340 | if (tty->cursor_hidden == 0) |
| @@ -353,7 +351,7 @@ tty_hide_cursor (struct tty_display_info *tty) | |||
| 353 | 351 | ||
| 354 | /* Ensure that cursor is visible. */ | 352 | /* Ensure that cursor is visible. */ |
| 355 | 353 | ||
| 356 | static void | 354 | void |
| 357 | tty_show_cursor (struct tty_display_info *tty) | 355 | tty_show_cursor (struct tty_display_info *tty) |
| 358 | { | 356 | { |
| 359 | if (tty->cursor_hidden) | 357 | if (tty->cursor_hidden) |
| @@ -788,13 +786,20 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 788 | /* Identify a run of glyphs with the same face. */ | 786 | /* Identify a run of glyphs with the same face. */ |
| 789 | int face_id = string->face_id; | 787 | int face_id = string->face_id; |
| 790 | 788 | ||
| 789 | /* FIXME/tty: it happens that a single glyph's frame is NULL. It | ||
| 790 | might depend on a tab bar line being present, then switching | ||
| 791 | from a buffer without header line to one with header line and | ||
| 792 | opening a child frame. */ | ||
| 793 | struct frame *face_id_frame = string->frame ? string->frame : f; | ||
| 794 | |||
| 791 | for (n = 1; n < stringlen; ++n) | 795 | for (n = 1; n < stringlen; ++n) |
| 792 | if (string[n].face_id != face_id) | 796 | if (string[n].face_id != face_id || string[n].frame != face_id_frame) |
| 793 | break; | 797 | break; |
| 794 | 798 | ||
| 795 | /* Turn appearance modes of the face of the run on. */ | 799 | /* Turn appearance modes of the face of the run on. */ |
| 796 | tty_highlight_if_desired (tty); | 800 | tty_highlight_if_desired (tty); |
| 797 | turn_on_face (f, face_id); | 801 | struct face *face = FACE_FROM_ID (face_id_frame, face_id); |
| 802 | turn_on_face (f, face); | ||
| 798 | 803 | ||
| 799 | if (n == stringlen) | 804 | if (n == stringlen) |
| 800 | /* This is the last run. */ | 805 | /* This is the last run. */ |
| @@ -812,7 +817,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 812 | string += n; | 817 | string += n; |
| 813 | 818 | ||
| 814 | /* Turn appearance modes off. */ | 819 | /* Turn appearance modes off. */ |
| 815 | turn_off_face (f, face_id); | 820 | turn_off_face (f, face); |
| 816 | tty_turn_off_highlight (tty); | 821 | tty_turn_off_highlight (tty); |
| 817 | } | 822 | } |
| 818 | 823 | ||
| @@ -822,8 +827,8 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 822 | #ifndef DOS_NT | 827 | #ifndef DOS_NT |
| 823 | 828 | ||
| 824 | static void | 829 | static void |
| 825 | tty_write_glyphs_with_face (register struct frame *f, register struct glyph *string, | 830 | tty_write_glyphs_with_face (struct frame *f, struct glyph *string, |
| 826 | register int len, register int face_id) | 831 | int len, struct face *face) |
| 827 | { | 832 | { |
| 828 | unsigned char *conversion_buffer; | 833 | unsigned char *conversion_buffer; |
| 829 | struct coding_system *coding; | 834 | struct coding_system *coding; |
| @@ -856,7 +861,7 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str | |||
| 856 | 861 | ||
| 857 | /* Turn appearance modes of the face. */ | 862 | /* Turn appearance modes of the face. */ |
| 858 | tty_highlight_if_desired (tty); | 863 | tty_highlight_if_desired (tty); |
| 859 | turn_on_face (f, face_id); | 864 | turn_on_face (f, face); |
| 860 | 865 | ||
| 861 | coding->mode |= CODING_MODE_LAST_BLOCK; | 866 | coding->mode |= CODING_MODE_LAST_BLOCK; |
| 862 | conversion_buffer = encode_terminal_code (string, len, coding); | 867 | conversion_buffer = encode_terminal_code (string, len, coding); |
| @@ -871,7 +876,7 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str | |||
| 871 | } | 876 | } |
| 872 | 877 | ||
| 873 | /* Turn appearance modes off. */ | 878 | /* Turn appearance modes off. */ |
| 874 | turn_off_face (f, face_id); | 879 | turn_off_face (f, face); |
| 875 | tty_turn_off_highlight (tty); | 880 | tty_turn_off_highlight (tty); |
| 876 | 881 | ||
| 877 | cmcheckmagic (tty); | 882 | cmcheckmagic (tty); |
| @@ -919,6 +924,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 919 | 924 | ||
| 920 | while (len-- > 0) | 925 | while (len-- > 0) |
| 921 | { | 926 | { |
| 927 | struct face *face = NULL; | ||
| 922 | OUTPUT1_IF (tty, tty->TS_ins_char); | 928 | OUTPUT1_IF (tty, tty->TS_ins_char); |
| 923 | if (!start) | 929 | if (!start) |
| 924 | { | 930 | { |
| @@ -928,7 +934,10 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 928 | else | 934 | else |
| 929 | { | 935 | { |
| 930 | tty_highlight_if_desired (tty); | 936 | tty_highlight_if_desired (tty); |
| 931 | turn_on_face (f, start->face_id); | 937 | int face_id = start->face_id; |
| 938 | struct frame *face_id_frame = start->frame; | ||
| 939 | face = FACE_FROM_ID (face_id_frame, face_id); | ||
| 940 | turn_on_face (f, face); | ||
| 932 | glyph = start; | 941 | glyph = start; |
| 933 | ++start; | 942 | ++start; |
| 934 | /* We must open sufficient space for a character which | 943 | /* We must open sufficient space for a character which |
| @@ -957,9 +966,9 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 957 | } | 966 | } |
| 958 | 967 | ||
| 959 | OUTPUT1_IF (tty, tty->TS_pad_inserted_char); | 968 | OUTPUT1_IF (tty, tty->TS_pad_inserted_char); |
| 960 | if (start) | 969 | if (face) |
| 961 | { | 970 | { |
| 962 | turn_off_face (f, glyph->face_id); | 971 | turn_off_face (f, face); |
| 963 | tty_turn_off_highlight (tty); | 972 | tty_turn_off_highlight (tty); |
| 964 | } | 973 | } |
| 965 | } | 974 | } |
| @@ -1542,6 +1551,7 @@ append_glyph (struct it *it) | |||
| 1542 | glyph->type = CHAR_GLYPH; | 1551 | glyph->type = CHAR_GLYPH; |
| 1543 | glyph->pixel_width = 1; | 1552 | glyph->pixel_width = 1; |
| 1544 | glyph->u.ch = it->char_to_display; | 1553 | glyph->u.ch = it->char_to_display; |
| 1554 | glyph->frame = it->f; | ||
| 1545 | glyph->face_id = it->face_id; | 1555 | glyph->face_id = it->face_id; |
| 1546 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 1556 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 1547 | glyph->multibyte_p = it->multibyte_p; | 1557 | glyph->multibyte_p = it->multibyte_p; |
| @@ -1769,6 +1779,7 @@ append_composite_glyph (struct it *it) | |||
| 1769 | 1779 | ||
| 1770 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 1780 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 1771 | glyph->multibyte_p = it->multibyte_p; | 1781 | glyph->multibyte_p = it->multibyte_p; |
| 1782 | glyph->frame = it->f; | ||
| 1772 | glyph->face_id = it->face_id; | 1783 | glyph->face_id = it->face_id; |
| 1773 | glyph->padding_p = false; | 1784 | glyph->padding_p = false; |
| 1774 | glyph->charpos = CHARPOS (it->position); | 1785 | glyph->charpos = CHARPOS (it->position); |
| @@ -1855,6 +1866,7 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str) | |||
| 1855 | glyph->pixel_width = 1; | 1866 | glyph->pixel_width = 1; |
| 1856 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 1867 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 1857 | glyph->multibyte_p = it->multibyte_p; | 1868 | glyph->multibyte_p = it->multibyte_p; |
| 1869 | glyph->frame = it->f; | ||
| 1858 | glyph->face_id = face_id; | 1870 | glyph->face_id = face_id; |
| 1859 | glyph->padding_p = false; | 1871 | glyph->padding_p = false; |
| 1860 | glyph->charpos = CHARPOS (it->position); | 1872 | glyph->charpos = CHARPOS (it->position); |
| @@ -1981,9 +1993,8 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym) | |||
| 1981 | FACE_ID is a realized face ID number, in the face cache. */ | 1993 | FACE_ID is a realized face ID number, in the face cache. */ |
| 1982 | 1994 | ||
| 1983 | static void | 1995 | static void |
| 1984 | turn_on_face (struct frame *f, int face_id) | 1996 | turn_on_face (struct frame *f, struct face *face) |
| 1985 | { | 1997 | { |
| 1986 | struct face *face = FACE_FROM_ID (f, face_id); | ||
| 1987 | unsigned long fg = face->foreground; | 1998 | unsigned long fg = face->foreground; |
| 1988 | unsigned long bg = face->background; | 1999 | unsigned long bg = face->background; |
| 1989 | struct tty_display_info *tty = FRAME_TTY (f); | 2000 | struct tty_display_info *tty = FRAME_TTY (f); |
| @@ -2064,9 +2075,8 @@ turn_on_face (struct frame *f, int face_id) | |||
| 2064 | /* Turn off appearances of face FACE_ID on tty frame F. */ | 2075 | /* Turn off appearances of face FACE_ID on tty frame F. */ |
| 2065 | 2076 | ||
| 2066 | static void | 2077 | static void |
| 2067 | turn_off_face (struct frame *f, int face_id) | 2078 | turn_off_face (struct frame *f, struct face *face) |
| 2068 | { | 2079 | { |
| 2069 | struct face *face = FACE_FROM_ID (f, face_id); | ||
| 2070 | struct tty_display_info *tty = FRAME_TTY (f); | 2080 | struct tty_display_info *tty = FRAME_TTY (f); |
| 2071 | 2081 | ||
| 2072 | if (tty->TS_exit_attribute_mode) | 2082 | if (tty->TS_exit_attribute_mode) |
| @@ -2399,8 +2409,10 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) | |||
| 2399 | t->display_info.tty->output = 0; | 2409 | t->display_info.tty->output = 0; |
| 2400 | 2410 | ||
| 2401 | if (FRAMEP (t->display_info.tty->top_frame)) | 2411 | if (FRAMEP (t->display_info.tty->top_frame)) |
| 2402 | SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0); | 2412 | { |
| 2403 | 2413 | struct frame *top = XFRAME (t->display_info.tty->top_frame); | |
| 2414 | SET_FRAME_VISIBLE (root_frame (top), false); | ||
| 2415 | } | ||
| 2404 | } | 2416 | } |
| 2405 | 2417 | ||
| 2406 | /* Clear display hooks to prevent further output. */ | 2418 | /* Clear display hooks to prevent further output. */ |
| @@ -2472,7 +2484,8 @@ frame's terminal). */) | |||
| 2472 | 2484 | ||
| 2473 | if (FRAMEP (t->display_info.tty->top_frame)) | 2485 | if (FRAMEP (t->display_info.tty->top_frame)) |
| 2474 | { | 2486 | { |
| 2475 | struct frame *f = XFRAME (t->display_info.tty->top_frame); | 2487 | struct frame *top = XFRAME (t->display_info.tty->top_frame); |
| 2488 | struct frame *f = root_frame (top); | ||
| 2476 | int width, height; | 2489 | int width, height; |
| 2477 | int old_height = FRAME_COLS (f); | 2490 | int old_height = FRAME_COLS (f); |
| 2478 | int old_width = FRAME_TOTAL_LINES (f); | 2491 | int old_width = FRAME_TOTAL_LINES (f); |
| @@ -2482,7 +2495,7 @@ frame's terminal). */) | |||
| 2482 | get_tty_size (fileno (t->display_info.tty->input), &width, &height); | 2495 | get_tty_size (fileno (t->display_info.tty->input), &width, &height); |
| 2483 | if (width != old_width || height != old_height) | 2496 | if (width != old_width || height != old_height) |
| 2484 | change_frame_size (f, width, height, false, false, false); | 2497 | change_frame_size (f, width, height, false, false, false); |
| 2485 | SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); | 2498 | SET_FRAME_VISIBLE (f, true); |
| 2486 | } | 2499 | } |
| 2487 | 2500 | ||
| 2488 | set_tty_hooks (t); | 2501 | set_tty_hooks (t); |
| @@ -2563,22 +2576,24 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, | |||
| 2563 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 2576 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 2564 | struct tty_display_info *tty = FRAME_TTY (f); | 2577 | struct tty_display_info *tty = FRAME_TTY (f); |
| 2565 | int face_id = tty->mouse_highlight.mouse_face_face_id; | 2578 | int face_id = tty->mouse_highlight.mouse_face_face_id; |
| 2566 | int save_x, save_y, pos_x, pos_y; | ||
| 2567 | 2579 | ||
| 2568 | if (end_hpos >= row->used[TEXT_AREA]) | 2580 | if (end_hpos >= row->used[TEXT_AREA]) |
| 2569 | nglyphs = row->used[TEXT_AREA] - start_hpos; | 2581 | nglyphs = row->used[TEXT_AREA] - start_hpos; |
| 2570 | 2582 | ||
| 2571 | pos_y = row->y + WINDOW_TOP_EDGE_Y (w); | 2583 | int pos_y = row->y + WINDOW_TOP_EDGE_Y (w); |
| 2572 | pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w); | 2584 | int pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w); |
| 2573 | 2585 | ||
| 2574 | /* Save current cursor coordinates. */ | 2586 | /* Save current cursor coordinates. */ |
| 2575 | save_y = curY (tty); | 2587 | int save_y = curY (tty); |
| 2576 | save_x = curX (tty); | 2588 | int save_x = curX (tty); |
| 2577 | cursor_to (f, pos_y, pos_x); | 2589 | cursor_to (f, pos_y, pos_x); |
| 2578 | 2590 | ||
| 2579 | if (draw == DRAW_MOUSE_FACE) | 2591 | if (draw == DRAW_MOUSE_FACE) |
| 2580 | tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, | 2592 | { |
| 2581 | nglyphs, face_id); | 2593 | struct glyph *glyph = row->glyphs[TEXT_AREA] + start_hpos; |
| 2594 | struct face *face = FACE_FROM_ID (f, face_id); | ||
| 2595 | tty_write_glyphs_with_face (f, glyph, nglyphs, face); | ||
| 2596 | } | ||
| 2582 | else if (draw == DRAW_NORMAL_TEXT) | 2597 | else if (draw == DRAW_NORMAL_TEXT) |
| 2583 | write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); | 2598 | write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); |
| 2584 | 2599 | ||
| @@ -3969,7 +3984,7 @@ tty_free_frame_resources (struct frame *f) | |||
| 3969 | 3984 | ||
| 3970 | #endif | 3985 | #endif |
| 3971 | 3986 | ||
| 3972 | 3987 | ||
| 3973 | 3988 | ||
| 3974 | #ifndef HAVE_ANDROID | 3989 | #ifndef HAVE_ANDROID |
| 3975 | 3990 | ||
| @@ -4044,6 +4059,8 @@ set_tty_hooks (struct terminal *terminal) | |||
| 4044 | terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ | 4059 | terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ |
| 4045 | terminal->delete_frame_hook = &tty_free_frame_resources; | 4060 | terminal->delete_frame_hook = &tty_free_frame_resources; |
| 4046 | terminal->delete_terminal_hook = &delete_tty; | 4061 | terminal->delete_terminal_hook = &delete_tty; |
| 4062 | |||
| 4063 | terminal->frame_raise_lower_hook = tty_raise_lower_frame; | ||
| 4047 | /* Other hooks are NULL by default. */ | 4064 | /* Other hooks are NULL by default. */ |
| 4048 | } | 4065 | } |
| 4049 | 4066 | ||
| @@ -4714,6 +4731,184 @@ delete_tty (struct terminal *terminal) | |||
| 4714 | 4731 | ||
| 4715 | #endif | 4732 | #endif |
| 4716 | 4733 | ||
| 4734 | /* Return geometric attributes of FRAME. According to the value of | ||
| 4735 | ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the | ||
| 4736 | native edges of FRAME (Qnative_edges), or the inner edges of frame | ||
| 4737 | (Qinner_edges). Any other value means to return the geometry as | ||
| 4738 | returned by Fx_frame_geometry. */ | ||
| 4739 | |||
| 4740 | static Lisp_Object | ||
| 4741 | tty_frame_geometry (Lisp_Object frame, Lisp_Object attribute) | ||
| 4742 | { | ||
| 4743 | struct frame *f = decode_live_frame (frame); | ||
| 4744 | if (FRAME_INITIAL_P (f) || !FRAME_TTY (f)) | ||
| 4745 | return Qnil; | ||
| 4746 | |||
| 4747 | int native_width = f->pixel_width; | ||
| 4748 | int native_height = f->pixel_height; | ||
| 4749 | |||
| 4750 | eassert (FRAME_PARENT_FRAME (f) || (f->left_pos == 0 && f->top_pos == 0)); | ||
| 4751 | int outer_left = f->left_pos; | ||
| 4752 | int outer_top = f->top_pos; | ||
| 4753 | int outer_right = outer_left + native_width; | ||
| 4754 | int outer_bottom = outer_top + native_height; | ||
| 4755 | |||
| 4756 | int native_left = outer_left; | ||
| 4757 | int native_top = outer_top; | ||
| 4758 | int native_right = outer_right; | ||
| 4759 | int native_bottom = outer_bottom; | ||
| 4760 | |||
| 4761 | int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 4762 | int inner_left = native_left + internal_border_width; | ||
| 4763 | int inner_top = native_top + internal_border_width; | ||
| 4764 | int inner_right = native_right - internal_border_width; | ||
| 4765 | int inner_bottom = native_bottom - internal_border_width; | ||
| 4766 | |||
| 4767 | int menu_bar_height = FRAME_MENU_BAR_HEIGHT (f); | ||
| 4768 | inner_top += menu_bar_height; | ||
| 4769 | int menu_bar_width = menu_bar_height ? native_width : 0; | ||
| 4770 | |||
| 4771 | int tab_bar_height = FRAME_TAB_BAR_HEIGHT (f); | ||
| 4772 | int tab_bar_width = (tab_bar_height | ||
| 4773 | ? native_width - 2 * internal_border_width | ||
| 4774 | : 0); | ||
| 4775 | inner_top += tab_bar_height; | ||
| 4776 | |||
| 4777 | int tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f); | ||
| 4778 | int tool_bar_width = (tool_bar_height | ||
| 4779 | ? native_width - 2 * internal_border_width | ||
| 4780 | : 0); | ||
| 4781 | |||
| 4782 | /* Subtract or add to the inner dimensions based on the tool bar | ||
| 4783 | position. */ | ||
| 4784 | if (EQ (FRAME_TOOL_BAR_POSITION (f), Qtop)) | ||
| 4785 | inner_top += tool_bar_height; | ||
| 4786 | else | ||
| 4787 | inner_bottom -= tool_bar_height; | ||
| 4788 | |||
| 4789 | /* Construct list. */ | ||
| 4790 | if (EQ (attribute, Qouter_edges)) | ||
| 4791 | return list4i (outer_left, outer_top, outer_right, outer_bottom); | ||
| 4792 | else if (EQ (attribute, Qnative_edges)) | ||
| 4793 | return list4i (native_left, native_top, native_right, native_bottom); | ||
| 4794 | else if (EQ (attribute, Qinner_edges)) | ||
| 4795 | return list4i (inner_left, inner_top, inner_right, inner_bottom); | ||
| 4796 | else | ||
| 4797 | return list (Fcons (Qouter_position, Fcons (make_fixnum (outer_left), | ||
| 4798 | make_fixnum (outer_top))), | ||
| 4799 | Fcons (Qouter_size, | ||
| 4800 | Fcons (make_fixnum (outer_right - outer_left), | ||
| 4801 | make_fixnum (outer_bottom - outer_top))), | ||
| 4802 | Fcons (Qouter_border_width, make_fixnum (0)), | ||
| 4803 | Fcons (Qexternal_border_size, | ||
| 4804 | Fcons (make_fixnum (0), make_fixnum (0))), | ||
| 4805 | Fcons (Qtitle_bar_size, | ||
| 4806 | Fcons (make_fixnum (0), make_fixnum (0))), | ||
| 4807 | Fcons (Qmenu_bar_external, Qnil), | ||
| 4808 | Fcons (Qmenu_bar_size, | ||
| 4809 | Fcons (make_fixnum (menu_bar_width), | ||
| 4810 | make_fixnum (menu_bar_height))), | ||
| 4811 | Fcons (Qtab_bar_size, | ||
| 4812 | Fcons (make_fixnum (tab_bar_width), | ||
| 4813 | make_fixnum (tab_bar_height))), | ||
| 4814 | Fcons (Qtool_bar_external, Qnil), | ||
| 4815 | Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)), | ||
| 4816 | Fcons (Qtool_bar_size, | ||
| 4817 | Fcons (make_fixnum (tool_bar_width), | ||
| 4818 | make_fixnum (tool_bar_height))), | ||
| 4819 | Fcons (Qinternal_border_width, | ||
| 4820 | make_fixnum (internal_border_width))); | ||
| 4821 | } | ||
| 4822 | |||
| 4823 | DEFUN ("tty-frame-geometry", Ftty_frame_geometry, Stty_frame_geometry, 0, 1, 0, | ||
| 4824 | doc: /* Return geometric attributes of terminal frame FRAME. | ||
| 4825 | See also `frame-geometry'. */) | ||
| 4826 | (Lisp_Object frame) | ||
| 4827 | { | ||
| 4828 | return tty_frame_geometry (frame, Qnil); | ||
| 4829 | } | ||
| 4830 | |||
| 4831 | DEFUN ("tty-frame-edges", Ftty_frame_edges, Stty_frame_edges, 0, 2, 0, | ||
| 4832 | doc: /* Return coordinates of FRAME's edges. | ||
| 4833 | See also `frame-edges'. */) | ||
| 4834 | (Lisp_Object frame, Lisp_Object type) | ||
| 4835 | { | ||
| 4836 | if (!EQ (type, Qouter_edges) && !EQ (type, Qinner_edges)) | ||
| 4837 | type = Qnative_edges; | ||
| 4838 | return tty_frame_geometry (frame, type); | ||
| 4839 | } | ||
| 4840 | |||
| 4841 | DEFUN ("tty-frame-list-z-order", Ftty_frame_list_z_order, | ||
| 4842 | Stty_frame_list_z_order, 0, 1, 0, | ||
| 4843 | doc: /* Return list of Emacs's frames, in Z (stacking) order. | ||
| 4844 | See also `frame-list-z-order'. */) | ||
| 4845 | (Lisp_Object frame) | ||
| 4846 | { | ||
| 4847 | struct frame *f = decode_tty_frame (frame); | ||
| 4848 | Lisp_Object frames = frames_in_reverse_z_order (f, true); | ||
| 4849 | return Fnreverse (frames); | ||
| 4850 | } | ||
| 4851 | |||
| 4852 | DEFUN ("tty-frame-restack", Ftty_frame_restack, | ||
| 4853 | Stty_frame_restack, 2, 3, 0, | ||
| 4854 | doc: /* Restack FRAME1 below FRAME2 on terminals. | ||
| 4855 | . See also `frame-restack'. */) | ||
| 4856 | (Lisp_Object frame1, Lisp_Object frame2, Lisp_Object above) | ||
| 4857 | { | ||
| 4858 | /* FIXME/tty: tty-frame-restack implementation. */ | ||
| 4859 | return Qnil; | ||
| 4860 | } | ||
| 4861 | |||
| 4862 | static void | ||
| 4863 | tty_display_dimension (Lisp_Object frame, int *width, int *height) | ||
| 4864 | { | ||
| 4865 | if (!FRAMEP (frame)) | ||
| 4866 | frame = Fselected_frame (); | ||
| 4867 | struct frame *f = XFRAME (frame); | ||
| 4868 | switch (f->output_method) | ||
| 4869 | { | ||
| 4870 | case output_initial: | ||
| 4871 | *width = 80; | ||
| 4872 | *height = 25; | ||
| 4873 | break; | ||
| 4874 | case output_termcap: | ||
| 4875 | *width = FrameCols (FRAME_TTY (f)); | ||
| 4876 | *height = FrameRows (FRAME_TTY (f)); | ||
| 4877 | break; | ||
| 4878 | case output_x_window: | ||
| 4879 | case output_msdos_raw: | ||
| 4880 | case output_w32: | ||
| 4881 | case output_ns: | ||
| 4882 | case output_pgtk: | ||
| 4883 | case output_haiku: | ||
| 4884 | case output_android: | ||
| 4885 | emacs_abort (); | ||
| 4886 | break; | ||
| 4887 | } | ||
| 4888 | } | ||
| 4889 | |||
| 4890 | DEFUN ("tty-display-pixel-width", Ftty_display_pixel_width, | ||
| 4891 | Stty_display_pixel_width, 0, 1, 0, | ||
| 4892 | doc: /* Return the width of DISPLAY's screen in pixels. | ||
| 4893 | . See also `display-pixel-width'. */) | ||
| 4894 | (Lisp_Object display) | ||
| 4895 | { | ||
| 4896 | int width, height; | ||
| 4897 | tty_display_dimension (display, &width, &height); | ||
| 4898 | return make_fixnum (width); | ||
| 4899 | } | ||
| 4900 | |||
| 4901 | DEFUN ("tty-display-pixel-height", Ftty_display_pixel_height, | ||
| 4902 | Stty_display_pixel_height, 0, 1, 0, | ||
| 4903 | doc: /* Return the height of DISPLAY's screen in pixels. | ||
| 4904 | See also `display-pixel-height'. */) | ||
| 4905 | (Lisp_Object display) | ||
| 4906 | { | ||
| 4907 | int width, height; | ||
| 4908 | tty_display_dimension (display, &width, &height); | ||
| 4909 | return make_fixnum (height); | ||
| 4910 | } | ||
| 4911 | |||
| 4717 | void | 4912 | void |
| 4718 | syms_of_term (void) | 4913 | syms_of_term (void) |
| 4719 | { | 4914 | { |
| @@ -4770,6 +4965,13 @@ trigger redisplay. */); | |||
| 4770 | defsubr (&Sgpm_mouse_stop); | 4965 | defsubr (&Sgpm_mouse_stop); |
| 4771 | #endif /* HAVE_GPM */ | 4966 | #endif /* HAVE_GPM */ |
| 4772 | 4967 | ||
| 4968 | defsubr (&Stty_frame_geometry); | ||
| 4969 | defsubr (&Stty_frame_edges); | ||
| 4970 | defsubr (&Stty_frame_list_z_order); | ||
| 4971 | defsubr (&Stty_frame_restack); | ||
| 4972 | defsubr (&Stty_display_pixel_width); | ||
| 4973 | defsubr (&Stty_display_pixel_height); | ||
| 4974 | |||
| 4773 | #if !defined DOS_NT && !defined HAVE_ANDROID | 4975 | #if !defined DOS_NT && !defined HAVE_ANDROID |
| 4774 | default_orig_pair = NULL; | 4976 | default_orig_pair = NULL; |
| 4775 | default_set_foreground = NULL; | 4977 | default_set_foreground = NULL; |