using parent window instead of root window
This commit is contained in:
parent
d81df81428
commit
b0641a8cbd
2 changed files with 78 additions and 75 deletions
142
src/Window.cc
142
src/Window.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.167 2003/05/10 16:53:09 fluxgen Exp $
|
// $Id: Window.cc,v 1.168 2003/05/10 23:04:37 fluxgen Exp $
|
||||||
|
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
|
|
||||||
|
@ -242,7 +242,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
|
||||||
m_client(&client),
|
m_client(&client),
|
||||||
m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
|
m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
|
||||||
m_layeritem(m_frame.window(), layer),
|
m_layeritem(m_frame.window(), layer),
|
||||||
m_layernum(layer.getLayerNum()) {
|
m_layernum(layer.getLayerNum()),
|
||||||
|
m_parent(scr.rootWindow()) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
|
||||||
m_client(new WinClient(w, *this)),
|
m_client(new WinClient(w, *this)),
|
||||||
m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
|
m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100),
|
||||||
m_layeritem(m_frame.window(), layer),
|
m_layeritem(m_frame.window(), layer),
|
||||||
m_layernum(layer.getLayerNum()) {
|
m_layernum(layer.getLayerNum()),
|
||||||
|
m_parent(scr.rootWindow()) {
|
||||||
assert(w != 0);
|
assert(w != 0);
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
@ -2292,7 +2294,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
|
||||||
|
|
||||||
|
|
||||||
void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
if (isMoving() && me.window == screen().getRootWindow()) {
|
if (isMoving() && me.window == parent()) {
|
||||||
me.window = m_frame.window().window();
|
me.window = m_frame.window().window();
|
||||||
}
|
}
|
||||||
bool inside_titlebar = (m_frame.titlebar() == me.window || m_frame.label() == me.window ||
|
bool inside_titlebar = (m_frame.titlebar() == me.window || m_frame.label() == me.window ||
|
||||||
|
@ -2375,15 +2377,15 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
doSnapping(dx, dy);
|
doSnapping(dx, dy);
|
||||||
|
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_frame.width() + 2*frame().window().borderWidth()-1,
|
m_frame.width() + 2*frame().window().borderWidth()-1,
|
||||||
m_frame.height() + 2*frame().window().borderWidth()-1);
|
m_frame.height() + 2*frame().window().borderWidth()-1);
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
dx, dy,
|
dx, dy,
|
||||||
m_frame.width() + 2*frame().window().borderWidth()-1,
|
m_frame.width() + 2*frame().window().borderWidth()-1,
|
||||||
m_frame.height() + 2*frame().window().borderWidth()-1);
|
m_frame.height() + 2*frame().window().borderWidth()-1);
|
||||||
m_last_move_x = dx;
|
m_last_move_x = dx;
|
||||||
m_last_move_y = dy;
|
m_last_move_y = dy;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2404,10 +2406,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
startResizing(me.window, me.x, me.y, left);
|
startResizing(me.window, me.x, me.y, left);
|
||||||
} else if (resizing) {
|
} else if (resizing) {
|
||||||
// draw over old rect
|
// draw over old rect
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
||||||
|
|
||||||
|
|
||||||
// move rectangle
|
// move rectangle
|
||||||
|
@ -2431,11 +2433,11 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
right_fixsize(&gx, &gy);
|
right_fixsize(&gx, &gy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw resize rectangle
|
// draw resize rectangle
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
||||||
|
|
||||||
if (screen().doShowWindowPos())
|
if (screen().doShowWindowPos())
|
||||||
screen().showGeometry(gx, gy);
|
screen().showGeometry(gx, gy);
|
||||||
|
@ -2455,11 +2457,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
m_last_move_x = me.x_root - 1;
|
m_last_move_x = me.x_root - 1;
|
||||||
m_last_move_y = me.y_root - 1;
|
m_last_move_y = me.y_root - 1;
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
screen().rootTheme().opGC(),
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_move_x, m_last_move_y,
|
m_labelbuttons[client]->width(),
|
||||||
m_labelbuttons[client]->width(),
|
m_labelbuttons[client]->height());
|
||||||
m_labelbuttons[client]->height());
|
|
||||||
} else {
|
} else {
|
||||||
// we already grabed and started to drag'n'drop tab
|
// we already grabed and started to drag'n'drop tab
|
||||||
// so we update drag'n'drop-rectangle
|
// so we update drag'n'drop-rectangle
|
||||||
|
@ -2489,21 +2490,19 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//erase rectangle
|
//erase rectangle
|
||||||
XDrawRectangle(display, screen().getRootWindow(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
screen().rootTheme().opGC(),
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_move_x, m_last_move_y,
|
m_labelbuttons[client]->width(),
|
||||||
m_labelbuttons[client]->width(),
|
m_labelbuttons[client]->height());
|
||||||
m_labelbuttons[client]->height());
|
|
||||||
|
|
||||||
|
|
||||||
// redraw rectangle at new pos
|
// redraw rectangle at new pos
|
||||||
m_last_move_x = dx;
|
m_last_move_x = dx;
|
||||||
m_last_move_y = dy;
|
m_last_move_y = dy;
|
||||||
XDrawRectangle(display, screen().getRootWindow(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
screen().rootTheme().opGC(),
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_move_x, m_last_move_y,
|
m_labelbuttons[client]->width(),
|
||||||
m_labelbuttons[client]->width(),
|
m_labelbuttons[client]->height());
|
||||||
m_labelbuttons[client]->height());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2700,23 +2699,23 @@ void FluxboxWindow::startMoving(Window win) {
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
// grabbing (and masking) on the root window allows us to
|
// grabbing (and masking) on the root window allows us to
|
||||||
// freely map and unmap the window we're moving.
|
// freely map and unmap the window we're moving.
|
||||||
XGrabPointer(display, screen().getRootWindow(), False, Button1MotionMask |
|
XGrabPointer(display, screen().rootWindow().window(), False, Button1MotionMask |
|
||||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
||||||
screen().getRootWindow(), fluxbox->getMoveCursor(), CurrentTime);
|
screen().rootWindow().window(), fluxbox->getMoveCursor(), CurrentTime);
|
||||||
|
|
||||||
if (m_windowmenu.isVisible())
|
if (m_windowmenu.isVisible())
|
||||||
m_windowmenu.hide();
|
m_windowmenu.hide();
|
||||||
|
|
||||||
fluxbox->maskWindowEvents(screen().getRootWindow(), this);
|
fluxbox->maskWindowEvents(screen().rootWindow().window(), this);
|
||||||
|
|
||||||
m_last_move_x = frame().x();
|
m_last_move_x = frame().x();
|
||||||
m_last_move_y = frame().y();
|
m_last_move_y = frame().y();
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
fluxbox->grab();
|
fluxbox->grab();
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
frame().x(), frame().y(),
|
frame().x(), frame().y(),
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
screen().showPosition(frame().x(), frame().y());
|
screen().showPosition(frame().x(), frame().y());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2729,10 +2728,10 @@ void FluxboxWindow::stopMoving() {
|
||||||
|
|
||||||
|
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
XDrawRectangle(FbTk::App::instance()->display(), screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
moveResize(m_last_move_x, m_last_move_y, m_frame.width(), m_frame.height());
|
moveResize(m_last_move_x, m_last_move_y, m_frame.width(), m_frame.height());
|
||||||
if (m_workspace_number != screen().getCurrentWorkspaceID()) {
|
if (m_workspace_number != screen().getCurrentWorkspaceID()) {
|
||||||
screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true);
|
screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true);
|
||||||
|
@ -2753,11 +2752,10 @@ void FluxboxWindow::pauseMoving() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
screen().rootTheme().opGC(),
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_move_x, m_last_move_y,
|
m_frame.width() + 2*frame().window().borderWidth()-1,
|
||||||
m_frame.width() + 2*frame().window().borderWidth()-1,
|
m_frame.height() + 2*frame().window().borderWidth()-1);
|
||||||
m_frame.height() + 2*frame().window().borderWidth()-1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2771,10 +2769,11 @@ void FluxboxWindow::resumeMoving() {
|
||||||
m_frame.show();
|
m_frame.show();
|
||||||
}
|
}
|
||||||
XSync(display,false);
|
XSync(display,false);
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
|
||||||
m_last_move_x, m_last_move_y,
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_frame.width() + 2*frame().window().borderWidth()-1,
|
m_last_move_x, m_last_move_y,
|
||||||
m_frame.height() + 2*frame().window().borderWidth()-1);
|
m_frame.width() + 2*frame().window().borderWidth()-1,
|
||||||
|
m_frame.height() + 2*frame().window().borderWidth()-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2917,19 +2916,19 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) {
|
||||||
if (screen().doShowWindowPos())
|
if (screen().doShowWindowPos())
|
||||||
screen().showGeometry(gx, gy);
|
screen().showGeometry(gx, gy);
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxboxWindow::stopResizing(Window win) {
|
void FluxboxWindow::stopResizing(Window win) {
|
||||||
resizing = false;
|
resizing = false;
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(), screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
m_last_resize_w - 1 + 2 * m_frame.window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
m_last_resize_h - 1 + 2 * m_frame.window().borderWidth());
|
||||||
|
|
||||||
screen().hideGeometry();
|
screen().hideGeometry();
|
||||||
|
|
||||||
|
@ -2952,17 +2951,16 @@ void FluxboxWindow::attachTo(int x, int y) {
|
||||||
XUngrabPointer(display, CurrentTime);
|
XUngrabPointer(display, CurrentTime);
|
||||||
|
|
||||||
|
|
||||||
XDrawRectangle(display, screen().getRootWindow(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
screen().rootTheme().opGC(),
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_move_x, m_last_move_y,
|
m_labelbuttons[m_attaching_tab]->width(),
|
||||||
m_labelbuttons[m_attaching_tab]->width(),
|
m_labelbuttons[m_attaching_tab]->height());
|
||||||
m_labelbuttons[m_attaching_tab]->height());
|
|
||||||
|
|
||||||
int dest_x = 0, dest_y = 0;
|
int dest_x = 0, dest_y = 0;
|
||||||
Window child = 0;
|
Window child = 0;
|
||||||
|
|
||||||
if (XTranslateCoordinates(display, screen().getRootWindow(),
|
if (XTranslateCoordinates(display, parent().window(),
|
||||||
screen().getRootWindow(),
|
parent().window(),
|
||||||
x, y, &dest_x, &dest_y, &child)) {
|
x, y, &dest_x, &dest_y, &child)) {
|
||||||
// search for a fluxboxwindow
|
// search for a fluxboxwindow
|
||||||
FluxboxWindow *attach_to_win = Fluxbox::instance()->searchWindow(child);
|
FluxboxWindow *attach_to_win = Fluxbox::instance()->searchWindow(child);
|
||||||
|
@ -3013,7 +3011,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
// reparent to root window
|
// reparent to root window
|
||||||
client->reparent(screen().getRootWindow(), m_frame.x(), m_frame.y());
|
client->reparent(screen().rootWindow().window(), m_frame.x(), m_frame.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remap)
|
if (remap)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.hh,v 1.69 2003/05/10 16:51:39 fluxgen Exp $
|
// $Id: Window.hh,v 1.70 2003/05/10 23:03:49 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef WINDOW_HH
|
#ifndef WINDOW_HH
|
||||||
#define WINDOW_HH
|
#define WINDOW_HH
|
||||||
|
@ -303,6 +303,9 @@ public:
|
||||||
FbTk::Menu &getLayermenu() { return m_layermenu; }
|
FbTk::Menu &getLayermenu() { return m_layermenu; }
|
||||||
const FbTk::Menu &getLayermenu() const { return m_layermenu; }
|
const FbTk::Menu &getLayermenu() const { return m_layermenu; }
|
||||||
|
|
||||||
|
const FbTk::FbWindow &parent() const { return m_parent; }
|
||||||
|
FbTk::FbWindow &parent() { return m_parent; }
|
||||||
|
|
||||||
const std::string &getTitle() const;
|
const std::string &getTitle() const;
|
||||||
const std::string &getIconTitle() const;
|
const std::string &getIconTitle() const;
|
||||||
int getXFrame() const { return m_frame.x(); }
|
int getXFrame() const { return m_frame.x(); }
|
||||||
|
@ -459,6 +462,8 @@ private:
|
||||||
FbTk::XLayerItem m_layeritem;
|
FbTk::XLayerItem m_layeritem;
|
||||||
int m_layernum;
|
int m_layernum;
|
||||||
|
|
||||||
|
FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
|
||||||
|
|
||||||
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
|
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue