Commit Graph

6747 Commits

Author SHA1 Message Date
Uli Schlachter 79fa6ad017 Fix client_apply_size_hints()
The bit that indicates that the base size is set is
XCB_ICCCM_SIZE_HINT_BASE_SIZE. However, instead this code checked
XCB_ICCCM_SIZE_HINT_P_SIZE which is set to indicate how the initial window
position is chosen. So we were checking the complete wrong bit. Whoops...

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 21:13:40 +02:00
Uli Schlachter 4daa6e8bef Select SubstructureRedirect on our systray window
This ensures that systray icons cannot resize themselves. We assign them some
size and they have to deal with what they get!

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:34:43 +02:00
Uli Schlachter d03762c322 systray: Make sure the widget is only placed in a wibox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:30:08 +02:00
Uli Schlachter b1b2852887 awful.screen.getbycoord: Use the same algorithm as in C
We recently changed the C function screen_getbycoord() and this commit makes
awful.screen.getbycoord() use the same algorithm.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:25:26 +02:00
Uli Schlachter d4168f3c36 screen_getbycoord: Change definition of 'closest screen'
Instead of comparing only the top-left corner of the screen to the provided
coordinate, this now compares the screen in a more intuitive way, e.g.
coordinates inside of the screen have a distance of zero.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:10:23 +02:00
Uli Schlachter b34a653448 Merge branch 'master' of https://github.com/everslick/awesome 2015-10-10 19:58:45 +02:00
Uli Schlachter 22305f3abf Merge branch 'client_resize_do-prefer-current' of https://github.com/blueyed/awesome 2015-10-10 19:57:45 +02:00
Uli Schlachter b1493c8f76 Merge branch 'enhance_menubar_icon_path_lookup' of https://github.com/nuko8/awesome 2015-10-10 19:54:23 +02:00
Uli Schlachter e3199edca1 Merge branch 'snid_callback' of https://github.com/Elv13/awesome-1 2015-10-10 19:52:41 +02:00
Uli Schlachter a66517bb75 Merge branch 'test-runner-for-bisect' of https://github.com/blueyed/awesome 2015-10-10 19:52:11 +02:00
Uli Schlachter b89918d0f1 Merge branch 'remember-mouse-pos-per-screen' of https://github.com/Bew78LesellB/awesome 2015-10-10 19:51:00 +02:00
Uli Schlachter e15df8cba9 Merge branch 'client-movetoscreen-raise-true' of https://github.com/blueyed/awesome 2015-10-10 19:50:18 +02:00
Uli Schlachter b2aaefd095 Apply window gravity for border width changes
Together with the previous changes, this also fixes the initial positions for
metacity's test-gravity.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:45:24 +02:00
Uli Schlachter 3b97d1c1a7 Apply window gravity for titlebar resizes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:44:11 +02:00
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
lesell_b 4003331b41 fix missing scope on the mouse position table 2015-10-09 21:27:17 +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
Daniel Hahler dcdd60382f Raise client in awful.client.movetoscreen
The intention of [#98] / fbc72624 was to actually raise the client,
but that was never the case apparently, and got totally lost in
[#441] / 57755b3.

[#98]: https://github.com/awesomeWM/awesome/pull/98
[#441]: https://github.com/awesomeWM/awesome/pull/441
2015-10-08 13:59:57 +02:00
lesell_b f2b6aa105c Update saved mouse position on screen focus change
Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 04:40:59 +02:00
lesell_b 23b2fae6a9 Remember mouse position per screen
The mouse position is saved and restored when focusing another screen

If the target screen has no saved mouse position, the relative position
of the current screen is used

Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 03:52:03 +02:00
Daniel Hahler fa1dea6df4 Improve test runner to be usable for git-bisect 2015-10-03 14:54:17 +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
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.

* Everything is public to allow alternative workflow modules such as
    Tyrannical to use their own callback implementation.
2015-09-29 18:05:56 -04: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
Kazunobu Kuriyama 9ae945c931 Enhance menubar icon path lookup
The way of icon path lookup for `menubar` is enhanced so that it is
based on a theme-oriented way as described in the specification:

  Icon Theme Specification, Ver. 0.12
  http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

To accomplish this:

 * Add the two new files `icon_theme.lua` and `index_theme.lua`.

   The former implements an icon lookup algorithm suggested in the URL
   above.  The latter implements a helper object to parse the cache file
   `index.theme` of which data is used by the former.

 * Modify `menu_gen.lua` to use the new algorithm.

   - The implementation of `lookup_category_icons` is changed
     accordingly.
   - The values of the field `all_categories.icon_name` are changed file
     names to icon names, i.e., file extensions which are used to
     indicate image file formats are removed.

 * Add the new file `icon_theme_spec.lua` for a unit test for checking
   if `icon_theme.lua` together with `index_theme.lua` works as
   expected.
2015-09-26 11:45:38 +09: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