aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-01-05 22:41:21 (GMT)
committerfluxgen <fluxgen>2003-01-05 22:41:21 (GMT)
commit9195cea6e7536f9bd59e6105c169945c4c5eff0b (patch)
tree9efad51064cf724eda78e24697965c2a67e150dc
parentf61ff3329e53ce7cfd80c881fc5846af9a37a485 (diff)
downloadfluxbox_paul-9195cea6e7536f9bd59e6105c169945c4c5eff0b.zip
fluxbox_paul-9195cea6e7536f9bd59e6105c169945c4c5eff0b.tar.bz2
adjusted for fluxboxwindow referens events, updated fbwin configure to moveresize, moved creation of fluxboxwindow object to BScreen
-rw-r--r--src/fluxbox.cc178
1 files changed, 84 insertions, 94 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 00caa3b..4a8bb0c 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.87 2002/12/09 22:21:00 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.88 2003/01/05 22:41:21 fluxgen Exp $
26 26
27 27
28#include "fluxbox.hh" 28#include "fluxbox.hh"
@@ -561,7 +561,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
561 if ((masked == e->xany.window) && masked_window && 561 if ((masked == e->xany.window) && masked_window &&
562 (e->type == MotionNotify)) { 562 (e->type == MotionNotify)) {
563 last_time = e->xmotion.time; 563 last_time = e->xmotion.time;
564 masked_window->motionNotifyEvent(&e->xmotion); 564 masked_window->motionNotifyEvent(e->xmotion);
565 565
566 return; 566 return;
567 } 567 }
@@ -582,7 +582,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
582#endif // SLIT 582#endif // SLIT
583 583
584 if ((win = searchWindow(e->xconfigurerequest.window))) { 584 if ((win = searchWindow(e->xconfigurerequest.window))) {
585 win->configureRequestEvent(&e->xconfigurerequest); 585 win->configureRequestEvent(e->xconfigurerequest);
586 586
587#ifdef SLIT 587#ifdef SLIT
588 } else if ((slit = searchSlit(e->xconfigurerequest.window))) { 588 } else if ((slit = searchSlit(e->xconfigurerequest.window))) {
@@ -612,83 +612,76 @@ void Fluxbox::handleEvent(XEvent * const e) {
612 612
613 } 613 }
614 break; 614 break;
615 case MapRequest: 615 case MapRequest: {
616 {
617#ifdef DEBUG 616#ifdef DEBUG
618 fprintf(stderr, 617 cerr<<"MapRequest for 0x"<<hex<<e->xmaprequest.window<<dec<<endl;
619 I18n::instance()->
620 getMessage(
621 FBNLS::blackboxSet, FBNLS::blackboxMapRequest,
622 "Fluxbox::process_event(): MapRequest for 0x%lx\n"),
623 e->xmaprequest.window);
624#endif // DEBUG 618#endif // DEBUG
625 619
626#ifdef SLIT 620#ifdef SLIT
627#ifdef KDE 621#ifdef KDE
628 //Check and see if client is KDE dock applet. 622 //Check and see if client is KDE dock applet.
629 //If so add to Slit 623 //If so add to Slit
630 bool iskdedockapp = false; 624 bool iskdedockapp = false;
631 Atom ajunk; 625 Atom ajunk;
632 int ijunk; 626 int ijunk;
633 unsigned long *data = (unsigned long *) 0, uljunk; 627 unsigned long *data = (unsigned long *) 0, uljunk;
634 628
635 // Check if KDE v2.x dock applet 629 // Check if KDE v2.x dock applet
636 if (XGetWindowProperty(getXDisplay(), e->xmaprequest.window, 630 if (XGetWindowProperty(getXDisplay(), e->xmaprequest.window,
637 getKWM2DockwindowAtom(), 0l, 1l, False, 631 getKWM2DockwindowAtom(), 0l, 1l, False,
638 XA_WINDOW, &ajunk, &ijunk, &uljunk, 632 XA_WINDOW, &ajunk, &ijunk, &uljunk,
639 &uljunk, (unsigned char **) &data) == Success) { 633 &uljunk, (unsigned char **) &data) == Success) {
640 634
641 if (data) 635 if (data)
642 iskdedockapp = True; 636 iskdedockapp = True;
643 XFree((char *) data); 637 XFree((char *) data);
644 638
645 } 639 }
646 640
647 // Check if KDE v1.x dock applet 641 // Check if KDE v1.x dock applet
648 if (!iskdedockapp) { 642 if (!iskdedockapp) {
649 if (XGetWindowProperty(getXDisplay(), e->xmaprequest.window, 643 if (XGetWindowProperty(getXDisplay(), e->xmaprequest.window,
650 getKWM1DockwindowAtom(), 0l, 1l, False, 644 getKWM1DockwindowAtom(), 0l, 1l, False,
651 getKWM1DockwindowAtom(), &ajunk, &ijunk, &uljunk, 645 getKWM1DockwindowAtom(), &ajunk, &ijunk, &uljunk,
652 &uljunk, (unsigned char **) &data) == Success) { 646 &uljunk, (unsigned char **) &data) == Success) {
653 iskdedockapp = (data && data[0] != 0); 647 iskdedockapp = (data && data[0] != 0);
654 XFree((char *) data); 648 XFree((char *) data);
655 }
656 } 649 }
650 }
657 651
658 if (iskdedockapp) { 652 if (iskdedockapp) {
659 XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask); 653 XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask);
660 ScreenList::iterator it = screenList.begin(); 654 ScreenList::iterator it = screenList.begin();
661 for (; (*it) == screenList.back(); ++it) { 655 for (; (*it) == screenList.back(); ++it) {
662 (*it)->getSlit()->addClient(e->xmaprequest.window); 656 (*it)->getSlit()->addClient(e->xmaprequest.window);
663 }
664 return;
665 } 657 }
658 return;
659 }
666#endif //KDE 660#endif //KDE
667#endif // SLIT 661#endif // SLIT
668 662
669 FluxboxWindow *win = searchWindow(e->xmaprequest.window); 663 FluxboxWindow *win = searchWindow(e->xmaprequest.window);
670 664
671 if (! win) { 665 if (! win) {
672 win = new FluxboxWindow(e->xmaprequest.window); 666 //!!! TODO
673 if (!win->isManaged()) { 667 BScreen *scr = searchScreen(e->xmaprequest.parent);
674 delete win; 668 cerr<<"screen = "<<scr<<endl;
675 win = 0; 669 if (scr != 0)
676 } else { 670 scr->createWindow(e->xmaprequest.window);
677 // attach signals 671 else
678 attachSignals(*win); 672 cerr<<"Fluxbox Warning! Could not find screen to map window on!"<<endl;
679 } 673 }
680 }
681 674
682 if ((win = searchWindow(e->xmaprequest.window))) 675 if ((win = searchWindow(e->xmaprequest.window)))
683 win->mapRequestEvent(&e->xmaprequest); 676 win->mapRequestEvent(e->xmaprequest);
684 677
685 } 678 }
686 break; 679 break;
687 case MapNotify: 680 case MapNotify:
688 { 681 {
689 FluxboxWindow *win = searchWindow(e->xmap.window); 682 FluxboxWindow *win = searchWindow(e->xmap.window);
690 if (win != 0) 683 if (win != 0)
691 win->mapNotifyEvent(&e->xmap); 684 win->mapNotifyEvent(e->xmap);
692 685
693 } 686 }
694 break; 687 break;
@@ -706,12 +699,10 @@ void Fluxbox::handleEvent(XEvent * const e) {
706 Slit *slit = 0; 699 Slit *slit = 0;
707#endif // SLIT 700#endif // SLIT
708 701
709 if ((win = searchWindow(e->xdestroywindow.window))) { 702 if ((win = searchWindow(e->xdestroywindow.window)) && win->getClientWindow() == e->xdestroywindow.window) {
710 if (win->destroyNotifyEvent(&e->xdestroywindow)) { 703 win->destroyNotifyEvent(e->xdestroywindow);
711 delete win; 704 removeWindowSearch(win->getClientWindow());
712 win = 0; 705 delete win;
713 }
714
715 } 706 }
716#ifdef SLIT 707#ifdef SLIT
717 else if ((slit = searchSlit(e->xdestroywindow.window))) { 708 else if ((slit = searchSlit(e->xdestroywindow.window))) {
@@ -729,7 +720,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
729 Tab *tab = 0; 720 Tab *tab = 0;
730 721
731 if ((win = searchWindow(e->xmotion.window)) !=0) 722 if ((win = searchWindow(e->xmotion.window)) !=0)
732 win->motionNotifyEvent(&e->xmotion); 723 win->motionNotifyEvent(e->xmotion);
733 else if ((tab = searchTab(e->xmotion.window)) !=0) 724 else if ((tab = searchTab(e->xmotion.window)) !=0)
734 tab->motionNotifyEvent(&e->xmotion); 725 tab->motionNotifyEvent(&e->xmotion);
735 726
@@ -829,7 +820,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
829 Tab *tab = 0; 820 Tab *tab = 0;
830 821
831 if ((win = searchWindow(e->xexpose.window))) 822 if ((win = searchWindow(e->xexpose.window)))
832 win->exposeEvent(&e->xexpose); 823 win->exposeEvent(e->xexpose);
833 else if ((tab = searchTab(e->xexpose.window))) 824 else if ((tab = searchTab(e->xexpose.window)))
834 tab->exposeEvent(&e->xexpose); 825 tab->exposeEvent(&e->xexpose);
835 } 826 }
@@ -891,7 +882,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
891 882
892 if ((win = searchWindow(be.window))) { 883 if ((win = searchWindow(be.window))) {
893 884
894 win->buttonPressEvent(&be); 885 win->buttonPressEvent(be);
895 886
896 if (be.button == 1) 887 if (be.button == 1)
897 win->installColormap(True); 888 win->installColormap(True);
@@ -997,7 +988,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
997 Tab *tab = 0; 988 Tab *tab = 0;
998 989
999 if ((win = searchWindow(be.window))) 990 if ((win = searchWindow(be.window)))
1000 win->buttonReleaseEvent(&be); 991 win->buttonReleaseEvent(be);
1001 else if ((tab = searchTab(be.window))) 992 else if ((tab = searchTab(be.window)))
1002 tab->buttonReleaseEvent(&be); 993 tab->buttonReleaseEvent(&be);
1003 } 994 }
@@ -1022,10 +1013,12 @@ void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
1022 1013
1023 if ((win = searchWindow(ue.window)) != 0) { 1014 if ((win = searchWindow(ue.window)) != 0) {
1024 1015
1025 if (win->unmapNotifyEvent(&ue)) { 1016 win->unmapNotifyEvent(ue);
1026 delete win; 1017 if (win->getClientWindow() == ue.window) {
1027 if (focused_window == win) // some extra checking 1018 if (win == focused_window)
1028 focused_window = 0; 1019 focused_window = 0;
1020 removeWindowSearch(win->getClientWindow());
1021 delete win;
1029 win = 0; 1022 win = 0;
1030 } 1023 }
1031 1024
@@ -1091,7 +1084,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
1091 net.workspace = ce.data.l[2]; 1084 net.workspace = ce.data.l[2];
1092 net.stack = ce.data.l[3]; 1085 net.stack = ce.data.l[3];
1093 net.decoration = static_cast<int>(ce.data.l[4]); 1086 net.decoration = static_cast<int>(ce.data.l[4]);
1094 win->changeBlackboxHints(&net); 1087 win->changeBlackboxHints(net);
1095 } 1088 }
1096 } else { 1089 } else {
1097 FluxboxWindow *win = searchWindow(ce.window); 1090 FluxboxWindow *win = searchWindow(ce.window);
@@ -1391,66 +1384,66 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
1391 focused_window->getTab()->shade(); 1384 focused_window->getTab()->shade();
1392 break; 1385 break;
1393 case Keys::MAXIMIZE: 1386 case Keys::MAXIMIZE:
1394 focused_window->maximize(0); 1387 focused_window->maximize();
1395 break; 1388 break;
1396 case Keys::STICK: 1389 case Keys::STICK:
1397 focused_window->stick(); 1390 focused_window->stick();
1398 break; 1391 break;
1399 case Keys::VERTMAX: 1392 case Keys::VERTMAX:
1400 if (focused_window->isResizable()) 1393 if (focused_window->isResizable())
1401 focused_window->maximize(2); // maximize vertically, done with mouse2 1394 focused_window->maximizeVertical();
1402 break; 1395 break;
1403 case Keys::HORIZMAX: 1396 case Keys::HORIZMAX:
1404 if (focused_window->isResizable()) 1397 if (focused_window->isResizable())
1405 focused_window->maximize(3); // maximize horisontally, done with mouse3 1398 focused_window->maximizeHorizontal();
1406 break; 1399 break;
1407 case Keys::NUDGERIGHT: 1400 case Keys::NUDGERIGHT:
1408 focused_window->configure( 1401 focused_window->moveResize(
1409 focused_window->getXFrame()+param, focused_window->getYFrame(), 1402 focused_window->getXFrame()+param, focused_window->getYFrame(),
1410 focused_window->getWidth(), focused_window->getHeight()); 1403 focused_window->getWidth(), focused_window->getHeight());
1411 break; 1404 break;
1412 case Keys::NUDGELEFT: 1405 case Keys::NUDGELEFT:
1413 focused_window->configure( 1406 focused_window->moveResize(
1414 focused_window->getXFrame()-param, focused_window->getYFrame(), 1407 focused_window->getXFrame()-param, focused_window->getYFrame(),
1415 focused_window->getWidth(), focused_window->getHeight()); 1408 focused_window->getWidth(), focused_window->getHeight());
1416 break; 1409 break;
1417 case Keys::NUDGEUP: 1410 case Keys::NUDGEUP:
1418 focused_window->configure( 1411 focused_window->moveResize(
1419 focused_window->getXFrame(), focused_window->getYFrame()-param, 1412 focused_window->getXFrame(), focused_window->getYFrame()-param,
1420 focused_window->getWidth(), focused_window->getHeight()); 1413 focused_window->getWidth(), focused_window->getHeight());
1421 break; 1414 break;
1422 case Keys::NUDGEDOWN: 1415 case Keys::NUDGEDOWN:
1423 focused_window->configure( 1416 focused_window->moveResize(
1424 focused_window->getXFrame(), focused_window->getYFrame()+param, 1417 focused_window->getXFrame(), focused_window->getYFrame()+param,
1425 focused_window->getWidth(), focused_window->getHeight()); 1418 focused_window->getWidth(), focused_window->getHeight());
1426 break; 1419 break;
1427 // NOTE !!! BIGNUDGExxxx is not needed, just use 10 as a parameter 1420 // NOTE !!! BIGNUDGExxxx is not needed, just use 10 as a parameter
1428 case Keys::BIGNUDGERIGHT: 1421 case Keys::BIGNUDGERIGHT:
1429 focused_window->configure( 1422 focused_window->moveResize(
1430 focused_window->getXFrame()+10, focused_window->getYFrame(), 1423 focused_window->getXFrame()+10, focused_window->getYFrame(),
1431 focused_window->getWidth(), focused_window->getHeight()); 1424 focused_window->getWidth(), focused_window->getHeight());
1432 break; 1425 break;
1433 case Keys::BIGNUDGELEFT: 1426 case Keys::BIGNUDGELEFT:
1434 focused_window->configure( 1427 focused_window->moveResize(
1435 focused_window->getXFrame()-10, focused_window->getYFrame(), 1428 focused_window->getXFrame()-10, focused_window->getYFrame(),
1436 focused_window->getWidth(), focused_window->getHeight()); 1429 focused_window->getWidth(), focused_window->getHeight());
1437 break; 1430 break;
1438 case Keys::BIGNUDGEUP: 1431 case Keys::BIGNUDGEUP:
1439 focused_window->configure( 1432 focused_window->moveResize(
1440 focused_window->getXFrame(), focused_window->getYFrame()-10, 1433 focused_window->getXFrame(), focused_window->getYFrame()-10,
1441 focused_window->getWidth(), focused_window->getHeight()); 1434 focused_window->getWidth(), focused_window->getHeight());
1442 break; 1435 break;
1443 case Keys::BIGNUDGEDOWN: 1436 case Keys::BIGNUDGEDOWN:
1444 focused_window->configure( 1437 focused_window->moveResize(
1445 focused_window->getXFrame(), focused_window->getYFrame()+10, 1438 focused_window->getXFrame(), focused_window->getYFrame()+10,
1446 focused_window->getWidth(), focused_window->getHeight()); 1439 focused_window->getWidth(), focused_window->getHeight());
1447 break; 1440 break;
1448 case Keys::HORIZINC: 1441 case Keys::HORIZINC:
1449 if (focused_window->isResizable()) 1442 focused_window->moveResize(
1450 focused_window->configure(
1451 focused_window->getXFrame(), focused_window->getYFrame(), 1443 focused_window->getXFrame(), focused_window->getYFrame(),
1452 focused_window->getWidth()+10, focused_window->getHeight()); 1444 focused_window->getWidth()+10, focused_window->getHeight());
1453 1445
1446
1454 if (focused_window->hasTab() && 1447 if (focused_window->hasTab() &&
1455 (t_placement == Tab::PTOP || t_placement == Tab::PBOTTOM)) { 1448 (t_placement == Tab::PTOP || t_placement == Tab::PBOTTOM)) {
1456 if (t_alignment == Tab::ARELATIVE) 1449 if (t_alignment == Tab::ARELATIVE)
@@ -1460,8 +1453,7 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
1460 } 1453 }
1461 break; 1454 break;
1462 case Keys::VERTINC: 1455 case Keys::VERTINC:
1463 if (focused_window->isResizable()) 1456 focused_window->moveResize(
1464 focused_window->configure(
1465 focused_window->getXFrame(), focused_window->getYFrame(), 1457 focused_window->getXFrame(), focused_window->getYFrame(),
1466 focused_window->getWidth(), focused_window->getHeight()+10); 1458 focused_window->getWidth(), focused_window->getHeight()+10);
1467 1459
@@ -1474,8 +1466,7 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
1474 } 1466 }
1475 break; 1467 break;
1476 case Keys::HORIZDEC: 1468 case Keys::HORIZDEC:
1477 if (focused_window->isResizable()) 1469 focused_window->moveResize(
1478 focused_window->configure(
1479 focused_window->getXFrame(), focused_window->getYFrame(), 1470 focused_window->getXFrame(), focused_window->getYFrame(),
1480 focused_window->getWidth()-10, focused_window->getHeight()); 1471 focused_window->getWidth()-10, focused_window->getHeight());
1481 1472
@@ -1488,8 +1479,7 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
1488 } 1479 }
1489 break; 1480 break;
1490 case Keys::VERTDEC: 1481 case Keys::VERTDEC:
1491 if (focused_window->isResizable()) 1482 focused_window->moveResize(
1492 focused_window->configure(
1493 focused_window->getXFrame(), focused_window->getYFrame(), 1483 focused_window->getXFrame(), focused_window->getYFrame(),
1494 focused_window->getWidth(), focused_window->getHeight()-10); 1484 focused_window->getWidth(), focused_window->getHeight()-10);
1495 1485