changeset: 2148:3b3ace954317
user: Kris Maglione <jg_AT_suckless.org>
date: Wed May 30 19:08:28 2007 -0400
summary: Send MouseDown events for the bar.
diff -r 3863bd1308a6 -r 3b3ace954317 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Wed May 30 15:39:21 2007 -0400
+++ b/cmd/wmii/bar.c Wed May 30 19:08:28 2007 -0400
@@ -22,6 +22,7 @@ initbar(WMScreen *s) {
wa.background_pixmap = ParentRelative;
wa.event_mask =
ExposureMask
+ | ButtonPressMask
| ButtonReleaseMask
| FocusChangeMask
| SubstructureRedirectMask
@@ -173,6 +174,26 @@ bar_of_name(Bar *bp, const char *name) {
}
static void
+bdown_event(Window *w, XButtonPressedEvent *e) {
+ Bar *b;
+
+ /* Ungrab so a menu can receive events before the button is released */
+ XUngrabPointer(display, e->time);
+ XSync(display, False);
+
+ for(b=screen->bar[BarLeft]; b; b=b->next)
+ if(ptinrect(Pt(e->x, e->y), b->r)) {
+ write_event("LeftBarMouseDown %d %s\n", e->button, b->name);
+ return;
+ }
+ for(b=screen->bar[BarRight]; b; b=b->next)
+ if(ptinrect(Pt(e->x, e->y), b->r)) {
+ write_event("RightBarMouseDown %d %s\n", e->button, b->name);
+ return;
+ }
+}
+
+static void
bup_event(Window *w, XButtonPressedEvent *e) {
Bar *b;
@@ -194,6 +215,7 @@ expose_event(Window *w, XExposeEvent *e)
}
static Handlers handlers = {
+ .bdown = bdown_event,
.bup = bup_event,
.expose = expose_event,
};
Received on Fri Jun 01 2007 - 03:10:51 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:11 UTC