Vincent Bernat | 2 Aug 2012 15:22
Gravatar

Is the mouse button pressed?

Hi!

I would like to determine if a mouse button is pressed. It is possible
using events and tracking the button states myself but something
like mouse.coords would be more helpful. Is something like this already
available?

--

-- 
panic("kmem_cache_init(): Offsets are wrong - I've been messed with!");
	2.2.16 /usr/src/linux/mm/slab.c

David Gomes | 2 Aug 2012 15:26
Favicon

Re: Is the mouse button pressed?

Use flags. When that key is pressed (awful.key.bind()) set a certain
variable to true. When that key is released, set it to false. And then
use that variable to check.

I'm just not sure of how you can check if a key is rleeased.

On Thu, Aug 2, 2012 at 2:22 PM, Vincent Bernat <bernat <at> luffy.cx> wrote:
>
> Hi!
>
> I would like to determine if a mouse button is pressed. It is possible
> using events and tracking the button states myself but something
> like mouse.coords would be more helpful. Is something like this already
> available?
>
> --
> panic("kmem_cache_init(): Offsets are wrong - I've been messed with!");
>         2.2.16 /usr/src/linux/mm/slab.c
>
> --
> To unsubscribe, send mail to awesome-unsubscribe <at> naquadah.org.

Julien Danjou | 2 Aug 2012 15:26
Gravatar

Re: Is the mouse button pressed?

On Thu, Aug 02 2012, Vincent Bernat wrote:

> I would like to determine if a mouse button is pressed. It is possible
> using events and tracking the button states myself but something
> like mouse.coords would be more helpful. Is something like this already
> available?

mouse.coords() returns the button status too in the returned table:
mouse.coords[1] is true or false according to the status of button 1,
etc.

--

-- 
Julien Danjou
;; Free Software hacker & freelance
;; http://julien.danjou.info
David Gomes | 2 Aug 2012 15:32
Favicon

Re: Is the mouse button pressed?

Oh! I confused "button" with "key", I'm sorry, my answer is pretty useless then.

On Thu, Aug 2, 2012 at 2:26 PM, Julien Danjou <julien <at> danjou.info> wrote:
> On Thu, Aug 02 2012, Vincent Bernat wrote:
>
>> I would like to determine if a mouse button is pressed. It is possible
>> using events and tracking the button states myself but something
>> like mouse.coords would be more helpful. Is something like this already
>> available?
>
> mouse.coords() returns the button status too in the returned table:
> mouse.coords[1] is true or false according to the status of button 1,
> etc.
>
> --
> Julien Danjou
> ;; Free Software hacker & freelance
> ;; http://julien.danjou.info

Vincent Bernat | 2 Aug 2012 15:41
Gravatar

Re: Is the mouse button pressed?

 ❦  2 août 2012 15:26 CEST, Julien Danjou <julien <at> danjou.info> :

>> I would like to determine if a mouse button is pressed. It is possible
>> using events and tracking the button states myself but something
>> like mouse.coords would be more helpful. Is something like this already
>> available?
>
> mouse.coords() returns the button status too in the returned table:
> mouse.coords[1] is true or false according to the status of button 1,
> etc.

OK, thanks! That's mouse.coords().buttons[1].
--

-- 
 /*
  * For moronic filesystems that do not allow holes in file.
  * We may have to extend the file.
  */
	2.4.0-test2 /usr/src/linux/fs/buffer.c

Vincent Bernat | 2 Aug 2012 19:46
Gravatar

Re: Is the mouse button pressed?

 ❦  2 août 2012 15:22 CEST, Vincent Bernat <bernat <at> luffy.cx> :

> I would like to determine if a mouse button is pressed. It is possible
> using events and tracking the button states myself but something
> like mouse.coords would be more helpful. Is something like this already
> available?

I was needing this for a "mouse follows focus" (combined with a classic
"sloppy focus"). I think I have now a fairly working setup around
this. For interested people (not all the file is revelant to this
functionality):

 https://github.com/vincentbernat/awesome-configuration/blob/master/rc/signals.lua
--

-- 
 /* Nobody will ever see this message :-) */
panic("Cannot initialize video hardware\n");
	2.0.38 /usr/src/linux/arch/m68k/atari/atafb.c


Gmane