Commit Graph

1965 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 42a906f300 capi.button: Enable the miss handlers. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee fe603f7dc5 capi.key: Enable the miss handlers. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 45823f230a capi: Move from `.data` to `._private` for the property data.
This will bring the CAPI classes closer to the gears.object ones.

Fixes #2897
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 025262fd95 doc: Use the new doc convention.
The previous few commits are very old, bring them to the new
standards without all the merging conflicts (which are error prone).
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 02486b3479 awful.key: Add a has_root_binding property and :trigger() method 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4f7388dd17 awful.button: Add a has_root_binding property and :trigger() method 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 93b90026e9 root: Add a `has_key` and `has_button` functions. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 86d8ef3142 awful.button: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 21ae9c1edb awful.key: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4501f0e768 Allow to add and remove keys and buttons.
Another step in moving these APIs toward the common object oriented and
declarative paradigms used by other APIs.

This commit introduces the `awful.keyboard` module. It currenly only
exists as a placeholder for the first few append/remove function, but
will grow in scope in another pull request to expose the currently
private modifier APIs and to provide keybindings collision detection
and replace some of `awful.hotkey_popup` business logic.

The `keygrabber` tests which uses root keybindings are disabled for
now to keep the commit size small. This is necessary since the shims
will need many iterations of changes before this work again with the
new syntax.
2019-11-09 16:42:06 -05:00
Emmanuel Lepage Vallee 4dbc83fa7d doc: Modify the template to allow merging sections.
It might not be the most pretty of change, but it works. With this
change, it is possible to have multiple "things" in the "same"
section having the "same" name.

This allows for C/C++ style functions with the same name but different
signatures. Lua doesn't handle this well, so it should usually be
avoided. However, constructors might be a valid exception. Most older
widget (and object) constructors have multiple random argument while
newer one use `args`. Deprecating the old ones for the sake of
standardization might be a bit too much for users upgrading from v3.5.

Given the only reason all of those deprecation would happen is because
"its pretty that way", then lets allow 2 constructors and avoid outrage.
2019-11-03 01:28:29 -05:00
Xinhao Yuan 8beb0286ea Fix: toggling the `maximized` state properly when a client requests to unmaximize.
The fix focuses on ewmh.merge_maximization function, which handles client intentions to change maximization states.
The fix includes:

  1. Fixing the `get_value` helper function to return the proper resulting state that client wanted to change.
     For example, when `c.maximized and not c.maximized_horizontal and not c.maximized_vertical` holds,
     the client would observe the `MAXIMIZED_VERT` and `MAXIMIZED_HORZ` atoms in X11, but get_value would compute
     the result values based on `c.maximized_{horizontal,vertical}`, which are all false. The fix makes the computation
     consistent to clients' view.

  2. Interpret a client's maximization intentions based on the client's view of how the X11 atoms changes.
2019-10-16 18:23:18 -04:00
mergify[bot] 344964a44a
Merge pull request #2529 from actionless/hotkeys-popup-dont-show-empty-groups
fix(awful: hotkeys_popup): don't show group label if group itself is empty
2019-10-12 22:14:48 +00:00
actionless beb54c7d5f fix(awful: hotkeys_popup): don't show group label if group itself is empty
1) factor out grouplabel-related logic into _create_group_columns() method
2) check the number of keys in group before calling that method
2019-10-11 15:31:57 +02:00
streetturtle 1b79dec685
Fix typo and wrong property name in popup docs
Fix typo: maxmimum -> maximum and fix wrong name of the property.
2019-10-07 21:45:41 -04:00
Emmanuel Lepage Vallee 2c08c2fa39 quality: Port all legacy `:buttons()` to `.buttons`. 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee ab1e62a332 Remove the instances of :buttons(awful.button()).
Having buttons without an awful.util.table.join/gears.table.join
has never been officially documented to be supported. I hope there
isn't too many of those and they wont try to mix the new and old
API syntax, because that will totally break.
2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee 57f38f4824 layoutbox: Deprecate the old constructor 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 82db9180b1 widget: Mutualize all set_widget implementation to behave the same
Now always call both check_widget and make_widget_from_value. This
should make it a lot less confusing when randomly trying to create
a widget as all ways to do it slowly converge toward an unified
one.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee 349b75994f titlebar/wibox: Support widget definition in set_widget.
So now it is mostly identical to `:setup()` beside some legacy
difference in how the get_children_by_id is implemented.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee cbb90d8bd1 root: Turn `root.keys()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 296ad18922 client: Move the `c:keys()` method to a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee f747438879 layoutbox: Modernize the constructor.
Another step in the long running project to unify all constructors
design.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 29e804a4f8 drawin: Turn `:buttons()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 3d918258e2 widget: Turn `:buttons()` into a normal property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 3230a41450 root: Turn root.button() into a property.
This is the first commit of a series to turn all function based
accessors into object properties. This will bring consistency
across the codebase.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 141aca2432 root.buttons: Move to Lua.
This is the groundwork commit to support using `awful.button` objects in
`root.buttons`.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee b1c81c4258 awful: Set a miss handler for capi.root
There is no better place to put it and need to always be required
for backward compatibility. Given Awesome no longer works properly
without `awful`, I put the code there.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 0cb22fd203 awful: Move the backward compatibility code into its own file.
The reason for this is that as more of CAPI is brought in line with the
current API guidelines, it is more and more likely the tests will hit
APIs shims (either to test them or because the prototype remains the
same and only the implementation moved to Lua).
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 96c4d001f1 doc: Remove capi.button/capi.key from the official doc.
`awful.button` is always the one used and it's confusing.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallée ffe7c4d1cc Apply suggestions from code review
Thanks to @Aire-one for those fixes!

Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee c2a2c789e6 doc: Add example sequences for the tags. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee cb88776980 screen: Add diagonal size (in inches and millimeters).
The use case for this will be to detech which screen is connected to
an output from the screen rules.

It is in millimeters because this is what the output provides and in
inches because the DPI is based on that unit and screens are sold with
the size in inches on the box.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee 93799e8be3 dpi: Better filter the viewports.
Identical viewports are already handled before getting into Lua,
but sometime xrandr gives another viewport that encompass all
others. It has to be removed.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee aa76b11b81 screen: Move the "added" signal from CAPI to Lua.
When the screens are created from the viewport in Lua, the signal is
sent too early and the DPI and outputs have not yet been added. This
cause the `connect_for_each_screen` callbacks to be called with a
partially initialized screen object. It also causes the drawables to be
repainted too early.

CAPI now emits "_added" and "awful.screen" takes care of emitting
"added".
2019-09-30 00:49:39 -04:00
Emmanuel Lepage Vallee 3e19251d14 screen: Set the managed flag when creating screens in awful.screen. 2019-09-30 00:49:17 -04:00
Emmanuel Lepage Vallee cd6998b18d screen: Delay the request::wallpaper and desktop_decoration for the DPI.
With this, there is plenty of palces where the DPI can be set before
those signals are sent. This allows wallpaper with the proper DPI to
work with screens created using `fake_add`. In turn, this will allow
screen rules to control the DPI. In "the past", the DPI used for those
handler was the native DPI of the screen with no opportunity to change
it before hand.
2019-09-30 00:48:09 -04:00
Emmanuel Lepage Vallee 1e1cd549c6 screen: Add a `:split()` method.
This is easier than messing with the `fake_resize()` method. This will
eventually have an awful.screen.rules equivalent to auto-split the
screen from the rules.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee b0f18bce52 screen: Allow `outputs` to be changed.
This moves the handling of the `outputs` property away from C and into
Lua. It will allow the use of `screen.fake_add` to have outputs.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee 51e3d66110 screen: Fix enough issue when all screens are removed to pass a test.
This doesn't mean removing all screens is supported. It isn't and never
will be. The only reason this commit exist is to allow some
initialization and error handling code to be tested.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 852ff9c340 screen: Add a fallback code path when --screen manual is used.
If there is no handler, then the fallback will create the screens.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee dcdbc679f7 doc: Add a file to ldoc blacklist before addint it.
Add `dpi.lua` to config.ld even if it isn't added yet. This is
because the way the test run has it cached in the build dir. A full
rebuild would take too long and timeout on travis for semi-large PRs.
2019-09-29 18:19:45 -04:00
laith-m0 e1169e864d propmpt: Rename `args.hook` to `args.hook` for consistency. 2019-09-29 17:09:01 -04:00
Emmanuel Lepage Vallee 602d6ded07 doc: Add some images to represent the various area of a screen. 2019-08-19 01:48:00 -04:00
Emmanuel Lepage Vallée b2ebf899d7
doc: Fix a broken reference. (#2850) 2019-08-12 00:31:41 -07:00
Emmanuel Lepage Vallee f3dc57f3f4 layoutlist: Add more caching.
Technically this doesn't solve any memory leak, but AwesomeWM uses in
average less memory when changing the selected tab in quick succession.

This is because it has less "temporary" tables to track.
2019-08-07 04:27:56 -04:00
Emmanuel Lepage Vallee d832b8c9b8 layoutlist: Use weak tables to store the cache. 2019-08-07 03:21:17 -04:00
mergify[bot] 88e51faa87
Merge pull request #2833 from DorianGray/patch-1
awful.tooltip:show() - swap timer.started and timer_function call
2019-08-02 15:01:02 +00:00
Sergey Vlasov 29f1719026 awful.titlebar: Fix GC for titlebar widgets (#2830)
Some titlebar widgets (`awful.titlebar.widget.titlewidget`,
`awful.titlebar.widget.button` and other specific button widgets) could
not be garbage collected until the associated client was unmanaged,
because the signal connection used to update the widget was never
destroyed, and the signal handling function was keeping a reference to
the widget in its environment.  This resulted in high memory usage when
the titlebar widgets were recreated multiple times for the same client
(this does not happen with the default Awesome configuration, but may be
needed for dynamic titlebar reconfiguration in a custom config).

Modify the code to use weak tables instead of direct signal connections
to avoid keeping strong references to widgets.  The widget update
functions still keep strong references to the widget itself (creating a
reference loop, but the Lua GC should handle it correctly) and the
client object, but this should not be a problem.

One publicly visible change is that `awful.titlebar.widget.titlewidget`
now has an `update` function, like the button widgets.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-22 11:12:16 +03:00
Robert Andrew Ditthardt 0b58cf9941
awful.tooltip:show() - swap timer.started and timer_function call
This is needed because if async code is run inside of a tooltip timer func the started property may not still be false.
The current version causes random spurious timer already started errors.
2019-07-21 19:07:33 -04:00