From 6e354cd3763cb7f934db24f2f084809a619d8dc7 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Apr 2016 23:29:22 -0400 Subject: [PATCH] doc: Add proper mouse documentation --- docs/images/mouse.svg | 253 ++++++++++++++++++++++++++++++++++++++++++ mouse.c | 34 +++++- 2 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 docs/images/mouse.svg diff --git a/docs/images/mouse.svg b/docs/images/mouse.svg new file mode 100644 index 000000000..e56eff51c --- /dev/null +++ b/docs/images/mouse.svg @@ -0,0 +1,253 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + Button 1(LMB) + Button 2(RMB) + + + Click: Button 3 + Down: Button 5 + Up: Button 4 + + + + + + + + + + + + + + + diff --git a/mouse.c b/mouse.c index 57c4a8ba5..272b12adc 100644 --- a/mouse.c +++ b/mouse.c @@ -19,7 +19,39 @@ * */ -/** awesome mouse API +/** awesome mouse API. + * + * The mouse buttons are represented as index. The common ones are: + * + * ![Client geometry](../images/mouse.svg) + * + * It is possible to be notified of mouse events by connecting to various + * `client`, `widget`s and `wibox` signals: + * + * * `mouse::enter` + * * `mouse::leave` + * * `mouse::press` + * * `mouse::release` + * * `mouse::move` + * + * It is also possible to add generic mouse button callbacks for `client`s, + * `wiboxe`s and the `root` window. Those are set in the default `rc.lua` as such: + * + * **root**: + * + * root.buttons(awful.util.table.join( + * awful.button({ }, 3, function () mymainmenu:toggle() end), + * awful.button({ }, 4, awful.tag.viewnext), + * awful.button({ }, 5, awful.tag.viewprev) + * )) + * + * **client**: + * + * clientbuttons = awful.util.table.join( + * awful.button({ }, 1, function (c) client.focus = c; c:raise() end), + * awful.button({ modkey }, 1, awful.mouse.client.move), + * awful.button({ modkey }, 3, awful.mouse.client.resize) + * ) * * See also `mousegrabber` *