aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-01-30 15:18:13 +0000
committerGerd Moellmann2001-01-30 15:18:13 +0000
commitde2f5dbec26582ead3f706e81eee9637cf6e4e4d (patch)
treea1b8e20fe6d9a9e3f64cf7aec8e176ad3a71683e
parent14f16b9c9a56e5b817822cd1160faa34d8f6c429 (diff)
downloademacs-de2f5dbec26582ead3f706e81eee9637cf6e4e4d.tar.gz
emacs-de2f5dbec26582ead3f706e81eee9637cf6e4e4d.zip
(frame-notice-user-settings): Do the tool-bar
stuff only for graphical displays. Fix a braino.
-rw-r--r--lisp/frame.el189
1 files changed, 95 insertions, 94 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index b7f6492a396..2486cf7bdfc 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -288,8 +288,9 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
288 ;; When tool-bar has been switched off, correct the frame size 288 ;; When tool-bar has been switched off, correct the frame size
289 ;; by the lines added in x-create-frame for the tool-bar and 289 ;; by the lines added in x-create-frame for the tool-bar and
290 ;; switch `tool-bar-mode' off. 290 ;; switch `tool-bar-mode' off.
291 (when (or (eq 0 (cdr (assq 'tool-bar-lines initial-frame-alist))) 291 (when (and (display-graphic-p)
292 (eq 0 (cdr (assq 'tool-bar-lines default-frame-alist)))) 292 (or (eq 0 (cdr (assq 'tool-bar-lines initial-frame-alist)))
293 (eq 0 (cdr (assq 'tool-bar-lines default-frame-alist)))))
293 (let* ((char-height (frame-char-height frame-initial-frame)) 294 (let* ((char-height (frame-char-height frame-initial-frame))
294 (image-height 24) 295 (image-height 24)
295 (margin (cond ((and (consp tool-bar-button-margin) 296 (margin (cond ((and (consp tool-bar-button-margin)
@@ -325,100 +326,100 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
325 ;; default-frame-alist in the parameters of the screen we 326 ;; default-frame-alist in the parameters of the screen we
326 ;; create here, so that its new value, gleaned from the user's 327 ;; create here, so that its new value, gleaned from the user's
327 ;; .emacs file, will be applied to the existing screen. 328 ;; .emacs file, will be applied to the existing screen.
328 (when (not (eq (cdr (or (assq 'minibuffer initial-frame-alist) 329 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
329 (assq 'minibuffer default-frame-alist) 330 (assq 'minibuffer default-frame-alist)
330 '(minibuffer . t))) 331 '(minibuffer . t)))
331 t)) 332 t))
332 ;; Create the new frame. 333 ;; Create the new frame.
333 (let (parms new) 334 (let (parms new)
334 ;; If the frame isn't visible yet, wait till it is. 335 ;; If the frame isn't visible yet, wait till it is.
335 ;; If the user has to position the window, 336 ;; If the user has to position the window,
336 ;; Emacs doesn't know its real position until 337 ;; Emacs doesn't know its real position until
337 ;; the frame is seen to be visible. 338 ;; the frame is seen to be visible.
338 (while (not (cdr (assq 'visibility 339 (while (not (cdr (assq 'visibility
339 (frame-parameters frame-initial-frame)))) 340 (frame-parameters frame-initial-frame))))
340 (sleep-for 1)) 341 (sleep-for 1))
341 (setq parms (frame-parameters frame-initial-frame)) 342 (setq parms (frame-parameters frame-initial-frame))
342 343
343 ;; Get rid of `name' unless it was specified explicitly before. 344 ;; Get rid of `name' unless it was specified explicitly before.
344 (or (assq 'name frame-initial-frame-alist) 345 (or (assq 'name frame-initial-frame-alist)
345 (setq parms (delq (assq 'name parms) parms))) 346 (setq parms (delq (assq 'name parms) parms)))
346 347
347 (setq parms (append initial-frame-alist 348 (setq parms (append initial-frame-alist
348 default-frame-alist 349 default-frame-alist
349 parms 350 parms
350 nil)) 351 nil))
351 352
352 ;; Get rid of `reverse', because that was handled 353 ;; Get rid of `reverse', because that was handled
353 ;; when we first made the frame. 354 ;; when we first made the frame.
354 (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms))) 355 (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms)))
355 356
356 (if (assq 'height frame-initial-geometry-arguments) 357 (if (assq 'height frame-initial-geometry-arguments)
357 (setq parms (assq-delete-all 'height parms))) 358 (setq parms (assq-delete-all 'height parms)))
358 (if (assq 'width frame-initial-geometry-arguments) 359 (if (assq 'width frame-initial-geometry-arguments)
359 (setq parms (assq-delete-all 'width parms))) 360 (setq parms (assq-delete-all 'width parms)))
360 (if (assq 'left frame-initial-geometry-arguments) 361 (if (assq 'left frame-initial-geometry-arguments)
361 (setq parms (assq-delete-all 'left parms))) 362 (setq parms (assq-delete-all 'left parms)))
362 (if (assq 'top frame-initial-geometry-arguments) 363 (if (assq 'top frame-initial-geometry-arguments)
363 (setq parms (assq-delete-all 'top parms))) 364 (setq parms (assq-delete-all 'top parms)))
364 (setq new 365 (setq new
365 (make-frame 366 (make-frame
366 ;; Use the geometry args that created the existing 367 ;; Use the geometry args that created the existing
367 ;; frame, rather than the parms we get for it. 368 ;; frame, rather than the parms we get for it.
368 (append frame-initial-geometry-arguments 369 (append frame-initial-geometry-arguments
369 '((user-size . t) (user-position . t)) 370 '((user-size . t) (user-position . t))
370 parms))) 371 parms)))
371 ;; The initial frame, which we are about to delete, may be 372 ;; The initial frame, which we are about to delete, may be
372 ;; the only frame with a minibuffer. If it is, create a 373 ;; the only frame with a minibuffer. If it is, create a
373 ;; new one. 374 ;; new one.
374 (or (delq frame-initial-frame (minibuffer-frame-list)) 375 (or (delq frame-initial-frame (minibuffer-frame-list))
375 (make-initial-minibuffer-frame nil)) 376 (make-initial-minibuffer-frame nil))
376 377
377 ;; If the initial frame is serving as a surrogate 378 ;; If the initial frame is serving as a surrogate
378 ;; minibuffer frame for any frames, we need to wean them 379 ;; minibuffer frame for any frames, we need to wean them
379 ;; onto a new frame. The default-minibuffer-frame 380 ;; onto a new frame. The default-minibuffer-frame
380 ;; variable must be handled similarly. 381 ;; variable must be handled similarly.
381 (let ((users-of-initial 382 (let ((users-of-initial
382 (filtered-frame-list 383 (filtered-frame-list
383 (function (lambda (frame) 384 (function (lambda (frame)
384 (and (not (eq frame frame-initial-frame)) 385 (and (not (eq frame frame-initial-frame))
385 (eq (window-frame 386 (eq (window-frame
386 (minibuffer-window frame)) 387 (minibuffer-window frame))
387 frame-initial-frame))))))) 388 frame-initial-frame)))))))
388 (if (or users-of-initial 389 (if (or users-of-initial
389 (eq default-minibuffer-frame frame-initial-frame)) 390 (eq default-minibuffer-frame frame-initial-frame))
390 391
391 ;; Choose an appropriate frame. Prefer frames which 392 ;; Choose an appropriate frame. Prefer frames which
392 ;; are only minibuffers. 393 ;; are only minibuffers.
393 (let* ((new-surrogate 394 (let* ((new-surrogate
394 (car 395 (car
395 (or (filtered-frame-list 396 (or (filtered-frame-list
396 (function 397 (function
397 (lambda (frame) 398 (lambda (frame)
398 (eq (cdr (assq 'minibuffer 399 (eq (cdr (assq 'minibuffer
399 (frame-parameters frame))) 400 (frame-parameters frame)))
400 'only)))) 401 'only))))
401 (minibuffer-frame-list)))) 402 (minibuffer-frame-list))))
402 (new-minibuffer (minibuffer-window new-surrogate))) 403 (new-minibuffer (minibuffer-window new-surrogate)))
403 404
404 (if (eq default-minibuffer-frame frame-initial-frame) 405 (if (eq default-minibuffer-frame frame-initial-frame)
405 (setq default-minibuffer-frame new-surrogate)) 406 (setq default-minibuffer-frame new-surrogate))
406 407
407 ;; Wean the frames using frame-initial-frame as 408 ;; Wean the frames using frame-initial-frame as
408 ;; their minibuffer frame. 409 ;; their minibuffer frame.
409 (mapcar 410 (mapcar
410 (function 411 (function
411 (lambda (frame) 412 (lambda (frame)
412 (modify-frame-parameters 413 (modify-frame-parameters
413 frame (list (cons 'minibuffer new-minibuffer))))) 414 frame (list (cons 'minibuffer new-minibuffer)))))
414 users-of-initial)))) 415 users-of-initial))))
415 416
416 ;; Redirect events enqueued at this frame to the new frame. 417 ;; Redirect events enqueued at this frame to the new frame.
417 ;; Is this a good idea? 418 ;; Is this a good idea?
418 (redirect-frame-focus frame-initial-frame new) 419 (redirect-frame-focus frame-initial-frame new)
419 420
420 ;; Finally, get rid of the old frame. 421 ;; Finally, get rid of the old frame.
421 (delete-frame frame-initial-frame t)) 422 (delete-frame frame-initial-frame t))
422 423
423 ;; Otherwise, we don't need all that rigamarole; just apply 424 ;; Otherwise, we don't need all that rigamarole; just apply
424 ;; the new parameters. 425 ;; the new parameters.