From: Charles McGarvey Date: Thu, 29 Dec 2011 22:43:35 +0000 (-0700) Subject: Add options for controlling frame flashing X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fopenbox;a=commitdiff_plain;h=445056664fbd8501a47724cf3976a45fab2f448e Add options for controlling frame flashing --- diff --git a/data/rc.xml b/data/rc.xml index 209cc2dc..2607ecee 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -63,6 +63,8 @@ --> yes yes + 600 + 5000 sans 8 diff --git a/data/rc.xsd b/data/rc.xsd index ad96994a..8e46d93a 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -92,6 +92,9 @@ + + + diff --git a/openbox/config.c b/openbox/config.c index 0d9eb689..460a3f85 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -48,6 +48,8 @@ StrutPartial config_margins; gchar *config_theme; gboolean config_theme_keepborder; guint config_theme_window_list_icon_size; +guint config_frame_flash_delay; +guint config_frame_flash_duration; gchar *config_title_layout; @@ -655,6 +657,10 @@ static void parse_theme(xmlNodePtr node, gpointer d) else if (config_theme_window_list_icon_size > 96) config_theme_window_list_icon_size = 96; } + if ((n = obt_xml_find_node(node, "flashFrameDelay"))) + config_frame_flash_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "flashFrameDuration"))) + config_frame_flash_duration = obt_xml_node_int(n); n = obt_xml_find_node(node, "font"); while (n) { @@ -1031,6 +1037,8 @@ void config_startup(ObtXmlInst *i) config_title_layout = g_strdup("NLIMC"); config_theme_keepborder = TRUE; config_theme_window_list_icon_size = 36; + config_frame_flash_delay = 600; + config_frame_flash_duration = 5000; config_font_activewindow = NULL; config_font_inactivewindow = NULL; diff --git a/openbox/config.h b/openbox/config.h index 730dc39a..500c7b46 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -145,6 +145,10 @@ extern gchar *config_title_layout; extern gboolean config_animate_iconify; /*! Size of icons in focus switching dialogs */ extern guint config_theme_window_list_icon_size; +/*! Amount of time between flashes (0 to disable flashing) */ +extern guint config_frame_flash_delay; +/*! How long (ms) to flash the window's frame (0 to flash forever) */ +extern guint config_frame_flash_duration; /*! The font for the active window's title */ extern RrFont *config_font_activewindow; diff --git a/openbox/frame.c b/openbox/frame.c index 48dda24e..4468e191 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -1665,11 +1665,13 @@ static gboolean flash_timeout(gpointer data) ObFrame *self = data; GTimeVal now; - g_get_current_time(&now); - if (now.tv_sec > self->flash_end.tv_sec || - (now.tv_sec == self->flash_end.tv_sec && - now.tv_usec >= self->flash_end.tv_usec)) - self->flashing = FALSE; + if (config_frame_flash_duration != 0) { + g_get_current_time(&now); + if (now.tv_sec > self->flash_end.tv_sec || + (now.tv_sec == self->flash_end.tv_sec && + now.tv_usec >= self->flash_end.tv_usec)) + self->flashing = FALSE; + } if (!self->flashing) return FALSE; /* we are done */ @@ -1685,14 +1687,19 @@ static gboolean flash_timeout(gpointer data) void frame_flash_start(ObFrame *self) { + if (config_frame_flash_delay == 0) return; + self->flash_on = self->focused; if (!self->flashing) self->flash_timer = g_timeout_add_full(G_PRIORITY_DEFAULT, - 600, flash_timeout, self, + config_frame_flash_delay, flash_timeout, self, flash_done); - g_get_current_time(&self->flash_end); - g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5); + + if (config_frame_flash_duration != 0) { + g_get_current_time(&self->flash_end); + g_time_val_add(&self->flash_end, 1000 * config_frame_flash_duration); + } self->flashing = TRUE; }