Commit Graph

51 Commits

Author SHA1 Message Date
Alastair Poole 6b70114c6d battery/batman: Various Improvements.
This adds support for multiple batteries on FreeBSD in line with
Linux and OpenBSD. Also display the vendor and model where
applicable. There are also fixes specific to the sysctl interface.
Fixes a potential crash and let's us have 100 batman gadgets if
wanted.
2019-11-30 20:46:09 +00:00
Stephen 'Okra' Houston 2081b92f07 Batman: Fix typo where batman was never resuming when screensaver returned. 2019-01-23 20:56:18 -06:00
Stephen 'Okra' Houston 13d2ae75d3 Batman: Don't leak stringshare when returning from update early. 2019-01-23 20:55:40 -06:00
Stephen 'Okra' Houston 42d16a0ec1 Batman Udev: Don't include batteries who have unknown status, have never had a full charge, and have no charge rate.
Summary: This fixes issues where erroneous udev detections of batteries are included. @bu5hm4n and I both have had issues where udev thinks we have two batteries because our hid/touchscreens report a battery even though they are not accurate.  The problem is batman will then think there are two batteries and calculate battery percentage based off both batteries.  For instance if the laptop battery is 100% and it is detecting this phony hid battery, the result is batman thinks you are at 50% battery life.  This also fixes the battery removal code which should only remove the battery with the syspath the function is called with.  The code was actually removing every single battery.

Test Plan: You have to have a device that udev reports two batteries for when there aren't two.  It should be harmless to not include batteries that have never been charged, have no charge, and have unknown for their status.

Reviewers: bu5hm4n, raster, zmike!, devilhorns

Reviewed By: raster

Subscribers: cedric, bu5hm4n

Tags: #enlightenment-git

Differential Revision: https://phab.enlightenment.org/D7736
2019-01-23 12:57:57 -06:00
Carsten Haitzler c09ba20464 warn - make buffer bigger to avoid trunc warn 2019-01-12 01:51:43 +00:00
Carsten Haitzler e4339f4819 bryce - improve usability from code and user by having std right menu
now right click on any gagdte in bryce and they ALL have a menu that
allows removal of the gagdte bar or the gadget as well as access to
gadget settings AND the ability for gadgets to extendthis menu like
lunhcer does per icon. now it's standard behavior everywhere which is
much easier to use and discover. it also removes code from every
gadget to do their own "button 3" handling as its handled centrally
making the code in gadgets simpler.

this is part of my effort to improve usability (mostly discoverability
and accessibility of settings/features).

also  long press left mouse gets u gadget right click menu

this has to move many modules/gadgets actions to mouse up instead of
mouse down so the bryce has a chance to trap the events first and set
hold flags. but now long press for 0.5 sec and bryce menu come sup
(with left mouse .. so touch friendly).

in addition move context menu hanbdling to e_gadget instead of in
bryce and in e_gadget. a context callback is called so different
systems can still do different things. this should probably change to
always pop up a mnenu and simple call populate callbacks for site
owner specific content.

all in all it makes the new gagdtes more consistent, easier to use
(without a right mouse button), doesn't need special action bindings
etc. etc.
2018-10-11 16:25:10 +01:00
Stephen Houston 30a7c82320 Sysinfo Batman Upower - use the correct functions for processing. 2018-08-08 09:38:25 -05:00
thierryOrdissimo fff3f69114 Update of the dbus calls of the upower module.
Reviewers: zmike, devilhorns, stephenmhouston

Reviewed By: zmike, stephenmhouston

Subscribers: cedric

Tags: #enlightenment-git

Differential Revision: https://phab.enlightenment.org/D6386
2018-08-08 09:17:08 -05:00
Mike Blumenkrantz 846c84639b use per-instance event handler for batman powersave eventing
==19679== Invalid read of size 4
==19679==    at 0x5CC90EF: _ecore_event_message_handler_handler_del (ecore_event_message_handler.c:194)
==19679==    by 0x5CCA332: ecore_event_message_handler_del (ecore_event_message_handler.eo.c:22)
==19679==    by 0x5CBC7E3: ecore_event_handler_del (ecore_events.c:51)
==19679==    by 0x2A23F4F1: _batman_removed_cb (batman.c:579)
==19679==    by 0x6A9A33D: _eo_evas_smart_cb (evas_object_smart.c:78)
==19679==    by 0xC166F4D: _event_callback_call (eo_base_class.c:1560)
==19679==    by 0xC16728E: _efl_object_event_callback_legacy_call (eo_base_class.c:1633)
==19679==    by 0xC167334: efl_event_callback_legacy_call (eo_base_class.c:1636)
==19679==    by 0x6A889CA: _efl_canvas_object_efl_object_event_callback_legacy_call (evas_object_main.c:1157)
==19679==    by 0xC167334: efl_event_callback_legacy_call (eo_base_class.c:1636)
==19679==    by 0x6A9CBA7: evas_object_smart_callback_call (evas_object_smart.c:1037)
==19679==    by 0x500B1D: _gadget_remove (e_gadget.c:426)
==19679==    by 0x5037A9: _gadget_menu_remove (e_gadget.c:1263)
==19679==    by 0x552600: _e_menu_active_call (e_menu.c:2066)
==19679==    by 0x55445E: _e_menu_cb_mouse_up (e_menu.c:2809)
==19679==    by 0x5CC9933: _ecore_event_message_handler_efl_loop_message_handler_message_call (ecore_event_message_handler.c:359)
==19679==    by 0x5CD31D1: efl_loop_message_handler_message_call (efl_loop_message_handler.eo.c:14)
==19679==    by 0x5CCDA73: _efl_loop_message_process (efl_loop.c:681)
==19679==    by 0x5CCDC64: efl_loop_message_process (efl_loop.c:711)
==19679==    by 0x5CC7453: _ecore_main_loop_iterate_internal (ecore_main.c:2444)
==19679==    by 0x5CC457E: _ecore_main_loop_begin (ecore_main.c:1173)
==19679==    by 0x5CCC0CD: _efl_loop_begin (efl_loop.c:97)
==19679==    by 0x5CCED13: efl_loop_begin (efl_loop.eo.c:50)
==19679==    by 0x5CC46F7: ecore_main_loop_begin (ecore_main.c:1246)
==19679==    by 0x5476B6: main (e_main.c:1092)
==19679==  Address 0x212af268 is 40 bytes inside a block of size 48 free'd
==19679==    at 0x4C30D18: free (vg_replace_malloc.c:530)
==19679==    by 0x5CC9BE6: _ecore_event_message_handler_efl_loop_message_handler_message_call (ecore_event_message_handler.c:389)
==19679==    by 0x5CD31D1: efl_loop_message_handler_message_call (efl_loop_message_handler.eo.c:14)
==19679==    by 0x5CCDA73: _efl_loop_message_process (efl_loop.c:681)
==19679==    by 0x5CCDC64: efl_loop_message_process (efl_loop.c:711)
==19679==    by 0x5CC7453: _ecore_main_loop_iterate_internal (ecore_main.c:2444)
==19679==    by 0x5CC457E: _ecore_main_loop_begin (ecore_main.c:1173)
==19679==    by 0x5CCC0CD: _efl_loop_begin (efl_loop.c:97)
==19679==    by 0x5CCED13: efl_loop_begin (efl_loop.eo.c:50)
==19679==    by 0x5CC46F7: ecore_main_loop_begin (ecore_main.c:1246)
==19679==    by 0x5476B6: main (e_main.c:1092)
==19679==  Block was alloc'd at
==19679==    at 0x4C31A1E: calloc (vg_replace_malloc.c:711)
==19679==    by 0x5CC8EE1: _ecore_event_message_handler_handler_add (ecore_event_message_handler.c:148)
==19679==    by 0x5CCA0FB: ecore_event_message_handler_add (ecore_event_message_handler.eo.c:14)
==19679==    by 0x5CBC790: ecore_event_handler_add (ecore_events.c:35)
==19679==    by 0x2A23FB87: _batman_created_cb (batman.c:661)
==19679==    by 0x6A9A33D: _eo_evas_smart_cb (evas_object_smart.c:78)
==19679==    by 0xC166F4D: _event_callback_call (eo_base_class.c:1560)
==19679==    by 0xC16728E: _efl_object_event_callback_legacy_call (eo_base_class.c:1633)
==19679==    by 0xC167334: efl_event_callback_legacy_call (eo_base_class.c:1636)
==19679==    by 0x6A889CA: _efl_canvas_object_efl_object_event_callback_legacy_call (evas_object_main.c:1157)
==19679==    by 0xC167334: efl_event_callback_legacy_call (eo_base_class.c:1636)
==19679==    by 0x6A9CBA7: evas_object_smart_callback_call (evas_object_smart.c:1037)
==19679==    by 0x501172: _gadget_object_create (e_gadget.c:548)
==19679==    by 0x506B90: e_gadget_type_add (e_gadget.c:2056)
==19679==    by 0x2A23CA44: sysinfo_init (mod.c:161)
==19679==    by 0x2A23CCF5: e_modapi_init (mod.c:203)
==19679==    by 0x556814: e_module_enable (e_module.c:524)
==19679==    by 0x555DF9: e_module_all_load (e_module.c:324)
==19679==    by 0x554EFF: _module_done_cb (e_module.c:73)
==19679==    by 0x73531C1: eio_async_end (eio_file.c:510)
==19679==    by 0x5CF8D67: _ecore_thread_kill (ecore_thread.c:229)
==19679==    by 0x5CF8E1C: _ecore_thread_handler (ecore_thread.c:256)
==19679==    by 0x5CB97D0: _ecore_main_call_flush (ecore.c:1090)
==19679==    by 0x5CB9858: _thread_callback (ecore.c:1101)
==19679==    by 0x5CF51F3: _ecore_pipe_handler_call (ecore_pipe.c:602)
==19679==    by 0x5CF5529: _ecore_pipe_read (ecore_pipe.c:725)
==19679==    by 0x5CC3677: _ecore_call_fd_cb (ecore_private.h:476)
==19679==    by 0x5CC6793: _ecore_main_fd_handlers_call (ecore_main.c:2051)
==19679==    by 0x5CC7414: _ecore_main_loop_iterate_internal (ecore_main.c:2439)
==19679==    by 0x5CC457E: _ecore_main_loop_begin (ecore_main.c:1173)
==19679==    by 0x5CCC0CD: _efl_loop_begin (efl_loop.c:97)
==19679==    by 0x5CCED13: efl_loop_begin (efl_loop.eo.c:50)
==19679==    by 0x5CC46F7: ecore_main_loop_begin (ecore_main.c:1246)
==19679==    by 0x5476B6: main (e_main.c:1092)
2018-02-22 11:14:33 -05:00
Mike Blumenkrantz 99db9e2557 more E_BITFIELD conversions 2017-11-08 09:22:24 -05:00
Mike Blumenkrantz 59fa0e418d use E_BITFIELD define for bitfield struct members
on release builds this will be a bitfield, on devel builds it will make
bools a normal unsigned char for easier debugging
2017-11-07 10:39:56 -05:00
Carsten Haitzler 929037aaa0 battery modules - actually set ac power flag based on ac presence
this should fix T3649

@fix
2017-10-18 13:32:50 +09:00
Mike Blumenkrantz b5e75eb264 formatting
lot of mixed spaces/tabs here made the code unreadable
2017-08-29 15:32:18 -04:00
Stephen 'Okra' Houston 1af5125cc9 Batman: Set the demo gadget to have full battery. 2017-08-24 08:08:41 -05:00
Stephen 'Okra' Houston ad46d041a8 Gadgets: Don't set gadgets to expand. 2017-08-23 09:55:59 -05:00
Stephen 'Okra' Houston 993f8ad519 Sysinfo Gadgets: Provide only demo data and don't poll/thread when gadgets are in demo mode.
This fixes T5816
2017-08-22 10:24:16 -05:00
Carsten Haitzler ec37c5e7eb batman - fix buffer warning by hanving big enough stack buffer
makes gcc warnings happy but otherwise doesn't hurt us as the buffer
should be at the top of the stack (last pushed) and only bytes used
will be allocated.
2017-08-04 14:09:25 +09:00
Stephen 'Okra' Houston 5370793399 Sysinfo Gadget: More thread vs object lifetime work: Make threads no longer dependent on the main loop objects and vice versa. 2017-07-15 21:32:38 -05:00
Stephen 'Okra' Houston 139045c120 Sysinfo Gadget: Unify define macro checking. 2017-07-15 21:32:11 -05:00
Al 'netstar' Poole d7538011ec Modules: Fix compilation and remove warnings for BSD 2017-07-15 21:32:11 -05:00
Stephen 'Okra' Houston 804f038f71 Sysinfo Gadget: Thread Lifetime vs Object Lifetime management.
This cleans up how sysinfo manages object vs thread lifetimes.  If thread is still alive dependent on aspects that need to be freed in the gadget removal process, it defers that cleanup from the remove callback to the thread end callback.  As for the combination sysinfo gadget, each gadget inside of sysinfo will set a done flag alerting that the cleanup of the combination gadget can happen once all threads are done.
This fixes T5694
2017-07-13 19:21:49 -05:00
Stephen 'Okra' Houston 739c1aa4b8 Sysinfo Gadgets: Thread handling improvement. Pause on Screensaver. Follow powersave. 2017-07-13 14:36:09 -05:00
Stephen 'Okra' Houston 9e7b78ffab Gadgets: Make sure to avoid conflicts with functions and globals. 2017-07-12 16:03:06 -05:00
Stephen 'Okra' Houston 9894726039 Gadgets: Clamp aspect sets to a minimum of width and height minimum of 1.
This fixes T5600
2017-07-06 14:16:00 -05:00
Stephen 'Okra' Houston 202bf770f4 Gadgets: Follow gadget theme naming conventions. 2017-07-06 12:20:53 -05:00
Mike Blumenkrantz 1fe4555d7b remove eeze init/shutdown calls from modules
this is unnecessary and was done with mismatched init/shutdowns in some cases
2017-06-30 10:25:17 -04:00
Stephen 'Okra' Houston 7d095c3fe3 Sysinfo: Fix use for non linux/bsd os's.
This fixes T5485
2017-05-15 10:43:05 -05:00
Al 'netstar' Poole 4e1d079aa8 Batman: Add multi-battery support for bsd based distros.
Differential was D4670
2017-03-13 14:59:39 -05:00
Stephen 'Okra' Houston 27d047f4bd Batman: Only show unique batteries. 2017-02-17 17:06:39 -06:00
Stephen 'Okra' Houston 671f881e42 Luncher/Batman: Don't access an invalid icon structure. 2017-02-10 16:22:49 -06:00
Davide Andreoli a2644259b2 sysinfo gadget: remove frames in popups 2017-02-10 21:23:55 +01:00
Stephen 'Okra' Houston 73495d6347 Sysinfo Gadgets: Allow for vertical themes for all sysinfo gadgets
This is in preparation for themers in the future.
2017-02-10 11:59:47 -06:00
Stephen 'Okra' Houston 327f9bc68f Sysinfo gadgets: Prevent info popup from getting stuck. 2017-02-10 11:37:30 -06:00
Stephen 'Okra' Houston 762879bf5c Batman - Don't destroy the popup on hide. 2017-02-10 11:15:02 -06:00
Stephen 'Okra' Houston 1f6baaf283 Cpumonitor: Add a similar popup to memusage. 2017-02-09 16:22:22 -06:00
Stephen 'Okra' Houston 8547164c16 Pager and Batman: Use pages in config popup and standardize look. 2017-02-09 11:14:03 -06:00
Stephen 'Okra' Houston 5489f690cc Batman: Don't show time left in the popup when battery is charged. 2017-02-09 10:21:52 -06:00
Stephen 'Okra' Houston b994562776 Batman - Add the config popup to configure batman. 2017-02-08 13:08:14 -06:00
Stephen 'Okra' Houston 75cbcf5b47 Batman - Don't show hard to read and redundant text in the gadget itself - Move it to a popup on left click. 2017-02-08 08:57:35 -06:00
Derek Foreman 73aecd73ab Replace all timer_add with timer_loop_add
So yeah, I've literally used sed to replace every occurrence of
ecore_time_add() with ecore_timer_loop_add() because I'm reasonably
confident that no part of E has a legitimate need for timer based on the
exact current time.

It would be really nice if I'm not wrong. :)

The reason for this is the incredible spew of clock_gettime() calls I'm
seeing on an ARM system (that should have a vdso for gettime, but...)
This can amount to thousands of system calls per second.

 #YOLO
2017-02-03 15:52:28 -06:00
Al netstar Poole b6b143bf0c Make sysinfo gadgets work with BSD 2017-02-02 15:48:48 -06:00
Stephen 'Okra' Houston f7d09d6002 Sysinfo Gadget: Don't set aspect to 1:1 out of the box. Let edje determine aspect. 2017-02-02 15:42:05 -06:00
Al Poole 55a7d4feed Fixes issues w/battery and batman living together
Summary:
The problems were that both sysctl implementations defined public accessable fields named bat.

The static definition moves into the file scopes.

The E_FREE calls are fixing a use after free.

Reviewers: zmike!, bu5hm4n

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D4629
2017-01-29 12:47:15 +01:00
Al 'netstar' Poole 2f218a1694 Enlightenment - BSD - Fix typos in battery sysctl float compares. 2017-01-27 19:08:14 -06:00
Al 'netstar' Poole 82af16c32b Enlightenment - BSD - Cleanup sysctl code for batteries. 2017-01-27 18:28:19 -06:00
Stephen 'Okra' Houston d99e88b78c Enlightenment - Sysinfo Gadget - Size all sysinfo gadgets by aspect - should allow for proper theming. 2017-01-27 14:55:24 -06:00
Stephen 'Okra' Houston 2f75513396 Enlightenment: Sysinfo gadgets - Remove temporary gadgets correctly. 2017-01-11 09:27:43 -06:00
Stephen 'Okra' Houston d843f58671 Enlightenment: Fix coverity issues related to new sysinfo gadget
This fixes CID1368352 CID1368351 CID1368350 CID1368349 CID1368348 CID1368347 CID1368346 CID1368344 CID1368343
2017-01-09 09:43:02 -06:00
Stephen 'Okra' Houston 0b1fc0e368 Batman: Allow multiple instances of batman to work correctly. 2017-01-07 17:39:48 -06:00
Stephen 'Okra' Houston 9189293b46 Enlightenment: Fix double compare in batman and fix compilation on bsd. 2017-01-07 04:49:57 -06:00