all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Manuel Giraud <manuel@ledu-giraud.fr>
Cc: 58406@debbugs.gnu.org
Subject: bug#58406: 29.0.50; Bars refactoring?
Date: Mon, 10 Oct 2022 11:45:31 +0300	[thread overview]
Message-ID: <83y1togj84.fsf@gnu.org> (raw)
In-Reply-To: <87a6641648.fsf@elite.giraud> (message from Manuel Giraud on Mon,  10 Oct 2022 09:37:43 +0200)

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Date: Mon, 10 Oct 2022 09:37:43 +0200
> 
> I'm trying to have some kind of highlight feature on the no-toolkit menu
> bar.  As this feature is already present in tool/tab bar, I'd like to
> mimic those.
> 
> While trying this, I think that I found that some "bar" functions could
> be factorized (up to a certain point I guess).  Here is a patch that
> shows my direction.
> 
> Do you think that this approach could make it into master or would it be
> frown upon?  And if so, what would be a better way?

The approach is OK, and welcome.  But let's please wait with this
refactoring until after the emacs-29 branch is cut.  OK?

Some minor comments below:

> +  /* Get the text property `menu-item' at pos. The value of that
> +     property is the start index of this item's properties in
> +     F->tool_bar_items.  */

The "F->tool_bar_items" part of the comment is outdated.

Also, our style is to leave two spaces between sentences in comments
and documentation.

> +  /* Get the start of this tool-bar item's properties in
> +     f->tool_bar_items.  */

Likewise here: outdated reference to tool_bar_items.

> +  /* Is mouse on the highlighted item?  */
> +  if (bar == TAB_BAR)
> +    return *prop_idx == f->last_tab_bar_item ? 0 : 1;
> +  else if (EQ (window, hlinfo->mouse_face_window)
> +      && *vpos >= hlinfo->mouse_face_beg_row
> +      && *vpos <= hlinfo->mouse_face_end_row
> +      && (*vpos > hlinfo->mouse_face_beg_row
> +	  || *hpos >= hlinfo->mouse_face_beg_col)
> +      && (*vpos < hlinfo->mouse_face_end_row
> +	  || *hpos < hlinfo->mouse_face_end_col
> +	  || hlinfo->mouse_face_past_end))
> +    return 0;

The "else if" clause should only be used for the tool bar, not for the
menu bar, AFAIU.

> @@ -15485,6 +15451,7 @@ handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p,
>    Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
>    struct window *w = XWINDOW (f->tool_bar_window);
>    int hpos, vpos, prop_idx;
> +  bool close_p;

The value of this is ignored here, so it is better to call this
variable 'ignored' or 'dummy' or something to that effect.





  parent reply	other threads:[~2022-10-10  8:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10  7:37 bug#58406: 29.0.50; Bars refactoring? Manuel Giraud
2022-10-10  8:08 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10  8:37   ` Manuel Giraud
2022-10-10  8:51     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10  9:01       ` Eli Zaretskii
2022-10-10 10:05         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10 11:24           ` Eli Zaretskii
2022-10-10 13:42             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10 12:10       ` Manuel Giraud
2022-10-10 13:41         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10 14:30           ` Manuel Giraud
2022-10-10 16:08             ` Eli Zaretskii
2022-10-11  0:32             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-10  8:58     ` Eli Zaretskii
2022-10-10  8:45 ` Eli Zaretskii [this message]
2022-10-10 11:58   ` Manuel Giraud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y1togj84.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=58406@debbugs.gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.