Of max-size and min-size



Hi,

I have been trying to solve bug #257838 of debian BTS
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257838
which is akin to bug #133260 of gnome-bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=133260

After investigation, it appears rhythmbox was setting curious hints for
the window manager:
max-height was set to 1 (in fact 0, but GTK turns this into 1)
min-height was set to 72 (widgets size)

Metacity appears to be a better citizen in face of this kind of
conflict, but several window managers (including waimea, and others,
I suspect) do not. So I redirected the bug to rhythmbox with a patch.

However, it would be fine if sawfish could cope with contradictory
hints. I made a first patch to lisp/.../windows.jl (function:
constrain-dimension-to-hints) adding this one line patch
--- sawfish-orig/lisp/sawfish/wm/windows.jl     2005-02-22 15:00:49.000000000 +0100
+++ sawfish-1.3+cvs20050222/lisp/sawfish/wm/windows.jl  2005-04-25 10:38:07.276557371 +0200
@@ -259,6 +259,7 @@
                                      'max-width 'max-height) hints)) 65535))
          (inc (or (cdr (assq (if (eq dimension 'x)
                                  'width-inc 'height-inc) hints)) 1)))
+      (unless (> maximum minimum) (setq maximum minimum))
       (let ((bottom (or base minimum 1)))
        (unless (= (mod (- x bottom) inc) 0)
          (setq x (inexact->exact


Next: when a configure event is received, if there is a buggy max-size
(smaller than the min-size), sawfish should probably force the respect
of the min-size hint. In fact, when a configure event is received, the
window manager should enforce the max-size and min-size hints, which is
not done currently. Therefore, I would propose the following patch to
lisp/.../state/configure.jl

--- sawfish-orig/lisp/sawfish/wm/state/configure.jl     2005-02-22 15:00:49.000000000 +0100
+++ sawfish-1.3+cvs20050222/lisp/sawfish/wm/state/configure.jl 2005-04-25 10:46:18.310726284 +0200
@@ -134,10 +134,10 @@
                ;; [y] placed relative to the center
                (rplacd coords (- (cdr coords) (quotient (- (cdr tem)
                                                            (cdr dims)) 2)))))))
-       (unless (window-locked-horizontally-p w)
-         (rplaca dims (car tem)))
-       (unless (window-locked-vertically-p w)
-         (rplacd dims (cdr tem))))
+        (unless (window-locked-horizontally-p w)
+          (rplaca dims (constrain-dimension-to-hints (car tem) 'x hints)))
+        (unless (window-locked-vertically-p w)
+          (rplacd dims (constrain-dimension-to-hints (cdr tem) 'y hints))))

       (when (setq tem (cdr (assq 'position alist)))
        (let ((grav (window-gravity w hints)))

This has been tested. Configure events are rare from the logs I could
gather from my desktop, anyway.

A third proposal I made was to "correct" the hints at the C source
level. This has been frowned upon by John Harper with good reasons:
the upper-level source code should be the one doing the decision, not
the C wrapper.

I sometimes still get a flip-flop effect with the buggy rhythmbox
(especially when trying to resize the small-size rhythmbox window), but
I think this is a buggy behaviour of rhythmbox. It does not appear in my
patched rhythmbox (even with an unpatched sawfish). This must be because
some widgets insists on having a minimal size (must be the ellispis
function somehow) which cannot be satisfied with the buggy max hint.

Any comments on that?

Sincerly,
-- 
JCD



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]