diff options
| author | Glenn Morris | 2008-06-12 03:53:47 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-06-12 03:53:47 +0000 |
| commit | 2a41ed3528e340befa13c616bd0717b71d96f182 (patch) | |
| tree | 6c2700d8844ed2259a797ed5889a9634aa406703 | |
| parent | 777a7291841b52b20c7d23cd9cbdb74d7bc88971 (diff) | |
| download | emacs-2a41ed3528e340befa13c616bd0717b71d96f182.tar.gz emacs-2a41ed3528e340befa13c616bd0717b71d96f182.zip | |
(dframe-reposition-frame-emacs): Reorder test, and use unless.
(x-display-pixel-width, x-display-pixel-height):
Define for compiler, for builds without X.
| -rw-r--r-- | lisp/dframe.el | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lisp/dframe.el b/lisp/dframe.el index 50395765a92..2086347dc90 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el | |||
| @@ -417,22 +417,24 @@ LOCATION can be one of 'random, 'left, 'right, 'left-right, or 'top-bottom." | |||
| 417 | (dframe-reposition-frame-xemacs new-frame parent-frame location) | 417 | (dframe-reposition-frame-xemacs new-frame parent-frame location) |
| 418 | (dframe-reposition-frame-emacs new-frame parent-frame location))) | 418 | (dframe-reposition-frame-emacs new-frame parent-frame location))) |
| 419 | 419 | ||
| 420 | ;; Not defined in builds without X, but behind window-system test. | ||
| 421 | (declare-function x-display-pixel-width "xfns.c" (&optional terminal)) | ||
| 422 | (declare-function x-display-pixel-height "xfns.c" (&optional terminal)) | ||
| 423 | |||
| 420 | (defun dframe-reposition-frame-emacs (new-frame parent-frame location) | 424 | (defun dframe-reposition-frame-emacs (new-frame parent-frame location) |
| 421 | "Move NEW-FRAME to be relative to PARENT-FRAME. | 425 | "Move NEW-FRAME to be relative to PARENT-FRAME. |
| 422 | LOCATION can be one of 'random, 'left-right, 'top-bottom, or | 426 | LOCATION can be one of 'random, 'left-right, 'top-bottom, or |
| 423 | a cons cell indicationg a position of the form (LEFT . TOP)." | 427 | a cons cell indicationg a position of the form (LEFT . TOP)." |
| 424 | (let* ((pfx (dframe-frame-parameter parent-frame 'left)) | 428 | ;; Position dframe. |
| 425 | (pfy (dframe-frame-parameter parent-frame 'top)) | 429 | ;; Do no positioning if not on a windowing system, |
| 426 | (pfw (frame-pixel-width parent-frame)) | 430 | (unless (or (not window-system) (eq window-system 'pc)) |
| 427 | (pfh (frame-pixel-height parent-frame)) | 431 | (let* ((pfx (dframe-frame-parameter parent-frame 'left)) |
| 428 | (nfw (frame-pixel-width new-frame)) | 432 | (pfy (dframe-frame-parameter parent-frame 'top)) |
| 429 | (nfh (frame-pixel-height new-frame)) | 433 | (pfw (frame-pixel-width parent-frame)) |
| 430 | newleft newtop | 434 | (pfh (frame-pixel-height parent-frame)) |
| 431 | ) | 435 | (nfw (frame-pixel-width new-frame)) |
| 432 | ;; Position dframe. | 436 | (nfh (frame-pixel-height new-frame)) |
| 433 | (if (or (not window-system) (eq window-system 'pc)) | 437 | newleft newtop) |
| 434 | ;; Do no positioning if not on a windowing system, | ||
| 435 | nil | ||
| 436 | ;; Rebuild pfx,pfy to be absolute positions. | 438 | ;; Rebuild pfx,pfy to be absolute positions. |
| 437 | (setq pfx (if (not (consp pfx)) | 439 | (setq pfx (if (not (consp pfx)) |
| 438 | pfx | 440 | pfx |
| @@ -455,8 +457,7 @@ a cons cell indicationg a position of the form (LEFT . TOP)." | |||
| 455 | ;; A - means distance from the right edge | 457 | ;; A - means distance from the right edge |
| 456 | ;; of the display, or DW - pfx - framewidth | 458 | ;; of the display, or DW - pfx - framewidth |
| 457 | (- (x-display-pixel-height) (car (cdr pfy)) pfh) | 459 | (- (x-display-pixel-height) (car (cdr pfy)) pfh) |
| 458 | (car (cdr pfy)))) | 460 | (car (cdr pfy))))) |
| 459 | ) | ||
| 460 | (cond ((eq location 'right) | 461 | (cond ((eq location 'right) |
| 461 | (setq newleft (+ pfx pfw 5) | 462 | (setq newleft (+ pfx pfw 5) |
| 462 | newtop pfy)) | 463 | newtop pfy)) |
| @@ -479,8 +480,7 @@ a cons cell indicationg a position of the form (LEFT . TOP)." | |||
| 479 | ;; otherwise choose side we overlap less | 480 | ;; otherwise choose side we overlap less |
| 480 | ((> left-margin right-margin) 0) | 481 | ((> left-margin right-margin) 0) |
| 481 | (t (- (x-display-pixel-width) nfw 5)))) | 482 | (t (- (x-display-pixel-width) nfw 5)))) |
| 482 | newtop pfy | 483 | newtop pfy)) |
| 483 | )) | ||
| 484 | ((eq location 'top-bottom) | 484 | ((eq location 'top-bottom) |
| 485 | (setq newleft pfx | 485 | (setq newleft pfx |
| 486 | newtop | 486 | newtop |
| @@ -494,15 +494,14 @@ a cons cell indicationg a position of the form (LEFT . TOP)." | |||
| 494 | ((>= bottom-margin 0) bottom-guess) | 494 | ((>= bottom-margin 0) bottom-guess) |
| 495 | ;; Choose a side to overlap the least. | 495 | ;; Choose a side to overlap the least. |
| 496 | ((> top-margin bottom-margin) 0) | 496 | ((> top-margin bottom-margin) 0) |
| 497 | (t (- (x-display-pixel-height) nfh 5))))) | 497 | (t (- (x-display-pixel-height) nfh 5)))))) |
| 498 | ) | ||
| 499 | ((consp location) | 498 | ((consp location) |
| 500 | (setq newleft (or (car location) 0) | 499 | (setq newleft (or (car location) 0) |
| 501 | newtop (or (cdr location) 0))) | 500 | newtop (or (cdr location) 0))) |
| 502 | (t nil)) | 501 | (t nil)) |
| 503 | (modify-frame-parameters new-frame | 502 | (modify-frame-parameters new-frame |
| 504 | (list (cons 'left newleft) | 503 | (list (cons 'left newleft) |
| 505 | (cons 'top newtop)))))) | 504 | (cons 'top newtop)))))) |
| 506 | 505 | ||
| 507 | (defun dframe-reposition-frame-xemacs (new-frame parent-frame location) | 506 | (defun dframe-reposition-frame-xemacs (new-frame parent-frame location) |
| 508 | "Move NEW-FRAME to be relative to PARENT-FRAME. | 507 | "Move NEW-FRAME to be relative to PARENT-FRAME. |