Skip to content

Commit

Permalink
ignore enter, delete and space on empty panel
Browse files Browse the repository at this point in the history
  • Loading branch information
eworm-de committed Jun 15, 2015
1 parent abe165f commit b796362
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MetersPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
case 0x0d:
case KEY_ENTER:
{
if (!Vector_size(this->meters))
break;
this->moving = !(this->moving);
((ListItem*)Panel_getSelected(super))->moving = this->moving;
result = HANDLED;
Expand All @@ -85,6 +87,8 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
case KEY_F(4):
case 't':
{
if (!Vector_size(this->meters))
break;
Meter* meter = (Meter*) Vector_get(this->meters, selected);
int mode = meter->mode + 1;
if (mode == LAST_METERMODE) mode = 1;
Expand Down Expand Up @@ -147,6 +151,8 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
case KEY_F(9):
case KEY_DC:
{
if (!Vector_size(this->meters))
break;
if (selected < Vector_size(this->meters)) {
Vector_remove(this->meters, selected);
Panel_remove(super, selected);
Expand Down

0 comments on commit b796362

Please sign in to comment.