diff options
author | fluxgen <fluxgen> | 2002-01-04 21:21:43 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-01-04 21:21:43 (GMT) |
commit | bec0065e4a5a4d0c487bd47ec208b9d30a7b9399 (patch) | |
tree | 916d78b2c52f6f4241d7a50ece648e96d16e0ea9 /src/Tab.cc | |
parent | 502f1a959cf14691097d2fcdefc5afdcf8e706d5 (diff) | |
download | fluxbox_pavel-bec0065e4a5a4d0c487bd47ec208b9d30a7b9399.zip fluxbox_pavel-bec0065e4a5a4d0c487bd47ec208b9d30a7b9399.tar.bz2 |
pekdon patch
Diffstat (limited to 'src/Tab.cc')
-rw-r--r-- | src/Tab.cc | 120 |
1 files changed, 64 insertions, 56 deletions
@@ -110,13 +110,12 @@ void Tab::createTabWindow() { | |||
110 | XGrabButton(m_display, Button1, Mod1Mask, m_tabwin, True, | 110 | XGrabButton(m_display, Button1, Mod1Mask, m_tabwin, True, |
111 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 111 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
112 | GrabModeAsync, None, Fluxbox::instance()->getMoveCursor()); | 112 | GrabModeAsync, None, Fluxbox::instance()->getMoveCursor()); |
113 | 113 | ||
114 | |||
115 | //save to tabsearch | 114 | //save to tabsearch |
116 | Fluxbox::instance()->saveTabSearch(m_tabwin, this); | 115 | Fluxbox::instance()->saveTabSearch(m_tabwin, this); |
117 | 116 | ||
118 | XMapSubwindows(m_display, m_tabwin); | 117 | XMapSubwindows(m_display, m_tabwin); |
119 | 118 | ||
120 | XMapWindow(m_display, m_tabwin); | 119 | XMapWindow(m_display, m_tabwin); |
121 | 120 | ||
122 | decorate(); | 121 | decorate(); |
@@ -155,12 +154,13 @@ void Tab::raise() { | |||
155 | m_win->getScreen()->raiseWindows(&first->m_tabwin, 1); | 154 | m_win->getScreen()->raiseWindows(&first->m_tabwin, 1); |
156 | } | 155 | } |
157 | 156 | ||
158 | //-------------- decorate -------------------- | 157 | //-------------- loadTheme ----------------- |
159 | // decorates the tab with current theme | 158 | // loads the texture with the correct |
159 | // width and height, this is necessary in | ||
160 | // vertical and relative tab modes | ||
160 | // TODO optimize this | 161 | // TODO optimize this |
161 | //-------------------------------------------- | 162 | //------------------------------------------ |
162 | void Tab::decorate() { | 163 | void Tab::loadTheme() { |
163 | |||
164 | BImageControl *image_ctrl = m_win->getScreen()->getImageControl(); | 164 | BImageControl *image_ctrl = m_win->getScreen()->getImageControl(); |
165 | Pixmap tmp = m_focus_pm; | 165 | Pixmap tmp = m_focus_pm; |
166 | BTexture *texture = &(m_win->getScreen()->getWindowStyle()->tab.l_focus); | 166 | BTexture *texture = &(m_win->getScreen()->getWindowStyle()->tab.l_focus); |
@@ -206,18 +206,24 @@ void Tab::decorate() { | |||
206 | } | 206 | } |
207 | 207 | ||
208 | if (tmp) image_ctrl->removeImage(tmp); | 208 | if (tmp) image_ctrl->removeImage(tmp); |
209 | 209 | } | |
210 | |||
211 | //-------------- decorate -------------------- | ||
212 | // decorates the tab with current theme | ||
213 | //-------------------------------------------- | ||
214 | void Tab::decorate() { | ||
215 | loadTheme(); | ||
216 | |||
210 | XSetWindowBorderWidth(m_display, m_tabwin, | 217 | XSetWindowBorderWidth(m_display, m_tabwin, |
211 | m_win->getScreen()->getWindowStyle()->tab.border_width); | 218 | m_win->getScreen()->getWindowStyle()->tab.border_width); |
212 | XSetWindowBorder(m_display, m_tabwin, | 219 | XSetWindowBorder(m_display, m_tabwin, |
213 | m_win->getScreen()->getWindowStyle()->tab.border_color.getPixel()); | 220 | m_win->getScreen()->getWindowStyle()->tab.border_color.getPixel()); |
214 | } | 221 | } |
215 | 222 | ||
216 | 223 | //-------------- deiconify ----------------- | |
217 | //-------------- deiconify ------------------- | ||
218 | // Deiconifies the tab | 224 | // Deiconifies the tab |
219 | // Used from FluxboxWindow to deiconify the tab when the window is deiconfied | 225 | // Used from FluxboxWindow to deiconify the tab when the window is deiconfied |
220 | //-------------------------------------------- | 226 | //------------------------------------------ |
221 | void Tab::deiconify() { | 227 | void Tab::deiconify() { |
222 | XMapWindow(m_display, m_tabwin); | 228 | XMapWindow(m_display, m_tabwin); |
223 | } | 229 | } |
@@ -386,6 +392,7 @@ void Tab::setPosition() { | |||
386 | if (m_win->isShaded()) | 392 | if (m_win->isShaded()) |
387 | pos_y = m_win->frame.y + m_win->getTitleHeight() + | 393 | pos_y = m_win->frame.y + m_win->getTitleHeight() + |
388 | m_win->getScreen()->getBorderWidth2x(); | 394 | m_win->getScreen()->getBorderWidth2x(); |
395 | |||
389 | else | 396 | else |
390 | pos_y = m_win->frame.y + m_win->getHeight() + | 397 | pos_y = m_win->frame.y + m_win->getHeight() + |
391 | m_win->getScreen()->getBorderWidth2x(); | 398 | m_win->getScreen()->getBorderWidth2x(); |
@@ -585,70 +592,63 @@ void Tab::buttonReleaseEvent(XButtonEvent *be) { | |||
585 | be->x_root, be->y_root, &dest_x, &dest_y, &child)) { | 592 | be->x_root, be->y_root, &dest_x, &dest_y, &child)) { |
586 | 593 | ||
587 | Tab *tab = 0; | 594 | Tab *tab = 0; |
595 | FluxboxWindow *win = 0; | ||
588 | //search tablist for a tabwindow | 596 | //search tablist for a tabwindow |
589 | if ((tab = Fluxbox::instance()->searchTab(child))!=0) { | 597 | if (((tab = Fluxbox::instance()->searchTab(child))!=0) || |
598 | (m_win->getScreen()->isSloppyWindowGrouping() && | ||
599 | ((win = Fluxbox::instance()->searchWindow(child))!=0) && | ||
600 | (tab = win->getTab())!=0)) { | ||
601 | |||
602 | if (tab == this) // inserting ourself to ourself causes a disconnect | ||
603 | return; | ||
604 | |||
590 | // do only attach a hole chain if we dropped the | 605 | // do only attach a hole chain if we dropped the |
591 | // first tab in the dropped chain... | 606 | // first tab in the dropped chain... |
592 | |||
593 | if (m_prev) | 607 | if (m_prev) |
594 | disconnect(); | 608 | disconnect(); |
595 | 609 | ||
596 | // attach this tabwindow chain to the tabwindow chain we found. | 610 | // attach this tabwindow chain to the tabwindow chain we found. |
597 | tab->insert(this); | 611 | tab->insert(this); |
598 | 612 | ||
599 | } else { | 613 | } else { |
600 | disconnect(); | 614 | disconnect(); |
601 | 615 | ||
616 | // convinience | ||
617 | unsigned short int placement = m_win->getScreen()->getTabPlacement(); | ||
618 | |||
602 | // (ab)using dest_x and dest_y | 619 | // (ab)using dest_x and dest_y |
603 | switch(m_win->getScreen()->getTabPlacement()) { | 620 | dest_x = be->x_root; |
604 | case PTop: | 621 | dest_y = be->y_root; |
605 | dest_x = be->x_root; | 622 | |
606 | dest_y = be->y_root; | 623 | if (placement == PTop || placement == PBottom || m_win->isShaded()) { |
607 | switch(m_win->getScreen()->getTabAlignment()) { | 624 | if (placement == PBottom && !m_win->isShaded()) |
608 | case ACenter: | 625 | dest_y -= m_win->frame.height; |
609 | dest_x -= (m_win->frame.width / 2) - (m_size_w / 2); | 626 | else if (placement != PTop && m_win->isShaded()) |
610 | break; | 627 | dest_y -= m_win->getTitleHeight(); |
611 | case ARight: | 628 | else // PTop |
612 | dest_x -= m_win->frame.width - m_size_w; | 629 | dest_y += m_win->getTitleHeight(); |
613 | break; | 630 | |
614 | } | 631 | switch(m_win->getScreen()->getTabAlignment()) { |
615 | break; | ||
616 | case PBottom: | ||
617 | dest_x = be->x_root; | ||
618 | dest_y = be->y_root - m_win->frame.height; | ||
619 | switch(m_win->getScreen()->getTabAlignment()) { | ||
620 | case ACenter: | 632 | case ACenter: |
621 | dest_x -= (m_win->frame.width / 2) - (m_size_w / 2); | 633 | dest_x -= (m_win->frame.width / 2) - (m_size_w / 2); |
622 | break; | 634 | break; |
623 | case ARight: | 635 | case ARight: |
624 | dest_x -= m_win->frame.width - m_size_w; | 636 | dest_x -= m_win->frame.width - m_size_w; |
625 | break; | ||
626 | } | ||
627 | break; | ||
628 | case PLeft: | ||
629 | dest_x = be->x_root; | ||
630 | dest_y = be->y_root; | ||
631 | switch(m_win->getScreen()->getTabAlignment()) { | ||
632 | case ACenter: | ||
633 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); | ||
634 | break; | 637 | break; |
635 | case ALeft: | 638 | } |
636 | dest_y -= m_win->frame.height - m_size_h; | 639 | |
637 | break; | 640 | } else { // PLeft & PRight |
638 | } | 641 | if (placement == PRight) |
639 | break; | ||
640 | case PRight: | ||
641 | dest_x = be->x_root - m_win->frame.width; | 642 | dest_x = be->x_root - m_win->frame.width; |
642 | dest_y = be->y_root; | 643 | |
643 | switch(m_win->getScreen()->getTabAlignment()) { | 644 | switch(m_win->getScreen()->getTabAlignment()) { |
644 | case ACenter: | 645 | case ACenter: |
645 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); | 646 | dest_y -= (m_win->frame.height / 2) - (m_size_h / 2); |
646 | break; | 647 | break; |
647 | case ALeft: | 648 | case ALeft: |
648 | dest_y -= m_win->frame.height - m_size_h; | 649 | dest_y -= m_win->frame.height - m_size_h; |
649 | break; | 650 | break; |
650 | } | 651 | } |
651 | break; | ||
652 | } | 652 | } |
653 | //TODO: this causes an calculate increase event, even if we | 653 | //TODO: this causes an calculate increase event, even if we |
654 | // only are moving a window | 654 | // only are moving a window |
@@ -778,8 +778,8 @@ Tab *Tab::getFirst(Tab *current) { | |||
778 | return i; | 778 | return i; |
779 | } | 779 | } |
780 | 780 | ||
781 | //-------------- getFirst() --------- | 781 | //-------------- getLast() --------- |
782 | // Returns the first Tab in the chain | 782 | // Returns the last Tab in the chain |
783 | // of currentchain. | 783 | // of currentchain. |
784 | //----------------------------------- | 784 | //----------------------------------- |
785 | Tab *Tab::getLast(Tab *current) { | 785 | Tab *Tab::getLast(Tab *current) { |
@@ -918,11 +918,15 @@ void Tab::disconnect() { | |||
918 | // Sets Tab width _including_ borders | 918 | // Sets Tab width _including_ borders |
919 | // --------------------------------------- | 919 | // --------------------------------------- |
920 | void Tab::setTabWidth(unsigned int w) { | 920 | void Tab::setTabWidth(unsigned int w) { |
921 | if (w > m_win->getScreen()->getWindowStyle()->tab.border_width_2x) { | 921 | if (w > m_win->getScreen()->getWindowStyle()->tab.border_width_2x && |
922 | w != m_size_w) { | ||
922 | m_size_w = w; | 923 | m_size_w = w; |
923 | XResizeWindow(m_display, m_tabwin, | 924 | XResizeWindow(m_display, m_tabwin, |
924 | m_size_w - m_win->getScreen()->getWindowStyle()->tab.border_width_2x, | 925 | m_size_w - m_win->getScreen()->getWindowStyle()->tab.border_width_2x, |
925 | m_size_h - m_win->getScreen()->getWindowStyle()->tab.border_width_2x); | 926 | m_size_h - m_win->getScreen()->getWindowStyle()->tab.border_width_2x); |
927 | |||
928 | loadTheme(); // rerender themes to right size | ||
929 | focus(); // redraw the window | ||
926 | } | 930 | } |
927 | } | 931 | } |
928 | 932 | ||
@@ -930,11 +934,15 @@ void Tab::setTabWidth(unsigned int w) { | |||
930 | // Sets Tab height _including_ borders | 934 | // Sets Tab height _including_ borders |
931 | // --------------------------------------- | 935 | // --------------------------------------- |
932 | void Tab::setTabHeight(unsigned int h) { | 936 | void Tab::setTabHeight(unsigned int h) { |
933 | if (h > m_win->getScreen()->getWindowStyle()->tab.border_width_2x) { | 937 | if (h > m_win->getScreen()->getWindowStyle()->tab.border_width_2x && |
938 | h != m_size_h) { | ||
934 | m_size_h = h; | 939 | m_size_h = h; |
935 | XResizeWindow(m_display, m_tabwin, | 940 | XResizeWindow(m_display, m_tabwin, |
936 | m_size_w - m_win->getScreen()->getWindowStyle()->tab.border_width_2x, | 941 | m_size_w - m_win->getScreen()->getWindowStyle()->tab.border_width_2x, |
937 | m_size_h - m_win->getScreen()->getWindowStyle()->tab.border_width_2x); | 942 | m_size_h - m_win->getScreen()->getWindowStyle()->tab.border_width_2x); |
943 | |||
944 | loadTheme(); // rerender themes to right size | ||
945 | focus(); // redraw the window | ||
938 | } | 946 | } |
939 | } | 947 | } |
940 | 948 | ||