From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#1133: Tool-bar and multi-tty Date: Fri, 10 Oct 2008 15:43:30 -0400 Message-ID: <873aj48cd9.fsf__12704.9341252588$1223669492$gmane$org@cyd.mit.edu> References: <873aj56v2p.fsf@cyd.mit.edu> <87prm8fkjn.fsf@cyd.mit.edu> Reply-To: Chong Yidong , 1133@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1223669427 21419 80.91.229.12 (10 Oct 2008 20:10:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Oct 2008 20:10:27 +0000 (UTC) Cc: 1133@emacsbugs.donarmstrong.com, dann@ics.uci.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 10 22:11:24 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KoOKQ-0003BH-V8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Oct 2008 22:11:15 +0200 Original-Received: from localhost ([127.0.0.1]:54110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KoOJM-0003G0-Qy for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Oct 2008 16:10:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KoOJH-0003EJ-PC for bug-gnu-emacs@gnu.org; Fri, 10 Oct 2008 16:10:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KoOJG-0003Db-EC for bug-gnu-emacs@gnu.org; Fri, 10 Oct 2008 16:10:03 -0400 Original-Received: from [199.232.76.173] (port=46675 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KoOJG-0003DP-B7 for bug-gnu-emacs@gnu.org; Fri, 10 Oct 2008 16:10:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:36938) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KoOJE-0001Ju-FU for bug-gnu-emacs@gnu.org; Fri, 10 Oct 2008 16:10:00 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9AK9w3q014916; Fri, 10 Oct 2008 13:09:58 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9AJo36S009511; Fri, 10 Oct 2008 12:50:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 10 Oct 2008 19:50:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1133 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1133-submit@emacsbugs.donarmstrong.com id=B1133.12236677008248 (code B ref 1133); Fri, 10 Oct 2008 19:50:03 +0000 Original-Received: (at 1133) by emacsbugs.donarmstrong.com; 10 Oct 2008 19:41:40 +0000 Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9AJfbpg008242 for <1133@emacsbugs.donarmstrong.com>; Fri, 10 Oct 2008 12:41:38 -0700 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 413FC57E210; Fri, 10 Oct 2008 15:43:30 -0400 (EDT) In-Reply-To: (Eli Zaretskii's message of "Fri, 10 Oct 2008 20:27:19 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Fri, 10 Oct 2008 16:10:02 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:21391 Archived-At: Eli Zaretskii writes: > What properties require X resources? Can we refactor the code so that > it only accesses X resources when the tool bar is about to be > displayed? OK, I looked further into this. I was mistaken in my diagnosis of the problem: it's not X resources that are the issue. First, let me explain the problem more precisely. To preload the tool-bar, we just need to make the following change to tool-bar.el: *** trunk/lisp/tool-bar.el.~1.19.~ 2008-10-10 15:15:38.000000000 -0400 --- trunk/lisp/tool-bar.el 2008-10-10 15:16:57.000000000 -0400 *************** *** 262,273 **** (defun tool-bar-setup (&optional frame) (unless (or tool-bar-setup ! (null tool-bar-mode) ! ;; No-op if the initial frame is on a tty, deferring ! ;; action until called from x-create-frame-with-faces. ! ;; Tool-bar icons can depend on X settings, which are ! ;; initially unavailable in this case. ! (not (display-graphic-p frame))) (with-selected-frame (or frame (selected-frame)) ;; People say it's bad to have EXIT on the tool bar, since users ;; might inadvertently click that button. --- 262,268 ---- (defun tool-bar-setup (&optional frame) (unless (or tool-bar-setup ! (null tool-bar-mode)) (with-selected-frame (or frame (selected-frame)) ;; People say it's bad to have EXIT on the tool bar, since users ;; might inadvertently click that button. Suppose you apply this patch, and start emacs on a tty with `emacs -nw', then start a server with M-x server-start RET. Then, open a graphical client with `emacsclient -c'. The result is an ugly, low-color toolbar; not the usual high-color toolbar. I thought this was due to GTK settings, but further investigation reveals that the low-color settings come from these lines in tool-bar-local-item-from-menu: (image-exp `(tool-bar-find-image (if (display-color-p) ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec) ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)))) Calling tool-bar-local-item-from-menu from the tty loads the lo-spec images, whereas deferring this call until X is started up loads the hi-spec images. But deferring the call, as I suggested, doesn't seem to be satisfactory either. Probably the way to do this correctly is to change update_frame_tool_bar to dynamically update the icons to deal with the latest display settings. Alternatively, we could drop support for "low-color" images on the toolbar entirely.