X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fframe.c;h=700f2eac3d3c45be6342a7e85d9ea4b70d23f0ea;hb=bd70fff6f96f482d309bf67d0eefa39d3a61f027;hp=0d5ddb2e6ac2592b96835750c69e8d83d4981bc2;hpb=6375df675f01dd1a9bc625e95d799b9cb40bcda3;p=chaz%2Fopenbox diff --git a/openbox/frame.c b/openbox/frame.c index 0d5ddb2e..700f2eac 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -4,11 +4,13 @@ #include "extensions.h" #include "config.h" #include "framerender.h" +#include "mainloop.h" #include "render/theme.h" #define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask) #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ - ButtonPressMask | ButtonReleaseMask) + ButtonPressMask | ButtonReleaseMask | \ + VisibilityChangeMask) #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask | ExposureMask | \ EnterWindowMask | LeaveWindowMask) @@ -36,7 +38,9 @@ ObFrame *frame_new() self = g_new(ObFrame, 1); self->visible = FALSE; + self->obscured = TRUE; self->decorations = 0; + self->flashing = FALSE; /* create all of the decor windows */ mask = CWOverrideRedirect | CWEventMask; @@ -211,6 +215,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, { if (resized) { self->decorations = self->client->decorations; + self->max_horz = self->client->max_horz; if (self->decorations & OB_FRAME_DECOR_BORDER) { self->bwidth = ob_rr_theme->bwidth; @@ -220,10 +225,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, } self->rbwidth = self->bwidth; - if (self->client->max_vert && self->client->max_horz) - self->decorations &= ~OB_FRAME_DECOR_HANDLE; - - if (self->client->max_horz) + if (self->max_horz) self->bwidth = self->cbwidth_x = 0; STRUT_SET(self->innersize, @@ -232,7 +234,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, self->cbwidth_x, self->cbwidth_y); self->width = self->client->area.width + self->cbwidth_x * 2 - - (self->client->max_horz ? self->rbwidth * 2 : 0); + (self->max_horz ? self->rbwidth * 2 : 0); self->width = MAX(self->width, 1); /* no lower than 1 */ /* set border widths */ @@ -338,7 +340,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, self->client->area.width + self->size.left + self->size.right, (self->client->shaded ? - ob_rr_theme->title_height + self->bwidth*2: + ob_rr_theme->title_height + self->rbwidth * 2: self->client->area.height + self->size.top + self->size.bottom)); @@ -601,8 +603,8 @@ static void layout_title(ObFrame *self) ObFrameContext frame_context_from_string(char *name) { - if (!g_ascii_strcasecmp("root", name)) - return OB_FRAME_CONTEXT_ROOT; + if (!g_ascii_strcasecmp("desktop", name)) + return OB_FRAME_CONTEXT_DESKTOP; else if (!g_ascii_strcasecmp("client", name)) return OB_FRAME_CONTEXT_CLIENT; else if (!g_ascii_strcasecmp("titlebar", name)) @@ -638,22 +640,23 @@ ObFrameContext frame_context(ObClient *client, Window win) { ObFrame *self; - if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_ROOT; + if (win == RootWindow(ob_display, ob_screen)) + return OB_FRAME_CONTEXT_DESKTOP; if (client == NULL) return OB_FRAME_CONTEXT_NONE; if (win == client->window) { - /* conceptually, this is the root window, as far as users are + /* conceptually, this is the desktop, as far as users are concerned */ if (client->type == OB_CLIENT_TYPE_DESKTOP) - return OB_FRAME_CONTEXT_ROOT; + return OB_FRAME_CONTEXT_DESKTOP; return OB_FRAME_CONTEXT_CLIENT; } self = client->frame; if (win == self->plate) { - /* conceptually, this is the root window, as far as users are + /* conceptually, this is the desktop, as far as users are concerned */ if (client->type == OB_CLIENT_TYPE_DESKTOP) - return OB_FRAME_CONTEXT_ROOT; + return OB_FRAME_CONTEXT_DESKTOP; return OB_FRAME_CONTEXT_CLIENT; } @@ -778,3 +781,58 @@ void frame_frame_gravity(ObFrame *self, int *x, int *y) break; } } + +static void flash_done(gpointer data) +{ + ObFrame *self = data; + + if (self->focused != self->flash_on) + frame_adjust_focus(self, self->focused); +} + +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 (!self->flashing) + return FALSE; /* we are done */ + + self->flash_on = !self->flash_on; + { + gboolean focused; + + focused = self->focused; /* save the focused flag */ + frame_adjust_focus(self, self->flash_on); + self->focused = focused; + } + + return TRUE; /* go again */ +} + +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 * 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 * 5); + + self->flashing = TRUE; +} + +void frame_flash_stop(ObFrame *self) +{ + self->flashing = FALSE; +}