--- rxvt-unicode/src/command.C 2005/02/14 10:44:50 1.194 +++ rxvt-unicode/src/command.C 2005/02/19 01:07:58 1.198 @@ -27,7 +27,7 @@ * Copyright (c) 2001 Marius Gedminas * - Ctrl/Mod4+Tab works like Meta+Tab (options) * Copyright (c) 2003 Rob McMullen - * Copyright (c) 2003-2004 Marc Lehmann + * Copyright (c) 2003-2005 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,7 +119,15 @@ XK_Print, 0x2399, XK_space, 0x2423, + +#ifdef XK_KP_Begin + XK_KP_Prior, 0x21de, + XK_KP_Next, 0x21df, + XK_KP_Begin, 0x2320, + XK_KP_Insert, 0x2380, + XK_KP_Delete, 0x2326, XK_KP_Space, 0x2422, +#endif 0, }; @@ -278,9 +286,9 @@ * * Always permit `shift' to override the current setting */ - shft = (ev.state & ShiftMask); - ctrl = (ev.state & ControlMask); - meta = (ev.state & ModMetaMask); + shft = ev.state & ShiftMask; + ctrl = ev.state & ControlMask; + meta = ev.state & ModMetaMask; if (numlock_state || (ev.state & ModNumLockMask)) { @@ -514,6 +522,16 @@ break; #endif #ifndef NO_DELETE_KEY +# ifdef XK_KP_Prior + case XK_KP_Delete: + /* allow shift to override */ + if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + { + strcpy (kbuf, "\033On"); + break; + } + /* FALLTHROUGH */ +# endif case XK_Delete: strcpy (kbuf, key_delete); break; @@ -626,13 +644,6 @@ strcpy (kbuf, "\033Ou"); break; - case XK_KP_Insert: - strcpy (kbuf, "\033Op"); - break; - - case XK_KP_Delete: - strcpy (kbuf, "\033On"); - break; #endif case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ @@ -674,6 +685,17 @@ case XK_Find: strcpy (kbuf, "\033[1~"); break; + +#ifdef XK_KP_End + case XK_KP_Insert: + /* allow shift to override */ + if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + { + strcpy (kbuf, "\033Op"); + break; + } + /* FALLTHROUGH */ +#endif case XK_Insert: strcpy (kbuf, "\033[2~"); break; @@ -1310,14 +1332,25 @@ case ClientMessage: if (ev.xclient.format == 32 - && (Atom)ev.xclient.data.l[0] == xa[XA_WMDELETEWINDOW]) - destroy (); + && ev.xclient.message_type == xa[XA_WM_PROTOCOLS] + && ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) + destroy (); +#if ENABLE_XEMBED + else if (ev.xclient.format == 32 + && ev.xclient.message_type == xa[XA_XEMBED]) + { + if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) + focus_in (); + else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) + focus_out (); + } +#endif #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) protocol */ - else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] - && (ev.xclient.data.l[0] == DndFile - || ev.xclient.data.l[0] == DndDir - || ev.xclient.data.l[0] == DndLink)) + else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] + && (ev.xclient.data.l[0] == DndFile + || ev.xclient.data.l[0] == DndDir + || ev.xclient.data.l[0] == DndLink)) { /* Get Dnd data */ Atom ActualType; @@ -1370,61 +1403,11 @@ break; case FocusIn: - if (!TermWin.focus) - { - TermWin.focus = 1; - want_refresh = 1; -#ifdef USE_XIM - if (Input_Context != NULL) - { - IMSetStatusPosition (); - XSetICFocus (Input_Context); - } -#endif -#ifdef CURSOR_BLINK - if (options & Opt_cursorBlink) - cursor_blink_ev.start (NOW + BLINK_INTERVAL); -#endif -#ifdef OFF_FOCUS_FADING - if (rs[Rs_fade]) - { - pix_colors = pix_colors_focused; - scr_recolour (); - } -#endif - - } + focus_in (); break; case FocusOut: - if (TermWin.focus) - { - TermWin.focus = 0; - want_refresh = 1; - -#if ENABLE_FRILLS || ISO_14755 - iso14755buf = 0; -#endif -#if ENABLE_OVERLAY - scr_overlay_off (); -#endif -#ifdef USE_XIM - if (Input_Context != NULL) - XUnsetICFocus (Input_Context); -#endif -#ifdef CURSOR_BLINK - if (options & Opt_cursorBlink) - cursor_blink_ev.stop (); - hidden_cursor = 0; -#endif -#ifdef OFF_FOCUS_FADING - if (rs[Rs_fade]) - { - pix_colors = pix_colors_unfocused; - scr_recolour (); - } -#endif - } + focus_out (); break; case ConfigureNotify: @@ -1651,6 +1634,67 @@ } } +void +rxvt_term::focus_in () +{ + if (!TermWin.focus) + { + TermWin.focus = 1; + want_refresh = 1; +#ifdef USE_XIM + if (Input_Context != NULL) + { + IMSetStatusPosition (); + XSetICFocus (Input_Context); + } +#endif +#ifdef CURSOR_BLINK + if (options & Opt_cursorBlink) + cursor_blink_ev.start (NOW + BLINK_INTERVAL); +#endif +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + { + pix_colors = pix_colors_focused; + scr_recolour (); + } +#endif + } +} + +void +rxvt_term::focus_out () +{ + if (TermWin.focus) + { + TermWin.focus = 0; + want_refresh = 1; + +#if ENABLE_FRILLS || ISO_14755 + iso14755buf = 0; +#endif +#if ENABLE_OVERLAY + scr_overlay_off (); +#endif +#ifdef USE_XIM + if (Input_Context != NULL) + XUnsetICFocus (Input_Context); +#endif +#ifdef CURSOR_BLINK + if (options & Opt_cursorBlink) + cursor_blink_ev.stop (); + hidden_cursor = 0; +#endif +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + { + pix_colors = pix_colors_unfocused; + scr_recolour (); + } +#endif + } +} + #if TRANSPARENT void rxvt_term::rootwin_cb (XEvent &ev) @@ -2582,7 +2626,7 @@ // unfortunately other programs are even more buggy and dislike // being sent SIGWINCH, so only do it when we were in fact being // resized. - if (seen_resize) + if (seen_resize && cmd_pid) kill (-cmd_pid, SIGWINCH); }