Re: [PATCH] maximize-horizontally/vertically behaviour change + fix



I stand corrected, this event gets executed way more frequently than I
expected, and could yield and infinite loop.
My apologies.

--dmg

2009/12/12 dmg <dmg uvic ca>:
> On Tue, Dec 8, 2009 at 6:37 AM, Christopher Roy Bratusek <zanghar freenet de> wrote:
>> Am Tue, 8 Dec 2009 03:11:33 -0800
>> schrieb dmg <dmg uvic ca>:
>>
>>> Hi everybody,
>>>
>>> one thing that I have been wanting is an automatic maximize of windows
>>> when there is a change in the size of the screen.
>>>
>>> I use a tablet, and when the display is put in slate mode I need to
>>> unmaximize-maximize windows manually. Does anybody
>>> know where should I hook to the even of resizing the size of the
>>> screen?
>>>
>>> thanks a lot!
>>>
>>> --(the other) daniel
>>
>> Actually sawfish does completely ignore the resolution-changed
>> notification. It's marked as BLOCKER for 3.0, though.
>>
>> Chris
>>
>>
>
> This got me thinking. The size of the screen is updated when xrandr rotates the screen. Hence I thought sawfish was handling
> the event. I looked today at events.c and found a hook: 'configure-notify-hook that gets executed by the same code that
> resets the size of the screen.
>
> So I hooked a function, and yes, it works. This is my current hooked function (it could be improved to handle
> moving the current window inside the boundaries of the screen and to make sure there is one window to resize.
>
> (Something else I'd like to implement is the ability to keep 2 geometries: one for portrait and one for landscape mode,
> similar to the way Maximize keeps the geometry before the maximization).
>
> (defun dmg-after-rotate ()
> "Test"
> (interactive)
> (dmg-remaximize-window (car (window-order current-workspace nil nil)))
> (display-message "This is a test3")
> )
>
> (add-hook 'configure-notify-hook dmg-after-rotate)
>
>
> ;;; this is my remaximize window.
> (defun dmg-remaximize-window (w )
> "remaximize the given window"
> (interactive "%W")
> (let* (
> (m (window-maximized-p w))
> (h (window-maximized-horizontally-p w))
> (v (window-maximized-vertically-p w))
> )
> (if (and m)
> (progn
> (unmaximize-window w)
> (dmg-move-window-inside w)
> (cond
> ((and v h)
> (maximize-window w)
> ) ; and v h
> ((and v)
> (maximize-window-vertically w)
> ) ; and v
> (maximize-window-horizontally w)
> )
> ) ; end cond
> ) ; end progn
> (progn
> (dmg-move-window-inside w)
> )
> ) ; end let
> )
>
>
>
>
>
> --
> --dmg
>
> ---
> Daniel M. German
> http://turingmachine.org
>
>
>



-- 
--dmg

---
Daniel M. German
http://turingmachine.org


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