]> Dogcows Code - chaz/openbox/commitdiff
made shaded windows snap properly at their bottom, using their shaded height.
authorDana Jansens <danakj@orodu.net>
Sun, 14 Apr 2002 09:39:14 +0000 (09:39 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 14 Apr 2002 09:39:14 +0000 (09:39 +0000)
window.getHeight() now returns the different/correct value when a window is shaded.

ChangeLog
src/Window.cc
src/Window.h

index 6cebecea5c9900fa1b0cceb2eb9d42f5eea63a7c..1a0ebc81819991932aaf1a9096ec0468acd54a00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
 Changelog for Openbox:
 
 1.0.0:
- * added BestFit window placement algorithm/type        (Ruhi Bloodworth)
+ * made shaded windows edge-snap correctly to the
+   bottom for their size instead for their unshaded
+   size.                                                (Ben Jansens)
+
+ * added BestFit window placement algorithm/type.       (Ruhi Bloodworth)
 
 0.99.1:
  * forced a redraw of the close button after pressing
index b81f1b90b55b8d27d0d60d214f526aacf530f723..0a0339329c70a1e1e74b93881a7e1ce28856655b 100644 (file)
@@ -2804,15 +2804,18 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
       dy -= frame.border_w;
 
       int snap_distance = screen->getEdgeSnapThreshold();
+      // width/height of the snapping window
+      unsigned int snap_w = frame.width + (frame.border_w * 2);
+      unsigned int snap_h = getHeight() + (frame.border_w * 2);
       if (snap_distance) {
-        int drx = screen->getWidth() - (dx + frame.snap_w);
+        int drx = screen->getWidth() - (dx + snap_w);
 
         if (dx < drx && (dx > 0 && dx < snap_distance) ||
                         (dx < 0 && dx > -snap_distance) )
           dx = 0;
         else if ( (drx > 0 && drx < snap_distance) ||
                   (drx < 0 && drx > -snap_distance) )
-          dx = screen->getWidth() - frame.snap_w;
+          dx = screen->getWidth() - snap_w;
 
         int dtty, dbby, dty, dby;
         switch (screen->getToolbarPlacement()) {
@@ -2831,14 +2834,14 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
         }
 
         dty = dy - dtty;
-        dby = dbby - (dy + frame.snap_h);
+        dby = dbby - (dy + snap_h);
 
         if ( (dy > 0 && dty < snap_distance) ||
             (dy < 0 && dty > -snap_distance) )
           dy = dtty;
         else if ( (dby > 0 && dby < snap_distance) ||
                  (dby < 0 && dby > -snap_distance) )
-          dy = dbby - frame.snap_h;
+          dy = dbby - snap_h;
       }
 
       if (screen->doOpaqueMove()) {
@@ -3148,9 +3151,6 @@ void OpenboxWindow::upsize(void) {
   
   frame.width = client.width + (frame.mwm_border_w * 2);
   frame.height = frame.y_handle + frame.handle_h;
-
-  frame.snap_w = frame.width + (frame.border_w * 2);
-  frame.snap_h = frame.height + (frame.border_w * 2);
 }
 
 
@@ -3172,9 +3172,6 @@ void OpenboxWindow::downsize(void) {
     - frame.handle_h - (decorations.handle ? frame.border_w : 0);
 
   frame.y_handle = frame.border_h + frame.y_border + frame.border_w;
-
-  frame.snap_w = frame.width + (frame.border_w * 2);
-  frame.snap_h = frame.height + (frame.border_w * 2);
 }
 
 
index b2f762428aceef8e6c8cdabe75f934f021479e4b..f3a79e3dd3cc2788c7acf3d85b8af4de90785b8f 100644 (file)
@@ -111,7 +111,7 @@ private:
   } flags;
 
   struct _client {
-    OpenboxWindow *transient_for,  // which window are we a transient for?
+    OpenboxWindow *transient_for,   // which window are we a transient for?
       *transient;                   // which window is our transient?
 
     Window window,                  // the client's window
@@ -199,7 +199,7 @@ private:
 
     unsigned int width, height, title_h, label_w, label_h, handle_h,
       button_w, button_h, grip_w, grip_h, mwm_border_w, border_h, border_w,
-      bevel_w, snap_w, snap_h;
+      bevel_w;
   } frame;
 
 protected:
@@ -279,7 +279,12 @@ public:
   inline const int &getWindowNumber(void) const { return window_number; }
 
   inline const unsigned int &getWidth(void) const { return frame.width; }
-  inline const unsigned int &getHeight(void) const { return frame.height; }
+  inline const unsigned int &getHeight(void) const {
+    if (!flags.shaded)
+      return frame.height;
+    else
+      return frame.title_h;
+  }
   inline const unsigned int &getClientHeight(void) const
   { return client.height; }
   inline const unsigned int &getClientWidth(void) const
This page took 0.030271 seconds and 4 git commands to generate.