diff options
author | mathias <mathias> | 2006-10-27 06:57:43 (GMT) |
---|---|---|
committer | mathias <mathias> | 2006-10-27 06:57:43 (GMT) |
commit | 10082d821d6691f42a8d8ad6fa2e42e5b3f44edd (patch) | |
tree | 99c94a6105cf35612307e307be343eda2aea8baf /src/FbWinFrame.cc | |
parent | 34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8 (diff) | |
download | fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.zip fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.tar.bz2 |
cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 158 |
1 files changed, 80 insertions, 78 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 869d34e..b966134 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -43,9 +43,11 @@ | |||
43 | #include <X11/X.h> | 43 | #include <X11/X.h> |
44 | 44 | ||
45 | #include <iostream> | 45 | #include <iostream> |
46 | using namespace std; // mem_fun | ||
47 | 46 | ||
48 | FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | 47 | using std::mem_fun; |
48 | using std::string; | ||
49 | |||
50 | FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | ||
49 | FbTk::XLayer &layer, | 51 | FbTk::XLayer &layer, |
50 | int x, int y, | 52 | int x, int y, |
51 | unsigned int width, unsigned int height): | 53 | unsigned int width, unsigned int height): |
@@ -55,7 +57,7 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr | |||
55 | m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask | | 57 | m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask | |
56 | ButtonMotionMask | EnterWindowMask, true), | 58 | ButtonMotionMask | EnterWindowMask, true), |
57 | m_layeritem(window(), layer), | 59 | m_layeritem(window(), layer), |
58 | m_titlebar(m_window, 0, 0, 100, 16, | 60 | m_titlebar(m_window, 0, 0, 100, 16, |
59 | ButtonPressMask | ButtonReleaseMask | | 61 | ButtonPressMask | ButtonReleaseMask | |
60 | ButtonMotionMask | ExposureMask | | 62 | ButtonMotionMask | ExposureMask | |
61 | EnterWindowMask | LeaveWindowMask), | 63 | EnterWindowMask | LeaveWindowMask), |
@@ -78,8 +80,8 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr | |||
78 | ButtonMotionMask | ExposureMask | | 80 | ButtonMotionMask | ExposureMask | |
79 | EnterWindowMask | LeaveWindowMask), | 81 | EnterWindowMask | LeaveWindowMask), |
80 | m_bevel(1), | 82 | m_bevel(1), |
81 | m_use_titlebar(true), | 83 | m_use_titlebar(true), |
82 | m_use_tabs(true), | 84 | m_use_tabs(true), |
83 | m_use_handle(true), | 85 | m_use_handle(true), |
84 | m_focused(false), | 86 | m_focused(false), |
85 | m_visible(false), | 87 | m_visible(false), |
@@ -104,7 +106,7 @@ FbWinFrame::~FbWinFrame() { | |||
104 | removeAllButtons(); | 106 | removeAllButtons(); |
105 | } | 107 | } |
106 | 108 | ||
107 | bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mousebutton_num, | 109 | bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mousebutton_num, |
108 | bool double_click, bool pressed) { | 110 | bool double_click, bool pressed) { |
109 | // find mousebutton_num | 111 | // find mousebutton_num |
110 | if (mousebutton_num < 1 || mousebutton_num > 5) | 112 | if (mousebutton_num < 1 || mousebutton_num > 5) |
@@ -127,7 +129,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { | |||
127 | 129 | ||
128 | bool ret = true; | 130 | bool ret = true; |
129 | 131 | ||
130 | // setting tabmode to notset forces it through when | 132 | // setting tabmode to notset forces it through when |
131 | // something is likely to change | 133 | // something is likely to change |
132 | if (tabmode == NOTSET) | 134 | if (tabmode == NOTSET) |
133 | tabmode = m_tabmode; | 135 | tabmode = m_tabmode; |
@@ -183,7 +185,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { | |||
183 | 185 | ||
184 | m_tab_container.raise(); | 186 | m_tab_container.raise(); |
185 | m_tab_container.show(); | 187 | m_tab_container.show(); |
186 | 188 | ||
187 | if (!m_use_tabs) | 189 | if (!m_use_tabs) |
188 | ret = false; | 190 | ret = false; |
189 | 191 | ||
@@ -234,7 +236,7 @@ void FbWinFrame::shade() { | |||
234 | alignTabs(); | 236 | alignTabs(); |
235 | // need to update our shape | 237 | // need to update our shape |
236 | if ( m_shape.get() ) | 238 | if ( m_shape.get() ) |
237 | m_shape->update(); | 239 | m_shape->update(); |
238 | } else { // should be unshaded | 240 | } else { // should be unshaded |
239 | m_window.resize(m_width_before_shade, m_height_before_shade); | 241 | m_window.resize(m_width_before_shade, m_height_before_shade); |
240 | reconfigure(); | 242 | reconfigure(); |
@@ -251,10 +253,10 @@ void FbWinFrame::resize(unsigned int width, unsigned int height) { | |||
251 | } | 253 | } |
252 | 254 | ||
253 | // need an atomic moveresize where possible | 255 | // need an atomic moveresize where possible |
254 | void FbWinFrame::moveResizeForClient(int x, int y, | 256 | void FbWinFrame::moveResizeForClient(int x, int y, |
255 | unsigned int width, unsigned int height, | 257 | unsigned int width, unsigned int height, |
256 | int win_gravity, | 258 | int win_gravity, |
257 | unsigned int client_bw, | 259 | unsigned int client_bw, |
258 | bool move, bool resize) { | 260 | bool move, bool resize) { |
259 | // total height for frame | 261 | // total height for frame |
260 | 262 | ||
@@ -266,16 +268,16 @@ void FbWinFrame::moveResizeForClient(int x, int y, | |||
266 | moveResize(x, y, width, height, move, resize); | 268 | moveResize(x, y, width, height, move, resize); |
267 | } | 269 | } |
268 | 270 | ||
269 | void FbWinFrame::resizeForClient(unsigned int width, unsigned int height, | 271 | void FbWinFrame::resizeForClient(unsigned int width, unsigned int height, |
270 | int win_gravity, unsigned int client_bw) { | 272 | int win_gravity, unsigned int client_bw) { |
271 | moveResizeForClient(0, 0, width, height, win_gravity, client_bw, false, true); | 273 | moveResizeForClient(0, 0, width, height, win_gravity, client_bw, false, true); |
272 | } | 274 | } |
273 | 275 | ||
274 | void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height, bool move, bool resize) { | 276 | void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height, bool move, bool resize) { |
275 | if (move && x == window().x() && y == window().y()) | 277 | if (move && x == window().x() && y == window().y()) |
276 | move = false; | 278 | move = false; |
277 | 279 | ||
278 | if (resize && width == FbWinFrame::width() && height == FbWinFrame::height()) | 280 | if (resize && width == FbWinFrame::width() && height == FbWinFrame::height()) |
279 | resize = false; | 281 | resize = false; |
280 | 282 | ||
281 | if (!move && !resize) | 283 | if (!move && !resize) |
@@ -320,11 +322,11 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh | |||
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
323 | void FbWinFrame::quietMoveResize(int x, int y, | 325 | void FbWinFrame::quietMoveResize(int x, int y, |
324 | unsigned int width, unsigned int height) { | 326 | unsigned int width, unsigned int height) { |
325 | m_window.moveResize(x, y, width, height); | 327 | m_window.moveResize(x, y, width, height); |
326 | if (m_tabmode == EXTERNAL) { | 328 | if (m_tabmode == EXTERNAL) { |
327 | 329 | ||
328 | switch(m_screen.getTabPlacement()) { | 330 | switch(m_screen.getTabPlacement()) { |
329 | case LEFTTOP: | 331 | case LEFTTOP: |
330 | case RIGHTTOP: | 332 | case RIGHTTOP: |
@@ -444,7 +446,7 @@ void FbWinFrame::alignTabs() { | |||
444 | void FbWinFrame::notifyMoved(bool clear) { | 446 | void FbWinFrame::notifyMoved(bool clear) { |
445 | // not important if no alpha... | 447 | // not important if no alpha... |
446 | unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); | 448 | unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); |
447 | if (alpha == 255) | 449 | if (alpha == 255) |
448 | return; | 450 | return; |
449 | 451 | ||
450 | if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) { | 452 | if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) { |
@@ -516,7 +518,7 @@ void FbWinFrame::setFocus(bool newvalue) { | |||
516 | 518 | ||
517 | if (currentLabel()) { | 519 | if (currentLabel()) { |
518 | if (newvalue) // focused | 520 | if (newvalue) // focused |
519 | applyFocusLabel(*m_current_label); | 521 | applyFocusLabel(*m_current_label); |
520 | else // unfocused | 522 | else // unfocused |
521 | applyActiveLabel(*m_current_label); | 523 | applyActiveLabel(*m_current_label); |
522 | } | 524 | } |
@@ -536,7 +538,7 @@ void FbWinFrame::addLeftButton(FbTk::Button *btn) { | |||
536 | return; | 538 | return; |
537 | 539 | ||
538 | applyButton(*btn); // setup theme and other stuff | 540 | applyButton(*btn); // setup theme and other stuff |
539 | 541 | ||
540 | m_buttons_left.push_back(btn); | 542 | m_buttons_left.push_back(btn); |
541 | } | 543 | } |
542 | 544 | ||
@@ -562,7 +564,7 @@ void FbWinFrame::removeAllButtons() { | |||
562 | } | 564 | } |
563 | } | 565 | } |
564 | 566 | ||
565 | FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Command *command, | 567 | FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *command, |
566 | int tabs_padding) { | 568 | int tabs_padding) { |
567 | FbTk::TextButton *button = new FbTk::TextButton(m_tab_container, | 569 | FbTk::TextButton *button = new FbTk::TextButton(m_tab_container, |
568 | theme().font(), | 570 | theme().font(), |
@@ -573,7 +575,7 @@ FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Comma | |||
573 | ButtonReleaseMask | ButtonMotionMask | | 575 | ButtonReleaseMask | ButtonMotionMask | |
574 | EnterWindowMask); | 576 | EnterWindowMask); |
575 | FbTk::EventManager::instance()->add(*button, button->window()); | 577 | FbTk::EventManager::instance()->add(*button, button->window()); |
576 | 578 | ||
577 | FbTk::RefCount<FbTk::Command> refcmd(command); | 579 | FbTk::RefCount<FbTk::Command> refcmd(command); |
578 | button->setOnClick(refcmd); | 580 | button->setOnClick(refcmd); |
579 | 581 | ||
@@ -681,7 +683,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { | |||
681 | win.setEventMask(NoEventMask); | 683 | win.setEventMask(NoEventMask); |
682 | win.reparent(m_window, 0, clientArea().y()); | 684 | win.reparent(m_window, 0, clientArea().y()); |
683 | // remask window so we get events | 685 | // remask window so we get events |
684 | win.setEventMask(PropertyChangeMask | StructureNotifyMask | | 686 | win.setEventMask(PropertyChangeMask | StructureNotifyMask | |
685 | FocusChangeMask); | 687 | FocusChangeMask); |
686 | 688 | ||
687 | m_window.setEventMask(ButtonPressMask | ButtonReleaseMask | | 689 | m_window.setEventMask(ButtonPressMask | ButtonReleaseMask | |
@@ -691,7 +693,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { | |||
691 | 693 | ||
692 | XSetWindowAttributes attrib_set; | 694 | XSetWindowAttributes attrib_set; |
693 | attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | FocusChangeMask; | 695 | attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | FocusChangeMask; |
694 | attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | | 696 | attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | |
695 | ButtonMotionMask; | 697 | ButtonMotionMask; |
696 | 698 | ||
697 | XChangeWindowAttributes(win.display(), win.window(), CWEventMask|CWDontPropagate, &attrib_set); | 699 | XChangeWindowAttributes(win.display(), win.window(), CWEventMask|CWDontPropagate, &attrib_set); |
@@ -852,7 +854,7 @@ void FbWinFrame::removeEventHandler() { | |||
852 | 854 | ||
853 | void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | 855 | void FbWinFrame::buttonPressEvent(XButtonEvent &event) { |
854 | // we can ignore which window the event was generated for | 856 | // we can ignore which window the event was generated for |
855 | if (event.window == m_label.window() && m_current_label) | 857 | if (event.window == m_label.window() && m_current_label) |
856 | event.window = m_current_label->window(); | 858 | event.window = m_current_label->window(); |
857 | 859 | ||
858 | m_tab_container.tryButtonPressEvent(event); | 860 | m_tab_container.tryButtonPressEvent(event); |
@@ -871,9 +873,9 @@ void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | |||
871 | 873 | ||
872 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { | 874 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { |
873 | // we can ignore which window the event was generated for | 875 | // we can ignore which window the event was generated for |
874 | if (event.window == m_label.window() && m_current_label) | 876 | if (event.window == m_label.window() && m_current_label) |
875 | event.window = m_current_label->window(); | 877 | event.window = m_current_label->window(); |
876 | 878 | ||
877 | // we continue even if a button got the event | 879 | // we continue even if a button got the event |
878 | m_tab_container.tryButtonReleaseEvent(event); | 880 | m_tab_container.tryButtonReleaseEvent(event); |
879 | 881 | ||
@@ -891,7 +893,7 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { | |||
891 | bool double_click = (event.time - last_release_time <= m_double_click_time); | 893 | bool double_click = (event.time - last_release_time <= m_double_click_time); |
892 | last_release_time = event.time; | 894 | last_release_time = event.time; |
893 | int real_button = event.button - 1; | 895 | int real_button = event.button - 1; |
894 | 896 | ||
895 | if (double_click && *m_commands[real_button].double_click) | 897 | if (double_click && *m_commands[real_button].double_click) |
896 | m_commands[real_button].double_click->execute(); | 898 | m_commands[real_button].double_click->execute(); |
897 | else if (*m_commands[real_button].click) | 899 | else if (*m_commands[real_button].click) |
@@ -918,7 +920,7 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) { | |||
918 | return; | 920 | return; |
919 | 921 | ||
920 | // create compare function | 922 | // create compare function |
921 | // that we should use with find_if | 923 | // that we should use with find_if |
922 | FbTk::CompareEqual_base<FbTk::FbWindow, Window> compare(&FbTk::FbWindow::window, | 924 | FbTk::CompareEqual_base<FbTk::FbWindow, Window> compare(&FbTk::FbWindow::window, |
923 | event.window); | 925 | event.window); |
924 | 926 | ||
@@ -966,18 +968,18 @@ void FbWinFrame::reconfigure() { | |||
966 | m_window.resize(m_window.width(), m_window.height() - | 968 | m_window.resize(m_window.width(), m_window.height() - |
967 | orig_handle_h + theme().handleWidth()); | 969 | orig_handle_h + theme().handleWidth()); |
968 | 970 | ||
969 | handle().resize(handle().width(), | 971 | handle().resize(handle().width(), |
970 | theme().handleWidth()); | 972 | theme().handleWidth()); |
971 | gripLeft().resize(buttonHeight(), | 973 | gripLeft().resize(buttonHeight(), |
972 | theme().handleWidth()); | 974 | theme().handleWidth()); |
973 | gripRight().resize(gripLeft().width(), | 975 | gripRight().resize(gripLeft().width(), |
974 | gripLeft().height()); | 976 | gripLeft().height()); |
975 | 977 | ||
976 | // align titlebar and render it | 978 | // align titlebar and render it |
977 | if (m_use_titlebar) { | 979 | if (m_use_titlebar) { |
978 | reconfigureTitlebar(); | 980 | reconfigureTitlebar(); |
979 | m_titlebar.raise(); | 981 | m_titlebar.raise(); |
980 | } else | 982 | } else |
981 | m_titlebar.lower(); | 983 | m_titlebar.lower(); |
982 | 984 | ||
983 | if (m_tabmode == EXTERNAL) { | 985 | if (m_tabmode == EXTERNAL) { |
@@ -1009,7 +1011,7 @@ void FbWinFrame::reconfigure() { | |||
1009 | client_top += titlebar_height; | 1011 | client_top += titlebar_height; |
1010 | client_height -= titlebar_height; | 1012 | client_height -= titlebar_height; |
1011 | } | 1013 | } |
1012 | 1014 | ||
1013 | // align handle and grips | 1015 | // align handle and grips |
1014 | const int grip_height = m_handle.height(); | 1016 | const int grip_height = m_handle.height(); |
1015 | const int grip_width = 20; //TODO | 1017 | const int grip_width = 20; //TODO |
@@ -1111,35 +1113,35 @@ void FbWinFrame::reconfigureTitlebar() { | |||
1111 | 1113 | ||
1112 | int orig_height = m_titlebar.height(); | 1114 | int orig_height = m_titlebar.height(); |
1113 | // resize titlebar to window size with font height | 1115 | // resize titlebar to window size with font height |
1114 | int title_height = m_theme.font().height() == 0 ? 16 : | 1116 | int title_height = m_theme.font().height() == 0 ? 16 : |
1115 | m_theme.font().height() + m_bevel*2 + 2; | 1117 | m_theme.font().height() + m_bevel*2 + 2; |
1116 | if (m_theme.titleHeight() != 0) | 1118 | if (m_theme.titleHeight() != 0) |
1117 | title_height = m_theme.titleHeight(); | 1119 | title_height = m_theme.titleHeight(); |
1118 | 1120 | ||
1119 | // if the titlebar grows in size, make sure the whole window does too | 1121 | // if the titlebar grows in size, make sure the whole window does too |
1120 | if (orig_height != title_height) | 1122 | if (orig_height != title_height) |
1121 | m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); | 1123 | m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); |
1122 | m_titlebar.invalidateBackground(); | 1124 | m_titlebar.invalidateBackground(); |
1123 | m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), | 1125 | m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), |
1124 | m_window.width(), title_height); | 1126 | m_window.width(), title_height); |
1125 | 1127 | ||
1126 | // draw left buttons first | 1128 | // draw left buttons first |
1127 | unsigned int next_x = m_bevel; | 1129 | unsigned int next_x = m_bevel; |
1128 | unsigned int button_size = buttonHeight(); | 1130 | unsigned int button_size = buttonHeight(); |
1129 | m_button_size = button_size; | 1131 | m_button_size = button_size; |
1130 | for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) { | 1132 | for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) { |
1131 | // probably on theme reconfigure, leave bg alone for now | 1133 | // probably on theme reconfigure, leave bg alone for now |
1132 | m_buttons_left[i]->invalidateBackground(); | 1134 | m_buttons_left[i]->invalidateBackground(); |
1133 | m_buttons_left[i]->moveResize(next_x, m_bevel, | 1135 | m_buttons_left[i]->moveResize(next_x, m_bevel, |
1134 | button_size, button_size); | 1136 | button_size, button_size); |
1135 | } | 1137 | } |
1136 | 1138 | ||
1137 | next_x += m_bevel; | 1139 | next_x += m_bevel; |
1138 | 1140 | ||
1139 | // space left on titlebar between left and right buttons | 1141 | // space left on titlebar between left and right buttons |
1140 | int space_left = m_titlebar.width() - next_x; | 1142 | int space_left = m_titlebar.width() - next_x; |
1141 | 1143 | ||
1142 | if (!m_buttons_right.empty()) | 1144 | if (!m_buttons_right.empty()) |
1143 | space_left -= m_buttons_right.size() * (button_size + m_bevel); | 1145 | space_left -= m_buttons_right.size() * (button_size + m_bevel); |
1144 | 1146 | ||
1145 | space_left -= m_bevel; | 1147 | space_left -= m_bevel; |
@@ -1167,7 +1169,7 @@ void FbWinFrame::reconfigureTitlebar() { | |||
1167 | next_x += m_label.width() + m_bevel; | 1169 | next_x += m_label.width() + m_bevel; |
1168 | 1170 | ||
1169 | // finaly set new buttons to the right | 1171 | // finaly set new buttons to the right |
1170 | for (size_t i=0; i < m_buttons_right.size(); | 1172 | for (size_t i=0; i < m_buttons_right.size(); |
1171 | ++i, next_x += button_size + m_bevel) { | 1173 | ++i, next_x += button_size + m_bevel) { |
1172 | m_buttons_right[i]->invalidateBackground(); | 1174 | m_buttons_right[i]->invalidateBackground(); |
1173 | m_buttons_right[i]->moveResize(next_x, m_bevel, | 1175 | m_buttons_right[i]->moveResize(next_x, m_bevel, |
@@ -1201,21 +1203,21 @@ void FbWinFrame::renderTitlebar() { | |||
1201 | } | 1203 | } |
1202 | 1204 | ||
1203 | // render pixmaps | 1205 | // render pixmaps |
1204 | render(m_theme.titleFocusTexture(), m_title_focused_color, | 1206 | render(m_theme.titleFocusTexture(), m_title_focused_color, |
1205 | m_title_focused_pm, | 1207 | m_title_focused_pm, |
1206 | m_titlebar.width(), m_titlebar.height()); | 1208 | m_titlebar.width(), m_titlebar.height()); |
1207 | 1209 | ||
1208 | render(m_theme.titleUnfocusTexture(), m_title_unfocused_color, | 1210 | render(m_theme.titleUnfocusTexture(), m_title_unfocused_color, |
1209 | m_title_unfocused_pm, | 1211 | m_title_unfocused_pm, |
1210 | m_titlebar.width(), m_titlebar.height()); | 1212 | m_titlebar.width(), m_titlebar.height()); |
1211 | 1213 | ||
1212 | //!! TODO: don't render label if internal tabs | 1214 | //!! TODO: don't render label if internal tabs |
1213 | 1215 | ||
1214 | render(m_theme.labelFocusTexture(), m_label_focused_color, | 1216 | render(m_theme.labelFocusTexture(), m_label_focused_color, |
1215 | m_label_focused_pm, | 1217 | m_label_focused_pm, |
1216 | m_label.width(), m_label.height()); | 1218 | m_label.width(), m_label.height()); |
1217 | 1219 | ||
1218 | render(m_theme.labelUnfocusTexture(), m_label_unfocused_color, | 1220 | render(m_theme.labelUnfocusTexture(), m_label_unfocused_color, |
1219 | m_label_unfocused_pm, | 1221 | m_label_unfocused_pm, |
1220 | m_label.width(), m_label.height()); | 1222 | m_label.width(), m_label.height()); |
1221 | 1223 | ||
@@ -1235,23 +1237,23 @@ void FbWinFrame::renderTabContainer() { | |||
1235 | if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE) | 1237 | if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE) |
1236 | tc_unfocused = &m_theme.titleUnfocusTexture(); | 1238 | tc_unfocused = &m_theme.titleUnfocusTexture(); |
1237 | 1239 | ||
1238 | render(*tc_focused, m_tabcontainer_focused_color, | 1240 | render(*tc_focused, m_tabcontainer_focused_color, |
1239 | m_tabcontainer_focused_pm, | 1241 | m_tabcontainer_focused_pm, |
1240 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); | 1242 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); |
1241 | 1243 | ||
1242 | render(*tc_unfocused, m_tabcontainer_unfocused_color, | 1244 | render(*tc_unfocused, m_tabcontainer_unfocused_color, |
1243 | m_tabcontainer_unfocused_pm, | 1245 | m_tabcontainer_unfocused_pm, |
1244 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); | 1246 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); |
1245 | 1247 | ||
1246 | render(m_theme.labelFocusTexture(), m_labelbutton_focused_color, | 1248 | render(m_theme.labelFocusTexture(), m_labelbutton_focused_color, |
1247 | m_labelbutton_focused_pm, | 1249 | m_labelbutton_focused_pm, |
1248 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); | 1250 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); |
1249 | 1251 | ||
1250 | render(m_theme.labelUnfocusTexture(), m_labelbutton_unfocused_color, | 1252 | render(m_theme.labelUnfocusTexture(), m_labelbutton_unfocused_color, |
1251 | m_labelbutton_unfocused_pm, | 1253 | m_labelbutton_unfocused_pm, |
1252 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); | 1254 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); |
1253 | 1255 | ||
1254 | render(m_theme.labelActiveTexture(), m_labelbutton_active_color, | 1256 | render(m_theme.labelActiveTexture(), m_labelbutton_active_color, |
1255 | m_labelbutton_active_pm, | 1257 | m_labelbutton_active_pm, |
1256 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); | 1258 | m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); |
1257 | 1259 | ||
@@ -1263,7 +1265,7 @@ void FbWinFrame::applyTitlebar() { | |||
1263 | 1265 | ||
1264 | // set up pixmaps for titlebar windows | 1266 | // set up pixmaps for titlebar windows |
1265 | Pixmap label_pm = None; | 1267 | Pixmap label_pm = None; |
1266 | Pixmap title_pm = None; | 1268 | Pixmap title_pm = None; |
1267 | FbTk::Color label_color; | 1269 | FbTk::Color label_color; |
1268 | FbTk::Color title_color; | 1270 | FbTk::Color title_color; |
1269 | getCurrentFocusPixmap(label_pm, title_pm, | 1271 | getCurrentFocusPixmap(label_pm, title_pm, |
@@ -1301,18 +1303,18 @@ void FbWinFrame::renderHandles() { | |||
1301 | return; | 1303 | return; |
1302 | } | 1304 | } |
1303 | 1305 | ||
1304 | render(m_theme.handleFocusTexture(), m_handle_focused_color, | 1306 | render(m_theme.handleFocusTexture(), m_handle_focused_color, |
1305 | m_handle_focused_pm, | 1307 | m_handle_focused_pm, |
1306 | m_handle.width(), m_handle.height()); | 1308 | m_handle.width(), m_handle.height()); |
1307 | 1309 | ||
1308 | render(m_theme.handleUnfocusTexture(), m_handle_unfocused_color, | 1310 | render(m_theme.handleUnfocusTexture(), m_handle_unfocused_color, |
1309 | m_handle_unfocused_pm, | 1311 | m_handle_unfocused_pm, |
1310 | m_handle.width(), m_handle.height()); | 1312 | m_handle.width(), m_handle.height()); |
1311 | 1313 | ||
1312 | render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm, | 1314 | render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm, |
1313 | m_grip_left.width(), m_grip_left.height()); | 1315 | m_grip_left.width(), m_grip_left.height()); |
1314 | 1316 | ||
1315 | render(m_theme.gripUnfocusTexture(), m_grip_unfocused_color, | 1317 | render(m_theme.gripUnfocusTexture(), m_grip_unfocused_color, |
1316 | m_grip_unfocused_pm, | 1318 | m_grip_unfocused_pm, |
1317 | m_grip_left.width(), m_grip_left.height()); | 1319 | m_grip_left.width(), m_grip_left.height()); |
1318 | 1320 | ||
@@ -1339,7 +1341,7 @@ void FbWinFrame::applyHandles() { | |||
1339 | } else { | 1341 | } else { |
1340 | m_grip_left.setBackgroundColor(m_grip_focused_color); | 1342 | m_grip_left.setBackgroundColor(m_grip_focused_color); |
1341 | m_grip_right.setBackgroundColor(m_grip_focused_color); | 1343 | m_grip_right.setBackgroundColor(m_grip_focused_color); |
1342 | } | 1344 | } |
1343 | 1345 | ||
1344 | } else { | 1346 | } else { |
1345 | 1347 | ||
@@ -1347,7 +1349,7 @@ void FbWinFrame::applyHandles() { | |||
1347 | m_handle.setBackgroundPixmap(m_handle_unfocused_pm); | 1349 | m_handle.setBackgroundPixmap(m_handle_unfocused_pm); |
1348 | } else { | 1350 | } else { |
1349 | m_handle.setBackgroundColor(m_handle_unfocused_color); | 1351 | m_handle.setBackgroundColor(m_handle_unfocused_color); |
1350 | } | 1352 | } |
1351 | 1353 | ||
1352 | if (m_grip_unfocused_pm) { | 1354 | if (m_grip_unfocused_pm) { |
1353 | m_grip_left.setBackgroundPixmap(m_grip_unfocused_pm); | 1355 | m_grip_left.setBackgroundPixmap(m_grip_unfocused_pm); |
@@ -1355,7 +1357,7 @@ void FbWinFrame::applyHandles() { | |||
1355 | } else { | 1357 | } else { |
1356 | m_grip_left.setBackgroundColor(m_grip_unfocused_color); | 1358 | m_grip_left.setBackgroundColor(m_grip_unfocused_color); |
1357 | m_grip_right.setBackgroundColor(m_grip_unfocused_color); | 1359 | m_grip_right.setBackgroundColor(m_grip_unfocused_color); |
1358 | } | 1360 | } |
1359 | } | 1361 | } |
1360 | 1362 | ||
1361 | } | 1363 | } |
@@ -1367,15 +1369,15 @@ void FbWinFrame::renderButtons() { | |||
1367 | return; | 1369 | return; |
1368 | } | 1370 | } |
1369 | 1371 | ||
1370 | render(m_theme.buttonFocusTexture(), m_button_color, | 1372 | render(m_theme.buttonFocusTexture(), m_button_color, |
1371 | m_button_pm, | 1373 | m_button_pm, |
1372 | m_button_size, m_button_size); | 1374 | m_button_size, m_button_size); |
1373 | 1375 | ||
1374 | render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, | 1376 | render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, |
1375 | m_button_unfocused_pm, | 1377 | m_button_unfocused_pm, |
1376 | m_button_size, m_button_size); | 1378 | m_button_size, m_button_size); |
1377 | 1379 | ||
1378 | render(m_theme.buttonPressedTexture(), m_button_pressed_color, | 1380 | render(m_theme.buttonPressedTexture(), m_button_pressed_color, |
1379 | m_button_pressed_pm, | 1381 | m_button_pressed_pm, |
1380 | m_button_size, m_button_size); | 1382 | m_button_size, m_button_size); |
1381 | } | 1383 | } |
@@ -1477,7 +1479,7 @@ void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, | |||
1477 | pm = m_imagectrl.renderImage(w, h, tex, orient); | 1479 | pm = m_imagectrl.renderImage(w, h, tex, orient); |
1478 | } | 1480 | } |
1479 | 1481 | ||
1480 | if (tmp) | 1482 | if (tmp) |
1481 | m_imagectrl.removeImage(tmp); | 1483 | m_imagectrl.removeImage(tmp); |
1482 | 1484 | ||
1483 | } | 1485 | } |
@@ -1489,7 +1491,7 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | |||
1489 | label_pm = m_label_focused_pm; | 1491 | label_pm = m_label_focused_pm; |
1490 | else | 1492 | else |
1491 | label_color = m_label_focused_color; | 1493 | label_color = m_label_focused_color; |
1492 | 1494 | ||
1493 | if (m_title_focused_pm != 0) | 1495 | if (m_title_focused_pm != 0) |
1494 | title_pm = m_title_focused_pm; | 1496 | title_pm = m_title_focused_pm; |
1495 | else | 1497 | else |
@@ -1499,12 +1501,12 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, | |||
1499 | label_pm = m_label_unfocused_pm; | 1501 | label_pm = m_label_unfocused_pm; |
1500 | else | 1502 | else |
1501 | label_color = m_label_unfocused_color; | 1503 | label_color = m_label_unfocused_color; |
1502 | 1504 | ||
1503 | if (m_title_unfocused_pm != 0) | 1505 | if (m_title_unfocused_pm != 0) |
1504 | title_pm = m_title_unfocused_pm; | 1506 | title_pm = m_title_unfocused_pm; |
1505 | else | 1507 | else |
1506 | title_color = m_title_unfocused_color; | 1508 | title_color = m_title_unfocused_color; |
1507 | } | 1509 | } |
1508 | } | 1510 | } |
1509 | 1511 | ||
1510 | void FbWinFrame::applyTabContainer() { | 1512 | void FbWinFrame::applyTabContainer() { |
@@ -1553,11 +1555,11 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) { | |||
1553 | gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); | 1555 | gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); |
1554 | 1556 | ||
1555 | 1557 | ||
1556 | // we need to change the size of the window | 1558 | // we need to change the size of the window |
1557 | // if the border width changes... | 1559 | // if the border width changes... |
1558 | if (m_use_titlebar) | 1560 | if (m_use_titlebar) |
1559 | bw_changes += static_cast<signed>(border_width - titlebar().borderWidth()); | 1561 | bw_changes += static_cast<signed>(border_width - titlebar().borderWidth()); |
1560 | if (m_use_handle) | 1562 | if (m_use_handle) |
1561 | bw_changes += static_cast<signed>(border_width - handle().borderWidth()); | 1563 | bw_changes += static_cast<signed>(border_width - handle().borderWidth()); |
1562 | 1564 | ||
1563 | window().setBorderWidth(border_width); | 1565 | window().setBorderWidth(border_width); |
@@ -1662,7 +1664,7 @@ private: | |||
1662 | // this function translates its arguments according to win_gravity | 1664 | // this function translates its arguments according to win_gravity |
1663 | // if win_gravity is negative, it does an inverse translation | 1665 | // if win_gravity is negative, it does an inverse translation |
1664 | // This function should be used when a window is mapped/unmapped/pos configured | 1666 | // This function should be used when a window is mapped/unmapped/pos configured |
1665 | void FbWinFrame::gravityTranslate(int &x, int &y, | 1667 | void FbWinFrame::gravityTranslate(int &x, int &y, |
1666 | int win_gravity, unsigned int client_bw, bool move_frame) { | 1668 | int win_gravity, unsigned int client_bw, bool move_frame) { |
1667 | bool invert = false; | 1669 | bool invert = false; |
1668 | if (win_gravity < 0) { | 1670 | if (win_gravity < 0) { |
@@ -1670,18 +1672,18 @@ void FbWinFrame::gravityTranslate(int &x, int &y, | |||
1670 | win_gravity = -win_gravity; // make +ve | 1672 | win_gravity = -win_gravity; // make +ve |
1671 | } | 1673 | } |
1672 | 1674 | ||
1673 | /* Ok, so, gravity says which point of the frame is put where the | 1675 | /* Ok, so, gravity says which point of the frame is put where the |
1674 | * corresponding bit of window would have been | 1676 | * corresponding bit of window would have been |
1675 | * Thus, x,y always refers to where top left of the WINDOW would be placed | 1677 | * Thus, x,y always refers to where top left of the WINDOW would be placed |
1676 | * but given that we're wrapping it in a frame, we actually place | 1678 | * but given that we're wrapping it in a frame, we actually place |
1677 | * it so that the given reference point is in the same spot as the | 1679 | * it so that the given reference point is in the same spot as the |
1678 | * window's reference point would have been. | 1680 | * window's reference point would have been. |
1679 | * i.e. east gravity says that the centre of the right hand side of the | 1681 | * i.e. east gravity says that the centre of the right hand side of the |
1680 | * frame is placed where the centre of the rhs of the window would | 1682 | * frame is placed where the centre of the rhs of the window would |
1681 | * have been if there was no frame. | 1683 | * have been if there was no frame. |
1682 | * Hope that makes enough sense. | 1684 | * Hope that makes enough sense. |
1683 | * | 1685 | * |
1684 | * NOTE: the gravity calculations are INDEPENDENT of the client | 1686 | * NOTE: the gravity calculations are INDEPENDENT of the client |
1685 | * window width/height. | 1687 | * window width/height. |
1686 | * | 1688 | * |
1687 | * If you get confused with the calculations, draw a picture. | 1689 | * If you get confused with the calculations, draw a picture. |
@@ -1753,7 +1755,7 @@ void FbWinFrame::gravityTranslate(int &x, int &y, | |||
1753 | } | 1755 | } |
1754 | 1756 | ||
1755 | int FbWinFrame::widthOffset() const { | 1757 | int FbWinFrame::widthOffset() const { |
1756 | if (m_tabmode != EXTERNAL || !m_use_tabs) | 1758 | if (m_tabmode != EXTERNAL || !m_use_tabs) |
1757 | return 0; | 1759 | return 0; |
1758 | 1760 | ||
1759 | // same height offset for top and bottom tabs | 1761 | // same height offset for top and bottom tabs |
@@ -1771,7 +1773,7 @@ int FbWinFrame::widthOffset() const { | |||
1771 | } | 1773 | } |
1772 | 1774 | ||
1773 | int FbWinFrame::heightOffset() const { | 1775 | int FbWinFrame::heightOffset() const { |
1774 | if (m_tabmode != EXTERNAL || !m_use_tabs) | 1776 | if (m_tabmode != EXTERNAL || !m_use_tabs) |
1775 | return 0; | 1777 | return 0; |
1776 | 1778 | ||
1777 | switch (m_screen.getTabPlacement()) { | 1779 | switch (m_screen.getTabPlacement()) { |
@@ -1788,7 +1790,7 @@ int FbWinFrame::heightOffset() const { | |||
1788 | } | 1790 | } |
1789 | 1791 | ||
1790 | int FbWinFrame::xOffset() const { | 1792 | int FbWinFrame::xOffset() const { |
1791 | if (m_tabmode != EXTERNAL || !m_use_tabs) | 1793 | if (m_tabmode != EXTERNAL || !m_use_tabs) |
1792 | return 0; | 1794 | return 0; |
1793 | 1795 | ||
1794 | switch (m_screen.getTabPlacement()) { | 1796 | switch (m_screen.getTabPlacement()) { |
@@ -1803,7 +1805,7 @@ int FbWinFrame::xOffset() const { | |||
1803 | } | 1805 | } |
1804 | 1806 | ||
1805 | int FbWinFrame::yOffset() const { | 1807 | int FbWinFrame::yOffset() const { |
1806 | if (m_tabmode != EXTERNAL || !m_use_tabs) | 1808 | if (m_tabmode != EXTERNAL || !m_use_tabs) |
1807 | return 0; | 1809 | return 0; |
1808 | 1810 | ||
1809 | switch (m_screen.getTabPlacement()) { | 1811 | switch (m_screen.getTabPlacement()) { |