| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | #include <afsconfig.h> |
| 11 | #include <afs/param.h> |
| 12 | |
| 13 | #include <roken.h> |
| 14 | |
| 15 | #include <lwp.h> |
| 16 | |
| 17 | #include "gtxobjects.h" |
| 18 | #include "gtxwindows.h" |
| 19 | #include "gtxcurseswin.h" |
| 20 | #include "gtxinput.h" |
| 21 | #include "gtxkeymap.h" |
| 22 | #include "gtxframe.h" |
| 23 | #include <afs/stds.h> |
| 24 | |
| 25 | |
| 26 | |
| 27 | void * |
| 28 | gtx_InputServer(void *param) |
| 29 | { |
| 30 | struct gwin *awin = (struct gwin *) param; |
| 31 | |
| 32 | int tc; |
| 33 | int code; |
| 34 | struct gtx_frame *tframe; |
| 35 | |
| 36 | WOP_DISPLAY(awin)(awin)->w_op->gw_display(awin); |
| 37 | while (1) { |
| 38 | |
| 39 | tframe = awin->w_frame; |
| 40 | code = WOP_WAIT(awin)(awin)->w_op->gw_wait(awin); |
| 41 | if (code) { |
| 42 | printf("***WAIT FAILURE %d****\n", code); |
| 43 | exit(1); |
| 44 | } |
| 45 | tc = WOP_GETCHAR(awin)(awin)->w_op->gw_getchar(awin); |
| 46 | tframe->flags &= ~GTXFRAME_NEWDISPLAY1; |
| 47 | if (tc < 0) |
| 48 | break; |
| 49 | |
| 50 | gtxframe_ClearMessageLine(tframe); |
| 51 | tframe->flags &= ~(GTXFRAME_RECURSIVEEND2 | GTXFRAME_RECURSIVEERR4); |
| 52 | keymap_ProcessKey(tframe->keystate, tc, awin); |
| 53 | tframe = awin->w_frame; |
| 54 | if (tframe->flags & GTXFRAME_RECURSIVEEND2) { |
| 55 | tframe->flags &= ~GTXFRAME_RECURSIVEEND2; |
| 56 | return 0; |
| 57 | } |
| 58 | tframe->flags &= ~GTXFRAME_RECURSIVEEND2; |
| 59 | WOP_DISPLAY(awin)(awin)->w_op->gw_display(awin); |
| 60 | } |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | struct gwin * |
| 65 | gtx_Init(int astartInput, |
| 66 | int atype) |
| 67 | { |
| 68 | PROCESS junk; |
| 69 | struct onode_initparams oi_params; |
| 70 | struct gwin_initparams wi_params; |
| 71 | struct gwin *twin; |
| 72 | int code; |
| 73 | |
| 74 | |
| 75 | wi_params.i_type = GATOR_WIN_CURSES2; |
| 76 | wi_params.i_x = 0; |
| 77 | wi_params.i_y = 0; |
| 78 | wi_params.i_width = 80; |
| 79 | wi_params.i_height = 200; |
| 80 | wi_params.i_debug = 0; |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | oi_params.i_debug = 0; |
| 87 | oi_params.i_gwparams = &wi_params; |
| 88 | |
| 89 | code = gator_objects_init(&oi_params); |
| 90 | if (code) |
| 91 | return NULL((void *)0); |
| 92 | |
| 93 | |
| 94 | IOMGR_Initialize(); |
| 95 | if (astartInput) |
| 96 | code = |
| Value stored to 'code' is never read |
| 97 | LWP_CreateProcess(gtx_InputServer, 8192, LWP_NORMAL_PRIORITY(4 -2), |
| 98 | (void *)0, "gx-listener", &junk); |
| 99 | |
| 100 | twin = &gator_basegwin; |
| 101 | return twin; |
| 102 | } |