commit 87b1782a0440cfed13d896b255c1301be897b1f4
parent 04f162eeb03fedfedc1b80d7782c1592b3e7bd2d
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Mon, 1 May 2006 20:40:33 +0200
changed wmiiwm.1 (added event processing section), attempt to fix the mouse issue reported by sander
Diffstat:
5 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -660,7 +660,7 @@ resize_all_clients()
flush_events(EnterWindowMask);
}
-/* convenipacke function */
+/* convenience function */
void
focus(Client *c, Bool restack)
{
diff --git a/cmd/wm/event.c b/cmd/wm/event.c
@@ -56,11 +56,13 @@ check_x_event(IXPConn *c)
}
}
-void
+unsigned int
flush_events(long even_mask)
{
XEvent ev;
- while(XCheckMaskEvent(dpy, even_mask, &ev));
+ unsigned int n = 0;
+ while(XCheckMaskEvent(dpy, even_mask, &ev)) n++;
+ return n;
}
static void
diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c
@@ -219,6 +219,10 @@ do_mouse_move(Client *c)
pt.x = ex;
pt.y = ey;
XSync(dpy, False);
+
+ if(flush_events(ButtonReleaseMask))
+ return;
+
XGrabServer(dpy);
while(XGrabPointer(dpy, root, False, ButtonMotionMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, cursor[CurMove],
@@ -458,6 +462,10 @@ do_mouse_resize(Client *c, BlitzAlign align)
XQueryPointer(dpy, c->framewin, &dummy, &dummy, &i, &i, &ox, &oy, &dmask);
XSync(dpy, False);
+
+ if(flush_events(ButtonReleaseMask))
+ return;
+
XGrabServer(dpy);
while(XGrabPointer(dpy, c->framewin, False, ButtonMotionMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, cursor[CurResize],
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -247,7 +247,7 @@ Area *new_right_column(View *v);
/* event.c */
void init_x_event_handler();
void check_x_event(IXPConn *c);
-void flush_events(long even_mask);
+unsigned int flush_events(long even_mask);
/* frame.c */
Frame *create_frame(Area *a, Client *c);
diff --git a/cmd/wm/wmiiwm.1 b/cmd/wm/wmiiwm.1
@@ -331,7 +331,7 @@ which selects the specific client from top to bottom.
This file defines the column mode of this column, described in detail below.
Note, floating layer directories do not contain this file.
.RE
-.SS Syntax of files
+.SS Syntax
All files of the filesystem described above can be read, most of them can be
written as well. Most of the only can be written using valid syntax.
.TP 2
@@ -454,6 +454,58 @@ then the last rule should be defined in the following form:
.B /.*/
\->
.IR <default\-tag> .
+.SS Processing events
+Running
+.B wmiiwm
+in an useful way needs to control it through reading events
+from the
+.I /event
+file described above.
+.TP 2
+BarClick <label> <button>
+This event is reported whenever a label in the bar has been clicked.
+The
+.IR <label>
+argument contains the name of the label in the
+.I /bar
+namespace. The
+.IR <button>
+argument contains the mouse button index which has been pressed during the
+click, e.g.
+.IR 1,
+if it has been the left mouse button.
+.TP 2
+ClientClick <index> <button>
+This event is reported whenever a client frame has been clicked.
+The
+.IR <index>
+argument represents this client in the
+.I /client
+namespace. The
+.IR <button>
+argument contains the mouse button index which has been pressed during the
+click, e.g.
+.IR 1,
+if it has been the left mouse button.
+.TP 2
+ClientFocus <index>
+This event is reported whenever a client is focused. The
+.IR <index>
+argument represents this client in the
+.I /client
+namespace.
+.TP 2
+Key <shortcut>
+This event is reported whenever a shortcut has been pressed, which has been
+grabbed through writing
+.I /def/keys
+file.
+.TP 2
+User defined
+Any writes to the
+.I /event
+file will be reported to all readers. This allows to implement user defined
+events.
.SH SEE ALSO
.BR wmii (1),
.BR wmiimenu (1),