*fix* tooltip fixed
*fix* send battery low command if below the value, not exactly the value git-svn-id: http://tint2.googlecode.com/svn/trunk@289 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
@@ -43,6 +43,7 @@ static char buf_bat_time[20];
|
|||||||
|
|
||||||
int8_t battery_low_status;
|
int8_t battery_low_status;
|
||||||
char *battery_low_cmd=0;
|
char *battery_low_cmd=0;
|
||||||
|
unsigned char battery_low_cmd_send=0;
|
||||||
char *path_energy_now=0;
|
char *path_energy_now=0;
|
||||||
char *path_energy_full=0;
|
char *path_energy_full=0;
|
||||||
char *path_current_now=0;
|
char *path_current_now=0;
|
||||||
@@ -266,10 +267,15 @@ void update_battery() {
|
|||||||
if(energy_full > 0)
|
if(energy_full > 0)
|
||||||
new_percentage = (energy_now*100)/energy_full;
|
new_percentage = (energy_now*100)/energy_full;
|
||||||
|
|
||||||
if(battery_low_status != 0 && battery_low_status == new_percentage && battery_state.percentage > new_percentage) {
|
if(battery_low_status > new_percentage && battery_state.state == BATTERY_DISCHARGING && !battery_low_cmd_send) {
|
||||||
//printf("battery low, executing: %s\n", battery_low_cmd);
|
printf("battery low, executing: %s\n", battery_low_cmd);
|
||||||
if (battery_low_cmd) system(battery_low_cmd);
|
if (battery_low_cmd)
|
||||||
|
system(battery_low_cmd);
|
||||||
|
battery_low_cmd_send = 1;
|
||||||
}
|
}
|
||||||
|
if(battery_low_status < new_percentage && battery_state.state == BATTERY_CHARGING && battery_low_cmd_send) {
|
||||||
|
battery_low_cmd_send = 0;
|
||||||
|
}
|
||||||
|
|
||||||
battery_state.percentage = new_percentage;
|
battery_state.percentage = new_percentage;
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,10 @@ void tooltip_trigger_show(Area* area, Panel* p, int x_root, int y_root)
|
|||||||
|
|
||||||
void tooltip_show()
|
void tooltip_show()
|
||||||
{
|
{
|
||||||
Area* area = click_area(g_tooltip.panel, x, y);
|
int mx, my;
|
||||||
|
Window w;
|
||||||
|
XTranslateCoordinates( server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w);
|
||||||
|
Area* area = click_area(g_tooltip.panel, mx, my);
|
||||||
stop_timeouts();
|
stop_timeouts();
|
||||||
if (!g_tooltip.mapped && area->_get_tooltip_text) {
|
if (!g_tooltip.mapped && area->_get_tooltip_text) {
|
||||||
tooltip_copy_text(area);
|
tooltip_copy_text(area);
|
||||||
|
|||||||
Reference in New Issue
Block a user