]> Dogcows Code - chaz/openbox/blobdiff - src/frame.cc
split up widget and basewidget
[chaz/openbox] / src / frame.cc
index d991e454eee57c18cd19364bc505825f2e7d517b..aa1e868f14b36d850d1745821632814cb195120a 100644 (file)
@@ -16,10 +16,11 @@ extern "C" {
 #include "otk/display.hh"
 
 #include <string>
-#include <iostream> // TEMP
 
 namespace ob {
 
+const long OBFrame::event_mask;
+
 OBFrame::OBFrame(OBClient *client, otk::Style *style)
   : otk::OtkWidget(Openbox::instance, style),
     _client(client),
@@ -39,6 +40,8 @@ OBFrame::OBFrame(OBClient *client, otk::Style *style)
   assert(client);
   assert(style);
 
+  XSelectInput(otk::OBDisplay::display, getWindow(), OBFrame::event_mask);
+  
   unmanaged();
   _titlebar.unmanaged();
   _button_close.unmanaged();
@@ -51,6 +54,9 @@ OBFrame::OBFrame(OBClient *client, otk::Style *style)
   _grip_right.unmanaged();
   _plate.unmanaged();
 
+  _grip_left.setCursor(Openbox::instance->cursors().ll_angle);
+  _grip_right.setCursor(Openbox::instance->cursors().lr_angle);
+  
   _plate.show();
 
   _button_close.setText("X");
@@ -196,8 +202,13 @@ void OBFrame::adjust()
     // that the ONE LABEL!!
     // adds an extra sep so that there's a space on either side of the
     // titlebar.. note: x = sep, below.
-    _label.setWidth(width - sep * 2 - 
-                    (_button_iconify.width() + sep) * (layout.size() - 1));
+    int lwidth = width - sep * 2 -
+      (_button_iconify.width() + sep) * (layout.size() - 1);
+    // quick sanity check for really small windows. if this is needed, its
+    // obviously not going to be displayed right...
+    // XXX: maybe we should make this look better somehow? constraints?
+    if (lwidth <= 0) lwidth = 1;
+    _label.setWidth(lwidth);
 
     int x = sep;
     for (int i = 0, len = layout.size(); i < len; ++i) {
@@ -349,16 +360,15 @@ void OBFrame::adjustShape()
 void OBFrame::grabClient()
 {
   
-  // select the event mask on the frame
-  //XSelectInput(otk::OBDisplay::display, _window, SubstructureRedirectMask);
-
   // reparent the client to the frame
   XReparentWindow(otk::OBDisplay::display, _client->window(),
                   _plate.getWindow(), 0, 0);
   _client->ignore_unmaps++;
 
-  // raise the client above the frame
-  //XRaiseWindow(otk::OBDisplay::display, _client->window());
+  // select the event mask on the client's parent
+  //XSelectInput(otk::OBDisplay::display, _plate.getWindow(),
+  //             SubstructureRedirectMask);
+
   // map the client so it maps when the frame does
   XMapWindow(otk::OBDisplay::display, _client->window());
 
@@ -449,4 +459,10 @@ void OBFrame::applyGravity()
 }
 
 
+void OBFrame::reverseGravity()
+{
+  move(_client->area().x() - _size.left, _client->area().y() - _size.top);
+}
+
+
 }
This page took 0.023638 seconds and 4 git commands to generate.