Commit Graph

451 Commits

Author SHA1 Message Date
Uli Schlachter bcf70f3740 Drop our use of iconv (#1772)
We were only using this for tag names. This means we are assuming that
everything is UTF8, but tag names are provided in the local locale and
need to be translated into UTF8? That makes no sense, so just drop this.

Fixes: https://github.com/awesomeWM/awesome/issues/1753
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-07 17:59:53 +02:00
Uli Schlachter 7481a6e6b8 Fix recursive enterleave ignore (#1747)
Every call to client_ignore_enterleave_events() must be paired with a
following call to client_restore_enterleave_events(). In between these
two calls, no other calls to client_ignore_enterleave_events() is
allowed.

The code in banning_refresh() sometimes broke these rules. This can
happen because the code causes signals to be emitted and Lua code can do
basically anything.

Fix this by moving the calls into the called functions.

Fixes: https://github.com/awesomeWM/awesome/issues/1746
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-21 18:53:25 +02:00
Uli Schlachter f290ea8b12 Stop grabbing mouse buttons on frame windows (#1724)
I failed to see the obvious. Thanks to mlen from IRC to make
me look into i3's source code so that I can figure out the obvious.

First, what is the problem? We want to be informed about mouse clicks on
client windows, e.g. for client-to-focus. For this we have to grab mouse
buttons on the client window, since only a single client at a time can
ask for information about all mouse clicks (I think...) and that right
is reserved for the actual application and not the WM.

We also want to be informed about mouse clicks on the titlebar, so that
clicking there actually does something (and also e.g. click-to-focus).
Obviously, we can just grab mouse buttons on the titlebar as well.

However, this causes lots of problems. The X11 window containing the
titlebar is not just the size of the titlebar, but also includes all of
the actual client window. This means that clicking into the client also
activates our button grab on the titlebar. This, in turn, causes the
input focus to briefly shift to the window for the titlebar. This shift
of focus can be detected by clients and caused various issues.

This fix is so obvious that I missed it. We don't have to grab buttons
on the titlebar window. We can just use the "normal" event propagation
without grabs there, i.e. we just include the event masks for button
press and button release and get informed about all mouse events. In
fact, we already have this event mask in place, so the whole use of
grabs is redundant.

That's what this commit does. It also partially reverts commit
394ff06589 which is where this unnecessary grabbing was introduced.

Fixes: https://github.com/awesomeWM/awesome/issues/1479
Fixes: https://github.com/awesomeWM/awesome/issues/1658
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-18 14:39:43 +02:00
Luke Bonham 30542351da pull #1648: add icon_sizes property signal emission 2017-03-14 19:38:25 +01:00
Emmanuel Lepage Vallée 957966d636 Merge pull request #1646 from psychon/systray_removal
Partly fix removal of systray from a wibox
2017-03-12 15:43:40 -04:00
Luke Bonham d3b8088c1b ldoc: fixes in lib/gears/color.lua and objects/client.c 2017-03-12 11:45:41 +01:00
Uli Schlachter 51e4a47938 Partly fix removal of systray from a wibox
This commit changes the systray widget, wibox.drawable and the C code to
fix the following bug: When the systray widget is removed from a
drawable without being moved somewhere else, the systray stayed visible.
This was because the systray is not drawn by awesome, but only placed.
When the widget is no longer "drawn", it stays wherever it was placed
last.

This change works by detecting the situation when the systray is
removed. Then, the C code is specifically told to remove the systray
window from the drawable.

Note that this is only a partial fix. This change works correctly when
the widget is removed completely, because it is no longer placed by its
parent widget. However, for example, when you do
wibox.widget.systray().visible = false, the effect is just that the
systray widget gets size 0x0. This is not really visible, but as far as
this change is concerned, the widget is still part of the drawable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:14:38 +01:00
Uli Schlachter 9992fd6b1a client: Add API to query all icons
This adds c.icon_sizes which is a table containing the width and height
of each available icon. With c:get_icon(i), Lua can query the i-th icon
as a lightuserdata.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 22:45:49 +01:00
Uli Schlachter f2cb8d8eb9 C code: save all instead of just one client icons
Clients can provide various icons in their _NET_WM_ICON property. Up to
now we only saved a single one, now we save all of them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 22:45:49 +01:00
Uli Schlachter 7d2a83f7d0 screen.c: Always emit "primary_changed" when needed
Without RandR telling us what the primary screen is, we just pick the
first one. However, the code here did not emit the right signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-03 13:25:28 +01:00
Emmanuel Lepage Vallee d5b681502a maximize: Stop mixing horizontal, vertical and both.
Before this commit, do this:

    c.maximize_hoizontal = true
    c.maximize = true
    c.maximize = false
    assert(c.maximize_hoizontal)

Would not work because the states were not preserved individually.
This commit fixes that. Awesome wont be confused about it's own
state anymore.

This may seem pointless, but when it come to undoing these
maximizations, it was ambiguous.
2017-02-07 11:12:42 -05:00
Emmanuel Lepage Vallee 3b1599bd99 maximize: Stop doing it in 2 operations.
Before 4.0, maximizing could only be done in 2 operations.

4.0 add an unified way, but kept doing 2 operations. The old
Lua EWMH code to serialize the 2 operations was dropped when
the codepath was simplified and replaced by a generic version
in awful.placement. However this version never implemented
combining multiple mementos into 1.

This commit unify the maximize C code, drop the ugly macro
template and actually fixes a couple more issues that were
caused because request::geometry was sent twice.
2017-02-07 11:12:40 -05:00
Uli Schlachter 27173163cb client: Apply the whole geometry before emitting the signals
This resolve a possible race condition where the size could be
invalid when queried from a signal callback.

Fix #1456
2017-02-07 11:12:40 -05:00
sudo-nice c003f7ba78 doc: mention to select a tag on awful.tag.add (#1520)
Ref: https://github.com/awesomeWM/awesome/issues/1509#issuecomment-276941061.
2017-02-04 15:13:12 +01:00
Emmanuel Lepage Vallée cbd22eea50 Merge pull request #1475 from psychon/input-shape-support
Input shape support
2017-02-03 12:25:56 -05:00
Luke Bonham ff47b0d0c4 object/client.c: added position and size properties
added client signals connection

added comments doc
2017-02-02 13:09:03 -05:00
Holger Schurig bf2c1993db doc: fix signals (#1455)
- rule reordering was mentioned twice in the NEWS
- fix all shown luadoc errors
- add missing descriptions for signals in module "awesome"
2017-01-28 15:03:56 +01:00
Uli Schlachter 70834848e4 Add input shape support to clients
I explicitly did not add client_shape_input property since querying the
input shape of the client window seems useless to me.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 11:12:41 +01:00
Uli Schlachter 614d1b0d57 Add input shape support to drawins
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 11:09:15 +01:00
SammysHP 0be3b0712a doc: Add missing dot 2017-01-22 09:35:44 -05:00
Vitja Makarov 5dc88da3bd Reply on configurerequest even if geometry is the same (#1388)
Bug was introduced by baaff93a73.

Fixes: https://github.com/awesomeWM/awesome/issues/1340
Fixes: https://github.com/awesomeWM/awesome/issues/1369
2017-01-12 11:19:01 +01:00
Uli Schlachter 528455045c Print warnings on invalid resizes
These warnings might help catching some problems in the future. These
could be asserts, but printing a warning is a lot nicer than dying.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Uli Schlachter e659b80f36 Refuse attempts to resize clients to invalid size
X11 does not allow to resize a window to size 0x0. Also, there are some
possibilities of integer overflows in our case. We tried to handle this
already, but there was a loop-hole: If the too-small-value is only
produced after applying size hints, then this was not caught.

Fix this by applying size hints before checking if the resulting size is
valid. However, this means some check needs to be duplicated to handle
the possibility of integer underflows while applying size hints.

Helps-with: https://github.com/awesomeWM/awesome/issues/1340
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Ingo Bürk 11a29540f2 Remove obsolete include and Xlib comment. 2017-01-05 23:17:11 +01:00
Emmanuel Lepage Vallee 160ea0fd66 doc: Fix 2 missing parentheses 2017-01-04 00:12:44 -05:00
Uli Schlachter 20b46cc2b3 tag_client: Update screen workarea
This fixes the last failure in test-struts.lua.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:35:33 +01:00
Uli Schlachter ea2d2cd038 untag_client: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:34:09 +01:00
Uli Schlachter e5be281ff3 client_set_sticky: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:31:41 +01:00
Uli Schlachter feb4fb0fbc tag_view: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Fixes: https://github.com/awesomeWM/awesome/issues/1335
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:30:14 +01:00
Emmanuel Lepage Vallee a93084947a doc: Add a virtual screen example 2016-12-21 11:41:30 -05:00
Emmanuel Lepage Vallee 66a9486992 doc: Add optional shortcuts to manage tags 2016-12-21 11:41:29 -05:00
Emmanuel Lepage Vallee 4dd30c29db doc: Add common ways to access the tags 2016-12-21 11:41:29 -05:00
Emmanuel Lepage Vallee 2523be99d4 doc: Add how to add tags
It's a common question
2016-12-21 11:41:29 -05:00
Uli Schlachter 13e8088d62 Handle unexpected XCB failures (#1260)
We have many places where we are sending an XCB request and expect an
answer where the protocol guarantees that no error can occur and we are
sure to get an answer. However, for example if the X11 server crashes,
these places can still fail. This commit tries to handle failures at all
these places.

I went through the code and tried to add missing error checking (well,
NULL-pointer-checking) to all affected places.

In most cases these errors are just silently ignored. The exception is
in screen querying during startup. If, for example, querying RandR info
fails, we will fall back to Xinerama or zaphod mode. This is serious
enough that it warrants a warning. In most cases, we should exit shortly
afterwards anyway, because, as explained above, these requests should
only fail when our connection to the X11 server breaks.

References: https://github.com/awesomeWM/awesome/issues/1205#issuecomment-265869874
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-10 00:48:53 +01:00
Daniel Hahler e1ccfe9168 doc: fix context doc 2016-11-22 01:15:35 +01:00
Daniel Hahler 55689b4cc7 doc: improve client class (#1221) 2016-11-16 11:14:19 +01:00
Uli Schlachter 3189996507 screen: Implement :swap(s)
This allows to change the order in which screens appear in our list of
screens.

Fixes: https://github.com/awesomeWM/awesome/issues/1122
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:36:31 +02:00
Uli Schlachter c347c0a54c screen: Add a "list" signal
Similarly to what we do with the client list, this signal is emitted
whenever the list of screens changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:35:02 +02:00
Uli Schlachter c218b1da72 Test and fix swapping clients
The code in luaA_client_swap() is incorrect, because
luaA_object_emit_signal() already pops the arguments to the signal.
Still, the code here tried to remove the arguments from the Lua stack
again, thereby corrupting the stack (removing more items than there are
in the stack).

Normally, popping more things from the stack than it has entries
silently corrupts the Lua stack. Apparently this doesn't necessarily
cause any immediate issues, because this code has been broken since nine
months and no one noticed. This mistakes was introduced in commit
55190646.

This issue was only noticed by accident. Thus, this commit also adds a
small integration test that exercises this bug. This test catches the
issue, but only on Travis, because there we are building our own version
of Lua 5.3 and that one has assertions enabled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:34:45 +02: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
Uli Schlachter 06f02f6004 Delay client frame window destruction (#1148)
Daniel sees a short flicker of his wallpaper when he closes a client.
This happens because the window is destroyed immediately, but other
clients are re-arranged only shortly later. In the mean time, the X
server updates the display and repaints the root window (= wallpaper
becomes visible).

Work around this by delaying the destruction of frame windows to the end
of the current main loop iteration. This means that we first update the
position of all other windows and later destroy the window that was
actually closed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-07 00:46:57 +02:00
Emmanuel Lepage Vallee c214a9b111 doc: Document the client request::activate contexts 2016-10-04 01:00:55 -04:00
Daniel Hahler d513e2c4fc doc fixes for awful.{client,screen,tag} (#1134)
This adds a tparam alias "@screen" for "@tparam screen" (when used to
document e.g. arguments for callbacks), and "@screen_or_idx" when a
function accepts a "screen" or "number".
2016-10-02 16:03:11 +02:00
Uli Schlachter 19094de661 Speed up client_ignore_enterleave_events()
There are some situations where we do things that can make the mouse pointer
enter another window. We do not want to react to these "self inflicted" mouse
enter and leave events, because they aren't "real" (= generated by the user).

Before this commit, this is done by going through all windows and toggling the
"please send us enter and leave events"-bit on them. This becomes slower when
many windows are visible and floods the server with requests.

This commit changes this to a constant-time logic. Each event contains the
sequence number of the last request that the X11 server handled. Thus, we just
remember the right sequence numbers and ignore any events that comes in whose
sequence number falls into the ignored range.

In detail, we keep a list of "begin" and "end" sequence numbers and ignore any
enter and leave events that fall in this range. If we get any event with a
sequence number higher than "end", we remove this pair from the list, since it
is no longer needed.

To generate these pairs, we use a GrabServer request in
client_ignore_enterleave_events(). This gives us a sequence number and makes
sure that nothing else besides us can cause events. The server is ours! In
client_restore_enterleave_events(), we first do a NoOperation request to
generate the sequence number for the end of the pair and then do UngrabServer.
Any event that is generated after UngrabServer will have at least the sequence
number of the UngrabServer request and thus no longer fails between begin and
end.

Fixes: https://github.com/awesomeWM/awesome/issues/1107
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:37:55 +02:00
Uli Schlachter fcf6c863cd drawin_map: Ignore enter/leave after apply_moveresize
drawin_apply_moveresize() calls client_ignore_enterleave_events() internally,
because it also wants these to be ignored. This means that the code disables
enter/leave events twice and then enables them twice. This recursive disabling
is something that should not occur.

Fix this by having drawin_map() disable the events a bit later.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:37:55 +02:00
Uli Schlachter 93ed7fd46f client_geometry_refresh(): Ignore enter/leave events less
This commit makes the function only call client_ignore_enterleave_events() when
it actually has to. Since we expect that most of the time, no client's geometry
is changed, this means that most of the time this function is not called.

Fixes: https://github.com/awesomeWM/awesome/issues/1107
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Uli Schlachter baaff93a73 Only configure client geometries once per main loop iteration
This should "protect" the user from some stupidities that Lua code might be
doing that e.g. makes a client jump to another position and then immediately
back to where it was before. Only the last change in a single main loop
iteration will actually have any effect.

Original idea by Daniel here: https://github.com/awesomeWM/awesome/pull/174

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:48:56 +02:00
Uli Schlachter dd1d81a3ac client.c: Use AREA_EQUAL()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:36:34 +02:00
Uli Schlachter 8283a12ec9 Only export a single refresh function for clients
We still need client_focus_refresh() as a separate entry point, because it is
used by event.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:31:29 +02:00
Uli Schlachter bc6d06a305 Remove an unnecessary variable
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:29:56 +02:00