@@ -24,10 +24,14 @@ in the source distribution for its full text.
2424
2525static const char * const DisplayOptionsFunctions [] = {" " , " " , " " , " " , " " , " " , " " , " " , " " , "Done " , NULL };
2626
27+ static const char * const DisplayOptionsDecIncFunctions [] = {"Dec " , "Inc " , " " , "Done " , NULL };
28+ static const char * const DisplayOptionsDecIncKeys [] = {"- " , "+ " , " " , "F10" , NULL };
29+ static const int DisplayOptionsDecIncEvents [] = {'-' , '+' , ERR , KEY_F (10 )};
30+
2731static void DisplayOptionsPanel_delete (Object * object ) {
28- Panel * super = (Panel * ) object ;
2932 DisplayOptionsPanel * this = (DisplayOptionsPanel * ) object ;
30- Panel_done (super );
33+ FunctionBar_delete (this -> decIncBar );
34+ Panel_done (& this -> super );
3135 free (this );
3236}
3337
@@ -73,6 +77,28 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
7377 result = HANDLED ;
7478 }
7579 break ;
80+ case KEY_UP :
81+ case KEY_DOWN :
82+ case KEY_NPAGE :
83+ case KEY_PPAGE :
84+ case KEY_HOME :
85+ case KEY_END :
86+ {
87+ OptionItem * previous = selected ;
88+ Panel_onKey (super , ch );
89+ selected = (OptionItem * ) Panel_getSelected (super );
90+ if (previous != selected ) {
91+ result = HANDLED ;
92+ }
93+ }
94+ /* fallthrough */
95+ case EVENT_SET_SELECTED :
96+ if (OptionItem_kind (selected ) == OPTION_ITEM_NUMBER ) {
97+ super -> currentBar = this -> decIncBar ;
98+ } else {
99+ Panel_setDefaultBar (super );
100+ }
101+ break ;
76102 }
77103
78104 if (result == HANDLED ) {
@@ -100,10 +126,12 @@ const PanelClass DisplayOptionsPanel_class = {
100126
101127DisplayOptionsPanel * DisplayOptionsPanel_new (Settings * settings , ScreenManager * scr ) {
102128 DisplayOptionsPanel * this = AllocThis (DisplayOptionsPanel );
103- Panel * super = (Panel * ) this ;
129+ Panel * super = & this -> super ;
130+
104131 FunctionBar * fuBar = FunctionBar_new (DisplayOptionsFunctions , NULL , NULL );
105132 Panel_init (super , 1 , 1 , 1 , 1 , Class (OptionItem ), true, fuBar );
106133
134+ this -> decIncBar = FunctionBar_new (DisplayOptionsDecIncFunctions , DisplayOptionsDecIncKeys , DisplayOptionsDecIncEvents );
107135 this -> settings = settings ;
108136 this -> scr = scr ;
109137
@@ -164,5 +192,6 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
164192 #ifdef HAVE_LIBHWLOC
165193 Panel_add (super , (Object * ) CheckItem_newByRef ("Show topology when selecting affinity by default" , & (settings -> topologyAffinity )));
166194 #endif
195+
167196 return this ;
168197}
0 commit comments