Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just upgraded from Firefox 16 to Firefox 17.0.1, and my Firefox windows lost their maximize button. The maximize-window command does nothing either. Switching to full screen mode in Firefox makes its menus and toolbars disappear, but the window decorations remain and the window remains the same size. Also, I can't resize the window to anything other than 18x108. All of this worked with Firefox 16.

I'm running Debian squeeze, with Firefox binaries from http://mozilla.org. My window manager is Sawfish 1.3.5. If I run an X session with Fvwm, I can maximize Firefox, so Firefox 17 is doing something that Sawfish doesn't like, but what?

share|improve this question
    
The starting point will be delete ~/.xsession-errors, log out of WM(sawfish), log back in, open firefox, try the maximize it, then check ~/.xsession-error. –  John Siu Dec 28 '12 at 23:57
    
@JohnSiu No need to delete ~/.xsession-errors or log out. And no, there's nothing there. –  Gilles Dec 28 '12 at 23:59
    
Try start firefox from a terminal, then do maximize, see if it print out error/complaint in the terminal. –  John Siu Dec 29 '12 at 0:02
    
@JohnSiu I assure you that neither Firefox nor Sawfish complain by writing on their stdout or stderr. –  Gilles Dec 29 '12 at 0:04
    
I just ry it, my 17.01 didn't give any complain in Ubuntu Unity. Installing sawfish now, have to try to see :) –  John Siu Dec 29 '12 at 0:08
add comment

2 Answers

You seems to hit a bug of sawfish:

https://bugs.launchpad.net/ubuntu/+source/sawfish/+bug/1083260

PS: And it is a bad idea to test sawfish with ubuntu repo, can't even login link.

share|improve this answer
    
Thanks, I'd found the bug in the code on my own but not the mailing list thread or the Ubuntu bug. Finding a way to work around it in Lisp was trickier. –  Gilles Dec 29 '12 at 2:04
    
Base on the link in my PS, sawfish in Ubuntu repo is pretty outdated. –  John Siu Dec 29 '12 at 2:09
add comment
up vote 1 down vote accepted

window-maximizable-p returns false if the window has a maximum size hint that is smaller than the display. The maximum size hint is the max_width and max_height values in the XSizeHints structure returned as a response to a WM_SIZE_HINTS message.

Firefox 17 declares maximum heights and widths, with the value 0x40000000. In Sawfish, the window-size-hints function reports these values as 0. As it happens, Sawfish's Lisp implementation uses 2 tag bits on integer values, which leaves 30 bits on 32-bit machines and 62 bits on 64-bit machine. So that value of 230 is being silently truncated to 0.

I had a look at the C code, and the way it's written, this truncation happens even on a 64-bit machine (because the 32-bit XSizeHints member is shifted first, then promoted to long).

As John Siu found, this is Ubuntu bug #1083260 which was fixed after being noticed in relation to Firefox 17 with a discussion in the mailing list.


Now for a workaround you can put in your .sawfishrc, at least to make Firefox 17 work.

Given that a maximum value of 0 doesn't make sense, it's possible to filter this value in Lisp and remove the hint when it seems to be 0. This only solves the issue for maximum size hints that are multiples of 230, but that's good enough here.

Warning: the code is pretty horrible — sawfish doesn't like patching subroutine-only modules (you can't do much without rep in the namespace — including (require 'rep)).

(let ((struct (get-structure 'sawfish.wm.windows.subrs)))
  (unless (structure-bound-p struct 'window-size-hints-before-max-truncation-fix)
    (let ((old-window-size-hints (eval 'window-size-hints struct)))
      (structure-define struct 'window-size-hints-before-max-truncation-fix
                        old-window-size-hints)
      (structure-set struct 'window-size-hints
                     (lambda (#!rest args)
                       (let* ((hints (apply old-window-size-hints args))
                              (cell (cons nil hints)))
                         (mapc (lambda (key)
                                 (let ((cell (assq key hints)))
                                   (if (zerop (cdr cell))
                                       (setq hints (delq cell hints)))))
                               '(max-height max-width))
                         hints))))))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.