diff options
Diffstat (limited to 'src/Slit.cc')
-rw-r--r-- | src/Slit.cc | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index 19cce1a..ef16c2f 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -42,8 +42,7 @@ | |||
42 | #include <algorithm> | 42 | #include <algorithm> |
43 | 43 | ||
44 | 44 | ||
45 | Slit::Slit(BScreen *scr) { | 45 | Slit::Slit(BScreen *scr):screen(scr), timer(this), slitmenu(this) { |
46 | screen = scr; | ||
47 | fluxbox = Fluxbox::instance(); | 46 | fluxbox = Fluxbox::instance(); |
48 | 47 | ||
49 | on_top = screen->isSlitOnTop(); | 48 | on_top = screen->isSlitOnTop(); |
@@ -52,11 +51,9 @@ Slit::Slit(BScreen *scr) { | |||
52 | display = screen->getBaseDisplay()->getXDisplay(); | 51 | display = screen->getBaseDisplay()->getXDisplay(); |
53 | frame.window = frame.pixmap = None; | 52 | frame.window = frame.pixmap = None; |
54 | 53 | ||
55 | timer = new BTimer(fluxbox, this); | 54 | |
56 | timer->setTimeout(fluxbox->getAutoRaiseDelay()); | 55 | timer.setTimeout(fluxbox->getAutoRaiseDelay()); |
57 | timer->fireOnce(True); | 56 | timer.fireOnce(True); |
58 | |||
59 | slitmenu = new Slitmenu(this); | ||
60 | 57 | ||
61 | XSetWindowAttributes attrib; | 58 | XSetWindowAttributes attrib; |
62 | unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | | 59 | unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | |
@@ -86,10 +83,6 @@ Slit::Slit(BScreen *scr) { | |||
86 | Slit::~Slit() { | 83 | Slit::~Slit() { |
87 | fluxbox->grab(); | 84 | fluxbox->grab(); |
88 | 85 | ||
89 | delete timer; | ||
90 | |||
91 | delete slitmenu; | ||
92 | |||
93 | screen->getImageControl()->removeImage(frame.pixmap); | 86 | screen->getImageControl()->removeImage(frame.pixmap); |
94 | 87 | ||
95 | fluxbox->removeSlitSearch(frame.window); | 88 | fluxbox->removeSlitSearch(frame.window); |
@@ -406,7 +399,7 @@ void Slit::reconfigure(void) { | |||
406 | break; | 399 | break; |
407 | } | 400 | } |
408 | 401 | ||
409 | slitmenu->reconfigure(); | 402 | slitmenu.reconfigure(); |
410 | } | 403 | } |
411 | 404 | ||
412 | 405 | ||
@@ -550,26 +543,26 @@ void Slit::buttonPressEvent(XButtonEvent *e) { | |||
550 | } else if (e->button == Button2 && (! on_top)) { | 543 | } else if (e->button == Button2 && (! on_top)) { |
551 | XLowerWindow(display, frame.window); | 544 | XLowerWindow(display, frame.window); |
552 | } else if (e->button == Button3) { | 545 | } else if (e->button == Button3) { |
553 | if (! slitmenu->isVisible()) { | 546 | if (! slitmenu.isVisible()) { |
554 | int x, y; | 547 | int x, y; |
555 | 548 | ||
556 | x = e->x_root - (slitmenu->getWidth() / 2); | 549 | x = e->x_root - (slitmenu.getWidth() / 2); |
557 | y = e->y_root - (slitmenu->getHeight() / 2); | 550 | y = e->y_root - (slitmenu.getHeight() / 2); |
558 | 551 | ||
559 | if (x < 0) | 552 | if (x < 0) |
560 | x = 0; | 553 | x = 0; |
561 | else if (x + slitmenu->getWidth() > screen->getWidth()) | 554 | else if (x + slitmenu.getWidth() > screen->getWidth()) |
562 | x = screen->getWidth() - slitmenu->getWidth(); | 555 | x = screen->getWidth() - slitmenu.getWidth(); |
563 | 556 | ||
564 | if (y < 0) | 557 | if (y < 0) |
565 | y = 0; | 558 | y = 0; |
566 | else if (y + slitmenu->getHeight() > screen->getHeight()) | 559 | else if (y + slitmenu.getHeight() > screen->getHeight()) |
567 | y = screen->getHeight() - slitmenu->getHeight(); | 560 | y = screen->getHeight() - slitmenu.getHeight(); |
568 | 561 | ||
569 | slitmenu->move(x, y); | 562 | slitmenu.move(x, y); |
570 | slitmenu->show(); | 563 | slitmenu.show(); |
571 | } else | 564 | } else |
572 | slitmenu->hide(); | 565 | slitmenu.hide(); |
573 | } | 566 | } |
574 | } | 567 | } |
575 | 568 | ||
@@ -579,9 +572,9 @@ void Slit::enterNotifyEvent(XCrossingEvent *) { | |||
579 | return; | 572 | return; |
580 | 573 | ||
581 | if (hidden) { | 574 | if (hidden) { |
582 | if (! timer->isTiming()) timer->start(); | 575 | if (! timer.isTiming()) timer.start(); |
583 | } else { | 576 | } else { |
584 | if (timer->isTiming()) timer->stop(); | 577 | if (timer.isTiming()) timer.stop(); |
585 | } | 578 | } |
586 | } | 579 | } |
587 | 580 | ||
@@ -591,9 +584,9 @@ void Slit::leaveNotifyEvent(XCrossingEvent *) { | |||
591 | return; | 584 | return; |
592 | 585 | ||
593 | if (hidden) { | 586 | if (hidden) { |
594 | if (timer->isTiming()) timer->stop(); | 587 | if (timer.isTiming()) timer.stop(); |
595 | } else if (! slitmenu->isVisible()) { | 588 | } else if (! slitmenu.isVisible()) { |
596 | if (! timer->isTiming()) timer->start(); | 589 | if (! timer.isTiming()) timer.start(); |
597 | } | 590 | } |
598 | } | 591 | } |
599 | 592 | ||