Commit Graph

6622 Commits

Author SHA1 Message Date
Uli Schlachter e73335d52d Refactor code a little
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>
2015-10-10 17:42:25 +02:00
Uli Schlachter 367c3acbcd Apply window gravity when a window moves itself
This just makes us do what ICCCM requires us to do. Tested via metacity's
test-gravity.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:41:05 +02:00
Uli Schlachter 39df6d98e7 Fix obvious typo in xwindow_translate_for_gravity()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:38:51 +02:00
Uli Schlachter 5760e536f9 Revert "Apply left/top titlebars in event_handle_configurerequest"
This reverts commit ecddee44cb. The commit broke
window gravities as can be reproduced with metacity's test-gravity.c.
2015-10-10 16:03:16 +02:00
Uli Schlachter 67faf52bab Properly update multiple taglists
My recent refactoring accidentally made the taglist only connect to the signal
for the first screen on which a taglist is created. This commit fixes the code
so that it connects for all screens.

Fixes https://github.com/awesomeWM/awesome/issues/500

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-09 20:59:18 +02:00
Emmanuel Lepage Vallée ee0e9badfa Merge pull request #491 from actionless/awful-key-data
feat(lib: awful: key): save current hotkeys
2015-09-30 17:25:39 -04:00
actionless 0e3009936c feat(lib: awful: key): save current hotkeys 2015-09-30 13:17:12 +02:00
Uli Schlachter 5f6bbdfc63 Add and use luaA_tolstring()
This is a version of luaL_tolstring() that also works with Lua 5.1.

Closes https://github.com/awesomeWM/awesome/issues/471.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Uli Schlachter a3e690d191 imagebox: Redraw in :set_image()
If someone modifies a cairo surface and then sets the resulting object as the
image of an imagebox, the imagebox needs to redraw. Thus, since surfaces are
modifiable, we cannot assume that nothing changed when the same image is set
multiple times on an imagebox.

However, the dimensions of a surface cannot be changed and thus this does not
need to emit widget::layout_changed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Uli Schlachter a71d12f07b awful.client.cycle: Fix API docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Uli Schlachter 2f78ec5b30 Never explicitly focus the root window
Whenever client.focus == nil, we set the input focus to the root window to
express "nothing has the input focus". However, thanks to the way X11 input
works, this means that whatever is under the mouse cursor gets keyboard input
events. This can easily be reproduced with urxvt and some small addition to the
config to unfocus things.

This commit changes things. Instead of focusing the root window, we create a
special "no focus" window that gets focused if we want nothing to have the
focus.

Closes https://github.com/awesomeWM/awesome/pull/470.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-28 23:36:23 +02:00
Daniel Hahler dd657c0531 Merge pull request #479 from psychon/leaks
Add integration tests checking for leaks and fix some results.

Closes https://github.com/awesomeWM/awesome/pull/479.
2015-09-28 23:35:56 +02:00
Daniel Hahler d544421c67 Travis: add luajit-5.1
This refactors the env vars for the build matrix:

 - add LUANAME
 - drop LUALIB
 - add LUAINCLUDE for special luajit include dir.
 - add LUAROCKS_ARGS for luarocks' `configure --lua-suffix=jit-2.0.0-beta9`.

Closes https://github.com/awesomeWM/awesome/pull/484.
2015-09-28 23:35:22 +02:00
Kazunobu Kuriyama 2f7f25dcc7 Fix the definition of A_STRNEQ_CASE
Replace A_STRCASEEQ whose definition is not given anywhere with A_STREQ_CASE.

Closes https://github.com/awesomeWM/awesome/pull/488.
2015-09-28 23:34:52 +02:00
Uli Schlachter 3e9fdea650 test-leaks: Fix with Lua 5.1
I have no idea why this needs collectgarbage() to be called twice.

On the other hand, I can explain the change in tooltip.lua. Lua 5.2 introduced
"ephermeron tables". This means that in the following sitation, lua 5.2 can
collect the entry from the table, while 5.1 keeps the entry alive, because the
table has a strong reference to the value and that in turn has a strong
reference to the key:

  t = setmetatable({}, { __mode = "k"})
  do
    local k = {}
    t[k] = function() print(k) end
  end
  collectgarbage("collect")
  print(next(t, nil))

To handle this incompatibility, this commit just removes the whole indirection
through the module-level variable "data".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 16:04:20 +02:00
Uli Schlachter 94271e8c91 test-leaks.lua: Also test tooltips
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:31:42 +02:00
Uli Schlachter f7799cbb7f Refactior test-leaks a bit
I think it looks nicer with this helper function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:30:04 +02:00
Uli Schlachter cd1ad8b753 Don't measure time for creating wiboxes
Apparently some of the last commits speeds up create_wibox() a lot. This
highlights that this is a bad test: After creating thousands of wiboxes, awesome
needed 15 seconds to draw all of them and in the end some dbus timeout aborted
the test run.

However, it's irrelevant how quickly we can create wibox. The interesting number
is how quickly we can display a new wibox. Thus, this commits changes the code
so that it also measures the time that is needed to update the wibox. This way,
we don't accumulate a huge number of pending repaints and everything's fine.

Some results (but there is nothing to compare this with):
   create&draw wibox: 0.0373947  sec/iter ( 28 iters, 1.59 sec for benchmark)
    update textclock: 0.00198174 sec/iter (515 iters, 1.937 sec for benchmark)
  relayout textclock: 0.000614439 sec/iter (1710 iters, 1.051 sec for benchmark)
    redraw textclock: 0.00116882 sec/iter (865 iters, 2.962 sec for benchmark)
          tag switch: 0.000705579 sec/iter (1498 iters, 3.703 sec for benchmark)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:07:22 +02:00
Uli Schlachter dc2147208f tests: Return more widgets from create_wibox()
All of these are checked for being GC'able in test-leaks.lua.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:44:19 +02:00
Uli Schlachter bd47edb4ef leak test: Make the layoutbox test pass
This commit does two things: It gets rid of the reference to the layoutbox that
the default config created and it changes the widget dependency cache to not
keep widgets alive unnecessarily.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:42:39 +02:00
Uli Schlachter abc5a552a4 Make tasklist garbage-collectable
Again, instead of directly connecting to various signals for updating a
tasklist, this commit changes the code so that there is just a single, global
connections and based on this a weak table with all tasklist instances is used
do the updates.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:20:24 +02:00
Uli Schlachter 40db0b7337 Make taglists garbage-collectable
Similar to what the previous commit does for layoutboxes, this changes the code
for the taglist so that there is only a single, global connection to the various
signals and these update all taglists via weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:03:59 +02:00
Uli Schlachter 6f2e7bba25 Make layoutbox kind-of garbage-collectable
Instead of connecting to the needed tag-update-signal again for every layoutbox,
this now just creates a single connection and updates all layoutboxes from here.
A new weak table is used to find the layoutboxes from these callbacks.
Additionally, layoutboxes are now per-screen unique. So even if you try to
create three layoutboxes for screen 1, the code will now always return the same
instance.

This kind-of fixes the leak test for layoutboxes. The problem is that the
default config also creates a layoutbox and adds it to a wibox. Since this is
now the same layoutbox, the test still fails. Just removing the layoutbox-part
from the default config makes this problem go away.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 13:19:12 +02:00
Uli Schlachter e9377c4808 Make textclock garbage-collectable
This fixes the textclock-specific part of the test that the previous commit
added.

To fix this, gears.timer.weak_start_new() is used. This function creates a timer
that is automatically stopped when its callback function is garbage collected.
The callback function is saved as a member of the texbox widget that is the
"widget behind the textclock". Thus, the timer can only be stopped after the
widget is garbage-collected, but the timer does not keep the widget alive.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 12:44:10 +02:00
Uli Schlachter 901c8f680a tests: Add some memory-leak tests
This creates some random collection of widgets and tests if they can be garbage
collected again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 12:36:21 +02:00
Uli Schlachter 225022be84 tests: Move create_wibox() into a helper script
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 11:58:35 +02:00
Daniel Hahler bf630de74e Merge pull request #438 from blueyed/ewmh-activate-raise-always
ewmh.activate: raise a client always
2015-09-25 10:16:03 +02:00
Daniel Hahler bd39a70b62 Merge pull request #474 from blueyed/ewmh-activate-only-focus-visible
ewmh.activate: only focus visible clients
2015-09-25 10:15:25 +02:00
Daniel Hahler 81a2baba30 Merge pull request #475 from blueyed/rename-client_maybevisible
Rename client_maybevisible to client_on_selected_tags
2015-09-25 10:15:00 +02:00
Daniel Hahler 2ab0267a5e Merge pull request #476 from blueyed/taglist-handle-urgent-always
awful.widget.taglist: handle/display urgent property always
2015-09-25 10:14:46 +02:00
Daniel Hahler 116c90c8d8 minor: taglist.taglist_label: join if / remove indent 2015-09-25 01:29:00 +02:00
Daniel Hahler f4d6011f23 awful.widget.taglist: handle/display urgent property always
For non-selected tags, display the urgent bg/fg always.
Previously, this was skipped in case the tag had the focused client,
which is possible since a while.

Ref: https://github.com/awesomeWM/awesome/issues/455#issuecomment-143072993
2015-09-25 01:07:51 +02:00
Daniel Hahler 5431b18f33 Rename client_maybevisible to client_on_selected_tags
This makes it more clear what it is about, and also fixes its
documentation.
2015-09-25 00:43:52 +02:00
Daniel Hahler b824d00284 ewmh.activate: only focus visible clients
Since focus can be moved to non-visible clients nowadays, this needs to be
checked in the `request::activate` handler.

Fixes https://github.com/awesomeWM/awesome/issues/455.
2015-09-25 00:18:33 +02:00
Daniel Hahler 81e59cdfc8 ewmh.activate: raise a client always
When a client is not visible, this would adjust its stacking order
still.

This also addresses https://github.com/awesomeWM/awesome/issues/472,
because it raises unminimized clients after they got focused.
2015-09-24 23:38:14 +02:00
▟ ▖▟ ▖ 0414a579c2 Expose dbus signal sender
Closes https://github.com/awesomeWM/awesome/pull/198.
2015-09-23 21:05:03 +02:00
actionless 3fea174c5e test(benchmark): add for tag switch
Closes https://github.com/awesomeWM/awesome/pull/465.
2015-09-23 21:02:29 +02:00
Daniel Hahler 4e22cf02e6 Merge pull request #384 from blueyed/more-robust-errors
More robust errors: make sure errors are strings

Closes https://github.com/awesomeWM/awesome/pull/384.
2015-09-23 20:59:35 +02:00
Uli Schlachter dfcbf20d81 Add and use wibox.hierarchy:update()
This function updates a hierarchy if the layout of some widgets changed. It does
nothing on the parts that did not change. This should be more efficient than
recomputing the whole hierarchy whenever something changes.

Once again, this has some positive results on the "benchmark test":

Before:
        create wibox: 0.083016   sec/iter ( 13 iters, 1.161 sec for benchmark)
    update textclock: 0.00391091 sec/iter (271 iters, 3.219 sec for benchmark)
  relayout textclock: 0.00273234 sec/iter (397 iters, 1.087 sec for benchmark)
    redraw textclock: 0.0010191  sec/iter (989 iters, 1.745 sec for benchmark)

After:
        create wibox: 0.083146   sec/iter ( 13 iters, 1.163 sec for benchmark)
    update textclock: 0.00170519 sec/iter (647 iters, 2.201 sec for benchmark)
  relayout textclock: 0.000581637 sec/iter (1880 iters, 1.094 sec for benchmark)
    redraw textclock: 0.0010167  sec/iter (997 iters, 1.773 sec for benchmark)

So again no difference for creating wiboxes (100.16% compared to before). This
time we also have no real difference for creating wiboxes (99.76%). Update (44%)
and relayout (21%) are improved a lot.

Closes https://github.com/awesomeWM/awesome/pull/463.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-23 20:57:41 +02:00
Daniel Hahler f7f8420d24 naughty.notify: improve doc for args.run
Closes https://github.com/awesomeWM/awesome/pull/469.
2015-09-23 20:56:17 +02:00
Daniel Hahler 7cbf3e8bee Fix tooltip.set_geometry: provide textbox context
Closes https://github.com/awesomeWM/awesome/pull/467.
2015-09-23 10:35:13 +02:00
actionless f2e554de91 fix(lib: naughty: core): make it work with textbox per-screen dpi
Closes https://github.com/awesomeWM/awesome/pull/464.
2015-09-22 08:56:25 +02:00
Daniel Hahler 28ffdb050e Merge pull request #454 from psychon/remove_gears.debug.assert
Remove gears.debug.assert

Closes https://github.com/awesomeWM/awesome/pull/454.

Conflicts:
	lib/gears/matrix.lua
2015-09-21 21:16:36 +02:00
Uli Schlachter 8d6030819b textbox: Honor per-screen DPI
This makes the textbox' :draw() and :fit() callbacks use the DPI that is
specified in the given drawing context. With this, the textbox now scales
correctly if different screens have different DPI values.

Idea originally from Daniel.

Closes https://github.com/awesomeWM/awesome/pull/457.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-21 21:13:21 +02:00
Daniel Hahler b0d7e6bb6c Merge pull request #458 from psychon/explicit_widget_deps
Explicitly track dependencies between widgets

Closes https://github.com/awesomeWM/awesome/pull/458.
2015-09-21 21:12:39 +02:00
Daniel Hahler 21dbe262fb Merge pull request #462 from psychon/gears.matrix2
Implement full matrix operations in gears.matrix

Closes https://github.com/awesomeWM/awesome/pull/462.
2015-09-21 21:12:10 +02:00
Uli Schlachter b134318f19 Use gears.matrix instead of cairo.Matrix everywhere
This has some positive results on the "benchmark test". Each single number is
the best one out of three runs.

Before:
        create wibox: 0.0826502  sec/iter ( 13 iters, 1.157 sec for benchmark)
    update textclock: 0.0186952  sec/iter ( 57 iters, 2.473 sec for benchmark)
  relayout textclock: 0.0158112  sec/iter ( 64 iters, 1.028 sec for benchmark)
    redraw textclock: 0.0015197  sec/iter (662 iters, 1.861 sec for benchmark)

After:
        create wibox: 0.0825672  sec/iter ( 13 iters, 1.154 sec for benchmark)
    update textclock: 0.00378412 sec/iter (277 iters, 4.216 sec for benchmark)
  relayout textclock: 0.00259056 sec/iter (420 iters, 1.09 sec for benchmark)
    redraw textclock: 0.00105128 sec/iter (958 iters, 1.79 sec for benchmark)

We see no significant change in the creation of wiboxes (99.9% compared to
before). Update (20% of the previous run time), relayout (16%) and redraw (69%)
are all sped up by this change.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 13:38:05 +02:00
Uli Schlachter 34927b187d gears.matrix: Implement matrices in Lua
Instead of going through LGI to call cairo, this now implements the various
matrix operations directly in Lua. The plan is to avoid the overhead that we hit
due to LGI.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 13:32:12 +02:00
Alastair Robertson b7669161a0 Add optional limit for nmaster/ncol based on number of tiled windows
Closes https://github.com/awesomeWM/awesome/pull/430.
2015-09-19 12:05:28 +02:00
Uli Schlachter 8abce1ff68 Add a benchmark to the test suite
This (ab)uses the integration tests to run a benchmark. This currently only
measures wibox drawing performance. To avoid wasting CPU-cycles, this does only
a quick run under travis while on "normal" runs the function under test is
executed in a loop to improve the precision of the measurement.

This benchmarks hopefully allow to optimize things in a clear fashion instead of
things like "it feels faster to me".

Results when run against the previous commit:

== Running test-benchmark.lua ==
        create wibox: 0.0788958  sec/iter ( 13 iters, 1.103 sec for benchmark)
    update textclock: 0.019493   sec/iter ( 56 iters, 2.507 sec for benchmark)
  relayout textclock: 0.0160725  sec/iter ( 63 iters, 1.029 sec for benchmark)
    redraw textclock: 0.0015601  sec/iter (647 iters, 1.875 sec for benchmark)
W: awesome: a_glib_poll:291: Last main loop iteration took 6.593912 seconds! Increasing limit for this warning to that value.

Results right before the new widget layouts were merged (commit 52154d0f15):

== Running test-benchmark.lua ==
        create wibox: 0.0782874  sec/iter ( 13 iters, 1.095 sec for benchmark)
    update textclock: 0.00736755 sec/iter (136 iters, 1.346 sec for benchmark)
W: awesome: luaA_dofunction:77: error while running function
[...]
error: /home/psychon/projects/awesome/build/lib/gears/object.lua:30: Trying to emit non-existent signal 'widget::layout_changed'

Closes https://github.com/awesomeWM/awesome/pull/451.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 12:02:44 +02:00