X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fframe.c;h=3bceec997a2f2aed40fac936123b125f474517cd;hb=a9c02d62e812f1fd71b00ed4323fec3012fe6ce2;hp=7c26d7068eefca58a51c5fbc398031609906365c;hpb=0621e22932b40ada705abbeb67b67c0e37ef7654;p=chaz%2Fopenbox diff --git a/openbox/frame.c b/openbox/frame.c index 7c26d706..3bceec99 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -19,6 +19,8 @@ f->cbwidth_y) static void layout_title(ObFrame *self); +static void flash_done(gpointer data); +static gboolean flash_timeout(gpointer data); static Window createWindow(Window parent, unsigned long mask, XSetWindowAttributes *attrib) @@ -475,6 +477,8 @@ void frame_release_client(ObFrame *self, ObClient *client) g_hash_table_remove(window_map, &self->tlresize); g_hash_table_remove(window_map, &self->trresize); + ob_main_loop_timeout_remove(ob_main_loop, flash_timeout); + frame_free(self); } @@ -785,7 +789,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 +798,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 +820,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; +}