Commit Graph

32 Commits

Author SHA1 Message Date
patrick96 4f8f076714 Remove atomic members from static modules 2021-09-30 15:38:18 +02:00
Patrick Ziegler d5be8cad97
Add compiler warning for missing override specifier (#2341)
* build: Add -Wsuggest-override

We should always use the override specifier when overriding virtual
functions. This helps prevent errors when a subclass tries to create a
function with the same name as a virtual function in a super-class but
with a different purpose.

* clang-format

* Upload logs on failure

* Add override to unsupported.hpp

* cmake: Make -Wsuggest-override flag conditional
2021-01-04 10:38:43 +01:00
Patrick Ziegler 26be83f893
module: Implement action router (#2336)
* module: Implement proof of concept action router

Action implementation inside module becomes much cleaner because each
module just registers action names together with a callback (pointer to
member function) and the action router does the rest.

* Make input function final

This forces all modules to use the action router

* modules: Catch exceptions in action handlers

* Use action router for all modules

* Use action_ prefix for function names

The mpd module's 'stop' action overwrote the base module's stop function
which caused difficult to debug behavior.

To prevent this in the future we now prefix each function that is
responsible for an action with 'action_'

* Cleanup

* actions: Throw exception when re-registering action

Action names are unique inside modules. Unfortunately there is no way to
ensure this statically, the next best thing is to crash the module and
let the user know that this is a bug.

* Formatting

* actions: Ignore data for actions without data

This is the same behavior as before.

* action_router: Write tests
2021-01-04 10:25:52 +01:00
patrick96 9fb75779f3 Incorporate reviews 2020-11-26 20:53:53 +01:00
patrick96 bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96 ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96 d592eea966 refactor: Move module type string into modules
This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
2020-11-26 20:53:53 +01:00
patrick96 4b5007294b refactor(modules): Make all modules input handlers
By default they will return false for calls to `input`
2020-11-26 20:53:53 +01:00
Joost Sijm 8ca36d9e16 typo: replace 'alot' with 'a lot' (#1634)
This is bothering me alot
2019-01-29 17:54:38 +01:00
Michael Carlberg 5c9bfc147c fix(xbacklight): Lower inc/dec value to 5 and fix flooring 2017-01-11 04:40:10 +01:00
Michael Carlberg 8cc885c316 refactor: Cleanup 2017-01-11 03:07:28 +01:00
Michael Carlberg b422d1d1a4 refactor(modules): Input handling 2016-12-23 20:43:52 +01:00
Michael Carlberg 8cff01e3d8 refactor(event_handler): Abstract sink attaching 2016-12-23 05:08:19 +01:00
Michael Carlberg 185363056a refactor(x11): Cleanup 2016-12-21 15:04:16 +01:00
Michael Carlberg 7979f5b3d4 refactor(modules): Handle events using signal_receiver 2016-12-21 08:38:44 +01:00
Michael Carlberg c01f111e34 refactor(modules): Move setup to constructor 2016-12-21 08:00:09 +01:00
Michael Carlberg a0d485f79d refactor: Initialize data 2016-12-15 09:30:31 +01:00
Michael Carlberg 4fca0c89b4 refactor: Object construction 2016-12-14 11:01:44 +01:00
Michael Carlberg 08be86fbe1 wip(refactor): Improve signal and event handling 2016-12-14 11:01:44 +01:00
Michael Carlberg 9f4638f42c refactor: Cleanup 2016-11-26 06:13:20 +01:00
Michael Carlberg ff9be848c7 refactor(clang-tidy): Apply fixes 2016-11-25 21:58:49 +01:00
Michael Carlberg 8db3e79919 refactor(clang-format): Apply fixes 2016-11-25 14:17:41 +01:00
Michael Carlberg c6d85b2b92 refactor: Optimize build 2016-11-20 23:04:31 +01:00
Michael Carlberg 88c8bbd940 refactor: Fwd declare drawtypes
Ref #164
2016-11-19 15:49:06 +01:00
Michael Carlberg fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg 51d8f289fa feat(xwindow): New module "xwindow"
Add module to display title of active window.
Requires WM with support for the _NET_ACTIVE_WINDOW hint.

Ref #84
2016-11-19 04:05:13 +01:00
Michael Carlberg f2bbd301f2 feat(xbacklight): Change value on scroll
- Add action handlers for scroll up/down (conf: enable-sroll = true)
- Use xcb_timestamps instead of the throttle util
2016-11-12 13:07:05 +01:00
Michael Carlberg e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg 83ae9f6435 fix(xbacklight): Allow larger property values
Not all backlight values are within 8 bit range
so do not truncate property values
2016-10-25 16:40:01 +02:00
Michael Carlberg d2187f44e0 refactor(drawtypes): Cleanup and fixes 2016-10-25 07:10:05 +02:00
Michael Carlberg 7905f37462 refactor(di): Move configure_T() to anonymous ns 2016-10-25 01:55:59 +02:00
Michael Carlberg 56b4657c3f feat: New module xbacklight
Better implementation for showing backlight information.
This one is using the XRandR extension instead of
reading from the raw file handlers.
2016-10-19 14:46:44 +02:00