MCPcopy Create free account
hub / github.com/ccMSC/ckb / keyEvent

Method keyEvent

src/ckb/keyaction.cpp:231–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231void KeyAction::keyEvent(KbBind* bind, bool down){
232 // No need to respond to standard actions
233 if(!isSpecial())
234 return;
235 QStringList parts = _value.split(":");
236 if(parts.length() < 2)
237 return;
238 QString prefix = parts[0];
239 int suffix = parts[1].toInt();
240 if(prefix == "$mode"){
241 if(!down)
242 return;
243 // Change mode
244 Kb* device = bind->devParent();
245 KbProfile* currentProfile = device->currentProfile();
246 int mode = currentProfile->indexOf(currentProfile->currentMode());
247 int modeCount = currentProfile->modeCount();
248 switch(suffix){
249 case MODE_PREV_WRAP:
250 mode--;
251 if(mode < 0)
252 mode = modeCount - 1;
253 break;
254 case MODE_NEXT_WRAP:
255 mode++;
256 if(mode >= modeCount)
257 mode = 0;
258 break;
259 case MODE_PREV:
260 mode--;
261 break;
262 case MODE_NEXT:
263 mode++;
264 break;
265 default:
266 // Absolute
267 mode = suffix;
268 break;
269 }
270 if(mode < 0 || mode >= modeCount)
271 return;
272 device->setCurrentMode(currentProfile->modes()[mode]);
273 } else if(prefix == "$dpi"){
274 KbPerf* perf = bind->perf();
275 int level = parts[1].split("+")[0].toInt();
276 switch(level){
277 case DPI_UP:
278 if(!down)
279 return;
280 perf->dpiUp();
281 break;
282 case DPI_DOWN:
283 if(!down)
284 return;
285 perf->dpiDown();
286 break;
287 case DPI_SNIPER:
288 if(down)

Callers

nothing calls this directly

Calls 15

devParentMethod · 0.80
currentProfileMethod · 0.80
modeCountMethod · 0.80
modesMethod · 0.80
dpiUpMethod · 0.80
dpiDownMethod · 0.80
pushSniperMethod · 0.80
popDpiMethod · 0.80
winLockMethod · 0.80
findAnimMethod · 0.80
isActiveMethod · 0.80
triggerMethod · 0.80

Tested by

no test coverage detected