]> Dogcows Code - chaz/openbox/commitdiff
Add options for controlling frame flashing
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 29 Dec 2011 22:43:35 +0000 (15:43 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 29 Dec 2011 23:08:03 +0000 (16:08 -0700)
data/rc.xml
data/rc.xsd
openbox/config.c
openbox/config.h
openbox/frame.c

index 209cc2dc9a9d416e0c04842060b7cb6f6dbb2be8..2607ecee9d2d140ece401f2ceed37f44d8802446 100644 (file)
@@ -63,6 +63,8 @@
   -->
   <keepBorder>yes</keepBorder>
   <animateIconify>yes</animateIconify>
+  <flashFrameDelay>600</flashFrameDelay>
+  <flashFrameDuration>5000</flashFrameDuration>
   <font place="ActiveWindow">
     <name>sans</name>
     <size>8</size>
index ad96994a8df161f762206474521d15d6a98f369d..8e46d93ad6b6035bd1e3d758455a3bf5eaca5f18 100644 (file)
@@ -92,6 +92,9 @@
             <xsd:element minOccurs="0" name="titleLayout" type="xsd:string"/>
             <xsd:element minOccurs="0" name="keepBorder" type="ob:bool"/>
             <xsd:element minOccurs="0" name="animateIconify" type="ob:bool"/>
+            <xsd:element minOccurs="0" name="flashFrameDelay" type="ob:integer"/>
+            <xsd:element minOccurs="0" name="flashFrameDuration" type="ob:integer"/>
+            <xsd:element minOccurs="0" name="animateIconify" type="ob:bool"/>
             <xsd:element minOccurs="0" maxOccurs="unbounded" name="font" type="ob:font"/>
         </xsd:sequence>
     </xsd:complexType>
index 0d9eb689f2e7f4e7ad8ecc4073529413c1541371..460a3f85f5a8d557568e144b97e8dae9557e893b 100644 (file)
@@ -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;
index 730dc39a5f8040d1a3ca5460dd087d4bf9c33f34..500c7b467f8c23b04db2fb8935bdaf42c429c7f0 100644 (file)
@@ -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;
index 48dda24eaa9880380d05b1ecc9bcc875cdb1a456..4468e1910bf75d33ef3e5da5cc24f4b2bc966561 100644 (file)
@@ -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;
 }
This page took 0.034791 seconds and 4 git commands to generate.