aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc73
1 files changed, 39 insertions, 34 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 15f7e0e..3cb6fcb 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.145 2003/04/25 09:07:09 rathnor Exp $ 25// $Id: Window.cc,v 1.146 2003/04/25 11:11:27 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -37,6 +37,8 @@
37#include "TextButton.hh" 37#include "TextButton.hh"
38#include "EventManager.hh" 38#include "EventManager.hh"
39#include "FbAtoms.hh" 39#include "FbAtoms.hh"
40#include "RootTheme.hh"
41#include "Workspace.hh"
40 42
41#ifdef HAVE_CONFIG_H 43#ifdef HAVE_CONFIG_H
42#include "config.h" 44#include "config.h"
@@ -773,19 +775,19 @@ void FluxboxWindow::reconfigure() {
773 775
774void FluxboxWindow::positionWindows() { 776void FluxboxWindow::positionWindows() {
775 777
776 m_frame.window().setBorderWidth(screen.getBorderWidth()); 778 m_frame.window().setBorderWidth(screen.rootTheme().borderWidth());
777 m_frame.clientArea().setBorderWidth(0); // client area bordered by other things 779 m_frame.clientArea().setBorderWidth(0); // client area bordered by other things
778 780
779 m_frame.titlebar().setBorderWidth(screen.getBorderWidth()); 781 m_frame.titlebar().setBorderWidth(screen.rootTheme().borderWidth());
780 if (decorations.titlebar) { 782 if (decorations.titlebar) {
781 m_frame.showTitlebar(); 783 m_frame.showTitlebar();
782 } else { 784 } else {
783 m_frame.hideTitlebar(); 785 m_frame.hideTitlebar();
784 } 786 }
785 787
786 m_frame.handle().setBorderWidth(screen.getBorderWidth()); 788 m_frame.handle().setBorderWidth(screen.rootTheme().borderWidth());
787 m_frame.gripLeft().setBorderWidth(screen.getBorderWidth()); 789 m_frame.gripLeft().setBorderWidth(screen.rootTheme().borderWidth());
788 m_frame.gripRight().setBorderWidth(screen.getBorderWidth()); 790 m_frame.gripRight().setBorderWidth(screen.rootTheme().borderWidth());
789 791
790 if (decorations.handle) 792 if (decorations.handle)
791 m_frame.showHandle(); 793 m_frame.showHandle();
@@ -1096,18 +1098,18 @@ bool FluxboxWindow::setInputFocus() {
1096 //TODO hint skip focus 1098 //TODO hint skip focus
1097 if (((signed) (m_frame.x() + m_frame.width())) < 0) { 1099 if (((signed) (m_frame.x() + m_frame.width())) < 0) {
1098 if (((signed) (m_frame.y() + m_frame.height())) < 0) { 1100 if (((signed) (m_frame.y() + m_frame.height())) < 0) {
1099 moveResize(screen.getBorderWidth(), screen.getBorderWidth(), 1101 moveResize(screen.rootTheme().borderWidth(), screen.rootTheme().borderWidth(),
1100 m_frame.width(), m_frame.height()); 1102 m_frame.width(), m_frame.height());
1101 } else if (m_frame.y() > (signed) screen.getHeight()) { 1103 } else if (m_frame.y() > (signed) screen.getHeight()) {
1102 moveResize(screen.getBorderWidth(), screen.getHeight() - m_frame.height(), 1104 moveResize(screen.rootTheme().borderWidth(), screen.getHeight() - m_frame.height(),
1103 m_frame.width(), m_frame.height()); 1105 m_frame.width(), m_frame.height());
1104 } else { 1106 } else {
1105 moveResize(screen.getBorderWidth(), m_frame.y() + screen.getBorderWidth(), 1107 moveResize(screen.rootTheme().borderWidth(), m_frame.y() + screen.rootTheme().borderWidth(),
1106 m_frame.width(), m_frame.height()); 1108 m_frame.width(), m_frame.height());
1107 } 1109 }
1108 } else if (m_frame.x() > (signed) screen.getWidth()) { 1110 } else if (m_frame.x() > (signed) screen.getWidth()) {
1109 if (((signed) (m_frame.y() + m_frame.height())) < 0) { 1111 if (((signed) (m_frame.y() + m_frame.height())) < 0) {
1110 moveResize(screen.getWidth() - m_frame.width(), screen.getBorderWidth(), 1112 moveResize(screen.getWidth() - m_frame.width(), screen.rootTheme().borderWidth(),
1111 m_frame.width(), m_frame.height()); 1113 m_frame.width(), m_frame.height());
1112 } else if (m_frame.y() > (signed) screen.getHeight()) { 1114 } else if (m_frame.y() > (signed) screen.getHeight()) {
1113 moveResize(screen.getWidth() - m_frame.width(), 1115 moveResize(screen.getWidth() - m_frame.width(),
@@ -1115,7 +1117,7 @@ bool FluxboxWindow::setInputFocus() {
1115 m_frame.width(), m_frame.height()); 1117 m_frame.width(), m_frame.height());
1116 } else { 1118 } else {
1117 moveResize(screen.getWidth() - m_frame.width(), 1119 moveResize(screen.getWidth() - m_frame.width(),
1118 m_frame.y() + screen.getBorderWidth(), 1120 m_frame.y() + screen.rootTheme().borderWidth(),
1119 m_frame.width(), m_frame.height()); 1121 m_frame.width(), m_frame.height());
1120 } 1122 }
1121 } 1123 }
@@ -2205,8 +2207,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2205 raise(); 2207 raise();
2206 XAllowEvents(display, ReplayPointer, be.time); 2208 XAllowEvents(display, ReplayPointer, be.time);
2207 } else { 2209 } else {
2208 button_grab_x = be.x_root - m_frame.x() - screen.getBorderWidth(); 2210 button_grab_x = be.x_root - m_frame.x() - screen.rootTheme().borderWidth();
2209 button_grab_y = be.y_root - m_frame.y() - screen.getBorderWidth(); 2211 button_grab_y = be.y_root - m_frame.y() - screen.rootTheme().borderWidth();
2210 } 2212 }
2211 2213
2212 if (m_windowmenu.isVisible()) 2214 if (m_windowmenu.isVisible())
@@ -2265,8 +2267,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2265 int dx = me.x_root - button_grab_x, 2267 int dx = me.x_root - button_grab_x,
2266 dy = me.y_root - button_grab_y; 2268 dy = me.y_root - button_grab_y;
2267 2269
2268 dx -= screen.getBorderWidth(); 2270 dx -= screen.rootTheme().borderWidth();
2269 dy -= screen.getBorderWidth(); 2271 dy -= screen.rootTheme().borderWidth();
2270 2272
2271 // Warp to next or previous workspace?, must have moved sideways some 2273 // Warp to next or previous workspace?, must have moved sideways some
2272 int moved_x = me.x_root - last_resize_x; 2274 int moved_x = me.x_root - last_resize_x;
@@ -2307,12 +2309,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2307 doSnapping(dx, dy); 2309 doSnapping(dx, dy);
2308 2310
2309 if (! screen.doOpaqueMove()) { 2311 if (! screen.doOpaqueMove()) {
2310 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2312 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2311 last_move_x, last_move_y, 2313 last_move_x, last_move_y,
2312 m_frame.width() + 2*frame().window().borderWidth()-1, 2314 m_frame.width() + 2*frame().window().borderWidth()-1,
2313 m_frame.height() + 2*frame().window().borderWidth()-1); 2315 m_frame.height() + 2*frame().window().borderWidth()-1);
2314 2316
2315 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2317 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2316 dx, dy, 2318 dx, dy,
2317 m_frame.width() + 2*frame().window().borderWidth()-1, 2319 m_frame.width() + 2*frame().window().borderWidth()-1,
2318 m_frame.height() + 2*frame().window().borderWidth()-1); 2320 m_frame.height() + 2*frame().window().borderWidth()-1);
@@ -2336,7 +2338,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2336 startResizing(me.window, me.x, me.y, left); 2338 startResizing(me.window, me.x, me.y, left);
2337 } else if (resizing) { 2339 } else if (resizing) {
2338 // draw over old rect 2340 // draw over old rect
2339 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2341 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2340 last_resize_x, last_resize_y, 2342 last_resize_x, last_resize_y,
2341 last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2343 last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2342 last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2344 last_resize_h - 1 + 2 * m_frame.window().borderWidth());
@@ -2364,7 +2366,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2364 } 2366 }
2365 2367
2366 // draw resize rectangle 2368 // draw resize rectangle
2367 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2369 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2368 last_resize_x, last_resize_y, 2370 last_resize_x, last_resize_y,
2369 last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2371 last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2370 last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2372 last_resize_h - 1 + 2 * m_frame.window().borderWidth());
@@ -2388,7 +2390,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2388 last_move_y = me.y_root - 1; 2390 last_move_y = me.y_root - 1;
2389 2391
2390 XDrawRectangle(display, getScreen().getRootWindow(), 2392 XDrawRectangle(display, getScreen().getRootWindow(),
2391 getScreen().getOpGC(), 2393 getScreen().rootTheme().opGC(),
2392 last_move_x, last_move_y, 2394 last_move_x, last_move_y,
2393 m_labelbuttons[client]->width(), 2395 m_labelbuttons[client]->width(),
2394 m_labelbuttons[client]->height()); 2396 m_labelbuttons[client]->height());
@@ -2397,8 +2399,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2397 // so we update drag'n'drop-rectangle 2399 // so we update drag'n'drop-rectangle
2398 int dx = me.x_root - 1, dy = me.y_root - 1; 2400 int dx = me.x_root - 1, dy = me.y_root - 1;
2399 2401
2400 dx -= getScreen().getBorderWidth(); 2402 dx -= getScreen().rootTheme().borderWidth();
2401 dy -= getScreen().getBorderWidth(); 2403 dy -= getScreen().rootTheme().borderWidth();
2402 2404
2403 if (getScreen().getEdgeSnapThreshold()) { 2405 if (getScreen().getEdgeSnapThreshold()) {
2404 int drx = getScreen().getWidth() - (dx + 1); 2406 int drx = getScreen().getWidth() - (dx + 1);
@@ -2422,7 +2424,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2422 2424
2423 //erase rectangle 2425 //erase rectangle
2424 XDrawRectangle(display, getScreen().getRootWindow(), 2426 XDrawRectangle(display, getScreen().getRootWindow(),
2425 getScreen().getOpGC(), 2427 getScreen().rootTheme().opGC(),
2426 last_move_x, last_move_y, 2428 last_move_x, last_move_y,
2427 m_labelbuttons[client]->width(), 2429 m_labelbuttons[client]->width(),
2428 m_labelbuttons[client]->height()); 2430 m_labelbuttons[client]->height());
@@ -2432,7 +2434,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2432 last_move_x = dx; 2434 last_move_x = dx;
2433 last_move_y = dy; 2435 last_move_y = dy;
2434 XDrawRectangle(display, getScreen().getRootWindow(), 2436 XDrawRectangle(display, getScreen().getRootWindow(),
2435 getScreen().getOpGC(), 2437 getScreen().rootTheme().opGC(),
2436 last_move_x, last_move_y, 2438 last_move_x, last_move_y,
2437 m_labelbuttons[client]->width(), 2439 m_labelbuttons[client]->width(),
2438 m_labelbuttons[client]->height()); 2440 m_labelbuttons[client]->height());
@@ -2576,7 +2578,7 @@ void FluxboxWindow::startMoving(Window win) {
2576 last_move_y = frame().y(); 2578 last_move_y = frame().y();
2577 if (! screen.doOpaqueMove()) { 2579 if (! screen.doOpaqueMove()) {
2578 fluxbox->grab(); 2580 fluxbox->grab();
2579 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2581 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2580 frame().x(), frame().y(), 2582 frame().x(), frame().y(),
2581 frame().width() + 2*frame().window().borderWidth()-1, 2583 frame().width() + 2*frame().window().borderWidth()-1,
2582 frame().height() + 2*frame().window().borderWidth()-1); 2584 frame().height() + 2*frame().window().borderWidth()-1);
@@ -2592,7 +2594,7 @@ void FluxboxWindow::stopMoving() {
2592 2594
2593 2595
2594 if (! screen.doOpaqueMove()) { 2596 if (! screen.doOpaqueMove()) {
2595 XDrawRectangle(FbTk::App::instance()->display(), screen.getRootWindow(), screen.getOpGC(), 2597 XDrawRectangle(FbTk::App::instance()->display(), screen.getRootWindow(), screen.rootTheme().opGC(),
2596 last_move_x, last_move_y, 2598 last_move_x, last_move_y,
2597 frame().width() + 2*frame().window().borderWidth()-1, 2599 frame().width() + 2*frame().window().borderWidth()-1,
2598 frame().height() + 2*frame().window().borderWidth()-1); 2600 frame().height() + 2*frame().window().borderWidth()-1);
@@ -2616,7 +2618,8 @@ void FluxboxWindow::pauseMoving() {
2616 return; 2618 return;
2617 } 2619 }
2618 2620
2619 XDrawRectangle(display, getScreen().getRootWindow(), getScreen().getOpGC(), 2621 XDrawRectangle(display, getScreen().getRootWindow(),
2622 getScreen().rootTheme().opGC(),
2620 last_move_x, last_move_y, 2623 last_move_x, last_move_y,
2621 m_frame.width() + 2*frame().window().borderWidth()-1, 2624 m_frame.width() + 2*frame().window().borderWidth()-1,
2622 m_frame.height() + 2*frame().window().borderWidth()-1); 2625 m_frame.height() + 2*frame().window().borderWidth()-1);
@@ -2633,7 +2636,7 @@ void FluxboxWindow::resumeMoving() {
2633 m_frame.show(); 2636 m_frame.show();
2634 } 2637 }
2635 XSync(display,false); 2638 XSync(display,false);
2636 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2639 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2637 last_move_x, last_move_y, 2640 last_move_x, last_move_y,
2638 m_frame.width() + 2*frame().window().borderWidth()-1, 2641 m_frame.width() + 2*frame().window().borderWidth()-1,
2639 m_frame.height() + 2*frame().window().borderWidth()-1); 2642 m_frame.height() + 2*frame().window().borderWidth()-1);
@@ -2779,7 +2782,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) {
2779 if (screen.doShowWindowPos()) 2782 if (screen.doShowWindowPos())
2780 screen.showGeometry(gx, gy); 2783 screen.showGeometry(gx, gy);
2781 2784
2782 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2785 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2783 last_resize_x, last_resize_y, 2786 last_resize_x, last_resize_y,
2784 last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2787 last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2785 last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2788 last_resize_h - 1 + 2 * m_frame.window().borderWidth());
@@ -2788,7 +2791,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) {
2788void FluxboxWindow::stopResizing(Window win) { 2791void FluxboxWindow::stopResizing(Window win) {
2789 resizing = false; 2792 resizing = false;
2790 2793
2791 XDrawRectangle(display, screen.getRootWindow(), screen.getOpGC(), 2794 XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(),
2792 last_resize_x, last_resize_y, 2795 last_resize_x, last_resize_y,
2793 last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2796 last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2794 last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2797 last_resize_h - 1 + 2 * m_frame.window().borderWidth());
@@ -2816,7 +2819,7 @@ void FluxboxWindow::attachTo(int x, int y) {
2816 2819
2817 2820
2818 XDrawRectangle(display, getScreen().getRootWindow(), 2821 XDrawRectangle(display, getScreen().getRootWindow(),
2819 getScreen().getOpGC(), 2822 getScreen().rootTheme().opGC(),
2820 last_move_x, last_move_y, 2823 last_move_x, last_move_y,
2821 m_labelbuttons[m_attaching_tab]->width(), 2824 m_labelbuttons[m_attaching_tab]->width(),
2822 m_labelbuttons[m_attaching_tab]->height()); 2825 m_labelbuttons[m_attaching_tab]->height());
@@ -3024,9 +3027,11 @@ void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) {
3024} 3027}
3025 3028
3026void FluxboxWindow::upsize() { 3029void FluxboxWindow::upsize() {
3027 m_frame.setBevel(screen.getBevelWidth()); 3030 m_frame.setBevel(screen.rootTheme().bevelWidth());
3028 m_frame.handle().resize(m_frame.handle().width(), screen.getHandleWidth()); 3031 m_frame.handle().resize(m_frame.handle().width(),
3029 m_frame.gripLeft().resize(m_frame.buttonHeight(), screen.getHandleWidth()); 3032 screen.rootTheme().handleWidth());
3033 m_frame.gripLeft().resize(m_frame.buttonHeight(),
3034 screen.rootTheme().handleWidth());
3030 m_frame.gripRight().resize(m_frame.gripLeft().width(), 3035 m_frame.gripRight().resize(m_frame.gripLeft().width(),
3031 m_frame.gripLeft().height()); 3036 m_frame.gripLeft().height());
3032} 3037}