summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-18 16:07:44 +0000
committerDana Jansens <danakj@orodu.net>2002-12-18 16:07:44 +0000
commit732bfd191dbf1f5cf3473a794f9a736dcba6117e (patch)
treeb59f4adfe447b2c3eb5d399b66efc0f211bab76f
parentf4e2fc32743309dae8663f9e47a4e2f4d941d1b5 (diff)
you can move windows!
-rw-r--r--src/actions.cc7
-rw-r--r--src/client.hh24
-rw-r--r--src/frame.hh21
-rw-r--r--src/screen.cc28
4 files changed, 67 insertions, 13 deletions
diff --git a/src/actions.cc b/src/actions.cc
index 9660937d..2c527b79 100644
--- a/src/actions.cc
+++ b/src/actions.cc
@@ -7,6 +7,7 @@
#include "actions.hh"
#include "widget.hh"
#include "openbox.hh"
+#include "client.hh"
#include "otk/display.hh"
#include <stdio.h>
@@ -177,6 +178,12 @@ void OBActions::motionHandler(const XMotionEvent &e)
// XXX: i can envision all sorts of crazy shit with this.. gestures, etc
printf("GUILE: MOTION: win %lx type %d modifiers %u x %d y %d\n",
(long)e.window, (w ? w->type():-1), e.state, _dx, _dy);
+
+ if (w && (w->type() == OBWidget::Type_Titlebar ||
+ w->type() == OBWidget::Type_Label)) {
+ OBClient *c = Openbox::instance->findClient(e.window);
+ if (c) c->move(c->area().x() + _dx, c->area().y() + _dy);
+ }
}
diff --git a/src/client.hh b/src/client.hh
index 39d9ac62..e61ece42 100644
--- a/src/client.hh
+++ b/src/client.hh
@@ -297,18 +297,6 @@ private:
void updateClass();
// XXX: updateTransientFor();
- //! Move the client window
- void move(int x, int y);
-
- //! Resizes the client window, anchoring it in a given corner
- /*!
- This also maintains things like the client's minsize, and size increments.
- @param anchor The corner to keep in the same position when resizing
- @param x The X component of the new size for the client
- @param y The Y component of the new size for the client
- */
- void resize(Corner anchor, int x, int y);
-
public:
//! Constructs a new OBClient object around a specified window id
/*!
@@ -418,6 +406,18 @@ public:
//! Returns the position and size of the client relative to the root window
inline const otk::Rect &area() const { return _area; }
+ //! Move the client window
+ void move(int x, int y);
+
+ //! Resizes the client window, anchoring it in a given corner
+ /*!
+ This also maintains things like the client's minsize, and size increments.
+ @param anchor The corner to keep in the same position when resizing
+ @param x The X component of the new size for the client
+ @param y The Y component of the new size for the client
+ */
+ void resize(Corner anchor, int x, int y);
+
virtual void propertyHandler(const XPropertyEvent &e);
virtual void clientMessageHandler(const XClientMessageEvent &e);
virtual void shapeHandler(const XShapeEvent &e);
diff --git a/src/frame.hh b/src/frame.hh
index 5268512f..1d7ebd6c 100644
--- a/src/frame.hh
+++ b/src/frame.hh
@@ -112,6 +112,27 @@ public:
*/
void frameGravity(int &x, int &y);
+ //! Gets the window id of the frame's "plate" subelement
+ inline Window plate() const { return _plate.getWindow(); }
+ //! Gets the window id of the frame's "titlebar" subelement
+ inline Window titlebar() const { return _titlebar.getWindow(); }
+ //! Gets the window id of the frame's "label" subelement
+ inline Window label() const { return _label.getWindow(); }
+ //! Gets the window id of the frame's "close button" subelement
+ inline Window button_close() const { return _button_close.getWindow(); }
+ //! Gets the window id of the frame's "iconify button" subelement
+ inline Window button_iconify() const { return _button_iconify.getWindow(); }
+ //! Gets the window id of the frame's "maximize button" subelement
+ inline Window button_max() const { return _button_max.getWindow(); }
+ //! Gets the window id of the frame's "sticky button" subelement
+ inline Window button_stick() const { return _button_stick.getWindow(); }
+ //! Gets the window id of the frame's "handle" subelement
+ inline Window handle() const { return _handle.getWindow(); }
+ //! Gets the window id of the frame's "left grip" subelement
+ inline Window grip_left() const { return _grip_left.getWindow(); }
+ //! Gets the window id of the frame's "right grip" subelement
+ inline Window grip_right() const { return _grip_right.getWindow(); }
+
};
}
diff --git a/src/screen.cc b/src/screen.cc
index d40a2a3a..ba058c8f 100644
--- a/src/screen.cc
+++ b/src/screen.cc
@@ -349,9 +349,11 @@ void OBScreen::manageWindow(Window window)
CWEventMask|CWDontPropagate, &attrib_set);
// create the OBClient class, which gets all of the hints on the window
- Openbox::instance->addClient(window, client = new OBClient(_number, window));
+ client = new OBClient(_number, window);
// register for events
Openbox::instance->registerHandler(window, client);
+ // add to the wm's map
+ Openbox::instance->addClient(window, client);
// we dont want a border on the client
client->toggleClientBorder(false);
@@ -367,6 +369,19 @@ void OBScreen::manageWindow(Window window)
// create the decoration frame for the client window
client->frame = new OBFrame(client, &_style);
+ // add to the wm's map
+ Openbox::instance->addClient(client->frame->getWindow(), client);
+ Openbox::instance->addClient(client->frame->plate(), client);
+ Openbox::instance->addClient(client->frame->titlebar(), client);
+ Openbox::instance->addClient(client->frame->label(), client);
+ Openbox::instance->addClient(client->frame->button_max(), client);
+ Openbox::instance->addClient(client->frame->button_iconify(), client);
+ Openbox::instance->addClient(client->frame->button_stick(), client);
+ Openbox::instance->addClient(client->frame->button_close(), client);
+ Openbox::instance->addClient(client->frame->handle(), client);
+ Openbox::instance->addClient(client->frame->grip_left(), client);
+ Openbox::instance->addClient(client->frame->grip_right(), client);
+
// XXX: if on the current desktop..
client->frame->show();
@@ -389,6 +404,17 @@ void OBScreen::unmanageWindow(OBClient *client)
// remove from the wm's map
Openbox::instance->removeClient(client->window());
+ Openbox::instance->removeClient(frame->getWindow());
+ Openbox::instance->removeClient(frame->plate());
+ Openbox::instance->removeClient(frame->titlebar());
+ Openbox::instance->removeClient(frame->label());
+ Openbox::instance->removeClient(frame->button_max());
+ Openbox::instance->removeClient(frame->button_iconify());
+ Openbox::instance->removeClient(frame->button_stick());
+ Openbox::instance->removeClient(frame->button_close());
+ Openbox::instance->removeClient(frame->handle());
+ Openbox::instance->removeClient(frame->grip_left());
+ Openbox::instance->removeClient(frame->grip_right());
// unregister for handling events
Openbox::instance->clearHandler(client->window());