aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-10 23:04:37 (GMT)
committerfluxgen <fluxgen>2003-05-10 23:04:37 (GMT)
commitb0641a8cbd12df26532723e46eb467dfaa067f8e (patch)
tree8739107de73be42b40aeda24116bd3c0c8c7f2df /src
parentd81df81428dd0bed0dc6201a91aa16c2f678d22b (diff)
downloadfluxbox_paul-b0641a8cbd12df26532723e46eb467dfaa067f8e.zip
fluxbox_paul-b0641a8cbd12df26532723e46eb467dfaa067f8e.tar.bz2
using parent window instead of root window
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc144
-rw-r--r--src/Window.hh11
2 files changed, 79 insertions, 76 deletions
diff --git a/src/Window.cc b/src/Window.cc
index adb8f2e..4161c3b 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.167 2003/05/10 16:53:09 fluxgen Exp $ 25// $Id: Window.cc,v 1.168 2003/05/10 23:04:37 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -242,7 +242,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
242 m_client(&client), 242 m_client(&client),
243 m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), 243 m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
244 m_layeritem(m_frame.window(), layer), 244 m_layeritem(m_frame.window(), layer),
245 m_layernum(layer.getLayerNum()) { 245 m_layernum(layer.getLayerNum()),
246 m_parent(scr.rootWindow()) {
246 247
247 init(); 248 init();
248} 249}
@@ -274,7 +275,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
274 m_client(new WinClient(w, *this)), 275 m_client(new WinClient(w, *this)),
275 m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), 276 m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
276 m_layeritem(m_frame.window(), layer), 277 m_layeritem(m_frame.window(), layer),
277 m_layernum(layer.getLayerNum()) { 278 m_layernum(layer.getLayerNum()),
279 m_parent(scr.rootWindow()) {
278 assert(w != 0); 280 assert(w != 0);
279 init(); 281 init();
280 282
@@ -2292,7 +2294,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
2292 2294
2293 2295
2294void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { 2296void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2295 if (isMoving() && me.window == screen().getRootWindow()) { 2297 if (isMoving() && me.window == parent()) {
2296 me.window = m_frame.window().window(); 2298 me.window = m_frame.window().window();
2297 } 2299 }
2298 bool inside_titlebar = (m_frame.titlebar() == me.window || m_frame.label() == me.window || 2300 bool inside_titlebar = (m_frame.titlebar() == me.window || m_frame.label() == me.window ||
@@ -2375,15 +2377,15 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2375 doSnapping(dx, dy); 2377 doSnapping(dx, dy);
2376 2378
2377 if (! screen().doOpaqueMove()) { 2379 if (! screen().doOpaqueMove()) {
2378 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2380 parent().drawRectangle(screen().rootTheme().opGC(),
2379 m_last_move_x, m_last_move_y, 2381 m_last_move_x, m_last_move_y,
2380 m_frame.width() + 2*frame().window().borderWidth()-1, 2382 m_frame.width() + 2*frame().window().borderWidth()-1,
2381 m_frame.height() + 2*frame().window().borderWidth()-1); 2383 m_frame.height() + 2*frame().window().borderWidth()-1);
2382 2384
2383 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2385 parent().drawRectangle(screen().rootTheme().opGC(),
2384 dx, dy, 2386 dx, dy,
2385 m_frame.width() + 2*frame().window().borderWidth()-1, 2387 m_frame.width() + 2*frame().window().borderWidth()-1,
2386 m_frame.height() + 2*frame().window().borderWidth()-1); 2388 m_frame.height() + 2*frame().window().borderWidth()-1);
2387 m_last_move_x = dx; 2389 m_last_move_x = dx;
2388 m_last_move_y = dy; 2390 m_last_move_y = dy;
2389 } else { 2391 } else {
@@ -2404,10 +2406,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2404 startResizing(me.window, me.x, me.y, left); 2406 startResizing(me.window, me.x, me.y, left);
2405 } else if (resizing) { 2407 } else if (resizing) {
2406 // draw over old rect 2408 // draw over old rect
2407 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2409 parent().drawRectangle(screen().rootTheme().opGC(),
2408 m_last_resize_x, m_last_resize_y, 2410 m_last_resize_x, m_last_resize_y,
2409 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2411 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2410 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2412 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
2411 2413
2412 2414
2413 // move rectangle 2415 // move rectangle
@@ -2431,11 +2433,11 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2431 right_fixsize(&gx, &gy); 2433 right_fixsize(&gx, &gy);
2432 } 2434 }
2433 2435
2434 // draw resize rectangle 2436 // draw resize rectangle
2435 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2437 parent().drawRectangle(screen().rootTheme().opGC(),
2436 m_last_resize_x, m_last_resize_y, 2438 m_last_resize_x, m_last_resize_y,
2437 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2439 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2438 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2440 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
2439 2441
2440 if (screen().doShowWindowPos()) 2442 if (screen().doShowWindowPos())
2441 screen().showGeometry(gx, gy); 2443 screen().showGeometry(gx, gy);
@@ -2455,11 +2457,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2455 m_last_move_x = me.x_root - 1; 2457 m_last_move_x = me.x_root - 1;
2456 m_last_move_y = me.y_root - 1; 2458 m_last_move_y = me.y_root - 1;
2457 2459
2458 XDrawRectangle(display, screen().getRootWindow(), 2460 parent().drawRectangle(screen().rootTheme().opGC(),
2459 screen().rootTheme().opGC(), 2461 m_last_move_x, m_last_move_y,
2460 m_last_move_x, m_last_move_y, 2462 m_labelbuttons[client]->width(),
2461 m_labelbuttons[client]->width(), 2463 m_labelbuttons[client]->height());
2462 m_labelbuttons[client]->height());
2463 } else { 2464 } else {
2464 // we already grabed and started to drag'n'drop tab 2465 // we already grabed and started to drag'n'drop tab
2465 // so we update drag'n'drop-rectangle 2466 // so we update drag'n'drop-rectangle
@@ -2489,21 +2490,19 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2489 } 2490 }
2490 2491
2491 //erase rectangle 2492 //erase rectangle
2492 XDrawRectangle(display, screen().getRootWindow(), 2493 parent().drawRectangle(screen().rootTheme().opGC(),
2493 screen().rootTheme().opGC(), 2494 m_last_move_x, m_last_move_y,
2494 m_last_move_x, m_last_move_y, 2495 m_labelbuttons[client]->width(),
2495 m_labelbuttons[client]->width(), 2496 m_labelbuttons[client]->height());
2496 m_labelbuttons[client]->height());
2497 2497
2498 2498
2499 // redraw rectangle at new pos 2499 // redraw rectangle at new pos
2500 m_last_move_x = dx; 2500 m_last_move_x = dx;
2501 m_last_move_y = dy; 2501 m_last_move_y = dy;
2502 XDrawRectangle(display, screen().getRootWindow(), 2502 parent().drawRectangle(screen().rootTheme().opGC(),
2503 screen().rootTheme().opGC(), 2503 m_last_move_x, m_last_move_y,
2504 m_last_move_x, m_last_move_y, 2504 m_labelbuttons[client]->width(),
2505 m_labelbuttons[client]->width(), 2505 m_labelbuttons[client]->height());
2506 m_labelbuttons[client]->height());
2507 2506
2508 2507
2509 } 2508 }
@@ -2700,23 +2699,23 @@ void FluxboxWindow::startMoving(Window win) {
2700 Fluxbox *fluxbox = Fluxbox::instance(); 2699 Fluxbox *fluxbox = Fluxbox::instance();
2701 // grabbing (and masking) on the root window allows us to 2700 // grabbing (and masking) on the root window allows us to
2702 // freely map and unmap the window we're moving. 2701 // freely map and unmap the window we're moving.
2703 XGrabPointer(display, screen().getRootWindow(), False, Button1MotionMask | 2702 XGrabPointer(display, screen().rootWindow().window(), False, Button1MotionMask |
2704 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, 2703 ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
2705 screen().getRootWindow(), fluxbox->getMoveCursor(), CurrentTime); 2704 screen().rootWindow().window(), fluxbox->getMoveCursor(), CurrentTime);
2706 2705
2707 if (m_windowmenu.isVisible()) 2706 if (m_windowmenu.isVisible())
2708 m_windowmenu.hide(); 2707 m_windowmenu.hide();
2709 2708
2710 fluxbox->maskWindowEvents(screen().getRootWindow(), this); 2709 fluxbox->maskWindowEvents(screen().rootWindow().window(), this);
2711 2710
2712 m_last_move_x = frame().x(); 2711 m_last_move_x = frame().x();
2713 m_last_move_y = frame().y(); 2712 m_last_move_y = frame().y();
2714 if (! screen().doOpaqueMove()) { 2713 if (! screen().doOpaqueMove()) {
2715 fluxbox->grab(); 2714 fluxbox->grab();
2716 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2715 parent().drawRectangle(screen().rootTheme().opGC(),
2717 frame().x(), frame().y(), 2716 frame().x(), frame().y(),
2718 frame().width() + 2*frame().window().borderWidth()-1, 2717 frame().width() + 2*frame().window().borderWidth()-1,
2719 frame().height() + 2*frame().window().borderWidth()-1); 2718 frame().height() + 2*frame().window().borderWidth()-1);
2720 screen().showPosition(frame().x(), frame().y()); 2719 screen().showPosition(frame().x(), frame().y());
2721 } 2720 }
2722} 2721}
@@ -2729,10 +2728,10 @@ void FluxboxWindow::stopMoving() {
2729 2728
2730 2729
2731 if (! screen().doOpaqueMove()) { 2730 if (! screen().doOpaqueMove()) {
2732 XDrawRectangle(FbTk::App::instance()->display(), screen().getRootWindow(), screen().rootTheme().opGC(), 2731 parent().drawRectangle(screen().rootTheme().opGC(),
2733 m_last_move_x, m_last_move_y, 2732 m_last_move_x, m_last_move_y,
2734 frame().width() + 2*frame().window().borderWidth()-1, 2733 frame().width() + 2*frame().window().borderWidth()-1,
2735 frame().height() + 2*frame().window().borderWidth()-1); 2734 frame().height() + 2*frame().window().borderWidth()-1);
2736 moveResize(m_last_move_x, m_last_move_y, m_frame.width(), m_frame.height()); 2735 moveResize(m_last_move_x, m_last_move_y, m_frame.width(), m_frame.height());
2737 if (m_workspace_number != screen().getCurrentWorkspaceID()) { 2736 if (m_workspace_number != screen().getCurrentWorkspaceID()) {
2738 screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true); 2737 screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true);
@@ -2753,11 +2752,10 @@ void FluxboxWindow::pauseMoving() {
2753 return; 2752 return;
2754 } 2753 }
2755 2754
2756 XDrawRectangle(display, screen().getRootWindow(), 2755 parent().drawRectangle(screen().rootTheme().opGC(),
2757 screen().rootTheme().opGC(), 2756 m_last_move_x, m_last_move_y,
2758 m_last_move_x, m_last_move_y, 2757 m_frame.width() + 2*frame().window().borderWidth()-1,
2759 m_frame.width() + 2*frame().window().borderWidth()-1, 2758 m_frame.height() + 2*frame().window().borderWidth()-1);
2760 m_frame.height() + 2*frame().window().borderWidth()-1);
2761 2759
2762} 2760}
2763 2761
@@ -2771,10 +2769,11 @@ void FluxboxWindow::resumeMoving() {
2771 m_frame.show(); 2769 m_frame.show();
2772 } 2770 }
2773 XSync(display,false); 2771 XSync(display,false);
2774 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2772
2775 m_last_move_x, m_last_move_y, 2773 parent().drawRectangle(screen().rootTheme().opGC(),
2776 m_frame.width() + 2*frame().window().borderWidth()-1, 2774 m_last_move_x, m_last_move_y,
2777 m_frame.height() + 2*frame().window().borderWidth()-1); 2775 m_frame.width() + 2*frame().window().borderWidth()-1,
2776 m_frame.height() + 2*frame().window().borderWidth()-1);
2778 2777
2779} 2778}
2780 2779
@@ -2917,19 +2916,19 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) {
2917 if (screen().doShowWindowPos()) 2916 if (screen().doShowWindowPos())
2918 screen().showGeometry(gx, gy); 2917 screen().showGeometry(gx, gy);
2919 2918
2920 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2919 parent().drawRectangle(screen().rootTheme().opGC(),
2921 m_last_resize_x, m_last_resize_y, 2920 m_last_resize_x, m_last_resize_y,
2922 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2921 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2923 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2922 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
2924} 2923}
2925 2924
2926void FluxboxWindow::stopResizing(Window win) { 2925void FluxboxWindow::stopResizing(Window win) {
2927 resizing = false; 2926 resizing = false;
2928 2927
2929 XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(), 2928 parent().drawRectangle(screen().rootTheme().opGC(),
2930 m_last_resize_x, m_last_resize_y, 2929 m_last_resize_x, m_last_resize_y,
2931 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(), 2930 m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
2932 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth()); 2931 m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
2933 2932
2934 screen().hideGeometry(); 2933 screen().hideGeometry();
2935 2934
@@ -2952,17 +2951,16 @@ void FluxboxWindow::attachTo(int x, int y) {
2952 XUngrabPointer(display, CurrentTime); 2951 XUngrabPointer(display, CurrentTime);
2953 2952
2954 2953
2955 XDrawRectangle(display, screen().getRootWindow(), 2954 parent().drawRectangle(screen().rootTheme().opGC(),
2956 screen().rootTheme().opGC(), 2955 m_last_move_x, m_last_move_y,
2957 m_last_move_x, m_last_move_y, 2956 m_labelbuttons[m_attaching_tab]->width(),
2958 m_labelbuttons[m_attaching_tab]->width(), 2957 m_labelbuttons[m_attaching_tab]->height());
2959 m_labelbuttons[m_attaching_tab]->height());
2960 2958
2961 int dest_x = 0, dest_y = 0; 2959 int dest_x = 0, dest_y = 0;
2962 Window child = 0; 2960 Window child = 0;
2963 2961
2964 if (XTranslateCoordinates(display, screen().getRootWindow(), 2962 if (XTranslateCoordinates(display, parent().window(),
2965 screen().getRootWindow(), 2963 parent().window(),
2966 x, y, &dest_x, &dest_y, &child)) { 2964 x, y, &dest_x, &dest_y, &child)) {
2967 // search for a fluxboxwindow 2965 // search for a fluxboxwindow
2968 FluxboxWindow *attach_to_win = Fluxbox::instance()->searchWindow(child); 2966 FluxboxWindow *attach_to_win = Fluxbox::instance()->searchWindow(child);
@@ -3013,7 +3011,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
3013#endif // DEBUG 3011#endif // DEBUG
3014 3012
3015 // reparent to root window 3013 // reparent to root window
3016 client->reparent(screen().getRootWindow(), m_frame.x(), m_frame.y()); 3014 client->reparent(screen().rootWindow().window(), m_frame.x(), m_frame.y());
3017 } 3015 }
3018 3016
3019 if (remap) 3017 if (remap)
diff --git a/src/Window.hh b/src/Window.hh
index 585a176..1bae6e2 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -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.hh,v 1.69 2003/05/10 16:51:39 fluxgen Exp $ 25// $Id: Window.hh,v 1.70 2003/05/10 23:03:49 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -302,7 +302,10 @@ public:
302 302
303 FbTk::Menu &getLayermenu() { return m_layermenu; } 303 FbTk::Menu &getLayermenu() { return m_layermenu; }
304 const FbTk::Menu &getLayermenu() const { return m_layermenu; } 304 const FbTk::Menu &getLayermenu() const { return m_layermenu; }
305 305
306 const FbTk::FbWindow &parent() const { return m_parent; }
307 FbTk::FbWindow &parent() { return m_parent; }
308
306 const std::string &getTitle() const; 309 const std::string &getTitle() const;
307 const std::string &getIconTitle() const; 310 const std::string &getIconTitle() const;
308 int getXFrame() const { return m_frame.x(); } 311 int getXFrame() const { return m_frame.x(); }
@@ -459,8 +462,10 @@ private:
459 FbTk::XLayerItem m_layeritem; 462 FbTk::XLayerItem m_layeritem;
460 int m_layernum; 463 int m_layernum;
461 464
465 FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
466
462 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; 467 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
463 468
464}; 469};
465 470
466 471