summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-09-01 03:41:53 +0000
committerDana Jansens <danakj@orodu.net>2003-09-01 03:41:53 +0000
commitbd70fff6f96f482d309bf67d0eefa39d3a61f027 (patch)
tree428a4ee6008e7be18b634f5e51eafc139e59fcad /openbox
parent169e64da2c5246fb9aaec417f12c0a9c89b295ee (diff)
improved frame flashing code, can start and stop it on command
Diffstat (limited to 'openbox')
-rw-r--r--openbox/frame.c25
-rw-r--r--openbox/frame.h3
2 files changed, 16 insertions, 12 deletions
diff --git a/openbox/frame.c b/openbox/frame.c
index 7c26d706..700f2eac 100644
--- a/openbox/frame.c
+++ b/openbox/frame.c
@@ -785,7 +785,6 @@ void frame_frame_gravity(ObFrame *self, int *x, int *y)
static void flash_done(gpointer data)
{
ObFrame *self = data;
- self->flashing = FALSE;
if (self->focused != self->flash_on)
frame_adjust_focus(self, self->focused);
@@ -795,21 +794,20 @@ static gboolean flash_timeout(gpointer data)
{
ObFrame *self = data;
GTimeVal now;
- gboolean focused;
-
- g_message("flash");
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)) {
- g_message("done flashing");
+ now.tv_usec >= self->flash_end.tv_usec))
+ self->flashing = FALSE;
+
+ if (!self->flashing)
return FALSE; /* we are done */
- }
self->flash_on = !self->flash_on;
- g_message("on %d", self->flash_on);
{
+ gboolean focused;
+
focused = self->focused; /* save the focused flag */
frame_adjust_focus(self, self->flash_on);
self->focused = focused;
@@ -818,18 +816,23 @@ static gboolean flash_timeout(gpointer data)
return TRUE; /* go again */
}
-void frame_flash(ObFrame *self)
+void frame_flash_start(ObFrame *self)
{
self->flash_on = self->focused;
if (!self->flashing)
ob_main_loop_timeout_add(ob_main_loop,
- G_USEC_PER_SEC / 2,
+ G_USEC_PER_SEC * 0.75,
flash_timeout,
self,
flash_done);
g_get_current_time(&self->flash_end);
- g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 4);
+ g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5);
self->flashing = TRUE;
}
+
+void frame_flash_stop(ObFrame *self)
+{
+ self->flashing = FALSE;
+}
diff --git a/openbox/frame.h b/openbox/frame.h
index d5a9c7ce..1de9090f 100644
--- a/openbox/frame.h
+++ b/openbox/frame.h
@@ -149,6 +149,7 @@ void frame_client_gravity(ObFrame *self, int *x, int *y);
*/
void frame_frame_gravity(ObFrame *self, int *x, int *y);
-void frame_flash(ObFrame *self);
+void frame_flash_start(ObFrame *self);
+void frame_flash_stop(ObFrame *self);
#endif