Browse Source

Use TTY function names instead of #define's.

Andrew Borodin 16 years ago
parent
commit
fb51cb8241
10 changed files with 34 additions and 43 deletions
  1. 3 2
      src/dialog.c
  2. 3 3
      src/find.c
  3. 5 5
      src/screen.c
  4. 2 2
      src/subshell.c
  5. 2 2
      src/tty/key.c
  6. 0 10
      src/tty/tty.h
  7. 2 2
      src/view.c
  8. 3 3
      src/widget.c
  9. 7 7
      vfs/direntry.c
  10. 7 7
      vfs/fish.c

+ 3 - 2
src/dialog.c

@@ -32,6 +32,7 @@
 #include "global.h"
 
 #include "../src/tty/tty.h"
+#include "../src/tty/color.h"
 #include "../src/tty/mouse.h"
 #include "../src/tty/key.h"	/* mi_getch() */
 
@@ -752,7 +753,7 @@ void dlg_run_done (Dlg_head *h)
 void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event)
 {
     if (key == EV_NONE){
-	if (got_interrupt ())
+	if (tty_got_interrupt ())
 	    key = XCTRL('g');
 	else
 	    return;
@@ -790,7 +791,7 @@ frontend_run_dlg (Dlg_head *h)
 	update_cursor (h);
 
 	/* Clear interrupt flag */
-	got_interrupt ();
+	tty_got_interrupt ();
 	d_key = get_event (&event, h->mouse_status == MOU_REPEAT, 1);
 
 	dlg_process_event (h, d_key, &event);

+ 3 - 3
src/find.c

@@ -667,8 +667,8 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
     status_update (buffer);
     tty_refresh ();
 
-    enable_interrupt_key ();
-    got_interrupt ();
+    tty_enable_interrupt_key ();
+    tty_got_interrupt ();
 
     {
 	int line = 1;
@@ -727,7 +727,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
 
 	}
     }
-    disable_interrupt_key ();
+    tty_disable_interrupt_key ();
     mc_close (file_fd);
     return ret_val;
 }

+ 5 - 5
src/screen.c

@@ -567,7 +567,7 @@ format_file (char *dest, int limit, WPanel *panel, int file_index, int width, in
                 tty_setcolor (SELECTED_COLOR);
             else
                 tty_setcolor (NORMAL_COLOR);
-	    one_vline ();
+	    tty_print_one_vline ();
 	    length++;
 	}
     }
@@ -620,7 +620,7 @@ repaint_file (WPanel *panel, int file_index, int mv, int attr, int isstatus)
 	    addch (' ');
 	else {
 	    tty_setcolor (NORMAL_COLOR);
-	    one_vline ();
+	    tty_print_one_vline ();
 	}
     }
 }
@@ -1224,7 +1224,7 @@ paint_frame (WPanel *panel)
 
 	if (side){
 	    tty_setcolor (NORMAL_COLOR);
-	    one_vline ();
+	    tty_print_one_vline ();
 	    width = panel->widget.cols - panel->widget.cols/2 - 1;
 	} else if (panel->split)
 	    width = panel->widget.cols/2 - 3;
@@ -1249,8 +1249,8 @@ paint_frame (WPanel *panel)
                 width -= format->field_len;
 	    } else {
 		tty_setcolor (NORMAL_COLOR);
-		one_vline ();
-		width --;
+		tty_print_one_vline ();
+		width--;
 		continue;
 	    }
 	}

+ 2 - 2
src/subshell.c

@@ -518,11 +518,11 @@ init_subshell (void)
     /* Wait until the subshell has started up and processed the command */
 
     subshell_state = RUNNING_COMMAND;
-    enable_interrupt_key ();
+    tty_enable_interrupt_key ();
     if (!feed_subshell (QUIETLY, TRUE)) {
 	use_subshell = FALSE;
     }
-    disable_interrupt_key ();
+    tty_disable_interrupt_key ();
     if (!subshell_alive)
 	use_subshell = FALSE;	/* Subshell died instantly, so don't use it */
 }

+ 2 - 2
src/tty/key.c

@@ -1143,9 +1143,9 @@ get_event (struct Gpm_Event *event, int redo_event, int block)
 	    timeout.tv_sec = 0;
 	    timeout.tv_usec = 0;
 	}
-	enable_interrupt_key ();
+	tty_enable_interrupt_key ();
 	flag = select (maxfdp + 1, &select_set, NULL, NULL, time_addr);
-	disable_interrupt_key ();
+	tty_disable_interrupt_key ();
 
 	/* select timed out: it could be for any of the following reasons:
 	 * redo_event -> it was because of the MOU_REPEAT handler

+ 0 - 10
src/tty/tty.h

@@ -51,18 +51,8 @@ extern void tty_print_vline(int top, int left, int length);
 extern void tty_print_hline(int top, int left, int length);
 extern void tty_draw_box (int y, int x, int rows, int cols);
 
-
 extern char *tty_tgetstr (const char *name);
 
-/* legacy interface */
-
-#define start_interrupt_key()	tty_start_interrupt_key()
-#define enable_interrupt_key()	tty_enable_interrupt_key()
-#define disable_interrupt_key()	tty_disable_interrupt_key()
-#define got_interrupt()		tty_got_interrupt()
-#define one_hline()		tty_print_one_hline()
-#define one_vline()		tty_print_one_vline()
-
 #define KEY_KP_ADD	4001
 #define KEY_KP_SUBTRACT	4002
 #define KEY_KP_MULTIPLY	4003

+ 2 - 2
src/view.c

@@ -3198,7 +3198,7 @@ do_search (WView *view)
     search_update_steps (view);
     view->update_activate = 0;
 
-    enable_interrupt_key ();
+    tty_enable_interrupt_key ();
 
     do
     {
@@ -3240,8 +3240,8 @@ do_search (WView *view)
     view->dirty++;
     view_update (view);
 
+    tty_disable_interrupt_key ();
 
-    disable_interrupt_key ();
     if (verbose) {
         dlg_run_done (d);
         destroy_dlg (d);

+ 3 - 3
src/widget.c

@@ -1848,7 +1848,7 @@ listbox_drawscroll (WListbox *l)
     /* Are we at the top? */
     widget_move (&l->widget, 0, l->width);
     if (l->list == l->top)
-	one_vline ();
+	tty_print_one_vline ();
     else
 	addch ('^');
 
@@ -1856,7 +1856,7 @@ listbox_drawscroll (WListbox *l)
     widget_move (&l->widget, max_line, l->width);
     top = listbox_cdiff (l->list, l->top);
     if ((top + l->height == l->count) || l->height >= l->count)
-	one_vline ();
+	tty_print_one_vline ();
     else
 	addch ('v');
 
@@ -1869,7 +1869,7 @@ listbox_drawscroll (WListbox *l)
     for (i = 1; i < max_line; i++){
 	widget_move (&l->widget, i, l->width);
 	if (i != line)
-	    one_vline ();
+	    tty_print_one_vline ();
 	else
 	    addch ('*');
     }

+ 7 - 7
vfs/direntry.c

@@ -969,8 +969,8 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
 	goto error_3;
 
     /* Clear the interrupt status */
-    got_interrupt ();
-    enable_interrupt_key ();
+    tty_got_interrupt ();
+    tty_enable_interrupt_key ();
 
     while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer)))) {
 	int t;
@@ -981,7 +981,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
 	vfs_s_print_stats (me->name, _("Getting file"), ino->ent->name,
 			   total, stat_size);
 
-	if (got_interrupt ())
+	if (tty_got_interrupt ())
 	    goto error_1;
 
 	t = write (handle, buffer, n);
@@ -994,13 +994,13 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
     MEDATA->linear_close (me, &fh);
     close (handle);
 
-    disable_interrupt_key ();
+    tty_disable_interrupt_key ();
     return 0;
 
   error_1:
     MEDATA->linear_close (me, &fh);
   error_3:
-    disable_interrupt_key ();
+    tty_disable_interrupt_key ();
     close (handle);
     unlink (ino->localname);
   error_4:
@@ -1241,10 +1241,10 @@ vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int
 
     (void) me;
 
-    enable_interrupt_key ();
+    tty_enable_interrupt_key ();
     for (i = 0; i < size-1; i++){
 	n = read (fd, buffer+i, 1);
-	disable_interrupt_key ();
+	tty_disable_interrupt_key ();
 	if (n == -1 && errno == EINTR){
 	    buffer [i] = 0;
 	    return EINTR;

+ 7 - 7
vfs/fish.c

@@ -157,12 +157,12 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super,
 	fflush (logfile);
     }
 
-    enable_interrupt_key ();
+    tty_enable_interrupt_key ();
 
     status = write (SUP.sockw, str, strlen (str));
     g_free (str);
 
-    disable_interrupt_key ();
+    tty_disable_interrupt_key ();
     if (status < 0)
 	return TRANSIENT;
 
@@ -749,7 +749,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
     while (1) {
 	int t;
 	while ((n = read(h, buffer, sizeof(buffer))) < 0) {
-	    if ((errno == EINTR) && got_interrupt())
+	    if ((errno == EINTR) && tty_got_interrupt ())
 	        continue;
 	    print_vfs_message(_("fish: Local read failed, sending zeros") );
 	    close(h);
@@ -765,7 +765,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
 	    }
 	    goto error_return;
 	}
-	disable_interrupt_key();
+	tty_disable_interrupt_key ();
 	total += n;
 	print_vfs_message(_("fish: storing %s %d (%lu)"), 
 			  was_error ? _("zeros") : _("file"), total,
@@ -861,13 +861,13 @@ fish_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len)
     struct vfs_s_super *super = FH_SUPER;
     int n = 0;
     len = MIN( fh->u.fish.total - fh->u.fish.got, len );
-    disable_interrupt_key();
+    tty_disable_interrupt_key ();
     while (len && ((n = read (SUP.sockr, buf, len))<0)) {
-        if ((errno == EINTR) && !got_interrupt())
+        if ((errno == EINTR) && !tty_got_interrupt ())
 	    continue;
 	break;
     }
-    enable_interrupt_key();
+    tty_enable_interrupt_key();
 
     if (n>0) fh->u.fish.got += n;
     if (n<0) fish_linear_abort(me, fh);

Some files were not shown because too many files changed in this diff