diff options
Diffstat (limited to 'src/ClientPattern.cc')
-rw-r--r-- | src/ClientPattern.cc | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc index 71725fb..3802e59 100644 --- a/src/ClientPattern.cc +++ b/src/ClientPattern.cc | |||
@@ -373,7 +373,7 @@ bool ClientPattern::addTerm(const FbTk::FbString &str, WinProperty prop, bool ne | |||
373 | if (!term) | 373 | if (!term) |
374 | return rc; | 374 | return rc; |
375 | 375 | ||
376 | if (rc = !term->regexp.error()) { | 376 | if ((rc = !term->regexp.error())) { |
377 | m_terms.push_back(term); | 377 | m_terms.push_back(term); |
378 | } else { | 378 | } else { |
379 | delete term; | 379 | delete term; |
@@ -383,76 +383,84 @@ bool ClientPattern::addTerm(const FbTk::FbString &str, WinProperty prop, bool ne | |||
383 | } | 383 | } |
384 | 384 | ||
385 | FbTk::FbString ClientPattern::getProperty(WinProperty prop, const Focusable &client) { | 385 | FbTk::FbString ClientPattern::getProperty(WinProperty prop, const Focusable &client) { |
386 | |||
387 | FbTk::FbString result; | ||
388 | |||
386 | // we need this for some of the window properties | 389 | // we need this for some of the window properties |
387 | const FluxboxWindow *fbwin = client.fbwindow(); | 390 | const FluxboxWindow *fbwin = client.fbwindow(); |
388 | 391 | ||
389 | switch (prop) { | 392 | switch (prop) { |
390 | case TITLE: | 393 | case TITLE: |
391 | return client.title().logical(); | 394 | result = client.title().logical(); |
392 | break; | 395 | break; |
393 | case CLASS: | 396 | case CLASS: |
394 | return client.getWMClassClass(); | 397 | result = client.getWMClassClass(); |
395 | break; | ||
396 | case NAME: | ||
397 | return client.getWMClassName(); | ||
398 | break; | 398 | break; |
399 | case ROLE: | 399 | case ROLE: |
400 | return client.getWMRole(); | 400 | result = client.getWMRole(); |
401 | break; | 401 | break; |
402 | case TRANSIENT: | 402 | case TRANSIENT: |
403 | return client.isTransient() ? "yes" : "no"; | 403 | result = client.isTransient() ? "yes" : "no"; |
404 | break; | 404 | break; |
405 | case MAXIMIZED: | 405 | case MAXIMIZED: |
406 | return (fbwin && fbwin->isMaximized()) ? "yes" : "no"; | 406 | result = (fbwin && fbwin->isMaximized()) ? "yes" : "no"; |
407 | break; | 407 | break; |
408 | case MINIMIZED: | 408 | case MINIMIZED: |
409 | return (fbwin && fbwin->isIconic()) ? "yes" : "no"; | 409 | result = (fbwin && fbwin->isIconic()) ? "yes" : "no"; |
410 | break; | 410 | break; |
411 | case SHADED: | 411 | case SHADED: |
412 | return (fbwin && fbwin->isShaded()) ? "yes" : "no"; | 412 | result = (fbwin && fbwin->isShaded()) ? "yes" : "no"; |
413 | break; | 413 | break; |
414 | case STUCK: | 414 | case STUCK: |
415 | return (fbwin && fbwin->isStuck()) ? "yes" : "no"; | 415 | result = (fbwin && fbwin->isStuck()) ? "yes" : "no"; |
416 | break; | 416 | break; |
417 | case FOCUSHIDDEN: | 417 | case FOCUSHIDDEN: |
418 | return (fbwin && fbwin->isFocusHidden()) ? "yes" : "no"; | 418 | result = (fbwin && fbwin->isFocusHidden()) ? "yes" : "no"; |
419 | break; | 419 | break; |
420 | case ICONHIDDEN: | 420 | case ICONHIDDEN: |
421 | return (fbwin && fbwin->isIconHidden()) ? "yes" : "no"; | 421 | result = (fbwin && fbwin->isIconHidden()) ? "yes" : "no"; |
422 | break; | 422 | break; |
423 | case WORKSPACE: { | 423 | case WORKSPACE: { |
424 | unsigned int wsnum = (fbwin ? fbwin->workspaceNumber() : client.screen().currentWorkspaceID()); | 424 | unsigned int wsnum = (fbwin ? fbwin->workspaceNumber() : client.screen().currentWorkspaceID()); |
425 | return FbTk::StringUtil::number2String(wsnum); | 425 | result = FbTk::StringUtil::number2String(wsnum); |
426 | break; | 426 | break; |
427 | } | 427 | } |
428 | case WORKSPACENAME: { | 428 | case WORKSPACENAME: { |
429 | const Workspace *w = (fbwin ? | 429 | const Workspace *w = (fbwin ? |
430 | client.screen().getWorkspace(fbwin->workspaceNumber()) : | 430 | client.screen().getWorkspace(fbwin->workspaceNumber()) : |
431 | client.screen().currentWorkspace()); | 431 | client.screen().currentWorkspace()); |
432 | return w ? w->name() : ""; | 432 | if (w) { |
433 | result = w->name(); | ||
434 | } | ||
433 | break; | 435 | break; |
434 | } | 436 | } |
435 | case HEAD: { | 437 | case HEAD: |
436 | if (!fbwin) | 438 | if (fbwin) { |
437 | return ""; | 439 | result = FbTk::StringUtil::number2String(client.screen().getHead(fbwin->fbWindow())); |
438 | int head = client.screen().getHead(fbwin->fbWindow()); | 440 | } |
439 | return FbTk::StringUtil::number2String(head); | ||
440 | break; | 441 | break; |
441 | } | ||
442 | case LAYER: | 442 | case LAYER: |
443 | return fbwin ? ::Layer::getString(fbwin->layerNum()) : ""; | 443 | if (fbwin) { |
444 | result = ::Layer::getString(fbwin->layerNum()); | ||
445 | } | ||
444 | break; | 446 | break; |
445 | case URGENT: | 447 | case URGENT: |
446 | return Fluxbox::instance()->attentionHandler() | 448 | result = Fluxbox::instance()->attentionHandler() |
447 | .isDemandingAttention(client) ? "yes" : "no"; | 449 | .isDemandingAttention(client) ? "yes" : "no"; |
448 | break; | 450 | break; |
449 | case SCREEN: { | 451 | case SCREEN: |
450 | int screenId = client.screen().screenNumber(); | 452 | result = FbTk::StringUtil::number2String(client.screen().screenNumber()); |
451 | return FbTk::StringUtil::number2String(screenId); | 453 | break; |
454 | |||
455 | case XPROP: | ||
456 | break; | ||
457 | |||
458 | case NAME: | ||
459 | default: | ||
460 | result = client.getWMClassName(); | ||
452 | break; | 461 | break; |
453 | } | 462 | } |
454 | } | 463 | return result; |
455 | return client.getWMClassName(); | ||
456 | } | 464 | } |
457 | 465 | ||
458 | bool ClientPattern::operator ==(const ClientPattern &pat) const { | 466 | bool ClientPattern::operator ==(const ClientPattern &pat) const { |