This commit adds a "removed" signal to screens. Together with the "added" signal
that we have since a while, this allows the C code to update the list of
available screens dynamically without needing to restart.
So far, this code received only minimal testing. So far, I don't have a nice
idea on how to easily test this...
Closes: https://github.com/awesomeWM/awesome/issues/672
Signed-off-by: Uli Schlachter <psychon@znc.in>
Xorg server from git[1] generates ConfigNotify event when monitor
configuration changes.
We handle the event, but only trigger required awesome_restart() if
screen size is changed. It's not what happens in case of monitor
configuration change.
Let's relax the condition and call awesome_restart() in response to all
ConfigNotify events to root window.
I'm not entirely sure that it wouldn't lead to superfluous restarts, but
I don't see an option.
[1] dbe8d03c42f0 ("randr: Send ConfigNotify when manual monitor list changes")
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
The code that claims to do what XRRUpdateConfiguration() would do was actually
wrong. That function does not send any requests to the X11 server, but it just
updates the local, in-memory state.
This commit makes us do the same: We update the size of the root window if it
changed. The code is directly inspired from the code in libXrandr.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit copies part of what XRRUpdateConfiguration() would do. When the root
window is resized, we update the information that the X11 server sent to us when
we connected to it to contain the new size of the root window.
This is 50% ugly, but having our own copy of the root window size would be 51%
ugly, so it's better to write to the XCB-owned structure.
Right now this is all dead code anyway, because we restart anyway, but since the
goal is to get rid of that restart, this is a step in the right direction (e.g.
root.size() will automatically return the new size).
Signed-off-by: Uli Schlachter <psychon@znc.in>
This function needs the event numbers for events from some extensions. These are
assigned dynamically by the server. Right now, this is done by having a bunch of
static variables that are initialized when needed.
Refactor this to have a function event_init() instead that sets variable in
globalconf (where all of our state should be saved). Also, a preprocessor macro
is introduced to handle event dispatch which also looks a bit nicer.
Signed-off-by: Uli Schlachter <psychon@znc.in>
p_dup really only duplicates the given region of memory. It does not append a
zero byte. Thus, the string we are using here was not zero-terminated.
Fix this by just using lua_pushlstring() so that we do not have to worry about a
null terminating the string at all.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This one actually uses the return value from the function (where's the
consistency?!), so the code is fixed to only pop the return value if there is
actually one.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We called the keygrabber and told Lua we are expecting one return value, so Lua
will always get us one return value on the Lua stack. However, when an error
happens, nothing is pushed on the stack, but we still tried to pop the return
value. This corrupted the Lua stack.
The easiest fix is to just not ask for a return value that is not used anyway.
Not adding a test for this, because the test has to cause a Lua error which the
C code will then log to stderr and the test runner considers this a test
failure...
Fixes: https://github.com/awesomeWM/awesome/issues/735
Signed-off-by: Uli Schlachter <psychon@znc.in>
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>
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>
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>
When a client is unmanaged, we know emit mouse::leave on its titlebar before the
client object is invalidated, so that Lua can still work with it. Before, this
event was emitted only when we got a LeaveNotify from the X11 server.
Fixes: #620
Signed-off-by: Uli Schlachter <psychon@znc.in>
When there are multiple X11 screens (i.e. :0.0 and :0.1) for zaphod mode
style X setups, this triggers a refresh of focus when the instance
running on a particular root receives the mouse
Fixes https://github.com/awesomeWM/awesome/issues/599.
These fields were only ever written to since commit 19137a55c3.
This commit removes the fields and the code that sets them.
Signed-off-by: Uli Schlachter <psychon@znc.in>
In commit 532ec0cd, we started grabbing keys on the client window directly
instead of its parent window (the frame window). This commit fixes one place
which was overlooked back then.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this, we grabbed the keys on the frame window. That meant we only got key
events for things that nothing else grabbed directly on the key window.
After this, we grab directly on the client window itself and so we "fight" with
everything else which wants to grab keys. I don't actually know how the winner
is decided... First come, first serve, the rest gets an error?
Signed-off-by: Uli Schlachter <psychon@znc.in>
This ensures that systray icons cannot resize themselves. We assign them some
size and they have to deal with what they get!
Fixes: https://github.com/awesomeWM/awesome/issues/487
Signed-off-by: Uli Schlachter <psychon@znc.in>
The previous commit added some variables and this commit makes the surrounding
code use these new variables as well.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There is a client window C. Around this window, awesome adds a frame window F.
When the pointer is inside of C and then moves inside of F, we get a LeaveNotify
with detail=Inferior, but from our point of view, the pointer is still inside of
C, because F is contained in C.
Similarly, if the pointer is in F and moves to C, we get an EnterNotify with
detail=Inferior that we should ignore. However, for an EnterNotify the pointer
can now be inside of a titlebar, so this case has to be handled now.
The above explains the enter/leave behavior for clients. Let's now think about
titlebars: When the pointer moves from C to F, it cannot be in any titlebar any
more, so we must generate a leave event on that titlebar. Similar when the
pointer moves from F to C, but in this case we also have to figure out which
titlebar now contains the pointer.
This patch makes the code handle these events with detail=Inferior correctly.
Closes https://github.com/awesomeWM/awesome/pull/461.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds a global variable that tracks the drawable that is currently under the
mouse cursor. This new variable is then used so that we get consistent behavior
for enter/leave signals. Such signals are now also generated when a MotionNotify
event tells us that the pointer is now in a different titlebar.
Before this, it was possible that we did not generate a leave event on a
titlebar since the LeaveNotify contains the cursor position after the leave and
we did not manage to figure out which titlebar was left.
Signed-off-by: Uli Schlachter <psychon@znc.in>
I have noticed that the HeidiSQL session manager window/dialog will be
moved down by the height of the top titlebar when selecting an entry
from the server list.
Closes https://github.com/awesomeWM/awesome/pull/385.
When you run a mousegrabber, the C code calls this callback when the pointer is
moved or when a button is pressed/released. However, the button state is totally
bogus on press/release events, always claiming that the button that was
pressed/released is the only button that is pressed (even for release events!).
This commit fixes up the code so that the button state after the press/release
event is passed to the mousegrabber callback function.
Fixes: #280
Signed-off-by: Uli Schlachter <psychon@znc.in>
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.
Everything that needs the lua_State should create a local variable like this:
lua_State *L = globalconf_get_lua_State();
This ensures that the compiler warns if there are two variables with name "L" in
scope. The idea here is that it should become harder to accidentally use the
global lua state instead of the state of the current state.
While writing this commit, I found another place that gets its wrong: Reading
client.focus from a coroutine was broken, since it was returning the result on
the main thread instead of the current one.
Signed-off-by: Uli Schlachter <psychon@znc.in>
I never saw a single program that set a border on its own windows. However,
awesome commonly sets borders on its clients and the position of a client is the
part outside of the border. So when processing a position request from a client,
we also have to include this border and fix things up correspondingly.
However, the same isn't needed for the client size, because the size does not
include the borders, but just the titlebar plus the "real" client content.
Thanks to Daniel Hahler for providing a simple test case based on urxvt for
debugging this!
Signed-off-by: Uli Schlachter <psychon@znc.in>
When we get an event due to a previous GrabButtons call, we have to continue
normal event processing again, because the server froze the input device for us.
Without this, everything appears to freeze.
Signed-off-by: Uli Schlachter <psychon@znc.in>
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>
Whenever a titlebar of a client needed to be refreshed, all (possibly) four
titlebars would get completely refreshed. So if someone actually added more than
one titlebar to a client, awesome would copy each titlebar's content to the
window four times. Fix this by introducing more fine-grined functions for
uploads.
This also makes awesome only update the affected area when it gets an expose
event for a titlebar instead of all four titlebars completely.
Signed-off-by: Uli Schlachter <psychon@znc.in>
A drawin's and a client's bounding and clip shape can now be queried and is
returned as a cairo surface. Also, a client window's shape (e.g. xeyes setting
its own shape) can be queried via c.shape_client_bounding and
c.shape_client_clip. All of these properties now emit signals when changed.
(This also silently fixes a bug in luaA_drawin_set_shape_bounding() which forgot
to include the drawin's border in its size calculation)
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, awesome didn't move windows when they sent a ConfigureRequest (and
it also shrunk them by the size of titlebars, before it forgot to add these).
This commit adds proper gravity support to ConfigureRequest handling.
This was tested with test-gravity from metacity (in src/wm-tester).
Signed-off-by: Uli Schlachter <psychon@znc.in>
This reverts commit bd8158495e.
The idea was to track the current list of pressed and depressed mouse buttons,
because we get button events for more than 5 buttons, but can only query the
state of the first 5 buttons.
However, there are cases where we see button presses, but won't see the
corresponding release event. This is quite bad.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Having this in lua means that size hints are only applied after the client got
resized. The bad side effect of this is some flickering if awesome is being
slow. And apparently, it is slow for way too many people...
Signed-off-by: Uli Schlachter <psychon@znc.in>