Wed May 14 14:54:16 2008 Michael Jennings (mej)

Modified patch from hsim@gmx.li to allow setting of the "Urgent" hint
on beep.
----------------------------------------------------------------------


SVN revision: 34572
This commit is contained in:
Michael Jennings 2008-05-14 21:54:45 +00:00
parent 3df02b2205
commit c7a352b0c0
6 changed files with 40 additions and 0 deletions

View File

@ -5555,3 +5555,8 @@ change the "#if 0" to "#ifdef ESCREEN" to revert to previous behavior
when in Escreen mode. Normal operation should not require the call in when in Escreen mode. Normal operation should not require the call in
question. question.
---------------------------------------------------------------------- ----------------------------------------------------------------------
Wed May 14 14:54:16 2008 Michael Jennings (mej)
Modified patch from hsim@gmx.li to allow setting of the "Urgent" hint
on beep.
----------------------------------------------------------------------

View File

@ -200,6 +200,7 @@ event_win_is_parent(register event_dispatcher_data_t *data, Window win)
unsigned char unsigned char
handle_key_press(event_t *ev) handle_key_press(event_t *ev)
{ {
XWMHints *wm_hints;
#ifdef COUNT_X_EVENTS #ifdef COUNT_X_EVENTS
static unsigned long keypress_cnt = 0; static unsigned long keypress_cnt = 0;
#endif #endif
@ -214,6 +215,12 @@ handle_key_press(event_t *ev)
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) { if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) {
lookup_key(ev); lookup_key(ev);
} }
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
wm_hints->flags &= ~XUrgencyHint;
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
XFree(wm_hints);
}
PROF_DONE(handle_key_press); PROF_DONE(handle_key_press);
PROF_TIME(handle_key_press); PROF_TIME(handle_key_press);
return 1; return 1;
@ -453,6 +460,7 @@ handle_leave_notify(event_t *ev)
unsigned char unsigned char
handle_focus_in(event_t *ev) handle_focus_in(event_t *ev)
{ {
XWMHints *wm_hints;
D_EVENTS(("handle_focus_in(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); D_EVENTS(("handle_focus_in(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
@ -488,6 +496,12 @@ handle_focus_in(event_t *ev)
if (xim_input_context != NULL) if (xim_input_context != NULL)
XSetICFocus(xim_input_context); XSetICFocus(xim_input_context);
#endif #endif
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
wm_hints->flags &= ~XUrgencyHint;
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
XFree(wm_hints);
}
} }
return 1; return 1;
} }

View File

@ -311,6 +311,7 @@ spifopt_t option_list[] = {
SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT), SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT),
# endif # endif
#endif #endif
SPIFOPT_BOOL_LONG("urg-alert", "set urgent hint on beep", vt_options, VT_OPTIONS_URG_ALERT),
#ifdef META8_OPTION #ifdef META8_OPTION
SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8), SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8),
#endif #endif
@ -1078,6 +1079,12 @@ parse_toggles(char *buff, void *state)
libast_print_warning("Support for the map_alert attribute was not compiled in, ignoring\n"); libast_print_warning("Support for the map_alert attribute was not compiled in, ignoring\n");
#endif #endif
} else if (!BEG_STRCASECMP(buff, "urg_alert ")) {
if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_URG_ALERT);
} else {
BITFIELD_CLEAR(vt_options, VT_OPTIONS_URG_ALERT);
}
} else if (!BEG_STRCASECMP(buff, "visual_bell ")) { } else if (!BEG_STRCASECMP(buff, "visual_bell ")) {
if (bool_val) { if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_VISUAL_BELL); BITFIELD_SET(vt_options, VT_OPTIONS_VISUAL_BELL);
@ -3808,6 +3815,7 @@ save_config(char *path, unsigned char save_theme)
fprintf(fp, "begin toggles\n"); fprintf(fp, "begin toggles\n");
fprintf(fp, " map_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT) ? 1 : 0)); fprintf(fp, " map_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT) ? 1 : 0));
fprintf(fp, " urg_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT) ? 1 : 0));
fprintf(fp, " visual_bell %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_VISUAL_BELL) ? 1 : 0)); fprintf(fp, " visual_bell %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_VISUAL_BELL) ? 1 : 0));
fprintf(fp, " login_shell %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL) ? 1 : 0)); fprintf(fp, " login_shell %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL) ? 1 : 0));
fprintf(fp, " scrollbar %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR) ? 1 : 0)); fprintf(fp, " scrollbar %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR) ? 1 : 0));

View File

@ -42,6 +42,7 @@
# define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11) # define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11)
# define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12) # define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12)
# define VT_OPTIONS_COLORS_SUPPRESS_BOLD (1LU << 13) # define VT_OPTIONS_COLORS_SUPPRESS_BOLD (1LU << 13)
# define VT_OPTIONS_URG_ALERT (1LU << 14)
# define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0) # define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0)
# define ETERM_OPTIONS_ICONIC (1LU << 1) # define ETERM_OPTIONS_ICONIC (1LU << 1)

View File

@ -1552,6 +1552,14 @@ scr_page(int direction, int nlines)
void void
scr_bell(void) scr_bell(void)
{ {
XWMHints *wm_hints;
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
wm_hints->flags |= XUrgencyHint;
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
XFree(wm_hints);
}
#ifndef NO_MAPALERT #ifndef NO_MAPALERT
#ifdef MAPALERT_OPTION #ifdef MAPALERT_OPTION
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT)) if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT))

View File

@ -2619,6 +2619,10 @@ xterm_seq(int op, const char *str)
XSetWMHints(Xdisplay, TermWin.parent, wm_hints); XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
XFree(wm_hints); XFree(wm_hints);
break; break;
case 28:
nstr = (char *) strsep(&tnstr, ";");
OPT_SET_OR_TOGGLE(nstr, vt_options, VT_OPTIONS_URG_ALERT);
break;
case 40: case 40:
nstr = (char *) strsep(&tnstr, ";"); nstr = (char *) strsep(&tnstr, ";");
if (nstr) { if (nstr) {