Commit Graph

7976 Commits

Author SHA1 Message Date
Uli Schlachter 9045add3f0 Fix docs for mouse::enter and mouse::leave
Just because they sound similar to mouse::press and mouse::release does
not mean that the arguments are the same. Perhaps they should be, but
that's another story.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:04:24 +02:00
Uli Schlachter 6224fc6751 Improve docs for widget::layout_changed and redraw_needed
The docs for widget::redraw_needed was previously just plain wrong!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:04:24 +02:00
Uli Schlachter 0183372ac2 wibox.drawable: Do not relayout while invisible
Similar to the previous commit, this makes the drawable not apply a
pending relayout while it is not visible. When it becomes visible again,
the relayout is done.

The hope here is that less work is done while a drawable is not visible,
saving CPU time.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:00:20 +02:00
Daniel Hahler 332681aaad progressbar: keep set_height/set_width working (#1141)
Ref: https://github.com/awesomeWM/awesome/issues/1140
2016-10-05 00:24:43 +02:00
Uli Schlachter 9b51779f2f wibox.drawable: Fix a possible crash
LGI does not protect against use-after-free issues that can occur due to
using an object after finalisation. This manifests itself as occasional
crashes on Travis in cairo_region_union_rectangle() (AFAIK no one ran
into this issue in real-world usage).

Since visible drawables are always strongly reachable, the issue can
only occur with invisible drawables. The previous commit made sure that
those are fully repainted when they become visible, so we can just
ignore redraws for those and fix the crash issue.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:27:10 +02:00
Uli Schlachter 650b01eb71 wibox.drawable: Stop using weak tables
Instead of tracking all drawables that are alive, the code now only
tracks visible drawables. When a drawable is made visible it is
completely repainted. This should not cause a difference when a wibox is
initially made visible, because it has to be redrawn anyway. However,
this introduces a full repaint when a wibox is hidden and then made
visible again.

Thanks to this change, we can stop using weak tables. Visible drawables
cannot be collected and so we can keep a strong reference to them. This
allows us to get rid of the weak tables which solves various problems
involving finalizers and using objects after finalisation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:20:55 +02:00
Uli Schlachter 843d0bdcf5 wibox.drawable: Add visibility tracking callback
This new function is called whenever the visibility of the drawable
changes. Later commits can use this for explicitly tracking the lifetime
of drawables instead of using magic weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:18:18 +02:00
Emmanuel Lepage Vallée 26d3c5eb1a Merge pull request #1123 from Elv13/focus_stealing_filter
Support focus stealing filters
2016-10-04 09:03:10 -04:00
Emmanuel Lepage Vallée 5b9ad22447 Merge pull request #1136 from Elv13/fix_missing_rclua
build: Fix make install when ldoc is missing
2016-10-04 09:02:16 -04:00
Emmanuel Lepage Vallee c214a9b111 doc: Document the client request::activate contexts 2016-10-04 01:00:55 -04:00
Emmanuel Lepage Vallee a2748a1fa3 tests: Test client focus stealing filters. 2016-10-04 01:00:55 -04:00
Emmanuel Lepage Vallee ef50f75551 prompt: Add a key release callback.
A possible use case is to highlight something when a key is
pressed and un-highlight it when the key is released.
2016-10-04 00:51:45 -04:00
Emmanuel Lepage Vallee 11644f4582 prompt: Deprecate 8 parameters. 2016-10-04 00:51:45 -04:00
Emmanuel Lepage Vallee c00c14ade3 doc: Improve the prompt documentation
It was still pre-ldoc
2016-10-04 00:43:05 -04:00
Emmanuel Lepage Vallee e5ebcc1e4c prompt: Allow each argument to be passed to the "args"
This is the first step in deprecating them. A function with so
many optional arguments is just bad design.

The next few commits will rewrite the documentation and deprecate
the old arguments.
2016-10-04 00:43:05 -04:00
Emmanuel Lepage Vallee d52c1e7f7a client: Add focus stealing filters.
For a while, it was often suggested on IRC to replace the default
request::activate handler to implement custom focus stealing policies.

While it is working, it isn't user friendly. This commit add a simple
mechanism to add such policies.
2016-10-04 00:42:25 -04:00
Emmanuel Lepage Vallee dd959eecd6 build: Fix make install when ldoc is missing 2016-10-03 23:39:14 -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
Daniel Hahler c84b900b87 Merge pull request #1135 from blueyed/improve-examples-CMakeLists
Improve tests/examples/CMakeLists.txt
2016-10-02 16:02:15 +02:00
Daniel Hahler 86bc579649 Improve messages with tests/examples/CMakeLists.txt 2016-10-01 17:24:44 +02:00
Daniel Hahler 84e7875e50 minor: fix doc for tests/examples/CMakeLists.txt 2016-10-01 17:24:03 +02:00
Uli Schlachter da6012da3e Fix memory leak in the default config on screen removal
The default config had tables like mywibox and mywibox[s] was the wibox
that is visible on screen s. When a screen is removed, nothing cleans up
these tables and so the screen and the wibox could not be garbage
collected. The same applies to the layoutbox, taglist etc.

This commit removes the global mywibox table and instead saves it as a
property on the screen. This way, the screen is not explicitly
referenced and when it is removed, the screen, its wibox and all of its
widgets become unreachable and can be garbage collected.

This commit also updates the docs and the tests that referenced things
(mostly the wibox) via mywibox[s] to now use s.mywibox.

Fixes: https://github.com/awesomeWM/awesome/issues/1125
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 22:46:51 +02:00
Uli Schlachter b6a3ae43fb gears.object.properties: Use the new .data table
Previously, gears.object.properties used a weak table for adding
additional information to a C object. However, weak tables can easily
cause leaks when the value references the key.

This commit makes the code instead use the new .data property that is
available on all C objects. This means we have no more magic with a weak
table and instead only use "regular" tables instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 11:11:55 +02:00
Uli Schlachter f9775b91de shims: Add support the new .data property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 11:11:55 +02:00
Uli Schlachter 9566defa93 C: Add a .data table to all C objects
This table is "just a normal Lua table". Lua code can use it in whatever
way it wants to store things related to a given C object.

An object (userdata) already references a "plain Lua table" via
lua_setuservalue() / lua_setfenv(). This is used to keep a reference to
signal functions that are connected to an object. The signal code only
uses lightuserdata keys in this table. This commit adds an entry with
key "data" to this table which just references another table. This is
the table that is made available as .data.

Via this .data property, Lua code can add own properties to C objects
without having to use, for example, weak tables. The weak tables have
the downside that they produce a leak if the value references the key.
The new .data property does not have any such problem (no weak
references are involved).

This new data property is not documented, because I'd have to touch lots
of files and I'm lazy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 11:07:55 +02:00
Uli Schlachter 502b4139ba Merge branch 'faster-client-deamon' 2016-09-30 10:17:35 +02:00
Uli Schlachter cd3d82d6f9 Merge branch 'speedup-ignore_enterleave' 2016-09-30 10:11:07 +02:00
Uli Schlachter 8dc6c5f502 Rewrite tests/_client.lua
The new client is hopefully faster. Why, you ask?

Instead of spawning a new Lua process each time a test asks for a new window,
there is a "daemon process" which gets commands to open new windows from its
standard input. That way, Lua doesn't have to load LGI all the time and lots of
pointless work is skipped. The daemon process exits when its stdin is closed and
thus should automatically exit when awesome exits.

Fixes: https://github.com/awesomeWM/awesome/issues/1089
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:58:20 +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 61d8d74421 Fix test-tooltip.lua: Run the event loop
This test changes the mouse cursor's position and afterwards has an
assert that checks something on the tooltip. This really looks a lot
like it expects the mouse cursor's position to be already updated and
its enter and leave events to be handled. However, this is now how
things actually work.

Fix this by moving the assert into its own step, so that in between the
normal main loop runs.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:36:47 +02:00
Uli Schlachter 3993388c01 awesomeConfig.cmake: Stop forcing CMAKE_BUILD_TYPE
I don't know why we force CMAKE_BUILD_TYPE to be RELEASE, but I don't think we
should do that.

This also changes the default build type to something which does not contain
-DNDEBUG in CFLAGS. This means that assert()s will start to work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:36:36 +02:00
Emmanuel Lepage Vallee fb5d995775 tests: Fix a luacheck issue. 2016-09-30 09:32:14 +02:00
Emmanuel Lepage Vallée 7f74c783cd Merge pull request #1119 from Elv13/upstream_shape_api_p4.03
Upstream shape api p4.03
2016-09-26 15:38:35 -04:00
Emmanuel Lepage Vallee fb4a48b744 doc: Document where gears.shape can be used. 2016-09-26 01:21:15 -04:00
Emmanuel Lepage Vallee b6421699da doc: Add more graph documentation. 2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee f25621c94c tests: Test the graph shape. 2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 5ef9b64b40 graph: Add shape support
This complete the shape API. Now, everything support shapes.
2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 68999f4a86 graph: Add min_value
Fix #277
2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee bbb3d14822 doc: Document the tasklist variables. 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 9e8c4a71e3 doc: Document taglist theme variables 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 6e829ce104 tasklist: Add shape support 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 520bd02416 tasklist: Add spacing support 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 967fc87a92 taglist: Add shape support 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee da47357ae7 widget.common: Add shape support 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee f517538b6a background: Avoid some redraw 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 00ee99851b taglist: Add spacing support 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 549d68dcc5 doc: Add more progressbar shape examples 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7b11f1c1b4 tests: Test progressbat paddings, margins and clip 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee a8568eb969 doc: Add examples for vertical and labelled progressbar 2016-09-26 01:18:09 -04:00