Commit graph

52 commits

Author SHA1 Message Date
Emmanuel Lepage Vallee
2bf930b044 keygrabber: Refactor to be an object instead of a function.
The old keygrabber API wasn't doing what the users want from a
keygrabber module. With tons of boilerplate code, everything could
be done, but it wasn't trivial.

This commit add a default grabber function that implements the
keybinding API already used by `awful.key` and `awful.prompt`.

It also add syntax candy left and right to make the module "feel"
like a native CAPI object.

Nothing is perfect and some parts, like adding root keybindings, are not
vevy pleasing. However it fulfill its goal when it comes to make
previously non-trivial use case very easy to implement and deploy.
2018-08-06 19:03:25 -04:00
Kevin Zander
6cb2e0fa82 Fix some deprecated calls in code and docs
Add missing newline in test runner
2017-03-30 21:26:50 -05:00
Uli Schlachter
259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Daniel Hahler
5ad3f03283 keygrabber: ignore modifiers for name of control keys
`xkb_state_key_get_one_sym` returns `Meta_L` for a (release) event of
`Alt_L` when Shift is pressed.

This patch changes it to use `xcb_key_symbols_get_keysym` in the same
way like normal key handling does it in `event_handle_key`.  This was
changed in 372d12e, but apparently forgotten for the keygrabber.

Closes https://github.com/awesomeWM/awesome/pull/364.
2015-08-10 23:05:16 +02:00
Daniel Hahler
1050237d04 minor: fix/improve doc comments 2015-07-12 17:42:53 +02:00
Julian Wollrath
26f15a13f3 Document C API directly in the C source code
v2: Add available signals to the docs.

Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-06-19 23:13:31 +02:00
Peter Junos
e2562227ab Less reloading of keymap, fixes from psychon comments
Response to psychon comments in PR#227 -
https://github.com/awesomeWM/awesome/pull/227

With this commit, we don't reload keymap, when we are not
notified about its change.
2015-05-28 23:20:17 +02:00
Peter Junos
19137a55c3 Support for XKB - changing keyboard layouts
This commit adds support for writing in prompt (<Super>+R by default)
while different keymap is selected

Signed-off-by: Peter Júnoš <petoju@gmail.com>
2015-05-28 23:20:17 +02:00
Uli Schlachter
d2b1e92f9e Clean up header includes
Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 20:07:48 +02:00
Uli Schlachter
88facb7f57 Make debug::index::miss and newindex work on classes and all objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:27:06 +01:00
Arvydas Sidorenko
d61cdb86c9 Renamed luaL_reg to luaL_Reg
The original struct name is luaL_Reg, but Lua v5.1 had a
`typedef luaL_reg luaL_Reg`, which in v5.2 was removed
and as a result breaking the build in Awesome which uses luaL_reg
version exclusively.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:52:10 +02:00
Sébastien Luttringer
c27ce1e833 Get keygrabber running state
Add a function keygrabber.isrunning() which return a boolean state of
keygrabber

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-06-06 17:28:58 +02:00
Anurag Priyam
014d191f66 keygrabber: continue grabbing till keygrabber.stop is explicitly called
Returning true from the callback just to signal keygrabber to continue grabbing
felt redundant (and silly :|).

This will break old code that relied on returning false to stop grabbing,
instead of calling keygrabber.stop.

And fix keygrabber docs.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-29 20:46:42 +01:00
Gregor Best
c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Uli Schlachter
5d35771673 Save the screen in globalconf.
There can only be on xcb_screen_t now, so we can save it in globalconf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-16 14:10:58 +02:00
Julien Danjou
5359e738e8 key: split resolving in keyresolv
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:20 +02:00
Julien Danjou
0672414414 key: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou
5b718cdacb structs: rename to globalconf
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-07 17:23:01 +02:00
Brian Gianforcaro
3145e3145e Grammar/spelling corrections in comments and docs.
Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-31 10:39:36 +02:00
Julien Danjou
88a6f06b21 add missing vim modelines
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 16:44:30 +02:00
Julien Danjou
a916f2cd55 image: port to new class system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou
e44d62cb09 key: looking up for a key use a keysym
We do not resolve keycode anymore.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-29 10:53:50 +02:00
Julien Danjou
bea4aa7f60 key: move keysym resolution to key
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-29 10:53:50 +02:00
Julien Danjou
ba48d8784d keygrabber: change key_press_lookup_string proto
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-29 10:53:50 +02:00
Julien Danjou
66767605ee Revert "keygrabber: use XStringToKeysym()"
This reverts commit 6ca27c7c4c.
2009-04-28 19:47:39 +02:00
Julien Danjou
6ca27c7c4c keygrabber: use XStringToKeysym()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-28 17:56:57 +02:00
Julien Danjou
e61ab85f5d keygrabber: use luaA_pushmodifiers()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-27 21:04:15 +02:00
Julien Danjou
dc29720ef7 Replace lua_newtable() with lua_createtable()
Lua can preallocate space in table for array or non-array elements type.
This should improve performance when setting table, so when we can we
use lua_createtable() since this is just a gain.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-25 15:04:27 +02:00
Julien Danjou
f473a107b0 cleanup #includes
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-17 16:52:25 +02:00
Julien Danjou
1a18088da5 key: stop ignoring arbitrary modifier
Before, we used to ignore Mod2 and Lock.
This is now configurable.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-15 12:01:55 +02:00
Uli Schlachter
95457c5ab7 Move the definition of globalconf into a header file
Pretty much every single source file needs this struct, so it makes sense to
define it in a common header instead of in every single .c file.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 16:32:42 +02:00
Alex Cornejo
106e6ed5ab Styling inconsistencies
Cheers,

Alex

From b5816ec55073507d4527ad3a77eae1878adb30d3 Mon Sep 17 00:00:00 2001
From: Alex Cornejo <acornejo@gmail.com>
Date: Sun, 29 Mar 2009 14:24:27 -0400
Subject: [PATCH] Fixed some styling issues.

Noticed in the latest pull that a commit introduced a lot of styling
inconsistencies, decided to remove those and others found by a simple
grep.

Signed-off-by: Alex Cornejo <acornejo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-03-30 12:53:12 +02:00
Julien Danjou
8edd049e4d keygrabber: report modifier key press
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-01-05 11:22:04 +01:00
Julien Danjou
c8c2c75472 keygrabber: add a bunch of new key
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-01-04 17:44:19 +01:00
Julien Danjou
53f58aa1a6 keybinding: move to key
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-18 11:33:52 +01:00
Julien Danjou
8193a9cf0c keygrabber: identify release events
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-16 15:02:54 +01:00
Julien Danjou
9abf89da2a keygrabber: remove duplicate case (FS#386)
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-24 11:24:19 +01:00
Julien Danjou
ce99ab2a3a keygrabber: add stop() method
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-10 17:31:18 +01:00
Julien Danjou
6a67910854 keygrabber: add support for XKB_KEYS
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-26 09:46:34 +02:00
Julien Danjou
6ac0c4130c image: merge draw_image_t and image_t
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:55 +02:00
Julien Danjou
01f37e1edc keygrabber: push an hash table instead of indexed table
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:54 +02:00
Julien Danjou
3104969d03 keygrabber: include header file for key_getkeysym()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-13 12:31:42 +02:00
Julien Danjou
530f27e4a1 keybinding: honor modifier state correctly (FS#264)
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-13 10:30:24 +02:00
Arnaud Fontaine
b655f6348c xutil: rename xutil functions according to the rest of code. 2008-08-11 18:05:35 +02:00
Pierre Habouzit
f96c5c6259 Simplify keygrabber.
* Use __utf8_mark to lookup the final patch for utf8 codepoints.
* Use __utf32_clz_to_len to compute the number of octets needed to encode
  a given Unicode codepoint in utf8, rather than inefficient ifs.
* Use static buffers (libc provides MB_LEN_MAX for the matter, and we know
  the special keys names won't be longer than 32, so avoid silly p_new's).
* Rework APIs to work with those static buffers, and return a boolean to
  tell if conversion worked.
* Factorize ksym XK_* to string conversion using ad-hoc macros.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-30 00:47:11 +02:00
Pierre Habouzit
cde80ab49a Move CLEANMASK to xutil.h, remove useless #Includes
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-26 22:47:56 +02:00
Julien Danjou
013b2afe62 remove useless #include
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-26 18:10:45 +02:00
Julien Danjou
46ead6ea3f comments fixing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-20 08:38:00 +02:00
Arnaud Fontaine
b9e1ec69d0 Replace xcb_aux_get_screen() by a safer function 2008-06-17 17:14:00 +02:00
Julien Danjou
6cd6e18e29 [keygrabber] Add keys between XK_Home and XK_Begin
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-10 22:57:26 +02:00