]> Dogcows Code - chaz/openbox/commitdiff
you can move windows!
authorDana Jansens <danakj@orodu.net>
Wed, 18 Dec 2002 16:07:44 +0000 (16:07 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 18 Dec 2002 16:07:44 +0000 (16:07 +0000)
src/actions.cc
src/client.hh
src/frame.hh
src/screen.cc

index 9660937dc9cce5729e72c9c7909d1971d6246556..2c527b799f25138124d69b0d7ed63a0bc2e08705 100644 (file)
@@ -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);
+  }
 }
 
 
index 39d9ac6288b83b041ea26564158987941eedd3df..e61ece428dd78d1fc61dbcc43da02ccbc75c09a8 100644 (file)
@@ -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);
index 5268512f44c9c9fe8f6d7ff3b997b37a67d42c0e..1d7ebd6c29a116def3c71ae98a96f3c2a6d94b0f 100644 (file)
@@ -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(); }
+
 };
 
 }
index d40a2a3a537a0ec86f9227953e35d3a19252ef00..ba058c8fe4029324da52dbe43726a82c18573986 100644 (file)
@@ -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());
   
This page took 0.029394 seconds and 4 git commands to generate.