summaryrefslogtreecommitdiff
path: root/openbox/slit.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-05-10 22:33:24 +0000
committerDana Jansens <danakj@orodu.net>2003-05-10 22:33:24 +0000
commit20ba24b7415609cbd57927c44f079bab3c911839 (patch)
treebe0a6130dac9a618b021c970bf589ca2b6856799 /openbox/slit.c
parent4e88712158d5019e09907a5f3ff4b78174712daf (diff)
add autohiding to the slit
Diffstat (limited to 'openbox/slit.c')
-rw-r--r--openbox/slit.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/openbox/slit.c b/openbox/slit.c
index 98eb010e..a43edccf 100644
--- a/openbox/slit.c
+++ b/openbox/slit.c
@@ -1,10 +1,11 @@
#include "slit.h"
#include "screen.h"
+#include "timer.h"
#include "openbox.h"
#include "render/theme.h"
#include "render/render.h"
-#define SLIT_EVENT_MASK (EnterNotifyMask | LeaveNotifyMask)
+#define SLIT_EVENT_MASK (EnterWindowMask | LeaveWindowMask)
#define SLITAPP_EVENT_MASK (StructureNotifyMask)
struct Slit {
@@ -25,6 +26,8 @@ struct Slit {
Appearance *a_frame;
+ Timer *hide_timer;
+
GList *slit_apps;
};
@@ -50,13 +53,15 @@ void slit_startup()
for (i = 0; i < nslits; ++i) {
slit[i].horz = FALSE;
slit[i].hide = TRUE;
- slit[i].hidden = FALSE;
+ slit[i].hidden = TRUE;
slit[i].pos = SlitPos_TopRight;
+ attrib.event_mask = SLIT_EVENT_MASK;
attrib.override_redirect = True;
slit[i].frame = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
render_depth, InputOutput, render_visual,
- CWOverrideRedirect, &attrib);
+ CWOverrideRedirect | CWEventMask,
+ &attrib);
slit[i].a_frame = appearance_copy(theme_a_unfocused_title);
XSetWindowBorder(ob_display, slit[i].frame, theme_b_color->pixel);
XSetWindowBorderWidth(ob_display, slit[i].frame, theme_bwidth);
@@ -330,3 +335,35 @@ void slit_app_configure(SlitApp *app, int w, int h)
app->h = h;
slit_configure(app->slit);
}
+
+static void hide_timeout(Slit *self)
+{
+ /* dont repeat */
+ timer_stop(self->hide_timer);
+ self->hide_timer = NULL;
+
+ /* hide */
+ self->hidden = TRUE;
+ slit_configure(self);
+}
+
+void slit_hide(Slit *self, gboolean hide)
+{
+ if (self->hidden == hide)
+ return;
+ if (!hide) {
+ /* show */
+ self->hidden = FALSE;
+ slit_configure(self);
+
+ /* if was hiding, stop it */
+ if (self->hide_timer) {
+ timer_stop(self->hide_timer);
+ self->hide_timer = NULL;
+ }
+ } else {
+ g_assert(!self->hide_timer);
+ self->hide_timer = timer_start(3000000,
+ (TimeoutHandler)hide_timeout, self);
+ }
+}