mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-09 07:08:01 +02:00
Add the ability to toggle off graphics mode with ctrl-T
When debugging it's useful to be able to force text mode so text messages become visible on screen. ctrl-t and ctrl-v combined make it a lot easier to see what's going on.
This commit is contained in:
parent
7952221f06
commit
cad6ba8b75
1 changed files with 12 additions and 1 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include "ply-logger.h"
|
||||
#include "ply-utils.h"
|
||||
|
||||
#define KEY_CTRL_T '\024'
|
||||
#define KEY_CTRL_V '\026'
|
||||
#define KEY_ESCAPE '\033'
|
||||
#define KEY_RETURN '\r'
|
||||
|
|
@ -60,6 +61,8 @@ struct _ply_window
|
|||
ply_fd_watch_t *tty_fd_watch;
|
||||
ply_window_mode_t mode;
|
||||
|
||||
uint32_t should_force_text_mode : 1;
|
||||
|
||||
ply_window_keyboard_input_handler_t keyboard_input_handler;
|
||||
void *keyboard_input_handler_user_data;
|
||||
|
||||
|
|
@ -107,6 +110,13 @@ process_keyboard_input (ply_window_t *window,
|
|||
ply_trace ("verbose mode toggled!");
|
||||
return;
|
||||
|
||||
case KEY_CTRL_T:
|
||||
ply_trace ("toggle text mode!");
|
||||
window->should_force_text_mode = !window->should_force_text_mode;
|
||||
ply_window_set_mode (window, window->mode);
|
||||
ply_trace ("text mode toggled!");
|
||||
return;
|
||||
|
||||
case KEY_ESCAPE:
|
||||
ply_trace ("escape key!");
|
||||
if (window->escape_handler != NULL)
|
||||
|
|
@ -274,7 +284,8 @@ ply_window_set_mode (ply_window_t *window,
|
|||
break;
|
||||
|
||||
case PLY_WINDOW_MODE_GRAPHICS:
|
||||
if (ioctl (window->tty_fd, KDSETMODE, KD_GRAPHICS) < 0)
|
||||
if (ioctl (window->tty_fd, KDSETMODE,
|
||||
window->should_force_text_mode? KD_TEXT : KD_GRAPHICS) < 0)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue