summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-10 18:05:41 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-10 18:05:41 +0000
commitbe549330de1979ba914194bd79bfd7eb998a792e (patch)
tree0e507d51c57f7a94934c3cf2ad3eaf72461ae510
parent26482336f2919d72935a8aacc42420aa89138cbd (diff)
console/
2002-09-10 Marcus Brinkmann <marcus@gnu.org> * display.c (DISPLAY_CHANGE_FLAGS): New macro. (struct changes): New member FLAGS. (display_flush_filechange): Handle change of flags. (display_output_some): Initialize DISPLAY->changes.flags. (display_start_output): Clear CONS_FLAGS_SCROLL_LOCK in DISPLAY. (display_stop_output): Set CONS_FLAGS_SCROLL_LOCK in DISPLAY. hurd/ 2002-09-10 Marcus Brinkmann <marcus@gnu.org> * console.h (struct cons_display): New member FLAGS. (union cons_change_t): Likewise for WHAT->flags. libcons/ 2002-09-10 Marcus Brinkmann <marcus@gnu.org> * cons.h: New prototype for cons_vcons_set_scroll_lock. (struct vcons): Add member FLAGS to state. * file-changed.c (cons_S_file_changed): Handle change of flags. * vcons-refresh.c (cons_vcons_refresh): Copy FLAGS field. Call cons_vcons_set_scroll_lock. * cons-switch.c (cons_switch): Initialize VCONS_ENTRY even if DELTA is negative. utils/ 2002-09-09 Marcus Brinkmann <marcus@gnu.org> * console-ncurses.c (cons_vcons_set_scroll_lock): New function.
-rw-r--r--console/ChangeLog7
-rw-r--r--console/display.c37
-rw-r--r--hurd/ChangeLog5
-rw-r--r--hurd/console.h8
-rw-r--r--libcons/ChangeLog11
-rw-r--r--libcons/cons-switch.c1
-rw-r--r--libcons/cons.h5
-rw-r--r--libcons/file-changed.c10
-rw-r--r--libcons/vcons-refresh.c2
-rw-r--r--utils/ChangeLog2
-rw-r--r--utils/console-ncurses.c5
11 files changed, 85 insertions, 8 deletions
diff --git a/console/ChangeLog b/console/ChangeLog
index bfa7eb14..e1bed32c 100644
--- a/console/ChangeLog
+++ b/console/ChangeLog
@@ -1,5 +1,12 @@
2002-09-10 Marcus Brinkmann <marcus@gnu.org>
+ * display.c (DISPLAY_CHANGE_FLAGS): New macro.
+ (struct changes): New member FLAGS.
+ (display_flush_filechange): Handle change of flags.
+ (display_output_some): Initialize DISPLAY->changes.flags.
+ (display_start_output): Clear CONS_FLAGS_SCROLL_LOCK in DISPLAY.
+ (display_stop_output): Set CONS_FLAGS_SCROLL_LOCK in DISPLAY.
+
* display.c (display_output_some): If iconv fails with EILSEQ,
skip the next byte in the buffer and print a replacement
character.
diff --git a/console/display.c b/console/display.c
index 638ac222..d11091b4 100644
--- a/console/display.c
+++ b/console/display.c
@@ -48,6 +48,7 @@
struct changes
{
+ uint32_t flags;
struct
{
uint32_t col;
@@ -66,13 +67,14 @@ struct changes
off_t start;
off_t end;
-#define DISPLAY_CHANGE_CURSOR_POS 1
-#define DISPLAY_CHANGE_CURSOR_STATUS 2
-#define DISPLAY_CHANGE_SCREEN_CUR_LINE 4
-#define DISPLAY_CHANGE_SCREEN_SCR_LINES 8
-#define DISPLAY_CHANGE_BELL_AUDIBLE 16
-#define DISPLAY_CHANGE_BELL_VISIBLE 32
-#define DISPLAY_CHANGE_MATRIX 64
+#define DISPLAY_CHANGE_CURSOR_POS 0x0001
+#define DISPLAY_CHANGE_CURSOR_STATUS 0x0002
+#define DISPLAY_CHANGE_SCREEN_CUR_LINE 0x0004
+#define DISPLAY_CHANGE_SCREEN_SCR_LINES 0x0008
+#define DISPLAY_CHANGE_BELL_AUDIBLE 0x0010
+#define DISPLAY_CHANGE_BELL_VISIBLE 0x0020
+#define DISPLAY_CHANGE_FLAGS 0x0030
+#define DISPLAY_CHANGE_MATRIX 0x0040
unsigned int which;
};
@@ -646,6 +648,16 @@ display_flush_filechange (display_t display, unsigned int type)
display->changes.which &= ~DISPLAY_CHANGE_BELL_VISIBLE;
}
+ if (type & DISPLAY_CHANGE_FLAGS
+ && display->changes.which & DISPLAY_CHANGE_FLAGS
+ && display->changes.flags != user->flags)
+ {
+ notify = 1;
+ next->what.flags = 1;
+ bump_written = 1;
+ display->changes.which &= ~DISPLAY_CHANGE_FLAGS;
+ }
+
if (bump_written)
user->changes.written++;
if (notify)
@@ -1609,6 +1621,7 @@ display_output_some (display_t display, char **buffer, size_t *length)
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.flags = display->user->flags;
display->changes.which = ~DISPLAY_CHANGE_MATRIX;
while (!err && *length > 0)
@@ -1913,6 +1926,7 @@ display_output (display_t display, int nonblock, char *data, size_t datalen)
return amount;
}
+
ssize_t
display_read (display_t display, int nonblock, off_t off,
char *data, size_t len)
@@ -1923,6 +1937,7 @@ display_read (display_t display, int nonblock, off_t off,
return len;
}
+
/* Resume the output on the display DISPLAY. */
void
display_start_output (display_t display)
@@ -1933,6 +1948,10 @@ display_start_output (display_t display)
display->output.stopped = 0;
condition_broadcast (&display->output.resumed);
}
+ display->changes.flags = display->user->flags;
+ display->changes.which = DISPLAY_CHANGE_FLAGS;
+ display->user->flags &= ~CONS_FLAGS_SCROLL_LOCK;
+ display_flush_filechange (display, DISPLAY_CHANGE_FLAGS);
mutex_unlock (&display->lock);
}
@@ -1943,6 +1962,10 @@ display_stop_output (display_t display)
{
mutex_lock (&display->lock);
display->output.stopped = 1;
+ display->changes.flags = display->user->flags;
+ display->changes.which = DISPLAY_CHANGE_FLAGS;
+ display->user->flags |= CONS_FLAGS_SCROLL_LOCK;
+ display_flush_filechange (display, DISPLAY_CHANGE_FLAGS);
mutex_unlock (&display->lock);
}
diff --git a/hurd/ChangeLog b/hurd/ChangeLog
index deea9289..d4c72fac 100644
--- a/hurd/ChangeLog
+++ b/hurd/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-10 Marcus Brinkmann <marcus@gnu.org>
+
+ * console.h (struct cons_display): New member FLAGS.
+ (union cons_change_t): Likewise for WHAT->flags.
+
2002-09-04 Marcus Brinkmann <marcus@gnu.org>
* console.h: Include <wchar.h>.
diff --git a/hurd/console.h b/hurd/console.h
index b673db54..bf15e357 100644
--- a/hurd/console.h
+++ b/hurd/console.h
@@ -65,7 +65,8 @@ typedef union
uint32_t screen_scr_lines : 1;
uint32_t bell_audible : 1;
uint32_t bell_visible : 1;
- uint32_t _unused : 25;
+ uint32_t flags : 1;
+ uint32_t _unused : 24;
uint32_t not_matrix : 1;
/* Here are 32 more unused bits. */
} what;
@@ -82,6 +83,11 @@ struct cons_display
uint32_t version; /* Version of interface. Lower 16
bits define the age, upper 16 bits
the major version. */
+
+ /* Various one bit flags that don't deserve their own field. */
+#define CONS_FLAGS_SCROLL_LOCK 0x00000001
+ uint32_t flags;
+
struct
{
uint32_t width; /* Width of screen matrix. */
diff --git a/libcons/ChangeLog b/libcons/ChangeLog
index bae85db0..e6323d2f 100644
--- a/libcons/ChangeLog
+++ b/libcons/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-10 Marcus Brinkmann <marcus@gnu.org>
+
+ * cons.h: New prototype for cons_vcons_set_scroll_lock.
+ (struct vcons): Add member FLAGS to state.
+ * file-changed.c (cons_S_file_changed): Handle change of flags.
+ * vcons-refresh.c (cons_vcons_refresh): Copy FLAGS field.
+ Call cons_vcons_set_scroll_lock.
+
+ * cons-switch.c (cons_switch): Initialize VCONS_ENTRY even if
+ DELTA is negative.
+
2002-09-09 Marcus Brinkmann <marcus@gnu.org>
* Makefile (SRCS): Add vcons-scrollback.c.
diff --git a/libcons/cons-switch.c b/libcons/cons-switch.c
index c39e83da..752af97e 100644
--- a/libcons/cons-switch.c
+++ b/libcons/cons-switch.c
@@ -56,6 +56,7 @@ cons_switch (vcons_t vcons, int id, int delta, vcons_t *r_vcons)
else
{
assert (delta < 0);
+ vcons_entry = vcons->vcons_entry;
while (delta++ < 0)
{
vcons_entry = vcons_entry->prev;
diff --git a/libcons/cons.h b/libcons/cons.h
index 6b2fca49..783aeb6a 100644
--- a/libcons/cons.h
+++ b/libcons/cons.h
@@ -76,6 +76,7 @@ struct vcons
struct
{
+ uint32_t flags;
struct
{
uint32_t col;
@@ -195,6 +196,10 @@ void cons_vcons_beep (vcons_t vcons);
VCONS, which is locked, flash visibly. */
void cons_vcons_flash (vcons_t vcons);
+/* The user must define this function. Notice the current status of
+ the scroll lock flag. */
+void cons_vcons_set_scroll_lock (vcons_t vcons, int onoff);
+
/* The user must define this function. It is called whenever a
virtual console is selected to be the active one. It is the user's
responsibility to close the console at some later time. */
diff --git a/libcons/file-changed.c b/libcons/file-changed.c
index b4372ed9..fabc7f6e 100644
--- a/libcons/file-changed.c
+++ b/libcons/file-changed.c
@@ -202,6 +202,16 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
vcons->state.bell.visible++;
}
}
+ if (change.what.flags)
+ {
+ uint32_t flags = vcons->display->flags;
+
+ if (flags & CONS_FLAGS_SCROLL_LOCK
+ != vcons->display->flags & CONS_FLAGS_SCROLL_LOCK)
+ cons_vcons_set_scroll_lock (vcons, flags
+ & CONS_FLAGS_SCROLL_LOCK);
+ vcons->state.flags = flags;
+ }
}
else
{
diff --git a/libcons/vcons-refresh.c b/libcons/vcons-refresh.c
index 35e74224..c2db2c57 100644
--- a/libcons/vcons-refresh.c
+++ b/libcons/vcons-refresh.c
@@ -34,6 +34,7 @@ cons_vcons_refresh (vcons_t vcons)
vcons->state.cursor.status = vcons->display->cursor.status;
vcons->state.bell.audible = vcons->display->bell.audible;
vcons->state.bell.visible = vcons->display->bell.visible;
+ vcons->state.flags = vcons->display->flags;
vcons->state.changes.written = vcons->display->changes.written;
cons_vcons_write (vcons, vcons->state.screen.matrix
@@ -60,5 +61,6 @@ cons_vcons_refresh (vcons_t vcons)
cons_vcons_set_cursor_pos (vcons, vcons->state.cursor.col,
vcons->state.cursor.row);
cons_vcons_set_cursor_status (vcons, vcons->state.cursor.status);
+ cons_vcons_set_scroll_lock (vcons, vcons->state.flags & CONS_FLAGS_SCROLL_LOCK);
cons_vcons_update (vcons);
}
diff --git a/utils/ChangeLog b/utils/ChangeLog
index 496edd80..624ad649 100644
--- a/utils/ChangeLog
+++ b/utils/ChangeLog
@@ -1,5 +1,7 @@
2002-09-09 Marcus Brinkmann <marcus@gnu.org>
+ * console-ncurses.c (cons_vcons_set_scroll_lock): New function.
+
* console-ncurses.c (console_switch): Keep a reference to the port
instead refering to it by number.
diff --git a/utils/console-ncurses.c b/utils/console-ncurses.c
index 98c212f6..0d290a2f 100644
--- a/utils/console-ncurses.c
+++ b/utils/console-ncurses.c
@@ -601,6 +601,11 @@ cons_vcons_flash (vcons_t vcons)
mutex_unlock (&global_lock);
}
+void
+cons_vcons_set_scroll_lock (vcons_t vcons, int onoff)
+{
+}
+
int
main (int argc, char *argv[])