summaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc80
1 files changed, 34 insertions, 46 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 320bd62..2101e0d 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.186 2003/05/24 13:02:49 fluxgen Exp $ 25// $Id: Window.cc,v 1.187 2003/05/26 04:24:24 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -502,7 +502,7 @@ void FluxboxWindow::init() {
502 502
503 grabButtons(); 503 grabButtons();
504 504
505 positionWindows(); 505 applyDecorations();
506 506
507 if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) 507 if (m_workspace_number < 0 || m_workspace_number >= screen().getCount())
508 m_workspace_number = screen().currentWorkspaceID(); 508 m_workspace_number = screen().currentWorkspaceID();
@@ -839,10 +839,10 @@ void FluxboxWindow::grabButtons() {
839 839
840 840
841void FluxboxWindow::reconfigure() { 841void FluxboxWindow::reconfigure() {
842 842
843 upsize(); 843 upsize();
844 844
845 positionWindows(); 845 applyDecorations();
846 846
847 setFocusFlag(focused); 847 setFocusFlag(focused);
848 848
@@ -856,32 +856,6 @@ void FluxboxWindow::reconfigure() {
856 856
857} 857}
858 858
859
860void FluxboxWindow::positionWindows() {
861
862 frame().window().setBorderWidth(screen().rootTheme().borderWidth());
863 frame().clientArea().setBorderWidth(0); // client area bordered by other things
864
865 frame().titlebar().setBorderWidth(screen().rootTheme().borderWidth());
866 if (decorations.titlebar) {
867 frame().showTitlebar();
868 } else {
869 frame().hideTitlebar();
870 }
871
872 frame().handle().setBorderWidth(screen().rootTheme().borderWidth());
873 frame().gripLeft().setBorderWidth(screen().rootTheme().borderWidth());
874 frame().gripRight().setBorderWidth(screen().rootTheme().borderWidth());
875
876 if (decorations.handle)
877 frame().showHandle();
878 else
879 frame().hideHandle();
880
881 frame().reconfigure();
882
883}
884
885/// update current client title and title in our frame 859/// update current client title and title in our frame
886void FluxboxWindow::updateTitleFromClient() { 860void FluxboxWindow::updateTitleFromClient() {
887 861
@@ -1026,12 +1000,12 @@ void FluxboxWindow::getMWMHints() {
1026 Atom atom_return; 1000 Atom atom_return;
1027 unsigned long num, len; 1001 unsigned long num, len;
1028 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); 1002 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
1029 if (!m_client->property(motif_wm_hints, 0, 1003 if (!(m_client->property(motif_wm_hints, 0,
1030 PropMwmHintsElements, false, 1004 PropMwmHintsElements, false,
1031 motif_wm_hints, &atom_return, 1005 motif_wm_hints, &atom_return,
1032 &format, &num, &len, 1006 &format, &num, &len,
1033 (unsigned char **) &m_client->mwm_hint) == Success && 1007 (unsigned char **) &m_client->mwm_hint) &&
1034 m_client->mwm_hint) { 1008 m_client->mwm_hint)) {
1035 return; 1009 return;
1036 } 1010 }
1037 if (num != static_cast<unsigned int>(PropMwmHintsElements)) 1011 if (num != static_cast<unsigned int>(PropMwmHintsElements))
@@ -1182,18 +1156,18 @@ bool FluxboxWindow::setInputFocus() {
1182 //TODO hint skip focus 1156 //TODO hint skip focus
1183 if (((signed) (frame().x() + frame().width())) < 0) { 1157 if (((signed) (frame().x() + frame().width())) < 0) {
1184 if (((signed) (frame().y() + frame().height())) < 0) { 1158 if (((signed) (frame().y() + frame().height())) < 0) {
1185 moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), 1159 moveResize(frame().window().borderWidth(), frame().window().borderWidth(),
1186 frame().width(), frame().height()); 1160 frame().width(), frame().height());
1187 } else if (frame().y() > (signed) screen().height()) { 1161 } else if (frame().y() > (signed) screen().height()) {
1188 moveResize(screen().rootTheme().borderWidth(), screen().height() - frame().height(), 1162 moveResize(frame().window().borderWidth(), screen().height() - frame().height(),
1189 frame().width(), frame().height()); 1163 frame().width(), frame().height());
1190 } else { 1164 } else {
1191 moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), 1165 moveResize(frame().window().borderWidth(), frame().y() + frame().window().borderWidth(),
1192 frame().width(), frame().height()); 1166 frame().width(), frame().height());
1193 } 1167 }
1194 } else if (frame().x() > (signed) screen().width()) { 1168 } else if (frame().x() > (signed) screen().width()) {
1195 if (((signed) (frame().y() + frame().height())) < 0) { 1169 if (((signed) (frame().y() + frame().height())) < 0) {
1196 moveResize(screen().width() - frame().width(), screen().rootTheme().borderWidth(), 1170 moveResize(screen().width() - frame().width(), frame().window().borderWidth(),
1197 frame().width(), frame().height()); 1171 frame().width(), frame().height());
1198 } else if (frame().y() > (signed) screen().height()) { 1172 } else if (frame().y() > (signed) screen().height()) {
1199 moveResize(screen().width() - frame().width(), 1173 moveResize(screen().width() - frame().width(),
@@ -1201,7 +1175,7 @@ bool FluxboxWindow::setInputFocus() {
1201 frame().width(), frame().height()); 1175 frame().width(), frame().height());
1202 } else { 1176 } else {
1203 moveResize(screen().width() - frame().width(), 1177 moveResize(screen().width() - frame().width(),
1204 frame().y() + screen().rootTheme().borderWidth(), 1178 frame().y() + frame().window().borderWidth(),
1205 frame().width(), frame().height()); 1179 frame().width(), frame().height());
1206 } 1180 }
1207 } 1181 }
@@ -2360,8 +2334,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2360 raise(); 2334 raise();
2361 XAllowEvents(display, ReplayPointer, be.time); 2335 XAllowEvents(display, ReplayPointer, be.time);
2362 } else { 2336 } else {
2363 m_button_grab_x = be.x_root - frame().x() - screen().rootTheme().borderWidth(); 2337 m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth();
2364 m_button_grab_y = be.y_root - frame().y() - screen().rootTheme().borderWidth(); 2338 m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth();
2365 } 2339 }
2366 2340
2367 if (m_windowmenu.isVisible()) 2341 if (m_windowmenu.isVisible())
@@ -2398,7 +2372,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2398 if (Fluxbox::instance()->getIgnoreBorder() 2372 if (Fluxbox::instance()->getIgnoreBorder()
2399 && !(me.state & Mod1Mask) // really should check for exact matches 2373 && !(me.state & Mod1Mask) // really should check for exact matches
2400 && !(isMoving() || isResizing())) { 2374 && !(isMoving() || isResizing())) {
2401 int borderw = screen().rootTheme().borderWidth(); 2375 int borderw = frame().window().borderWidth();
2402 if (me.x_root < (frame().x() + borderw) || 2376 if (me.x_root < (frame().x() + borderw) ||
2403 me.y_root < (frame().y() + borderw) || 2377 me.y_root < (frame().y() + borderw) ||
2404 me.x_root > (frame().x() + (int)frame().width() + borderw) || 2378 me.x_root > (frame().x() + (int)frame().width() + borderw) ||
@@ -2430,8 +2404,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2430 int dx = me.x_root - m_button_grab_x, 2404 int dx = me.x_root - m_button_grab_x,
2431 dy = me.y_root - m_button_grab_y; 2405 dy = me.y_root - m_button_grab_y;
2432 2406
2433 dx -= screen().rootTheme().borderWidth(); 2407 dx -= frame().window().borderWidth();
2434 dy -= screen().rootTheme().borderWidth(); 2408 dy -= frame().window().borderWidth();
2435 2409
2436 // Warp to next or previous workspace?, must have moved sideways some 2410 // Warp to next or previous workspace?, must have moved sideways some
2437 int moved_x = me.x_root - m_last_resize_x; 2411 int moved_x = me.x_root - m_last_resize_x;
@@ -2561,8 +2535,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2561 // so we update drag'n'drop-rectangle 2535 // so we update drag'n'drop-rectangle
2562 int dx = me.x_root - 1, dy = me.y_root - 1; 2536 int dx = me.x_root - 1, dy = me.y_root - 1;
2563 2537
2564 dx -= screen().rootTheme().borderWidth(); 2538 dx -= frame().window().borderWidth();
2565 dy -= screen().rootTheme().borderWidth(); 2539 dy -= frame().window().borderWidth();
2566 2540
2567 if (screen().getEdgeSnapThreshold()) { 2541 if (screen().getEdgeSnapThreshold()) {
2568 int drx = screen().width() - (dx + 1); 2542 int drx = screen().width() - (dx + 1);
@@ -2699,6 +2673,21 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
2699 2673
2700// commit current decoration values to actual displayed things 2674// commit current decoration values to actual displayed things
2701void FluxboxWindow::applyDecorations() { 2675void FluxboxWindow::applyDecorations() {
2676 frame().clientArea().setBorderWidth(0); // client area bordered by other things
2677
2678 unsigned int borderW = 0;
2679 if (decorations.border)
2680 borderW = screen().rootTheme().borderWidth();
2681
2682 if (frame().window().borderWidth() != borderW) {
2683 frame().window().setBorderWidth(borderW);
2684 frame().titlebar().setBorderWidth(borderW);
2685 frame().handle().setBorderWidth(borderW);
2686 frame().gripLeft().setBorderWidth(borderW);
2687 frame().gripRight().setBorderWidth(borderW);
2688 frame().reconfigure();
2689 }
2690
2702 // we rely on frame not doing anything if it is already shown/hidden 2691 // we rely on frame not doing anything if it is already shown/hidden
2703 if (decorations.titlebar) 2692 if (decorations.titlebar)
2704 frame().showTitlebar(); 2693 frame().showTitlebar();
@@ -2710,7 +2699,6 @@ void FluxboxWindow::applyDecorations() {
2710 else 2699 else
2711 frame().hideHandle(); 2700 frame().hideHandle();
2712 2701
2713 // is reconfigure needed here?
2714} 2702}
2715 2703
2716void FluxboxWindow::toggleDecoration() { 2704void FluxboxWindow::toggleDecoration() {