1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: command.c |
2 | * File: command.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: command.C,v 1.30 2004/01/29 21:35:58 pcg Exp $ |
4 | * $Id: command.C,v 1.31 2004/01/29 23:26:01 pcg Exp $ |
5 | * |
5 | * |
6 | * All portions of code are copyright by their respective author/s. |
6 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
8 | * - original version |
8 | * - original version |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
… | |
… | |
716 | XEvent xev; |
716 | XEvent xev; |
717 | |
717 | |
718 | XNextEvent (Xdisplay, &xev); |
718 | XNextEvent (Xdisplay, &xev); |
719 | |
719 | |
720 | #if defined(CURSOR_BLINK) |
720 | #if defined(CURSOR_BLINK) |
721 | if ((Options & Opt_cursorBlink) |
721 | if ((Options & Opt_cursorBlink) && xev.type == KeyPress) |
722 | && xev.type == KeyPress) |
|
|
723 | { |
722 | { |
724 | if (hidden_cursor) |
723 | if (hidden_cursor) |
725 | { |
724 | { |
726 | hidden_cursor = 0; |
725 | hidden_cursor = 0; |
727 | want_refresh = 1; |
726 | want_refresh = 1; |
728 | } |
727 | } |
729 | |
728 | |
730 | blink_ev.start (NOW + BLINK_INTERVAL); |
729 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
731 | } |
730 | } |
732 | #endif |
731 | #endif |
733 | |
732 | |
734 | #if defined(POINTER_BLANK) |
733 | #if defined(POINTER_BLANK) |
735 | if ((Options & Opt_pointerBlank) |
734 | if ((Options & Opt_pointerBlank) && pointerBlankDelay > 0) |
736 | && (pointerBlankDelay > 0)) |
|
|
737 | { |
735 | { |
738 | if (xev.type == MotionNotify |
736 | if (xev.type == MotionNotify |
739 | || xev.type == ButtonPress |
737 | || xev.type == ButtonPress |
740 | || xev.type == ButtonRelease) |
738 | || xev.type == ButtonRelease) |
741 | if (hidden_pointer) |
739 | if (hidden_pointer) |
… | |
… | |
754 | while (XPending (Xdisplay)); |
752 | while (XPending (Xdisplay)); |
755 | } |
753 | } |
756 | |
754 | |
757 | #ifdef CURSOR_BLINK |
755 | #ifdef CURSOR_BLINK |
758 | void |
756 | void |
759 | rxvt_term::blink_cb (time_watcher &w) |
757 | rxvt_term::cursor_blink_cb (time_watcher &w) |
760 | { |
758 | { |
761 | hidden_cursor = !hidden_cursor; |
759 | hidden_cursor = !hidden_cursor; |
762 | want_refresh = 1; |
760 | want_refresh = 1; |
763 | |
761 | |
764 | w.start (w.at + BLINK_INTERVAL); |
762 | w.start (w.at + BLINK_INTERVAL); |
|
|
763 | } |
|
|
764 | #endif |
|
|
765 | |
|
|
766 | #ifdef TEXT_BLINK |
|
|
767 | void |
|
|
768 | rxvt_term::text_blink_cb (time_watcher &w) |
|
|
769 | { |
|
|
770 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
|
|
771 | { |
|
|
772 | hidden_text = !hidden_text; |
|
|
773 | want_refresh = 1; |
|
|
774 | w.start (w.at + TEXT_BLINK_INTERVAL); |
|
|
775 | } |
765 | } |
776 | } |
766 | #endif |
777 | #endif |
767 | |
778 | |
768 | void |
779 | void |
769 | rxvt_term::x_cb (io_watcher &w, short revents) |
780 | rxvt_term::x_cb (io_watcher &w, short revents) |
… | |
… | |
1292 | if (R->Input_Context != NULL) |
1303 | if (R->Input_Context != NULL) |
1293 | XSetICFocus(R->Input_Context); |
1304 | XSetICFocus(R->Input_Context); |
1294 | #endif |
1305 | #endif |
1295 | #ifdef CURSOR_BLINK |
1306 | #ifdef CURSOR_BLINK |
1296 | if (R->Options & Opt_cursorBlink) |
1307 | if (R->Options & Opt_cursorBlink) |
1297 | R->blink_ev.start (NOW + BLINK_INTERVAL); |
1308 | R->cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1298 | #endif |
1309 | #endif |
1299 | } |
1310 | } |
1300 | break; |
1311 | break; |
1301 | |
1312 | |
1302 | case FocusOut: |
1313 | case FocusOut: |
… | |
… | |
1307 | if (R->Input_Context != NULL) |
1318 | if (R->Input_Context != NULL) |
1308 | XUnsetICFocus(R->Input_Context); |
1319 | XUnsetICFocus(R->Input_Context); |
1309 | #endif |
1320 | #endif |
1310 | #ifdef CURSOR_BLINK |
1321 | #ifdef CURSOR_BLINK |
1311 | if (R->Options & Opt_cursorBlink) |
1322 | if (R->Options & Opt_cursorBlink) |
1312 | R->blink_ev.stop (); |
1323 | R->cursor_blink_ev.stop (); |
1313 | R->hidden_cursor = 0; |
1324 | R->hidden_cursor = 0; |
1314 | #endif |
1325 | #endif |
1315 | } |
1326 | } |
1316 | break; |
1327 | break; |
1317 | |
1328 | |
… | |
… | |
1358 | rxvt_selection_send(aR_ &(ev->xselectionrequest)); |
1369 | rxvt_selection_send(aR_ &(ev->xselectionrequest)); |
1359 | break; |
1370 | break; |
1360 | |
1371 | |
1361 | case UnmapNotify: |
1372 | case UnmapNotify: |
1362 | R->TermWin.mapped = 0; |
1373 | R->TermWin.mapped = 0; |
|
|
1374 | #ifdef TEXT_BLINK |
|
|
1375 | R->text_blink_ev.stop (); |
|
|
1376 | #endif |
1363 | break; |
1377 | break; |
1364 | |
1378 | |
1365 | case MapNotify: |
1379 | case MapNotify: |
1366 | R->TermWin.mapped = 1; |
1380 | R->TermWin.mapped = 1; |
|
|
1381 | #ifdef TEXT_BLINK |
|
|
1382 | R->text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1383 | #endif |
1367 | break; |
1384 | break; |
1368 | |
1385 | |
1369 | case PropertyNotify: |
1386 | case PropertyNotify: |
1370 | if (ev->xproperty.atom == R->xa[XA_VT_SELECTION]) { |
1387 | if (ev->xproperty.atom == R->xa[XA_VT_SELECTION]) { |
1371 | if (ev->xproperty.state == PropertyNewValue) |
1388 | if (ev->xproperty.state == PropertyNewValue) |