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#73838: 31.0.50; Problems in note_mouse_highlight if -nw Date: Wed, 16 Oct 2024 16:19:53 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10047"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 73838@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 16 16:22:16 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 1t14ul-0002Oe-K3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Oct 2024 16:22:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t14uI-0001up-5w; Wed, 16 Oct 2024 10:21:46 -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 1t14uE-0001uI-Fu for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2024 10:21:42 -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 1t14uE-0001qG-7D for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2024 10:21:42 -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=mTJc6sjBqkAbsAX4dlL8XFtgC4wC3UCWiJmfOQyAMck=; b=aDbhMlWoEu0QxWilkrqes9jF27ax1zTPzDGFIzlRjM6neALcmC8DuQnIA5SKDI4gVKktTVQvjF68k5ahTDkU47muS0FW5ImVXtZSE3kM4pRsH7kxZUdYLbQHQaeNPRFK6KOVbinm8jZR0WDzR0tc8mLounmYDfEXTMw2TBNeu7AvjGoJlfaLbXIZMnaA+ZqUIpH6EKF3UlGQVoe0QCc46zTsy+VbPNahn8l+mYJcTkMcf+KtY3ecHwqabYzYfN1jOXsBWZC9DNA6LSqBZ8II4RfCTZF3wU10AYDsPMw0yPk1ZarpFuygZGPS/C+PM+CqSDYrsTXU6WF00XHtiFFSUw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t14uX-0003rN-P0 for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2024 10:22:01 -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: Wed, 16 Oct 2024 14:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73838 X-GNU-PR-Package: emacs Original-Received: via spool by 73838-submit@debbugs.gnu.org id=B73838.172908847714762 (code B ref 73838); Wed, 16 Oct 2024 14:22:01 +0000 Original-Received: (at 73838) by debbugs.gnu.org; 16 Oct 2024 14:21:17 +0000 Original-Received: from localhost ([127.0.0.1]:60046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t14tp-0003q1-8t for submit@debbugs.gnu.org; Wed, 16 Oct 2024 10:21:17 -0400 Original-Received: from mail-wr1-f50.google.com ([209.85.221.50]:42343) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t14tn-0003pu-Jx for 73838@debbugs.gnu.org; Wed, 16 Oct 2024 10:21:16 -0400 Original-Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d41894a32so703984f8f.1 for <73838@debbugs.gnu.org>; Wed, 16 Oct 2024 07:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729088395; x=1729693195; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mTJc6sjBqkAbsAX4dlL8XFtgC4wC3UCWiJmfOQyAMck=; b=LxTpDeafVK+h7dc7DBBu31F+wGzQq9YIyJf9IktURDVd+jy2NSsCFy4m5UhbclZyq5 4K8ganDUoYj06JEfvEgcGw9dmnCYoc+US9zd0IGWokBUQhbm19+CUkgbmKCPGKC+Jk6A NYtEDv6XagCrok6R5gN/Q/bt4Se+Q5FYU05i4GwwAisUXFTnOaXkl8c2MZr2tz3vEp4P 7u/EwL14AwswGHUXfUiBTmiNlJVydBAZJ2+0/8ejslfLekWMCBJaloM06dtcYwWHB0Yk HtRKnlWNvs+sj705QNHWw4d8tQWyApLSk4xtP8hRdQtRvrb5QdXeKstEuWcYlBfKWFxf ccXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729088395; x=1729693195; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mTJc6sjBqkAbsAX4dlL8XFtgC4wC3UCWiJmfOQyAMck=; b=JOrhfmCLYBrBcom50oA3sfL7KjJ+eywqc26SslTHsWXEeelVOl/n5Co7JIM41ZQNJl sLNrfKnJ2ZYPP58lo1t9nKSjMcXceH9/k/OnkQa5R7ttr2uUSzkXf7qomKMkb+p0yFLv LAx/i0iaKjWK3mTGcv7dTgk6JmDVtKNzgBYmLE1WepwBz9Ncj9TdZu1XCPaf3kwIdOGI SF4gHSBgbQ1GVy5pFycjpBkNdbILxI157KeZv18T+SBMc6sDnCPh49KnZHmCgObl1YfQ S2YLx1mz7plyoW/xJbTwcZ405NkiQ6qmC/agr4Gz9MXjS42UkuJuxXmsuHHpHrLrFUmD MlAg== X-Gm-Message-State: AOJu0Yy0nha3Q6XmyMEEwD4HyKUU9ptHnwZfthcvOusKfIfgB7XZRbB7 3dJ95HVzIFvAJtIlc6rWDb/BWjTWU/jtZ8Ekp6HpJQWs9iU5yBPZM5+cdA== X-Google-Smtp-Source: AGHT+IGOFZOo1SGPOveWkxVQfw33L5pQpt2XFeh60So90hayCzVjvHeZpK9Kj3fMdwpCbHdOHD8uxQ== X-Received: by 2002:a05:6000:dd2:b0:374:c21a:9dd4 with SMTP id ffacd0b85a97d-37d5529cb8dmr14241359f8f.20.1729088394521; Wed, 16 Oct 2024 07:19:54 -0700 (PDT) Original-Received: from pro2 (pd9e36c48.dip0.t-ipconnect.de. [217.227.108.72]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fbf8143sm4499473f8f.70.2024.10.16.07.19.53 for <73838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 07:19:54 -0700 (PDT) In-Reply-To: ("Gerd =?UTF-8?Q?M=C3=B6llmann?="'s message of "Wed, 16 Oct 2024 12:47:13 +0200") 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:293677 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Gerd M=C3=B6llmann writes: > This is with master fdac10b216f7b47e2eea129d2a96807a0c2055f3 on > macOS, built with ASAN. > > $ /Users/gerd/emacs/savannah/master/configure --cache-file /var/folders= /1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.master --without-tree-si= tter --with-native-compilation=3Dno CC=3Dclang 'LDFLAGS=3D-fsanitize=3Daddr= ess -fno-omit-frame-pointer' 'CFLAGS=3D-Wgnu-imaginary-constant -Wunused-re= sult -g -fno-omit-frame-pointer -g -O0 -fsanitize=3Daddress -fno-omit-frame= -pointer' > > Recipe: > > - emacs -nw -q > - M-x xterm-mouse-mode RET > - M-x make TAB > - Move the move over the completion candidates > > =3D> ASAN abort in note_mouse_highlight, xdisp.c:36108 > > The line number may vary. Looking at that in the debugger, I see > > default: > /* This should not happen. */ > if (cursor !=3D FRAME_OUTPUT_DATA (f)->nontext_cursor) > cursor =3D FRAME_OUTPUT_DATA (f)->nontext_cursor; > > nsterm.h defines FRAME_OUTPUT_DATA(f) as > > #define FRAME_OUTPUT_DATA(f) ((f)->output_data.ns) > > and since we are not in a GUI frame, this is no good. Analogous defines > are in xterm.h etc., so the problem is not limited to macOS. > > (I built with ASAN because I observe weird things with mouse stuff in > conjunction with tty child frames, and wanted to check what's up with > that in master.) I'd like to propose a change like in the attached patch (from my tty child frames branch). It fixes the case I mentioned above. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=frame_output_data.patch Content-Description: FRAME_OUTPUT_DATA diff --git a/src/nsterm.h b/src/nsterm.h index 256a233558e..0343064fe5b 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1020,10 +1020,18 @@ #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) int unused; }; +INLINE struct ns_output * +frame_output_data (struct frame *f) +{ + eassert (FRAME_NS_P (f)); + return f->output_data.ns; +} + +/* xdisp.c checks for this macro being #defined. */ +#define FRAME_OUTPUT_DATA(f) frame_output_data (f) /* This gives the ns_display_info structure for the display F is on. */ #define FRAME_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) -#define FRAME_OUTPUT_DATA(f) ((f)->output_data.ns) #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc) #define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f) diff --git a/src/xdisp.c b/src/xdisp.c index 25184e8d186..8321702b760 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -36106,7 +36106,8 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM /* If the cursor is on the internal border of FRAME and FRAME's internal border is draggable, provide some visual feedback. */ - if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0 + if (FRAME_WINDOW_P (f) + && FRAME_INTERNAL_BORDER_WIDTH (f) > 0 && !NILP (get_frame_param (f, Qdrag_internal_border))) { enum internal_border_part part = frame_internal_border_part (f, x, y); @@ -36170,7 +36171,8 @@ note_mouse_highlight (struct frame *f, int x, int y) buffer. */ if (EQ (window, f->menu_bar_window)) { - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; goto set_cursor; } #endif @@ -36181,10 +36183,13 @@ note_mouse_highlight (struct frame *f, int x, int y) if (EQ (window, f->tab_bar_window)) { note_tab_bar_highlight (f, x, y); - if (tab_bar__dragging_in_progress) - cursor = FRAME_OUTPUT_DATA (f)->hand_cursor; - else - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + if (FRAME_WINDOW_P (f)) + { + if (tab_bar__dragging_in_progress) + cursor = FRAME_OUTPUT_DATA (f)->hand_cursor; + else + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + } goto set_cursor; } else @@ -36203,7 +36208,8 @@ note_mouse_highlight (struct frame *f, int x, int y) if (EQ (window, f->tool_bar_window)) { note_tool_bar_highlight (f, x, y); - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; goto set_cursor; } #endif @@ -36217,7 +36223,8 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; /* Show non-text cursor (Bug#16647). */ goto set_cursor; } @@ -36229,13 +36236,15 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM if (part == ON_VERTICAL_BORDER) { - cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } else if (part == ON_RIGHT_DIVIDER) { - cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } @@ -36244,7 +36253,8 @@ note_mouse_highlight (struct frame *f, int x, int y) || minibuf_level || NILP (Vresize_mini_windows)) { - cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } @@ -36252,13 +36262,17 @@ note_mouse_highlight (struct frame *f, int x, int y) cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) { - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; note_fringe_highlight (f, window, x, y, part); } else if (part == ON_VERTICAL_SCROLL_BAR || part == ON_HORIZONTAL_SCROLL_BAR) - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; - else + { + if (FRAME_WINDOW_P (f)) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + } + else if (FRAME_WINDOW_P (f)) cursor = FRAME_OUTPUT_DATA (f)->text_cursor; #endif --=-=-=--