From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#72331: 29.4; Modifying horizontal-scroll-bar does not fully work (MacOS only) Date: Mon, 05 Aug 2024 15:43:21 +0200 Message-ID: References: <8e515633e5357ca950d4990b03bb4897@finder.org> <86ed74sn4x.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22368"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Po Lu , Jared Finder , 72331@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 05 15:45:04 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1say1H-0005fg-4I for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Aug 2024 15:45:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1say0w-0005oB-TW; Mon, 05 Aug 2024 09:44:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1say0u-0005nd-Ak for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 09:44:40 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1say0u-0006Xz-1Q for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 09:44:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=7cwrzIo6hbGsX64Ak4/szqOVuXLlLspbRvJOJmFjywk=; b=DRL2FPgv63U4IEcddPkOkm50WnyMn4iQSzyE18f7h0IuXjQKLsLqHA7qgiULTMkpyb2iq2GRjjfQ0S8on3NrSbVMiGFQkkUuHOD/oC8/mwkeNs3PMzQfLGumX8NBzbhkUyxkcVo6NFcU+Ph6ABLwGCHwyX/O/gLrx7N5YFv+uryBN5PI2W7R6vYDUefdqBCfQg+7bP6NU0gKUD9B4hMWv0FSGrup0nqfSMoaR5diGq28WjwFzyeVyagh4sd5i7tk+nIigBT7MCP+oWCdkesY1wutVYbGQd85EtO+iXls/ZL1DwndjJhS9Juk+WPwJdSiM1QwxfqU+Mk67NuVtoC/MA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1say1G-0002hb-6y for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 09:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2024 13:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72331 X-GNU-PR-Package: emacs Original-Received: via spool by 72331-submit@debbugs.gnu.org id=B72331.172286549610345 (code B ref 72331); Mon, 05 Aug 2024 13:45:02 +0000 Original-Received: (at 72331) by debbugs.gnu.org; 5 Aug 2024 13:44:56 +0000 Original-Received: from localhost ([127.0.0.1]:58289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1say1A-0002gn-27 for submit@debbugs.gnu.org; Mon, 05 Aug 2024 09:44:56 -0400 Original-Received: from mail-lf1-f42.google.com ([209.85.167.42]:53531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1say17-0002gK-0L for 72331@debbugs.gnu.org; Mon, 05 Aug 2024 09:44:53 -0400 Original-Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-530ae4ef29dso10971224e87.3 for <72331@debbugs.gnu.org>; Mon, 05 Aug 2024 06:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722865404; x=1723470204; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=7cwrzIo6hbGsX64Ak4/szqOVuXLlLspbRvJOJmFjywk=; b=DUvftUENH0QuzoyDpWyGduwAa4BY5FlgxFdxTnw4K7wQ8Kei6ACPLOhl2zrBvAb91+ kVxaIZhBPniL61ELLfjTEA+DLgSxI7LiOBWYJTT1+mf1WL1vrBTkCm2NvvBcP7z68NQJ XQANSqCk+CtzvRDhzhhzHWiAmDTpljoH71sJJz33N3g0Fx79HTh/wEsJ7rLguLwv4Gsl 45ng2MkscdGTAoSR92VesJW542gkXBeL37QYt4OaG30i2RYGQJA89W2f4DlTVuR9/L8L BRHNYkCn6RZ+Svdkt5dF/ImKhppTKjsAqbtFO5gw/+VoXLuITjBip23LKkQSkcBtsTml O4YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722865404; x=1723470204; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7cwrzIo6hbGsX64Ak4/szqOVuXLlLspbRvJOJmFjywk=; b=Elu/HPccsI9NY732ATERJTbBPb7R6qtQsA6pvgtik4qJyf4JN0JPsYIaMuYl8zKF2q SdcRstOn5PQGlOLjK069289IOqapAEN7JE0w0pmJMLjTLj/F4BZ+4sfGKBaxAbCEw8jZ VeKXrOX3ux1hDzIJfHfA+hiXdkZgJb9AFFuY0CHT+s3iAiyPU9g9+SBQCMux4zR19yh9 IjZwTzJMGa3NwEfu4CFqaDS8cZDFvPxzTl38im7z3pYhlhAMM0jiSUxilVYoHBF0QMv+ g04c6kmGbPLo3BBah7Hf5JhTIYA+9UMFbt6EIit4GQEQ5c5XcGJmAwBuxM7eJUA5Trny 6Xkw== X-Forwarded-Encrypted: i=1; AJvYcCV05Hb6NpNo9yzu0GsyBakEGXM6Z6kde5cTkLwMspVkzX5NMTGUS5BMxoo9BvSrEd+gGCsWZDOyamcXbpFh9M3o/9AgPVQ= X-Gm-Message-State: AOJu0YxjN+xXii+IgDMXjxGXOm78Pms7xum/DmND8z7+ETQG5IaAMLq0 1PjJ3WRLNSTzptwIoR9EeqnYVTyJSdKJvYLzGXHoFp01BJs6NmD7M5EjSw== X-Google-Smtp-Source: AGHT+IGGXdxrB7EwbPiAVdPv49eFkyX6qXLfIxew8uZ8bjEKBSsM+HHtbCnOKqQxbhipyu8ULXtnYA== X-Received: by 2002:a05:6512:31c1:b0:52e:716a:1898 with SMTP id 2adb3069b0e04-530bb3bcc80mr9138699e87.58.1722865403674; Mon, 05 Aug 2024 06:43:23 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e366bb.dip0.t-ipconnect.de. [217.227.102.187]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e842bfsm455927266b.181.2024.08.05.06.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 06:43:23 -0700 (PDT) In-Reply-To: <86ed74sn4x.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 04 Aug 2024 11:33:34 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289792 Archived-At: Eli Zaretskii writes: >> Date: Sat, 27 Jul 2024 22:10:06 -0700 >> From: Jared Finder via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Directly modifying the variable horizontal-scroll-bar on MacOS doesn't >> show a scroll bar unless the frame also has the horizontal-scroll-bars >> frame parameter set. This only happens on MacOS, on Linux and Windows >> everything behaves as I would expect. >> >> To reproduce, define the following function: >> >> (defun bug-report-toggle-buffer-horizontal-scroll-bar () >> "Like `toggle-scroll-bar', but for just the current buffer. >> And for horizontal scroll bars. I guess it's acutally very >> different." >> (interactive) >> (setq horizontal-scroll-bar (if horizontal-scroll-bar nil 'bottom)) >> (set-window-buffer (selected-window) (current-buffer))) >> >> Then run M-x bug-report-toggle-buffer-horizontal-scroll-bar repeatedly >> and observe that on MacOS space gets reserved for the horizontal scroll >> bar but no scroll bar is rendered. Finally, run M-x >> horizontal-scroll-bar-mode and observe that now the horizontal scroll >> bar is properly shown and hidden. >> >> I also tested this on master and observed the same behavior. > > Thanks. > > Could some macOS user please look into this? Same for vertical-scroll-bar, BTW. From reading the code and setting a breakpoint in ns_set_horizontal_scroll_bar, I'd say it's the definition of these macros in nsterm.h: /* Compute pixel size for vertical scroll bars. */ #define NS_SCROLL_BAR_WIDTH(f) \ (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \ ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \ : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ : 0) /* Compute pixel size for horizontal scroll bars. */ #define NS_SCROLL_BAR_HEIGHT(f) \ (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \ ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \ ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \ : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \ : 0) Both check FRAME_HAS_H/V_SCROLL_BARS which in this case results in width or height being 0, which is a bit small. A change like the one below makes the horizontal scroll bar visible with Jared's test function. 1 file changed, 4 insertions(+), 1 deletion(-) src/nsterm.m | 5 ++++- modified src/nsterm.m @@ -5167,7 +5167,10 @@ Function modeled after x_draw_glyph_string_box (). window_box (window, ANY_AREA, &window_x, 0, &window_width, 0); left = window_x; width = window_width; - height = NS_SCROLL_BAR_HEIGHT (f); + // height = NS_SCROLL_BAR_HEIGHT (f); + height = rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 + ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) + : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))); top = WINDOW_SCROLL_BAR_AREA_Y (window); r = NSMakeRect (left, top, width, height); If that's the right thing (plus a corresponding change for vertical scroll bars) I don't know without studying the code and docs, and what other platforms do. Maybe Po Lu can help (CC'd).