summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2008-05-14 21:54:45 +0000
committerMichael Jennings <mej@kainx.org>2008-05-14 21:54:45 +0000
commitc7a352b0c0e3ff79b7d552fbdea6ddaf9c88dbec (patch)
treed0880c9717965338f6544195b245367832f51dc3
parent3df02b2205c960d4c18293a64fccb8b603480c39 (diff)
downloadeterm-c7a352b0c0e3ff79b7d552fbdea6ddaf9c88dbec.tar.gz
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
-rw-r--r--ChangeLog5
-rw-r--r--src/events.c14
-rw-r--r--src/options.c8
-rw-r--r--src/options.h1
-rw-r--r--src/screen.c8
-rw-r--r--src/term.c4
6 files changed, 40 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 798e997..ce7d576 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
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.
+----------------------------------------------------------------------
diff --git a/src/events.c b/src/events.c
index d6b6d26..b52f7e1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -200,6 +200,7 @@ event_win_is_parent(register event_dispatcher_data_t *data, Window win)
unsigned char
handle_key_press(event_t *ev)
{
+ XWMHints *wm_hints;
#ifdef COUNT_X_EVENTS
static unsigned long keypress_cnt = 0;
#endif
@@ -214,6 +215,12 @@ handle_key_press(event_t *ev)
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) {
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_TIME(handle_key_press);
return 1;
@@ -453,6 +460,7 @@ handle_leave_notify(event_t *ev)
unsigned char
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));
@@ -488,6 +496,12 @@ handle_focus_in(event_t *ev)
if (xim_input_context != NULL)
XSetICFocus(xim_input_context);
#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;
}
diff --git a/src/options.c b/src/options.c
index 802a473..24405f4 100644
--- a/src/options.c
+++ b/src/options.c
@@ -311,6 +311,7 @@ spifopt_t option_list[] = {
SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT),
# endif
#endif
+ SPIFOPT_BOOL_LONG("urg-alert", "set urgent hint on beep", vt_options, VT_OPTIONS_URG_ALERT),
#ifdef META8_OPTION
SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8),
#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");
#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 ")) {
if (bool_val) {
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, " 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, " 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));
diff --git a/src/options.h b/src/options.h
index 04ea6d2..5024127 100644
--- a/src/options.h
+++ b/src/options.h
@@ -42,6 +42,7 @@
# define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11)
# define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12)
# 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_ICONIC (1LU << 1)
diff --git a/src/screen.c b/src/screen.c
index 54e0aa2..b9caf7d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1552,6 +1552,14 @@ scr_page(int direction, int nlines)
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
#ifdef MAPALERT_OPTION
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT))
diff --git a/src/term.c b/src/term.c
index 65e5a39..1fd197e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2619,6 +2619,10 @@ xterm_seq(int op, const char *str)
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
XFree(wm_hints);
break;
+ case 28:
+ nstr = (char *) strsep(&tnstr, ";");
+ OPT_SET_OR_TOGGLE(nstr, vt_options, VT_OPTIONS_URG_ALERT);
+ break;
case 40:
nstr = (char *) strsep(&tnstr, ";");
if (nstr) {