all repos — openbox @ 732bfd191dbf1f5cf3473a794f9a736dcba6117e

openbox fork - make it a bit more like ryudo

you can move windows!
Dana Jansens danakj@orodu.net
commit

732bfd191dbf1f5cf3473a794f9a736dcba6117e

parent

f4e2fc32743309dae8663f9e47a4e2f4d941d1b5

4 files changed, 67 insertions(+), 13 deletions(-)

jump to
M src/actions.ccsrc/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 @@

// 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); + } }
M src/client.hhsrc/client.hh

@@ -297,18 +297,6 @@ //! Updates the window's application name and class

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 @@

//! 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);
M src/frame.hhsrc/frame.hh

@@ -112,6 +112,27 @@ @return The proper coordinates for the client, based on the frame.

*/ 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(); } + }; }
M src/screen.ccsrc/screen.cc

@@ -349,9 +349,11 @@ XChangeWindowAttributes(otk::OBDisplay::display, 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 @@

// 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 @@ // XXX: pass around focus if this window was focused

// 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());