Просмотр исходного кода

Convert _{store,restore}_cursor_pos to static inlines.

tags/v0.9.3
Michael Brown 18 лет назад
Родитель
Сommit
ba26defa6e
2 измененных файлов: 20 добавлений и 33 удалений
  1. 0
    31
      src/hci/mucurses/cursor.c
  2. 20
    2
      src/hci/mucurses/cursor.h

+ 0
- 31
src/hci/mucurses/cursor.c Просмотреть файл

@@ -1,31 +0,0 @@
1
-#include <curses.h>
2
-#include "cursor.h"
3
-
4
-/** @file
5
- *
6
- * MuCurses cursor preserving functions
7
- *
8
- */
9
-
10
-/**
11
- * Restore cursor position from encoded backup variable
12
- *
13
- * @v *win	window on which to operate
14
- * @v *pos	pointer to struct in which original cursor position is stored
15
- */
16
-void _restore_curs_pos ( WINDOW *win, struct cursor_pos *pos ) {
17
-	win->curs_y = pos->y;
18
-	win->curs_x = pos->x;
19
-	win->scr->movetoyx ( win->scr, win->curs_y, win->curs_x );
20
-}
21
-
22
-/**
23
- * Store cursor position for later restoration
24
- *
25
- * @v *win	window on which to operate
26
- * @v *pos	pointer to struct in which to store cursor position
27
- */
28
-void _store_curs_pos ( WINDOW *win, struct cursor_pos *pos ) {
29
-	pos->y = win->curs_y;
30
-	pos->x = win->curs_x;
31
-}

+ 20
- 2
src/hci/mucurses/cursor.h Просмотреть файл

@@ -11,7 +11,25 @@ struct cursor_pos {
11 11
 	unsigned int y, x;
12 12
 };
13 13
 
14
-void _restore_curs_pos ( WINDOW *win, struct cursor_pos *pos );
15
-void _store_curs_pos ( WINDOW *win, struct cursor_pos *pos );
14
+/**
15
+ * Restore cursor position from encoded backup variable
16
+ *
17
+ * @v *win	window on which to operate
18
+ * @v *pos	pointer to struct in which original cursor position is stored
19
+ */
20
+static inline void _restore_curs_pos ( WINDOW *win, struct cursor_pos *pos ) {
21
+	wmove ( win, pos->y, pos->x );
22
+}
23
+
24
+/**
25
+ * Store cursor position for later restoration
26
+ *
27
+ * @v *win	window on which to operate
28
+ * @v *pos	pointer to struct in which to store cursor position
29
+ */
30
+static inline void _store_curs_pos ( WINDOW *win, struct cursor_pos *pos ) {
31
+	pos->y = win->curs_y;
32
+	pos->x = win->curs_x;
33
+}
16 34
 
17 35
 #endif /* CURSOR_H */

Загрузка…
Отмена
Сохранить