Commit graph

19 commits

Author SHA1 Message Date
Emmanuel Lepage Vallee
b4ece0f053 doc: Use an explicit tag for all static functions.
This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.

This commit also fixes a large number of issues found while
proof-reading everything.
2019-06-08 18:14:13 -04:00
Uli Schlachter
fb147cf856 XKB update: Use an idle source
Instead of updating the keyboard state at the end of the current main
loop iteration, this now uses a GLib idle source with a very low
priority. This increases the chance of batching multiple refreshes
together. Also, this means that awesome_refresh() does less work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 13:45:34 +01:00
Uli Schlachter
9f3a6757e9 Asynchronously update the keyboard state
When the keyboard layout is modified via xmodmap, each single "change"
(line of input to xmodmap) causes an "the keyboard configuration
changed"-event to be sent. Awesome reacted to each of these events by
reloading the keyboard layout. Thus, awesome reloaded the keyboard
layout a lot and appeared to freeze.

Fix this by asynchronously update the keyboard state: When such an event
comes in, instead of reloading things immediately, we set a flag which
makes us update the state at the end of the main loop iteration. This
means that many events still cause only a single (or at least few)
re-quering of the layout. Thus, a lot of time is saved.

This commit removes the argument to the (undocumented!) signal
xkb::group_changed. Previously, the argument was the active group
number. Since this argument was unused and I'm lazy, I just removed it.
The alternative would be that it might be visible to Lua that some "the
active group changed"-events are dropped.

Fixes: https://github.com/awesomeWM/awesome/issues/1494
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-28 15:21:01 +02:00
Uli Schlachter
a4748164ab Add fallbacks for when XKB is unavailable
Fixes: https://github.com/awesomeWM/awesome/issues/1205
       (for master, dunno about 3.5)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-11-04 17:26:28 +01:00
Uli Schlachter
aae960e99e Make client key bindings for e.g. xeyes work again
Instead of focusing the root window, we now create a "focus window" inside of
our frame window. This window is placed so that it is not visible, but we can
grab key bindings on it to simulate the window having the input focus.

Fixes: https://github.com/awesomeWM/awesome/issues/699
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-28 13:29:25 +01:00
Uli Schlachter
051d0de85f Replace many pushnumber calls with pushinteger
The only remaining calls are for a window's opacity and in the DBus type
handling. Everything else wants integers, not something with a comma.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-06 13:46:46 +01:00
Uli Schlachter
a98fc92b81 Move handling of MappingNotify to xkb.c
A quote from the XKeyboard specification:

  The server notifies interested clients of keyboard map changes in one of two
  ways. It sends XkbMapNotify to clients that have explicitly selected them and
  core protocol MappingNotify events to clients that have not. Once a client
  requests XkbMapNotify events, the server stops sending it MappingNotify events
  to inform it of keyboard changes.

This commit moves the code that we had for handling MappingNotify events to the
place where we handle XkbMapNotify events. This might even fix some bugs where
parts of awesome continued to use old key binding "stuff"!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-23 17:03:29 +01:00
Uli Schlachter
a141370704 Add a vim modeline to all C source
Most of the files already had this, at least.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:42:16 +01:00
Uli Schlachter
6f2424e901 Enable detectable autorepeat (#550)
Imagine the following snippet is run:

    keygrabber.run(function(mod, key, event)
      gears.debug.dump{mod, key, event}
    end)

The above starts a keygrabber and prints the events that are received.
Currently, when a key is pressed and held down, this prints a series of press
and release, because that's what the X11 server sends us.

This commit enables detectable autorepeat. This means that the X11 server only
sends us a series of press events for autorepeat and a single release when the
key really is released.

Testing this is a bit hard, because detectable autorepeat does not seem to work
with Xephyr. Instead, a "real" Xorg instance is needed.

We do not check the response to the PerClientFlags request, because it doesn't
really tell us anything useful. If the server does not support detectable
autorepeat, we could print a warning, but so what? As I just said, this does not
work in Xephyr and yet Xephyr announced to support this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:45:04 +01:00
Uli Schlachter
e279d68670 xkb.c: Remove trailing whitespace
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:27:35 +01:00
Uli Schlachter
10daa6b09e xkb: Don't use _checked() requests
In XCB, each request has a checked and an unchecked version. The checked version
can be used to check if the request caused any errors. Since the code here
doesn't do this check, it shouldn't use the checked versions of the requests.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:24:21 +01: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
594c01dc36 Xkb setup by calling xkbcommon function 2015-05-28 23:20:17 +02:00
Peter Junos
835c13bd80 NamesNotify should never come; moved under MapNotify 2015-05-28 23:20:17 +02:00
Peter Junos
f50ed9a1e8 Fix - get correct type and unbind finally 2015-05-28 23:20:17 +02:00
Peter Junos
7d88aebbf9 Respect remapped keys 2015-05-28 23:20:17 +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
Aleksey Fedotov
996f6785a8 xkb: implementation of keyboard layout switched
This patch provides functions to get/set current keyboard layout.

Current implementation doesn't support any configuration of layout,
it's a merely a layout indicator and switcher, however layout
configuration can be set by tools like setxkbmap or by any third-party
tools.
2015-03-03 00:33:16 +03:00