Commit Graph

441 Commits

Author SHA1 Message Date
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
Uli Schlachter 4d9bbf0ba6 Remove an obsolete argument to client_resize_do()
Thanks to Java being broken, the function always sends a notice anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:28:46 +02:00
Emmanuel Lepage Vallée 587cc530c7 Merge pull request #1067 from BlueUsername/tiling-to-floating-window-fix
Fix a bug moving between a tiled and a floating screen.
2016-09-07 16:20:20 -04:00
Emmanuel Lepage Vallee e29a2d3ac9 client: Add property::tags
It is useful for rules debugging.
2016-09-04 02:52:16 -04:00
blueusername 9ca57a8364 Fix a bug moving between a tiled and a floating screen.
Check if any of the window is on the screen it is moved to, not just
the topmost leftmost edge.

Signed-off-by: blueusername <blueusername@github>
2016-09-02 20:15:00 +01:00
Emmanuel Lepage Vallée 08e4c304cd client: Fix a potential crash due to a race condition. (#1055)
If raise was called from the awful.rule `manage` callback at
startup with a client already present it crashed due to a
buffer underflow.
2016-08-30 12:59:45 +02:00
Daniel Hahler 63c8a310d0 doc: fix missing parenthesis with client examples (#1046) 2016-08-20 18:59:01 +02:00
Uli Schlachter 128933c115 Correctly disable RandR if it provides no usable data (#1012)
Fixes: https://github.com/awesomeWM/awesome/issues/1003
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-31 16:52:44 +02:00
Uli Schlachter bdfc0c0d71 screen: Mention the property::geometry signal in the docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:33:06 +02:00
Uli Schlachter 311a41b646 screen: Add old geometry as argument to property::geometry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:32:12 +02:00
Uli Schlachter 338064ae96 screen: Add old workarea as argument to property::workarea
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:29:56 +02:00