Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
b5e9cbb6
Commit
b5e9cbb6
authored
Jun 02, 2012
by
Eli Zaretskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial incomplete version of tty menus. tty_menu_activate not done yet.
parent
f51b6486
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
998 additions
and
50 deletions
+998
-50
src/dispextern.h
src/dispextern.h
+29
-26
src/dispnew.c
src/dispnew.c
+33
-0
src/menu.c
src/menu.c
+20
-9
src/menu.h
src/menu.h
+2
-0
src/msdos.c
src/msdos.c
+0
-7
src/term.c
src/term.c
+801
-0
src/termhooks.h
src/termhooks.h
+6
-0
src/w32console.c
src/w32console.c
+15
-0
src/window.c
src/window.c
+21
-8
src/xdisp.c
src/xdisp.c
+71
-0
No files found.
src/dispextern.h
View file @
b5e9cbb6
...
...
@@ -3115,6 +3115,7 @@ extern int clear_mouse_face (Mouse_HLInfo *);
extern
int
cursor_in_mouse_face_p
(
struct
window
*
w
);
extern
void
tty_draw_row_with_mouse_face
(
struct
window
*
,
struct
glyph_row
*
,
int
,
int
,
enum
draw_glyphs_face
);
extern
void
display_tty_menu_item
(
const
char
*
,
int
,
int
,
int
,
int
);
/* Flags passed to try_window. */
#define TRY_WINDOW_CHECK_MARGINS (1 << 0)
...
...
@@ -3278,6 +3279,8 @@ extern void hide_hourglass (void);
int
popup_activated
(
void
);
/* Defined in dispnew.c */
extern
Lisp_Object
buffer_posn_from_coords
(
struct
window
*
,
int
*
,
int
*
,
struct
display_pos
*
,
...
...
@@ -3292,35 +3295,35 @@ extern Lisp_Object marginal_area_string (struct window *, enum window_part,
Lisp_Object
*
,
int
*
,
int
*
,
int
*
,
int
*
);
extern
void
redraw_frame
(
struct
frame
*
);
extern
void
cancel_line
(
int
,
struct
frame
*
);
extern
void
init_desired_glyphs
(
struct
frame
*
);
extern
int
update_frame
(
struct
frame
*
,
int
,
int
);
extern
void
update_frame_with_menu
(
struct
frame
*
);
extern
void
bitch_at_user
(
void
);
void
adjust_glyphs
(
struct
frame
*
);
void
free_glyphs
(
struct
frame
*
);
void
free_window_matrices
(
struct
window
*
);
void
check_glyph_memory
(
void
);
void
mirrored_line_dance
(
struct
glyph_matrix
*
,
int
,
int
,
int
*
,
char
*
);
void
clear_glyph_matrix
(
struct
glyph_matrix
*
);
void
clear_current_matrices
(
struct
frame
*
f
);
void
clear_desired_matrices
(
struct
frame
*
);
void
shift_glyph_matrix
(
struct
window
*
,
struct
glyph_matrix
*
,
int
,
int
,
int
);
void
rotate_matrix
(
struct
glyph_matrix
*
,
int
,
int
,
int
);
void
increment_matrix_positions
(
struct
glyph_matrix
*
,
int
,
int
,
ptrdiff_t
,
ptrdiff_t
);
void
blank_row
(
struct
window
*
,
struct
glyph_row
*
,
int
);
void
enable_glyph_matrix_rows
(
struct
glyph_matrix
*
,
int
,
int
,
int
);
void
clear_glyph_row
(
struct
glyph_row
*
);
void
prepare_desired_row
(
struct
glyph_row
*
);
void
set_window_update_flags
(
struct
window
*
,
int
);
void
update_single_window
(
struct
window
*
,
int
);
void
do_pending_window_change
(
int
);
void
change_frame_size
(
struct
frame
*
,
int
,
int
,
int
,
int
,
int
);
void
init_display
(
void
);
void
syms_of_display
(
void
);
extern
void
adjust_glyphs
(
struct
frame
*
);
extern
void
free_glyphs
(
struct
frame
*
);
extern
void
free_window_matrices
(
struct
window
*
);
extern
void
check_glyph_memory
(
void
);
extern
void
mirrored_line_dance
(
struct
glyph_matrix
*
,
int
,
int
,
int
*
,
char
*
);
extern
void
clear_glyph_matrix
(
struct
glyph_matrix
*
);
extern
void
clear_current_matrices
(
struct
frame
*
f
);
extern
void
clear_desired_matrices
(
struct
frame
*
);
extern
void
shift_glyph_matrix
(
struct
window
*
,
struct
glyph_matrix
*
,
int
,
int
,
int
);
extern
void
rotate_matrix
(
struct
glyph_matrix
*
,
int
,
int
,
int
);
extern
void
increment_matrix_positions
(
struct
glyph_matrix
*
,
int
,
int
,
ptrdiff_t
,
ptrdiff_t
);
extern
void
blank_row
(
struct
window
*
,
struct
glyph_row
*
,
int
);
extern
void
enable_glyph_matrix_rows
(
struct
glyph_matrix
*
,
int
,
int
,
int
);
extern
void
clear_glyph_row
(
struct
glyph_row
*
);
extern
void
prepare_desired_row
(
struct
glyph_row
*
);
extern
void
set_window_update_flags
(
struct
window
*
,
int
);
extern
void
update_single_window
(
struct
window
*
,
int
);
extern
void
do_pending_window_change
(
int
);
extern
void
change_frame_size
(
struct
frame
*
,
int
,
int
,
int
,
int
,
int
);
extern
void
init_display
(
void
);
extern
void
syms_of_display
(
void
);
extern
Lisp_Object
Qredisplay_dont_pause
;
void
spec_glyph_lookup_face
(
struct
window
*
,
GLYPH
*
);
extern
void
spec_glyph_lookup_face
(
struct
window
*
,
GLYPH
*
);
/* Defined in terminal.c */
...
...
src/dispnew.c
View file @
b5e9cbb6
...
...
@@ -3337,6 +3337,39 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
return
paused_p
;
}
/* Update a TTY frame F that has a menu dropped down over some of its
glyphs. This is like the second part of update_frame, but it
doesn't call build_frame_matrix, because we already have the
desired matrix prepared, and don't want it to be overwritten by the
text of the normal display. */
void
update_frame_with_menu
(
struct
frame
*
f
)
{
struct
window
*
root_window
=
XWINDOW
(
f
->
root_window
);
xassert
(
FRAME_TERMCAP_P
(
f
));
/* We are working on frame matrix basis. Set the frame on whose
frame matrix we operate. */
set_frame_matrix_frame
(
f
);
/* Update the display */
update_begin
(
f
);
paused_p
=
update_frame_1
(
f
,
1
,
1
);
update_end
(
f
);
if
(
FRAME_TTY
(
f
)
->
termscript
)
fflush
(
FRAME_TTY
(
f
)
->
termscript
);
fflush
(
FRAME_TTY
(
f
)
->
output
);
/* Check window matrices for lost pointers. */
#if GLYPH_DEBUG
check_window_matrix_pointers
(
root_window
);
add_frame_display_history
(
f
,
paused_p
);
#endif
/* Reset flags indicating that a window should be updated. */
set_window_update_flags
(
root_window
,
0
);
}
/************************************************************************
...
...
src/menu.c
View file @
b5e9cbb6
...
...
@@ -1323,20 +1323,31 @@ no quit occurs and `x-popup-menu' returns nil. */)
/* FIXME: Use a terminal hook! */
#if defined HAVE_NTGUI
selection
=
w32_menu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
);
#elif defined HAVE_NS
selection
=
ns_menu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
);
#else
/* MSDOS and X11 */
if
(
FRAME_W32_P
(
f
))
selection
=
w32_menu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
);
else
#endif
#if defined HAVE_NS
if
(
FRAME_NS_P
(
f
))
selection
=
ns_menu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
);
else
#endif
#if (defined (HAVE_X_WINDOWS) || defined (MSDOS))
/* Assume last_event_timestamp is the timestamp of the button event.
Is this assumption ever violated? We can't use the timestamp
stored within POSITION because there the top bits from the actual
timestamp may be truncated away (Bug#4930). */
selection
=
xmenu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
,
last_event_timestamp
);
if
(
FRAME_X_P
(
f
)
||
FRAME_MSDOS_P
(
f
))
selection
=
xmenu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
,
last_event_timestamp
);
else
#endif
if
(
FRAME_TERMCAP_P
(
f
))
selection
=
tty_menu_show
(
f
,
xpos
,
ypos
,
for_click
,
keymaps
,
title
,
&
error_name
);
UNBLOCK_INPUT
;
...
...
src/menu.h
View file @
b5e9cbb6
...
...
@@ -51,4 +51,6 @@ extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int,
Lisp_Object
,
const
char
**
);
extern
Lisp_Object
xmenu_show
(
FRAME_PTR
,
int
,
int
,
int
,
int
,
Lisp_Object
,
const
char
**
,
Time
);
extern
Lisp_Object
tty_menu_show
(
FRAME_PTR
,
int
,
int
,
int
,
int
,
Lisp_Object
,
const
char
**
);
#endif
/* MENU_H */
src/msdos.c
View file @
b5e9cbb6
...
...
@@ -1389,13 +1389,6 @@ IT_delete_glyphs (struct frame *f, int n)
abort
();
}
/* set-window-configuration on window.c needs this. */
void
x_set_menu_bar_lines
(
struct
frame
*
f
,
Lisp_Object
value
,
Lisp_Object
oldval
)
{
set_menu_bar_lines
(
f
,
value
,
oldval
);
}
/* This was copied from xfaces.c */
extern
Lisp_Object
Qbackground_color
;
...
...
src/term.c
View file @
b5e9cbb6
This diff is collapsed.
Click to expand it.
src/termhooks.h
View file @
b5e9cbb6
...
...
@@ -665,3 +665,9 @@ extern unsigned char *encode_terminal_code (struct glyph *, int,
#ifdef HAVE_GPM
extern
void
close_gpm
(
int
gpm_fd
);
#endif
#ifdef WINDOWSNT
extern
int
curX
(
struct
tty_display_info
*
);
extern
int
curY
(
struct
tty_display_info
*
);
#endif
src/w32console.c
View file @
b5e9cbb6
...
...
@@ -603,6 +603,21 @@ Wcm_clear (struct tty_display_info *tty)
}
/* Report the current cursor position. The following two functions
mirror cm.h macros and are used in term.c's tty menu code, so they
are not really "stubs". */
int
curX
(
struct
tty_display_info
*
tty
)
{
return
cursor_coords
.
X
;
}
int
curY
(
struct
tty_display_info
*
tty
)
{
return
cursor_coords
.
Y
;
}
/***********************************************************************
Faces
***********************************************************************/
...
...
src/window.c
View file @
b5e9cbb6
...
...
@@ -5464,17 +5464,23 @@ the return value is nil. Otherwise the value is t. */)
|| data->frame_cols != previous_frame_cols)
change_frame_size (f, data->frame_lines,
data->frame_cols, 0, 0, 0);
#if
defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS)
#if
def HAVE_MENUS
if (data->frame_menu_bar_lines
!= previous_frame_menu_bar_lines)
x_set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
make_number (0));
{
if (FRAME_WINDOW_P (f))
x_set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
make_number (0));
else /* TTY or MSDOS */
set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
make_number (0));
}
#endif
#ifdef HAVE_WINDOW_SYSTEM
if (data->frame_tool_bar_lines
!= previous_frame_tool_bar_lines)
x_set_tool_bar_lines (f, make_number (data->frame_tool_bar_lines),
make_number (0));
#endif
#endif
/* "Swap out" point from the selected window's buffer
...
...
@@ -5688,15 +5694,22 @@ the return value is nil. Otherwise the value is t. */)
|| previous_frame_cols != FRAME_COLS (f))
change_frame_size (f, previous_frame_lines, previous_frame_cols,
0, 0, 0);
#if
defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS)
#if
def HAVE_MENUS
if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f))
x_set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines),
make_number (0));
{
if (FRAME_WINDOW_P (f))
x_set_menu_bar_lines (f,
make_number (previous_frame_menu_bar_lines),
make_number (0));
else /* TTY or MSDOS */
set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines),
make_number (0));
}
#endif
#ifdef HAVE_WINDOW_SYSTEM
if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f))
x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines),
make_number (0));
#endif
#endif
/* Now, free glyph matrices in windows that were not reused. */
...
...
src/xdisp.c
View file @
b5e9cbb6
...
...
@@ -19961,7 +19961,78 @@ display_menu_bar (struct window *w)
compute_line_metrics (&it);
}
#ifdef HAVE_MENUS
/* Display one menu item on a TTY, by overwriting the glyphs in the
desired glyph matrix with glyphs produced from the menu item text.
Called from term.c to display TTY drop-down menus one item at a
time.
ITEM_TEXT is the menu item text as a C string.
FACE_ID is the face ID to be used for this menu item. FACE_ID
could specify one of 3 faces: a face for an enabled item, a face
for a disabled item, or a face for a selected item.
X and Y are coordinates of the first glyph in the desired matrix to
be overwritten by the menu item. Since this is a TTY, Y is the
glyph row and X is the glyph number in the row, where to start
displaying the item.
SUBMENU non-zero means this menu item drops down a submenu, which
should be indicated by displaying a proper visual cue after the
item text. */
void
display_tty_menu_item (const char *item_text, int face_id, int x, int y,
int submenu)
{
struct it it;
struct frame *f = SELECTED_FRAME ();
int saved_used, saved_truncated;
struct glyph_row *row;
xassert (FRAME_TERMCAP_P (f));
init_iterator (&it, w, -1, -1, f->desired_matrix->rows + y, MENU_FACE_ID);
it.first_visible_x = 0;
it.last_visible_x = FRAME_COLS (f);
row = it.glyph_row;
row->full_width_p = 1;
/* Arrange for the menu item glyphs to start at X and have the
desired face. */
it.current_x = it.hpos = x;
saved_used = row->used[TEXT_AREA];
saved_truncated = row->truncated_on_right_p;
row->used[TEXT_AREA] = x - row->used[LEFT_MARGIN_AREA];
it.face_id = face_id;
/* FIXME: This should be controlled by a user option. See the
comments in redisplay_tool_bar and display_mode_line about this.
Also, if paragraph_embedding could ever be R2L, changes will be
needed to avoid shifting to the right the row characters in
term.c:append_glyph. */
it.paragraph_embedding = L2R;
if (submenu)
{
/* Indicate with ">" that there's a submenu. */
display_string (item_text, Qnil, Qnil, 0, 0, &it,
strlen (item_text), 0, FRAME_COLS (f) - 2, -1);
display_string (">", Qnil, Qnil, 0, 0, &it, 1, 0, 0, -1);
}
else
{
/* Display the menu item, pad with one space. */
display_string (item_text, Qnil, Qnil, 0, 0, &it,
strlen (item_text) + 1, 0, 0, -1);
}
row->used[TEXT_AREA] = saved_used;
row->truncated_on_right_p = saved_truncated;
row->hash - row_hash (row);
}
#endif /* HAVE_MENUS */
/***********************************************************************
Mode Line
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment