home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume12 / kterm / part18 < prev    next >
Internet Message Format  |  1991-05-11  |  21KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!jethro!exodus!NMSU.Edu!mleisher
  2. From: mleisher@NMSU.Edu
  3. Newsgroups: comp.sources.x
  4. Subject: v12i099: kterm  - kanji xterm, Part18/18
  5. Message-ID: <13151@exodus.Eng.Sun.COM>
  6. Date: 11 May 91 00:52:28 GMT
  7. References: <csx-12i082:kterm@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 719
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: mleisher@NMSU.Edu
  13. Posting-number: Volume 12, Issue 99
  14. Archive-name: kterm/part18
  15.  
  16. #!/bin/sh
  17. # this is kt412.18 (part 18 of kterm-4.1.2)
  18. # do not concatenate these parts, unpack them in order with /bin/sh
  19. # file kterm-4.1.2/util.c continued
  20. #
  21. if test ! -r _shar_seq_.tmp; then
  22.     echo 'Please unpack part 1 first!'
  23.     exit 1
  24. fi
  25. (read Scheck
  26.  if test "$Scheck" != 18; then
  27.     echo Please unpack part "$Scheck" next!
  28.     exit 1
  29.  else
  30.     exit 0
  31.  fi
  32. ) < _shar_seq_.tmp || exit 1
  33. if test ! -f _shar_wnt_.tmp; then
  34.     echo 'x - still skipping kterm-4.1.2/util.c'
  35. else
  36. echo 'x - continuing file kterm-4.1.2/util.c'
  37. sed 's/^X//' << 'SHAR_EOF' >> 'kterm-4.1.2/util.c' &&
  38. X    if(screen->cursor_state)
  39. X        HideCursor();
  40. X    screen->do_wrap = 0;
  41. X    if (n > (i = screen->bot_marg - screen->cur_row + 1))
  42. X        n = i;
  43. X    if(screen->jumpscroll) {
  44. X    if(screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) {
  45. X        if(screen->refresh_amt + n > screen->max_row + 1)
  46. X            FlushScroll(screen);
  47. X        screen->scroll_amt += n;
  48. X        screen->refresh_amt += n;
  49. X    } else if(screen->scroll_amt)
  50. X        FlushScroll(screen);
  51. X    }
  52. X    if(!screen->scroll_amt) {
  53. X
  54. X    shift = -screen->topline;
  55. X    bot = screen->max_row - shift;
  56. X    scrollheight = i - n;
  57. X    refreshheight = n;
  58. X    if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) >
  59. X     (i = screen->max_row - refreshheight + 1))
  60. X        refreshtop = i;
  61. X    if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0) {
  62. X        scrolltop = 0;
  63. X        if((scrollheight += shift) > i)
  64. X            scrollheight = i;
  65. X        if((i = screen->savedlines) < screen->savelines) {
  66. X            if((i += n) > screen->savelines)
  67. X                i = screen->savelines;
  68. X            screen->savedlines = i;
  69. X            ScrollBarDrawThumb(screen->scrollWidget);
  70. X        }
  71. X    } else {
  72. X        scrolltop = screen->cur_row + shift;
  73. X        if((i = screen->bot_marg - bot) > 0) {
  74. X            scrollheight -= i;
  75. X            if((i = screen->cur_row + n - 1 - bot) >= 0) {
  76. X                refreshheight -= i;
  77. X            }
  78. X        }
  79. X    }
  80. X    if(scrollheight > 0) {
  81. X        if (screen->incopy)
  82. X            CopyWait(screen);
  83. X        screen->incopy = -1;
  84. X
  85. X        XCopyArea (
  86. X            screen->display,
  87. X            TextWindow(screen),
  88. X            TextWindow(screen),
  89. X            screen->normalGC,
  90. X            (int) screen->border + screen->scrollbar,
  91. X            (int) (scrolltop + n) * FontHeight(screen) + screen->border, 
  92. X            (unsigned) Width(screen),
  93. X            (unsigned) scrollheight * FontHeight(screen),
  94. X            (int) screen->border + screen->scrollbar,
  95. X            (int) scrolltop * FontHeight(screen) + screen->border);
  96. X    }
  97. X    if(refreshheight > 0)
  98. X        XClearArea (
  99. X            screen->display,
  100. X            TextWindow(screen),
  101. X            (int) screen->border + screen->scrollbar,
  102. X            (int) refreshtop * FontHeight(screen) + screen->border,
  103. X            (unsigned) Width(screen),
  104. X            (unsigned) refreshheight * FontHeight(screen),
  105. X            FALSE);
  106. X    }
  107. X    /* adjust screen->buf */
  108. X    if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0)
  109. X        ScrnDeleteLine(screen->allbuf, screen->bot_marg +
  110. X         screen->savelines, 0, n, screen->max_col + 1);
  111. X    else
  112. X        ScrnDeleteLine(screen->buf, screen->bot_marg, screen->cur_row,
  113. X         n, screen->max_col + 1);
  114. }
  115. X
  116. /*
  117. X * Insert n blanks at the cursor's position, no wraparound
  118. X */
  119. InsertChar (screen, n)
  120. register TScreen *screen;
  121. register int n;
  122. {
  123. X    register int width = n * FontWidth(screen), cx, cy;
  124. X
  125. X    if(screen->cursor_state)
  126. X        HideCursor();
  127. X    screen->do_wrap = 0;
  128. #ifdef STATUSLINE
  129. X    if(screen->cur_row - screen->topline <= screen->max_row ||
  130. X       screen->instatus) {
  131. #else /* !STATUSLINE */
  132. X    if(screen->cur_row - screen->topline <= screen->max_row) {
  133. #endif /* !STATUSLINE */
  134. X        if(!AddToRefresh(screen)) {
  135. X        if(screen->scroll_amt)
  136. X            FlushScroll(screen);
  137. #ifdef KTERM_KANJI
  138. X        BreakMBchar(screen);
  139. #endif /* KTERM_KANJI */
  140. X    
  141. X        if (screen->incopy)
  142. X            CopyWait (screen);
  143. X        screen->incopy = -1;
  144. X    
  145. X        cx = CursorX (screen, screen->cur_col);
  146. X        cy = CursorY (screen, screen->cur_row);
  147. X        XCopyArea(
  148. X            screen->display,
  149. X            TextWindow(screen), TextWindow(screen),
  150. X            screen->normalGC,
  151. X            cx, cy,
  152. X            (unsigned) Width(screen)
  153. X                - (screen->cur_col + n) * FontWidth(screen),
  154. X            (unsigned) FontHeight(screen), 
  155. X            cx + width, cy);
  156. X        XFillRectangle(
  157. X            screen->display,
  158. X            TextWindow(screen), 
  159. #ifdef STATUSLINE
  160. X            screen->instatus ? screen->normalGC :
  161. #endif /* STATUSLINE */
  162. X            screen->reverseGC,
  163. X            cx, cy,
  164. X            (unsigned) width, (unsigned) FontHeight(screen));
  165. X        }
  166. X    }
  167. X    /* adjust screen->buf */
  168. X    ScrnInsertChar(screen->buf, screen->cur_row, screen->cur_col, n,
  169. X            screen->max_col + 1);
  170. }
  171. X
  172. /*
  173. X * Deletes n chars at the cursor's position, no wraparound.
  174. X */
  175. DeleteChar (screen, n)
  176. register TScreen *screen;
  177. register int    n;
  178. {
  179. X    register int width, cx, cy;
  180. X
  181. X    if(screen->cursor_state)
  182. X        HideCursor();
  183. X    screen->do_wrap = 0;
  184. X    if (n > (width = screen->max_col + 1 - screen->cur_col))
  185. X          n = width;
  186. X        
  187. #ifdef STATUSLINE
  188. X    if(screen->cur_row - screen->topline <= screen->max_row ||
  189. X       screen->instatus) {
  190. #else /* !STATUSLINE */
  191. X    if(screen->cur_row - screen->topline <= screen->max_row) {
  192. #endif /* !STATUSLINE */
  193. X        if(!AddToRefresh(screen)) {
  194. X        if(screen->scroll_amt)
  195. X            FlushScroll(screen);
  196. X    
  197. X        width = n * FontWidth(screen);
  198. #ifdef KTERM_KANJI
  199. X        BreakMBchar(screen);
  200. X        screen->cur_col += n;
  201. X        BreakMBchar(screen);
  202. X        screen->cur_col -= n;
  203. #endif /* KTERM_KANJI */
  204. X    
  205. X        if (screen->incopy)
  206. X            CopyWait (screen);
  207. X        screen->incopy = -1;
  208. X    
  209. X        cx = CursorX (screen, screen->cur_col);
  210. X        cy = CursorY (screen, screen->cur_row);
  211. X        XCopyArea(screen->display,
  212. X             TextWindow(screen), TextWindow(screen),
  213. X             screen->normalGC, 
  214. X             cx + width, cy,
  215. X             Width(screen) - (screen->cur_col + n) * FontWidth(screen),
  216. X             FontHeight(screen), 
  217. X             cx, cy);
  218. X        XFillRectangle (screen->display, TextWindow(screen),
  219. #ifdef STATUSLINE
  220. X             screen->instatus ? screen->normalGC :
  221. #endif /* STATUSLINE */
  222. X             screen->reverseGC,
  223. X             screen->border + screen->scrollbar + Width(screen) - width,
  224. X             cy, width, FontHeight(screen));
  225. X        }
  226. X    }
  227. X    /* adjust screen->buf */
  228. X    ScrnDeleteChar (screen->buf, screen->cur_row, screen->cur_col, n,
  229. X            screen->max_col + 1);
  230. X
  231. }
  232. X
  233. /*
  234. X * Clear from cursor position to beginning of display, inclusive.
  235. X */
  236. ClearAbove (screen)
  237. register TScreen *screen;
  238. {
  239. X    register top, height;
  240. X
  241. X    if(screen->cursor_state)
  242. X        HideCursor();
  243. X    if((top = -screen->topline) <= screen->max_row) {
  244. X        if(screen->scroll_amt)
  245. X            FlushScroll(screen);
  246. X        if((height = screen->cur_row + top) > screen->max_row)
  247. X            height = screen->max_row;
  248. X        if((height -= top) > 0)
  249. X            XClearArea(screen->display, TextWindow(screen),
  250. X             screen->border + screen->scrollbar, top *
  251. X             FontHeight(screen) + screen->border,
  252. X             Width(screen), height * FontHeight(screen), FALSE);
  253. X
  254. X        if(screen->cur_row - screen->topline <= screen->max_row)
  255. X            ClearLeft(screen);
  256. X    }
  257. X    ClearBufRows(screen, 0, screen->cur_row - 1);
  258. }
  259. X
  260. /*
  261. X * Clear from cursor position to end of display, inclusive.
  262. X */
  263. ClearBelow (screen)
  264. register TScreen *screen;
  265. {
  266. X    register top;
  267. X
  268. X    ClearRight(screen);
  269. X    if((top = screen->cur_row - screen->topline) <= screen->max_row) {
  270. X        if(screen->scroll_amt)
  271. X            FlushScroll(screen);
  272. X        if(++top <= screen->max_row)
  273. X            XClearArea(screen->display, TextWindow(screen),
  274. X             screen->border + screen->scrollbar, top *
  275. X             FontHeight(screen) + screen->border,
  276. X             Width(screen), (screen->max_row - top + 1) *
  277. X             FontHeight(screen), FALSE);
  278. X    }
  279. X    ClearBufRows(screen, screen->cur_row + 1, screen->max_row);
  280. }
  281. X
  282. /* 
  283. X * Clear last part of cursor's line, inclusive.
  284. X */
  285. ClearRight (screen)
  286. register TScreen *screen;
  287. {
  288. X    if(screen->cursor_state)
  289. X        HideCursor();
  290. X    screen->do_wrap = 0;
  291. #ifdef STATUSLINE
  292. X    if(screen->cur_row - screen->topline <= screen->max_row ||
  293. X       screen->instatus) {
  294. #else /* !STATUSLINE */
  295. X    if(screen->cur_row - screen->topline <= screen->max_row) {
  296. #endif /* !STATUSLINE */
  297. X        if(!AddToRefresh(screen)) {
  298. X    if(screen->scroll_amt)
  299. X        FlushScroll(screen);
  300. #ifdef KTERM_KANJI
  301. X        BreakMBchar(screen);
  302. #endif /* KTERM_KANJI */
  303. X        XFillRectangle(screen->display, TextWindow(screen),
  304. #ifdef STATUSLINE
  305. X         screen->instatus ? screen->normalGC :
  306. #endif /* STATUSLINE */
  307. X          screen->reverseGC,
  308. X         CursorX(screen, screen->cur_col),
  309. X         CursorY(screen, screen->cur_row),
  310. X         Width(screen) - screen->cur_col * FontWidth(screen),
  311. X         FontHeight(screen));
  312. X        }
  313. X    }
  314. #ifdef KTERM
  315. X    bzero(screen->buf[screen->cur_row] + screen->cur_col,
  316. X           (screen->max_col - screen->cur_col + 1) * sizeof(Bchr));
  317. #else /* !KTERM */
  318. X    bzero(screen->buf [2 * screen->cur_row] + screen->cur_col,
  319. X           (screen->max_col - screen->cur_col + 1));
  320. X    bzero(screen->buf [2 * screen->cur_row + 1] + screen->cur_col,
  321. X           (screen->max_col - screen->cur_col + 1));
  322. #endif /* !KTERM */
  323. }
  324. X
  325. /*
  326. X * Clear first part of cursor's line, inclusive.
  327. X */
  328. ClearLeft (screen)
  329. register TScreen *screen;
  330. {
  331. X    if(screen->cursor_state)
  332. X        HideCursor();
  333. X    screen->do_wrap = 0;
  334. #ifdef STATUSLINE
  335. X    if(screen->cur_row - screen->topline <= screen->max_row ||
  336. X       screen->instatus) {
  337. #else /* !STATUSLINE */
  338. X    if(screen->cur_row - screen->topline <= screen->max_row) {
  339. #endif /* !STATUSLINE */
  340. X        if(!AddToRefresh(screen)) {
  341. X        if(screen->scroll_amt)
  342. X            FlushScroll(screen);
  343. #ifdef KTERM_KANJI
  344. X        BreakMBchar(screen);
  345. #endif /* KTERM_KANJI */
  346. X        XFillRectangle (screen->display, TextWindow(screen),
  347. #ifdef STATUSLINE
  348. X             screen->instatus ? screen->normalGC :
  349. #endif /* STATUSLINE */
  350. X             screen->reverseGC,
  351. X             screen->border + screen->scrollbar,
  352. X              CursorY (screen, screen->cur_row),
  353. X             (screen->cur_col + 1) * FontWidth(screen),
  354. X             FontHeight(screen));
  355. X        }
  356. X    }
  357. #ifdef KTERM
  358. X    bzero (screen->buf[screen->cur_row], (screen->cur_col + 1) * sizeof(Bchr));
  359. #else /* !KTERM */
  360. X    bzero (screen->buf [2 * screen->cur_row], (screen->cur_col + 1));
  361. X    bzero (screen->buf [2 * screen->cur_row + 1], (screen->cur_col + 1));
  362. #endif /* !KTERM */
  363. }
  364. X
  365. /* 
  366. X * Erase the cursor's line.
  367. X */
  368. ClearLine(screen)
  369. register TScreen *screen;
  370. {
  371. X    if(screen->cursor_state)
  372. X        HideCursor();
  373. X    screen->do_wrap = 0;
  374. #ifdef STATUSLINE
  375. X    if(screen->cur_row - screen->topline <= screen->max_row ||
  376. X       screen->instatus) {
  377. #else /* !STATUSLINE */
  378. X    if(screen->cur_row - screen->topline <= screen->max_row) {
  379. #endif /* !STATUSLINE */
  380. X        if(!AddToRefresh(screen)) {
  381. X        if(screen->scroll_amt)
  382. X            FlushScroll(screen);
  383. X        XFillRectangle (screen->display, TextWindow(screen), 
  384. #ifdef STATUSLINE
  385. X             screen->instatus && screen->reversestatus ?
  386. X             screen->normalGC :
  387. #endif /* STATUSLINE */
  388. X             screen->reverseGC,
  389. X             screen->border + screen->scrollbar,
  390. X              CursorY (screen, screen->cur_row),
  391. X             Width(screen), FontHeight(screen));
  392. X        }
  393. X    }
  394. #ifdef KTERM
  395. X    bzero (screen->buf[screen->cur_row], (screen->max_col + 1) * sizeof(Bchr));
  396. #else /* !KTERM */
  397. X    bzero (screen->buf [2 * screen->cur_row], (screen->max_col + 1));
  398. X    bzero (screen->buf [2 * screen->cur_row + 1], (screen->max_col + 1));
  399. #endif /* !KTERM */
  400. }
  401. X
  402. ClearScreen(screen)
  403. register TScreen *screen;
  404. {
  405. X    register int top;
  406. X
  407. X    if(screen->cursor_state)
  408. X        HideCursor();
  409. X    screen->do_wrap = 0;
  410. X    if((top = -screen->topline) <= screen->max_row) {
  411. X        if(screen->scroll_amt)
  412. X            FlushScroll(screen);
  413. #ifdef STATUSLINE
  414. X        if(top == 0 && !screen->statusline)
  415. #else /* !STATUSLINE */
  416. X        if(top == 0)
  417. #endif /* !STATUSLINE */
  418. X            XClearWindow(screen->display, TextWindow(screen));
  419. X        else
  420. X            XClearArea(screen->display, TextWindow(screen),
  421. X             screen->border + screen->scrollbar, 
  422. X             top * FontHeight(screen) + screen->border,    
  423. X              Width(screen), (screen->max_row - top + 1) *
  424. X             FontHeight(screen), FALSE);
  425. X    }
  426. X    ClearBufRows (screen, 0, screen->max_row);
  427. }
  428. X
  429. CopyWait(screen)
  430. register TScreen *screen;
  431. {
  432. X    XEvent reply;
  433. X    XEvent *rep = &reply;
  434. X
  435. X    while (1) {
  436. X        XWindowEvent (screen->display, VWindow(screen), 
  437. X          ExposureMask, &reply);
  438. X        switch (reply.type) {
  439. X        case Expose:
  440. X            HandleExposure (screen, (XExposeEvent *) &reply);
  441. X            break;
  442. X        case NoExpose:
  443. X        case GraphicsExpose:
  444. X            if (screen->incopy <= 0) {
  445. X                screen->incopy = 1;
  446. X                if (screen->scrolls > 0)
  447. X                    screen->scrolls--;
  448. X            }
  449. X            if (reply.type == GraphicsExpose)
  450. X                HandleExposure (screen, (XExposeEvent *) &reply);
  451. X
  452. X            if ((reply.type == NoExpose) ||
  453. X                ((XExposeEvent *)rep)->count == 0) {
  454. X                if (screen->incopy <= 0 && screen->scrolls > 0)
  455. X                screen->scrolls--;
  456. X                if (screen->scrolls == 0) {
  457. X                screen->incopy = 0;
  458. X                return;
  459. X                }
  460. X                screen->incopy = -1;
  461. X            }
  462. X            break;
  463. X        }
  464. X    }
  465. }
  466. /*
  467. X * This routine handles exposure events
  468. X */
  469. HandleExposure (screen, reply)
  470. register TScreen *screen;
  471. register XExposeEvent *reply;
  472. {
  473. X    register int toprow, leftcol, nrows, ncols;
  474. X    extern Bool waiting_for_initial_map;
  475. X
  476. X    if((toprow = (reply->y - screen->border) /
  477. X     FontHeight(screen)) < 0)
  478. X        toprow = 0;
  479. X    if((leftcol = (reply->x - screen->border - screen->scrollbar)
  480. X     / FontWidth(screen)) < 0)
  481. X        leftcol = 0;
  482. X    nrows = (reply->y + reply->height - 1 - screen->border) / 
  483. X        FontHeight(screen) - toprow + 1;
  484. X    ncols =
  485. X     (reply->x + reply->width - 1 - screen->border - screen->scrollbar) /
  486. X            FontWidth(screen) - leftcol + 1;
  487. X    toprow -= screen->scrolls;
  488. X    if (toprow < 0) {
  489. X        nrows += toprow;
  490. X        toprow = 0;
  491. X    }
  492. X    if (toprow + nrows - 1 > screen->max_row)
  493. #ifdef STATUSLINE
  494. X        nrows = screen->max_row - toprow + 1 + screen->statusline;
  495. #else /* !STATUSLINE */
  496. X        nrows = screen->max_row - toprow + 1;
  497. #endif /* !STATUSLINE */
  498. X    if (leftcol + ncols - 1 > screen->max_col)
  499. X        ncols = screen->max_col - leftcol + 1;
  500. X
  501. X    if (nrows > 0 && ncols > 0) {
  502. X        ScrnRefresh (screen, toprow, leftcol, nrows, ncols, False);
  503. X        if (waiting_for_initial_map) {
  504. X            first_map_occurred ();
  505. X        }
  506. X        if (screen->cur_row >= toprow &&
  507. X            screen->cur_row < toprow + nrows &&
  508. X            screen->cur_col >= leftcol &&
  509. X            screen->cur_col < leftcol + ncols)
  510. X            return (1);
  511. X
  512. X    }
  513. X    return (0);
  514. }
  515. X
  516. ReverseVideo (term)
  517. X    XtermWidget term;
  518. {
  519. X    register TScreen *screen = &term->screen;
  520. X    GC tmpGC;
  521. X    Window tek = TWindow(screen);
  522. X    unsigned long tmp;
  523. #ifdef KTERM
  524. X    int fnum;
  525. #ifdef    COLOR_TEXT    /* mukawa */
  526. X    XGCValues    xgcv;
  527. #endif    /* COLOR_TEXT */
  528. #endif /* KTERM */
  529. X
  530. X    tmp = term->core.background_pixel;
  531. X    if(screen->cursorcolor == screen->foreground)
  532. X        screen->cursorcolor = tmp;
  533. X    term->core.background_pixel = screen->foreground;
  534. X    screen->foreground = tmp;
  535. X
  536. X    tmp = screen->mousecolorback;
  537. X    screen->mousecolorback = screen->mousecolor;
  538. X    screen->mousecolor = tmp;
  539. X
  540. #ifdef KTERM
  541. #ifdef    COLOR_TEXT    /* mukawa */
  542. X    xgcv.foreground = screen->foreground;
  543. X    xgcv.background = term->core.background_pixel;
  544. #endif    /* COLOR_TEXT */
  545. X    for (fnum=F_ISO8859_1; fnum<FCNT; fnum++) {
  546. #ifdef    COLOR_TEXT    /* mukawa */
  547. X        /* reset color attribute */
  548. X        xgcv.foreground = screen->foreground;
  549. X        xgcv.background = term->core.background_pixel;
  550. X        if(screen->reverseGC) 
  551. X        XChangeGC(screen->display, screen->reverseGC,
  552. X                GCForeground|GCBackground, &xgcv);
  553. X        if(screen->reverseboldGC) 
  554. X        XChangeGC(screen->display, screen->reverseboldGC,
  555. X                GCForeground|GCBackground, &xgcv);
  556. /*        if(screen->reversecursorGC) 
  557. X        XChangeGC(screen->display, screen->reversecursorGC,
  558. X                GCForeground|GCBackground, &xgcv);
  559. */
  560. X        xgcv.foreground = term->core.background_pixel;
  561. X        xgcv.background = screen->foreground;
  562. X        if(screen->normalGC) 
  563. X        XChangeGC(screen->display, screen->normalGC,
  564. X                GCForeground|GCBackground, &xgcv);
  565. X        if(screen->normalboldGC) 
  566. X        XChangeGC(screen->display, screen->normalboldGC,
  567. X                GCForeground|GCBackground, &xgcv);
  568. /*        if(screen->cursorGC) 
  569. X        XChangeGC(screen->display, screen->cursorGC,
  570. X                GCForeground|GCBackground, &xgcv);
  571. */
  572. #endif    /* COLOR_TEXT */
  573. X        tmpGC = screen->normalGC;
  574. X        screen->normalGC = screen->reverseGC;
  575. X        screen->reverseGC = tmpGC;
  576. X
  577. X        tmpGC = screen->normalboldGC;
  578. X        screen->normalboldGC = screen->reverseboldGC;
  579. X        screen->reverseboldGC = tmpGC;
  580. X
  581. X        tmpGC = screen->cursorGC;
  582. X        screen->cursorGC = screen->reversecursorGC;
  583. X        screen->reversecursorGC = tmpGC;
  584. X    }
  585. #else /* !KTERM */
  586. X    tmpGC = screen->normalGC;
  587. X    screen->normalGC = screen->reverseGC;
  588. X    screen->reverseGC = tmpGC;
  589. X
  590. X    tmpGC = screen->normalboldGC;
  591. X    screen->normalboldGC = screen->reverseboldGC;
  592. X    screen->reverseboldGC = tmpGC;
  593. /*
  594. X * Bug fix by michael
  595. X * 3 non null lines are inserted.
  596. X */
  597. X    tmpGC = screen->cursorGC;
  598. X    screen->cursorGC = screen->reversecursorGC;
  599. X    screen->reversecursorGC = tmpGC;
  600. #endif /* !KTERM */
  601. X
  602. X    recolor_cursor (screen->pointer_cursor, 
  603. X            screen->mousecolor, screen->mousecolorback);
  604. X    recolor_cursor (screen->arrow,
  605. X            screen->mousecolor, screen->mousecolorback);
  606. X
  607. X    term->misc.re_verse = !term->misc.re_verse;
  608. X
  609. X    XDefineCursor(screen->display, TextWindow(screen), screen->pointer_cursor);
  610. X    if(tek)
  611. X        XDefineCursor(screen->display, tek, screen->arrow);
  612. X
  613. X    
  614. X    if(screen->scrollWidget)
  615. X        ScrollBarReverseVideo(screen->scrollWidget);
  616. X
  617. X    XSetWindowBackground(screen->display, TextWindow(screen), term->core.background_pixel);
  618. X    if(tek) {
  619. X        TekReverseVideo(screen);
  620. X    }
  621. X    XClearWindow(screen->display, TextWindow(screen));
  622. #ifdef STATUSLINE
  623. X    ScrnRefresh (screen, 0, 0, screen->max_row + 1 + screen->statusline,
  624. #else /* !STATUSLINE */
  625. X    ScrnRefresh (screen, 0, 0, screen->max_row + 1,
  626. #endif /* !STATUSLINE */
  627. X     screen->max_col + 1, False);
  628. X    if(screen->Tshow) {
  629. X        XClearWindow(screen->display, tek);
  630. X        TekExpose((XExposeEvent *) NULL);
  631. X    }
  632. X    update_reversevideo();
  633. }
  634. X
  635. X
  636. recolor_cursor (cursor, fg, bg)
  637. X    Cursor cursor;            /* X cursor ID to set */
  638. X    unsigned long fg, bg;        /* pixel indexes to look up */
  639. {
  640. X    register TScreen *screen = &term->screen;
  641. X    register Display *dpy = screen->display;
  642. X    XColor colordefs[2];        /* 0 is foreground, 1 is background */
  643. X
  644. X    colordefs[0].pixel = fg;
  645. X    colordefs[1].pixel = bg;
  646. X    XQueryColors (dpy, DefaultColormap (dpy, DefaultScreen (dpy)),
  647. X          colordefs, 2);
  648. X    XRecolorCursor (dpy, cursor, colordefs, colordefs+1);
  649. X    return;
  650. }
  651. X
  652. #ifdef KTERM_KANJI
  653. /*
  654. X * If the cursor points second byte of multi byte character,
  655. X * replace this character into two blanks.
  656. X */
  657. BreakMBchar(screen)
  658. register TScreen *screen;
  659. {
  660. X    register Bchr *ptr;
  661. X    if (screen->cur_col >= 1 && screen->cur_col <= screen->max_col
  662. X     && screen->buf[screen->cur_row][screen->cur_col].gset == MBC2) {
  663. X        XFillRectangle(screen->display, TextWindow(screen),
  664. #ifdef STATUSLINE
  665. X         screen->instatus ? screen->normalGC :
  666. #endif /* STATUSLINE */
  667. X         screen->reverseGC,
  668. X         CursorX(screen, screen->cur_col - 1),
  669. X         CursorY(screen, screen->cur_row),
  670. X         2 * FontWidth(screen), FontHeight(screen));
  671. X        ptr = screen->buf[screen->cur_row] + screen->cur_col - 1;
  672. X        bzero((char*)ptr, 2 * sizeof(Bchr));
  673. X    }
  674. }
  675. X
  676. #endif /* KTERM_KANJI */
  677. #ifdef KTERM
  678. X
  679. Char
  680. MapOnFont(gset, code)
  681. register Char gset;
  682. register Char code;
  683. {
  684. X    if (code & NEEDMAP) {
  685. X        switch (gset) {
  686. X        case GSET_UK:
  687. X            return '\243';        /* UK pound sign on iso8859-1 */
  688. X            break;
  689. X        case GSET_GRAPH:
  690. X            code &= ~NEEDMAP;
  691. X            return (code == 0x5f) ? 0x7f : (code - 0x5f);
  692. X            break;
  693. X        case GSET_KANA:
  694. X            return code & ~NEEDMAP | 0x80;    /* kana on jisx0201 */
  695. X            break;
  696. X        }
  697. X    } else if (code == 0) {
  698. X        return ' ';
  699. X    } else {
  700. X        return code;
  701. X    }
  702. }
  703. X
  704. #endif /* KTERM */
  705. SHAR_EOF
  706. echo 'File kterm-4.1.2/util.c is complete' &&
  707. chmod 0664 kterm-4.1.2/util.c ||
  708. echo 'restore of kterm-4.1.2/util.c failed'
  709. Wc_c="`wc -c < 'kterm-4.1.2/util.c'`"
  710. test 32241 -eq "$Wc_c" ||
  711.     echo 'kterm-4.1.2/util.c: original size 32241, current size' "$Wc_c"
  712. rm -f _shar_wnt_.tmp
  713. fi
  714. rm -f _shar_seq_.tmp
  715. echo You have unpacked the last part
  716. exit 0
  717.  
  718.  
  719. -----------------------------------------------------------------------------
  720. mleisher@nmsu.edu                      "I laughed.
  721. Mark Leisher                                I cried.
  722. Computing Research Lab                          I fell down.
  723. New Mexico State University                        It changed my life."
  724. Las Cruces, NM                     - Rich [Cowboy Feng's Space Bar and Grille]
  725.  
  726. --
  727. Dan Heller
  728. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  729. Senior Writer                President          comp-sources.x@uunet.uu.net
  730. argv@ora.com                 argv@zipcode.com
  731.