Commit Graph

7331 Commits

Author SHA1 Message Date
Uli Schlachter a0d47f8ea5 awful.wibox: Fix some minor things
capi.awesome is unused and capi.screen is unused, but really should be used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 09:34:54 +02:00
Uli Schlachter 9b44e9a011 tag:delete(): Allow deletion of the last tag
When a tag is deleted, this code tries to select some other tag. If the tag
which is to delete is the last tag of a screen, this code failed and indexed a
nil value. Fix this with a simple "if".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 09:34:54 +02:00
Uli Schlachter 2485d334cf awful.layout.arrange(): Handle screen removal
If a screen is removed while a re-layout is pending, previously this code would
cause errors and problems. Since the screen is gone, there is nothing to arrange
anyway and we can just not do anything.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 09:34:54 +02:00
Uli Schlachter fc390ff405 Use weak keys for referring to screens
This commit changes some tables that are used for per-screen stuff to have weak
keys, so that the screens can be garbage-collected, if needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 09:34:54 +02:00
Uli Schlachter 0d4cc5f43a Fix integer overflow in overflow checking functions (#851)
The min/max arguments to the integer range checking functions are integer. We
call these with UINT32_MAX in two places and this value (notice the "U" for
"unsigned") does not fit into a signed integer. Hence, there is an integer
overflow at compile time and the maximum value that is actually checked for is
-1.

Fix this by using lua_Number (double) instead of int.

Fixes: https://github.com/awesomeWM/awesome/issues/840
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 00:51:51 +02:00
Emmanuel Lepage Vallée dace6d3721 Merge pull request #849 from actionless/fix-awful-rule-floating
fix(awful: rules): floating property
2016-04-25 15:09:29 -04:00
actionless cdb5a0f046 fix(awful: rules): floating property 2016-04-25 15:43:14 +02:00
Emmanuel Lepage Vallee 58a6cdb440 doc: Add a missing '@' sign in mousegrabber documentation 2016-04-24 21:44:04 -04:00
Emmanuel Lepage Vallee 2ccc7c88d6 awful.mouse.snap: Fix invalid fallback 2016-04-23 22:12:28 -04:00
Daniel Hahler 135ff4b0c8 Use gears.protected_call with awful.rules callbacks (#843)
Fixes https://github.com/awesomeWM/awesome/issues/840#issuecomment-211823483.
2016-04-20 22:34:16 +02:00
Emmanuel Lepage Vallée cdc6909bc7 Merge pull request #824 from Elv13/rules_refactor
Rules refactor, part 1

This fix the following awful.rules bugs:

 * **x**: Broken when "border_width" is set or left titlebars are used
 * **y**: Borken when"border_width" is set or top titlebars are used
 * **width**: See above + right litlebar
 * **height**: Same as above
 * **switchtotag**: Have a race with the "manage" -> "tag.withcurrent" code in `awful.tag`
 * **tag**: Had dead code
 * **screen**: Had a race condition with switchtotag
 * **urgent**: Had a race with screen and another with switchtotag+focus
 * **focusable**: Was broken yet again when request::activate was introduced (and also because of FS1098, that I also fixed)
 * **no_overlap**: The "no_overlap" call in rc.lua "manage" section conflict with the geometry rules as the hints are not set (idk why).
 * **size_hints_honor**: If set to false, it would be applied too late, causing height and width offsets due to placement or various geometry related properties
2016-04-20 00:39:45 -04:00
Emmanuel Lepage Vallee d736850e60 tests: Fix urgent test use of deprecated functions
It caused noise in the test results
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f2a19690ac tests: Test geometry changes 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee a4f1b760bd awful.rules: Apply size_hints_honor early
There is a property race with width, height and geometry
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 8875b66d2e tests: Test awful.rules 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 9798b455cb tests: Add a flexible dummy client.
XTerm isn't really a perfect test candidate.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 6bc99fe52f awesomerc: Use rules to set the default position instead of "manage"
This avoid a conflict when rules try to set overlapping geometry.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f5a27ab99b tests: Test maximizing and fullscreen 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee e54387904b client: Add request::geometry
Remove request::fullscreen and request::maximized_* and use
a single request for them. The other client resizing features
will soon also start to use this.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f681ace587 ewmh: Take focusable into account in request::activate 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee c678a0d426 awful.rules: Apply floating early 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 06716df05a awful.rules: Apply border_width early 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 89edc92110 awful.rules: Add the 'tags' property
Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f72dcce4bd titlebars: Use the request system rather than 'manage'.
As awesomerc.lua "manage" section is executed after the rules, using
a 'geometry' or 'placement' property in the rules was broken.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 299e155acc client: Extend request::tag instead of awful.tag.withcurrent
There was a regression when refactoring the API. It was no longer
possible to disable the automatic tag selection.

Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 7cd76e0529 awful.rules: Add 'placement' property 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee b0aedcda67 awful.rules: Add `new_tag` property
Create a new dynamic tag for the client.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 090f2b83ac awful.rules: Avoid trying to set some properties
This avoid unwanted signals or properties being set twice.
2016-04-20 00:10:42 -04:00
Emmanuel Lepage Vallee ddf14a3ffc awful.rules: Refactor the code to avoid many race conditions.
Testing demonstrated that many rule properties were broken when used
together. This commit try to address this by forcing an execution order
that doesn't trigger the problems.

It is still possible to write broken rules, but it should not happen by
accident anymore. Users should not try to assign the client a tag on
screen 2 and also use screen=screen[1].
2016-04-20 00:08:28 -04:00
Emmanuel Lepage Vallee a2a5448442 awful.rules: Remove dead code
Also change the focus callback signature to match the others
2016-04-20 00:02:38 -04:00
Emmanuel Lepage Vallee 2a8cc08ca1 awful.rules: Make adding new properties easier.
This commit also add a 3 step process to apply rules.

Testing showed that many rules are currently broken because
of execution races.

Create a new dynamic tag for the client.
2016-04-20 00:02:01 -04:00
Daniel Hahler 761e244b32 Handle `awful.util.deprecate('Use …')` style (#837) 2016-04-19 22:37:14 +02:00
Daniel Hahler 4d49f76e16 Merge pull request #838 from blueyed/streamline-util.deprecate-calls
Streamline/cleanup util.deprecate calls
2016-04-19 10:49:24 +02:00
Emmanuel Lepage Vallee fe8beaeaac placement: Fix incorect use of the border_width
The code and tests assumed the border was equaly applied around
the geometry while the {x,y} pair of the geometry include the
border.
2016-04-18 23:56:23 -04:00
Emmanuel Lepage Vallee 798729ff11 tests: Test placement composition 2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee bfc8f35fb9 placement: Support composition.
Multiple placement function can now be daisy chained like
in gears.matrix. This is useful for building rules.
2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee 2b5d918a8d awful.placement: Add a memento system.
It is used by the ewmh methods.
2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee fcd320c7f6 Make awful.rules mandatory
There was many unfixable race conditions that could only be
solved by better integrating the request:: system and
awful.rules. This has the side effect to make rules mandatory.
2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee 30a527fcfd travis: Install GTK
So the tests can generate custom clients to suit their purpose.
2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee 5ebe073cdc mouse: Correctly round floating points
Fix #835
2016-04-18 23:30:26 -04:00
Daniel Hahler 473df11e1f Streamline/cleanup util.deprecate calls 2016-04-18 23:20:16 +02:00
Daniel Hahler 8387d8fecc .travis.yml: improve comments 2016-04-18 22:35:50 +02:00
Daniel Hahler e0d1814685 Merge pull request #812 from blueyed/travis-luajit-from-source
Travis: build luajit from source (2.0.4 as of now)
2016-04-18 22:22:27 +02:00
Emmanuel Lepage Vallée bc2ddfe82d Merge pull request #820 from Elv13/layout_tests
tests: Test all client layouts
2016-04-18 04:27:11 -04:00
Emmanuel Lepage Vallee bb47aa5861 tests: Test all client layouts 2016-04-18 04:20:23 -04:00
Emmanuel Lepage Vallee 7654abcedc layout.tile: Avoid negative geometries 2016-04-18 04:20:23 -04:00
Emmanuel Lepage Vallee b938a99e1e layout: Avoid creating negative geometries when adding gaps 2016-04-18 04:20:22 -04:00
Emmanuel Lepage Vallee 9991f9ccc8 geometry: Use the relevant rounding functions instead of integers
In the case where one want to put the cursor at the middle of the
workarea, it is logic to do:

   x=screen.workarea.x+screen.workasrea.width/2

However, this can cause floating points. This commit move the
burden back to the C-API so the Lua placement code doesn't have
to add a large number of rounding methods. Given 1 type of rounding
cover a vast majority of use cases for each types of coordinates,
the C-API can take care of it in peace. For the other corner cases,
it is still possible for the Lua code to do the rounding there, but
no longer necessary. The convenstions are:

 'x' and 'y': use round (move to the closest point)

 'width' and 'height': use ceil (to avoid involontary truncating)
2016-04-18 04:20:22 -04:00
Uli Schlachter d46e11f5e1 Add range-checking to lots of arguments in the C code
This change catches things like c:geometry { width = -42 }.

Helps-a-bit-with: https://github.com/awesomeWM/awesome/pull/820 (fixes X errors)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-18 04:20:22 -04:00
Emmanuel Lepage Vallee 39c031241f Add number range checking.
Add the "number" equivalent functions for the integers one
introduced by the last commit.
2016-04-18 04:20:22 -04:00