Merge branch 'moreclicks' into 'master'

Moreclicks

The two commits in this merge request would allow the user to set up as many as eight extra custom actions via tint2rc.

I've been running these changes (minus the up/down wheel actions) for many months without any obvious issues, mainly to adjust laptop screen brightness via a couple of scripts.

I've just tested the wheel actions and they appeared to work fine. The clock commit should solve issue #505.

I have merely augmented the work of two other people, and appropriate credits/references are indicated in the individual commit messages.

See merge request !5
This commit is contained in:
o9000
2015-08-01 07:02:51 +00:00
8 changed files with 165 additions and 1 deletions

View File

@@ -447,11 +447,27 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e)
if (tskbar && e->button == 1 && panel_mode == MULTI_DESKTOP)
return 1;
if (click_clock(panel, e->x, e->y)) {
if ( (e->button == 1 && clock_lclick_command) || (e->button == 3 && clock_rclick_command) )
if ( (e->button == 1 && clock_lclick_command) ||
(e->button == 2 && clock_mclick_command) ||
(e->button == 3 && clock_rclick_command) ||
(e->button == 4 && clock_uwheel_command) ||
(e->button == 5 && clock_dwheel_command) )
return 1;
else
return 0;
}
#ifdef ENABLE_BATTERY
if (click_battery(panel, e->x, e->y)) {
if ( (e->button == 1 && battery_lclick_command) ||
(e->button == 2 && battery_mclick_command) ||
(e->button == 3 && battery_rclick_command) ||
(e->button == 4 && battery_uwheel_command) ||
(e->button == 5 && battery_dwheel_command) )
return 1;
else
return 0;
}
#endif
return 0;
}
@@ -599,6 +615,16 @@ void event_button_release (XEvent *e)
return;
}
#ifdef ENABLE_BATTERY
if (click_battery(panel, e->xbutton.x, e->xbutton.y)) {
battery_action(e->xbutton.button);
if (panel_layer == BOTTOM_LAYER)
XLowerWindow (server.dsp, panel->main_win);
task_drag = 0;
return;
}
#endif
if (e->xbutton.button == 1 && click_launcher(panel, e->xbutton.x, e->xbutton.y)) {
LauncherIcon *icon = click_launcher_icon(panel, e->xbutton.x, e->xbutton.y);
if (icon) {