Mercurial > hg > xemacs-beta
comparison lisp/window-xemacs.el @ 4673:11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
And use them.
author | Mike Sperber <sperber@deinprogramm.de> |
---|---|
date | Wed, 29 Jul 2009 10:23:19 +0200 |
parents | 1d41b9bcf74f |
children | e95ddfd6a409 |
comparison
equal
deleted
inserted
replaced
4672:938ffa3ffe4d | 4673:11d71be1c232 |
---|---|
340 (setq minibuffer-scroll-window nil) | 340 (setq minibuffer-scroll-window nil) |
341 | 341 |
342 (frame-reduce-to-one-window frame) | 342 (frame-reduce-to-one-window frame) |
343 (set-window-configuration-frame-size configuration) | 343 (set-window-configuration-frame-size configuration) |
344 | 344 |
345 ; avoid setting these if they're already up-to-date | 345 ;; avoid setting these if they're already up-to-date |
346 ; This also avoids potential inaccuracies in these settings --Mike | 346 ;; This also avoids potential inaccuracies in these settings --Mike |
347 (when window-configuration-includes-position | 347 (when window-configuration-includes-position |
348 (let ((left (window-configuration-frame-left configuration)) | 348 (let ((left (window-configuration-frame-left configuration)) |
349 (top (window-configuration-frame-top configuration))) | 349 (top (window-configuration-frame-top configuration))) |
350 (if (not (equal left (frame-property frame 'left))) | 350 (if (not (equal left (frame-property frame 'left))) |
351 (set-frame-property frame 'left left)) | 351 (set-frame-property frame 'left left)) |
352 (if (not (equal top (frame-property frame 'top))) | 352 (if (not (equal top (frame-property frame 'top))) |
353 (set-frame-property frame 'top top)))) | 353 (set-frame-property frame 'top top)))) |
354 | 354 |
355 ;; these may have changed because of the delete | 355 ;; these may have changed because of the delete |
356 (let ((root-window (frame-root-window frame))) | 356 (set-window-pixel-height (minibuffer-window frame) |
357 (enlarge-window-pixels | 357 (window-configuration-minibuffer-pixel-height configuration)) |
358 (- (window-configuration-minibuffer-pixel-height configuration) | 358 |
359 (window-pixel-height (minibuffer-window frame))) | 359 ;; avoid that `set-window-point' will set the buffer's point for |
360 nil | 360 ;; the selected window |
361 (minibuffer-window frame)) | 361 (select-window (minibuffer-window frame)) |
362 | 362 |
363 ;; avoid that `set-window-point' will set the buffer's point for | 363 (let ((window-configuration-current-window nil) |
364 ;; the selected window | 364 (mapping (list nil))) ; poor man's box |
365 (select-window (minibuffer-window frame)) | |
366 | |
367 (let ((window-configuration-current-window nil) | |
368 (mapping (list nil))) ; poor man's box | |
369 | 365 |
370 (declare (special window-configuration-current-window)) | 366 (declare (special window-configuration-current-window)) |
371 (restore-saved-window configuration | 367 (restore-saved-window configuration |
372 root-window | 368 (frame-root-window frame) |
373 (window-configuration-saved-root-window configuration) | 369 (window-configuration-saved-root-window configuration) |
374 'vertical | 370 'vertical |
375 mapping) | 371 mapping) |
376 (if window-configuration-current-window | 372 (if window-configuration-current-window |
377 (select-window window-configuration-current-window)) | 373 (select-window window-configuration-current-window)) |
378 | 374 |
379 (setq window-min-width (window-configuration-min-width configuration)) | 375 (setq window-min-width (window-configuration-min-width configuration)) |
380 (setq window-min-height (window-configuration-min-height configuration)) | 376 (setq window-min-height (window-configuration-min-height configuration)) |
381 | 377 |
382 (let ((buffer (window-configuration-current-buffer configuration))) | 378 (let ((buffer (window-configuration-current-buffer configuration))) |
383 (if (buffer-live-p buffer) | 379 (if (buffer-live-p buffer) |
384 (set-buffer buffer) | 380 (set-buffer buffer) |
385 (set-buffer (car (buffer-list))))) | 381 (set-buffer (car (buffer-list))))) |
386 (car mapping)))) | 382 (car mapping))) |
387 | 383 |
388 (defun set-window-configuration-frame-size (configuration) | 384 (defun set-window-configuration-frame-size (configuration) |
389 "Restore the frame size of a window configuration." | 385 "Restore the frame size of a window configuration." |
390 (set-frame-pixel-size | 386 (set-frame-pixel-size |
391 (window-configuration-frame configuration) | 387 (window-configuration-frame configuration) |
483 ;; Because of mismatches between actual and reported frame | 479 ;; Because of mismatches between actual and reported frame |
484 ;; size, it may not let us actually set the size of the root | 480 ;; size, it may not let us actually set the size of the root |
485 ;; window to what we want. --Mike | 481 ;; window to what we want. --Mike |
486 (if (not (eq window (frame-root-window (window-frame window)))) | 482 (if (not (eq window (frame-root-window (window-frame window)))) |
487 (progn | 483 (progn |
488 (enlarge-window-pixels (- (saved-window-pixel-width saved-window) | 484 (set-window-pixel-width window |
489 (window-pixel-width window)) | 485 (saved-window-pixel-width saved-window)) |
490 t | 486 (set-window-pixel-height window |
491 window) | 487 (saved-window-pixel-height saved-window)))) |
492 (enlarge-window-pixels (- (saved-window-pixel-height saved-window) | |
493 (window-pixel-height window)) | |
494 nil | |
495 window))) | |
496 (set-window-hscroll window (saved-window-hscroll saved-window)) | 488 (set-window-hscroll window (saved-window-hscroll saved-window)) |
497 (set-modeline-hscroll window | 489 (set-modeline-hscroll window |
498 (saved-window-modeline-hscroll saved-window)) | 490 (saved-window-modeline-hscroll saved-window)) |
499 (set-window-dedicated-p window (saved-window-dedicatedp saved-window)))) | 491 (set-window-dedicated-p window (saved-window-dedicatedp saved-window)))) |
500 | 492 |
510 | 502 |
511 (defun saved-window-pixel-height (saved-window) | 503 (defun saved-window-pixel-height (saved-window) |
512 "Compute the pixel height of SAVED-WINDOW." | 504 "Compute the pixel height of SAVED-WINDOW." |
513 (- (saved-window-pixel-bottom saved-window) | 505 (- (saved-window-pixel-bottom saved-window) |
514 (saved-window-pixel-top saved-window))) | 506 (saved-window-pixel-top saved-window))) |
507 | |
508 (defun set-window-pixel-width (window width) | |
509 "Set the pixel width of WINDOW." | |
510 (enlarge-window-pixels (- width (window-pixel-width window)) t window)) | |
511 | |
512 (defun set-window-pixel-height (window height) | |
513 "Set the pixel height of WINDOW." | |
514 (enlarge-window-pixels (- height (window-pixel-height window)) nil window)) | |
515 | |
515 | 516 |
516 ;; The window-config stack is stored as a list in frame property | 517 ;; The window-config stack is stored as a list in frame property |
517 ;; 'window-config-stack, with the most recent element at the front. | 518 ;; 'window-config-stack, with the most recent element at the front. |
518 ;; When you pop off an element, the popped off element gets put at the | 519 ;; When you pop off an element, the popped off element gets put at the |
519 ;; front of frame property 'window-config-unpop-stack, so you can | 520 ;; front of frame property 'window-config-unpop-stack, so you can |