summaryrefslogtreecommitdiff
path: root/console/display.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-06-24 23:46:55 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-06-24 23:46:55 +0000
commit71a1935eec0e651a74ddfc51d2e291d6376e04f0 (patch)
tree0d91eba8831c50397be9cebbbd378e5830fcf7e5 /console/display.c
parent52be5cefb4852e6c2921fd1b19c4d0b4952860ea (diff)
2002-06-25 Marcus Brinkmann <marcus@gnu.org>
* Makefile (LCLHDRS): Add priv.h and mutations.h. (MIGSTUBS): Add tioctlServer.o * console.c: Include <hurd/ioctl-types.h>. (new_node): Bump up st_size for display node. (S_tioctl_tiocflush, S_tioctl_tiocgwinsz, S_tioctl_tiocstart, S_tioctl_tiocstop, S_tioctl_tiocoutq, S_tioctl_tiocspgrp, S_tioctl_tiocgpgrp): New functions. (S_tioctl_tiocmodg, S_tioctl_tiocmods, S_tioctl_tiocexcl, S_tioctl_tiocnxcl, S_tioctl_tiocgeta, S_tioctl_tiocseta, S_tioctl_tiocsetaw, S_tioctl_tiocsetaf, S_tioctl_tiocgetd, S_tioctl_tiocsetd, S_tioctl_tiocdrain, S_tioctl_tiocmget, S_tioctl_tiocmset, S_tioctl_tiocsig, S_tioctl_tiocext, S_tioctl_tiocswinsz, S_tioctl_tiocremote, S_tioctl_tiocmbic, S_tioctl_tiocmbis, S_tioctl_tiocpkt, S_tioctl_tiocsti, S_tioctl_tioccdtr, S_tioctl_tiocsdtr, S_tioctl_tioccbrk, S_tioctl_tiocsbrk): New stubs. (console_demuxer): New function. (main): Don't call netfs_server_loop, but call ports_manage_port_operations_multithread, so we can use our own demuxer. * mutations.h: Use intran and outtran for netfs. * priv.h: Likewise. * console.h (cons_change_t): Add bits for bell_audible and bell_visible. (struct cons_display): Add member BELL. * display.c (struct changes): Add new members bell_audible and bell_visible. Add bit flag macro names for those. (display_flush_filechange): Start with first index in buffer. Signal bell events. (display_record_filechange): Set DISPLAY_CHANGE_MATRIX bit in the disjoint case after flushing the update. (display_output_one): Recognize '\a' as audible bell and '\Eg' as visible bell. (display_output_some): Handle bell updates.
Diffstat (limited to 'console/display.c')
-rw-r--r--console/display.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/console/display.c b/console/display.c
index a70902c0..2b15e343 100644
--- a/console/display.c
+++ b/console/display.c
@@ -58,6 +58,10 @@ struct changes
uint32_t cur_line;
uint32_t scr_lines;
} screen;
+
+ uint32_t bell_audible;
+ uint32_t bell_visible;
+
off_t start;
off_t end;
@@ -65,7 +69,9 @@ struct changes
#define DISPLAY_CHANGE_CURSOR_STATUS 2
#define DISPLAY_CHANGE_SCREEN_CUR_LINE 4
#define DISPLAY_CHANGE_SCREEN_SCR_LINES 8
-#define DISPLAY_CHANGE_MATRIX 16
+#define DISPLAY_CHANGE_BELL_AUDIBLE 16
+#define DISPLAY_CHANGE_BELL_VISIBLE 32
+#define DISPLAY_CHANGE_MATRIX 64
unsigned int which;
};
@@ -544,7 +550,7 @@ static void
display_flush_filechange (display_t display, unsigned int type)
{
struct cons_display *user = display->user;
- cons_change_t *next = &user->changes._buffer[(user->changes.written + 1)
+ cons_change_t *next = &user->changes._buffer[user->changes.written
% _CONS_CHANGES_LENGTH];
int notify = 0;
int bump_written = 0;
@@ -556,7 +562,7 @@ display_flush_filechange (display_t display, unsigned int type)
next->matrix.start = display->changes.start;
next->matrix.end = display->changes.end;
user->changes.written++;
- next = &user->changes._buffer[(user->changes.written + 1)
+ next = &user->changes._buffer[user->changes.written
% _CONS_CHANGES_LENGTH];
display->changes.which &= ~DISPLAY_CHANGE_MATRIX;
}
@@ -605,6 +611,26 @@ display_flush_filechange (display_t display, unsigned int type)
display->changes.which &= ~DISPLAY_CHANGE_SCREEN_SCR_LINES;
}
+ if (type & DISPLAY_CHANGE_BELL_AUDIBLE
+ && display->changes.which & DISPLAY_CHANGE_BELL_AUDIBLE
+ && display->changes.bell_audible != user->bell.audible)
+ {
+ notify = 1;
+ next->what.bell_audible = 1;
+ bump_written = 1;
+ display->changes.which &= ~DISPLAY_CHANGE_BELL_AUDIBLE;
+ }
+
+ if (type & DISPLAY_CHANGE_BELL_VISIBLE
+ && display->changes.which & DISPLAY_CHANGE_BELL_VISIBLE
+ && display->changes.bell_visible != user->bell.visible)
+ {
+ notify = 1;
+ next->what.bell_visible = 1;
+ bump_written = 1;
+ display->changes.which &= ~DISPLAY_CHANGE_BELL_VISIBLE;
+ }
+
if (bump_written)
user->changes.written++;
if (notify)
@@ -682,8 +708,9 @@ display_record_filechange (display_t display, off_t start, off_t end)
if (disjunct)
{
/* The regions are disjunct, so we have to flush the old
- changes. */
+ changes. */
display_flush_filechange (display, DISPLAY_CHANGE_MATRIX);
+ display->changes.which |= DISPLAY_CHANGE_MATRIX;
}
display->changes.start = start;
display->changes.end = end;
@@ -1437,6 +1464,10 @@ display_output_one (display_t display, wchar_t chr)
case L'\0':
/* Padding character: <pad>. */
break;
+ case L'\a':
+ /* Audible bell. */
+ user->bell.audible++;
+ break;
default:
{
int line = (user->screen.cur_line + user->cursor.row)
@@ -1498,6 +1529,10 @@ display_output_one (display_t display, wchar_t chr)
/* In case the screen was larger before: */
limit_cursor (display);
break;
+ case L'g':
+ /* Visible bell. */
+ user->bell.visible++;
+ break;
default:
/* Unsupported escape sequence. */
parse->state = STATE_NORMAL;
@@ -1555,6 +1590,8 @@ display_output_some (display_t display, char **buffer, size_t *length)
display->changes.cursor.status = display->user->cursor.status;
display->changes.screen.cur_line = display->user->screen.cur_line;
display->changes.screen.scr_lines = display->user->screen.scr_lines;
+ display->changes.bell_audible = display->user->bell.audible;
+ display->changes.bell_visible = display->user->bell.visible;
display->changes.which = ~DISPLAY_CHANGE_MATRIX;
while (!err && *length > 0)