unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* UI issue: inactive menu entries and icons
@ 2006-12-27 12:34 David Kastrup
  2006-12-27 15:22 ` Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: David Kastrup @ 2006-12-27 12:34 UTC (permalink / raw)



Hi,

I find it disturbing that inactive menu entries and toolbar icons
won't display their tooltip.  "What is this about?" is an interesting
question also when an item is inactive.  I actually find this
_particularly_ interesting since I would like to figure out what would
make such entries active.  Not getting the tooltip for them makes this
more difficult.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: UI issue: inactive menu entries and icons
  2006-12-27 12:34 UI issue: inactive menu entries and icons David Kastrup
@ 2006-12-27 15:22 ` Drew Adams
  2006-12-27 16:06 ` Stefan Monnier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2006-12-27 15:22 UTC (permalink / raw)


> I find it disturbing that inactive menu entries and toolbar icons
> won't display their tooltip.

I agree.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 12:34 UI issue: inactive menu entries and icons David Kastrup
  2006-12-27 15:22 ` Drew Adams
@ 2006-12-27 16:06 ` Stefan Monnier
  2006-12-27 16:19   ` David Kastrup
                     ` (2 more replies)
  2006-12-27 17:24 ` Jan Djärv
  2006-12-27 21:16 ` Richard Stallman
  3 siblings, 3 replies; 12+ messages in thread
From: Stefan Monnier @ 2006-12-27 16:06 UTC (permalink / raw)
  Cc: emacs-devel

> I find it disturbing that inactive menu entries and toolbar icons
> won't display their tooltip.  "What is this about?" is an interesting
> question also when an item is inactive.  I actually find this
> _particularly_ interesting since I would like to figure out what would
> make such entries active.  Not getting the tooltip for them makes this
> more difficult.

90% agreement.  I'd just push this further and suggest that we add
a "inactive-help-echo" property which would be displayed in place of the
help-echo when the item is inactive.  This alternative help could indeed
explain why it's inactive and/or how to activate it.


        Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 16:06 ` Stefan Monnier
@ 2006-12-27 16:19   ` David Kastrup
  2006-12-27 16:47   ` Drew Adams
  2006-12-28 17:19   ` Richard Stallman
  2 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2006-12-27 16:19 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I find it disturbing that inactive menu entries and toolbar icons
>> won't display their tooltip.  "What is this about?" is an interesting
>> question also when an item is inactive.  I actually find this
>> _particularly_ interesting since I would like to figure out what would
>> make such entries active.  Not getting the tooltip for them makes this
>> more difficult.
>
> 90% agreement.  I'd just push this further and suggest that we add
> a "inactive-help-echo" property which would be displayed in place of the
> help-echo when the item is inactive.  This alternative help could indeed
> explain why it's inactive and/or how to activate it.

In the rare cases where this would be desirable, help-echo can be set
to a function or cond checking the condition.  So I don't think we
need an extra property for it.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: UI issue: inactive menu entries and icons
  2006-12-27 16:06 ` Stefan Monnier
  2006-12-27 16:19   ` David Kastrup
@ 2006-12-27 16:47   ` Drew Adams
  2006-12-27 19:17     ` David Kastrup
  2006-12-28 17:19   ` Richard Stallman
  2 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2006-12-27 16:47 UTC (permalink / raw)


> > [David] I find it disturbing that inactive menu entries and toolbar
> > icons won't display their tooltip.  "What is this about?" is an
> > interesting question also when an item is inactive.  I actually find
> > this _particularly_ interesting since I would like to figure out
> > what would make such entries active.  Not getting the tooltip for
> > them makes this more difficult.
>
> [Stefan] 90% agreement.  I'd just push this further and suggest that we
> add a "inactive-help-echo" property which would be displayed in place of
> the help-echo when the item is inactive.  This alternative help could
> indeed explain why it's inactive and/or how to activate it.

I almost wrote something similar [but that would be a new feature ;-)]. It
is not uncommon to want to know under what circumstances some inactive menu
item would be available. However, the "inactive-help-echo" should also
include some info on what the active menu item does.

I suspect that people might not always be diligent about adding an
"inactive-help-echo" value. As a fall-back for such cases, the Lisp
condition for enablement could be used. Ugly perhaps, and not understandable
by all, but maybe better than nothing - and some :enable conditions are
clear to everyone.

> [David] In the rare cases where this would be desirable, help-echo can
> be set to a function or cond checking the condition.  So I don't think
> we need an extra property for it.

I don't think the desirability of this would be rare. On the contrary, I
don't see why it wouldn't be the rule that people might like to know when an
inactive menu item would become available.

If it were the rule, the question would become "Why not always include this
info as part of the `help-echo' property, and forget about another
property?" That's possible too, but this added info is only interesting when
the menu item is inactive. I like Stefan's proposal best, so far.


[BTW, I thought we weren't supposed to discuss new features now... Or is
this somehow considered a bug? The subject line says "issue"...]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 12:34 UI issue: inactive menu entries and icons David Kastrup
  2006-12-27 15:22 ` Drew Adams
  2006-12-27 16:06 ` Stefan Monnier
@ 2006-12-27 17:24 ` Jan Djärv
  2006-12-30  6:49   ` YAMAMOTO Mitsuharu
  2006-12-27 21:16 ` Richard Stallman
  3 siblings, 1 reply; 12+ messages in thread
From: Jan Djärv @ 2006-12-27 17:24 UTC (permalink / raw)
  Cc: emacs-devel



David Kastrup skrev:
> Hi,
> 
> I find it disturbing that inactive menu entries and toolbar icons
> won't display their tooltip.  "What is this about?" is an interesting
> question also when an item is inactive.  I actually find this
> _particularly_ interesting since I would like to figure out what would
> make such entries active.  Not getting the tooltip for them makes this
> more difficult.
> 

I agree, but it is very hard (impossible?) to do in some toolkits.  For 
example, inactive usually means that no events whatsoever are generated for 
those icons/buttons.  Things like Enter and Leave events that are used to 
determine what tooltip to show.

Tooltips are shown for inactive icons with the native toolbar, but not 
inactive menu entries. It is complicated for Lesstif/Motif and Gtk+ and I 
guess that is why tool tips for inactive tool bar icons are not shown (well, 
in the Gtk-case, I know that is so).  So I suggest leaving this as is until 
after the release.

	Jan D.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 16:47   ` Drew Adams
@ 2006-12-27 19:17     ` David Kastrup
  0 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2006-12-27 19:17 UTC (permalink / raw)
  Cc: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:

>> [David] In the rare cases where this would be desirable, help-echo can
>> be set to a function or cond checking the condition.  So I don't think
>> we need an extra property for it.
>
> I don't think the desirability of this would be rare. On the contrary, I
> don't see why it wouldn't be the rule that people might like to know when an
> inactive menu item would become available.
>
> If it were the rule, the question would become "Why not always include this
> info as part of the `help-echo' property, and forget about another
> property?" That's possible too, but this added info is only interesting when
> the menu item is inactive. I like Stefan's proposal best, so far.
>
>
> [BTW, I thought we weren't supposed to discuss new features now... Or is
> this somehow considered a bug? The subject line says "issue"...]

I was not discussing a "new feature".  I was proposing changing an
irksome default of an existing feature.

Stefan then proposed a new feature for that, and I said why I think we
would not need a new feature.

However, Jan said that, depending on toolkit, this might not be easy
to do.

I would have guessed that the misfeature (as I consider it) was
actively built into our code rather than be a consequence of how the
toolkit works (since the behavior seems undesirable not only for Emacs
alone).  Jan says that this is not the case, and while I am surprised,
I have no reason to doubt him.

Too bad.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 12:34 UI issue: inactive menu entries and icons David Kastrup
                   ` (2 preceding siblings ...)
  2006-12-27 17:24 ` Jan Djärv
@ 2006-12-27 21:16 ` Richard Stallman
  2006-12-29 12:12   ` Jan Djärv
  3 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2006-12-27 21:16 UTC (permalink / raw)
  Cc: emacs-devel

    I find it disturbing that inactive menu entries and toolbar icons
    won't display their tooltip.  "What is this about?" is an interesting
    question also when an item is inactive.  I actually find this
    _particularly_ interesting since I would like to figure out what would
    make such entries active.  Not getting the tooltip for them makes this
    more difficult.

That is an interesting point, and maybe Emacs should display those
tooltips.  Does anyone see an argument against it?

Anyway, is it Emacs that makes the choice, or is it the GUI toolkit?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 16:06 ` Stefan Monnier
  2006-12-27 16:19   ` David Kastrup
  2006-12-27 16:47   ` Drew Adams
@ 2006-12-28 17:19   ` Richard Stallman
  2 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2006-12-28 17:19 UTC (permalink / raw)
  Cc: emacs-devel

    90% agreement.  I'd just push this further and suggest that we add
    a "inactive-help-echo" property which would be displayed in place of the
    help-echo when the item is inactive.  This alternative help could indeed
    explain why it's inactive and/or how to activate it.

I would not object to adding this at some other time,
but not now.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 21:16 ` Richard Stallman
@ 2006-12-29 12:12   ` Jan Djärv
  2006-12-29 22:58     ` Richard Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Djärv @ 2006-12-29 12:12 UTC (permalink / raw)
  Cc: emacs-devel



Richard Stallman skrev:
>     I find it disturbing that inactive menu entries and toolbar icons
>     won't display their tooltip.  "What is this about?" is an interesting
>     question also when an item is inactive.  I actually find this
>     _particularly_ interesting since I would like to figure out what would
>     make such entries active.  Not getting the tooltip for them makes this
>     more difficult.
> 
> That is an interesting point, and maybe Emacs should display those
> tooltips.  Does anyone see an argument against it?
> 
> Anyway, is it Emacs that makes the choice, or is it the GUI toolkit?

As for not displaying tooltips for inactive tool bar items, it is the GUI 
toolkit (i.e. GTK).  Tooltips are displayed for inactive tool bar items for 
the native tool bar.

As for menus, this is the toolkit also, but now Lesstif/Motif, Lucid and GTK 
are involved.

I can relatively easy fix this for GTK (tool bar and menu) and probably Lucid 
as well (menu).  I haven't looked very hard att Lesstif/Motif yet.

Of these, I think only the GTK tool bar issue could be considered a bug, as 
tool tips for inactive menu items has not been shown previously.

Should I fix the GTK tool bar before the release or just leave it till after?

	Jan D.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-29 12:12   ` Jan Djärv
@ 2006-12-29 22:58     ` Richard Stallman
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2006-12-29 22:58 UTC (permalink / raw)
  Cc: emacs-devel

    I can relatively easy fix this for GTK (tool bar and menu) and probably Lucid 
    as well (menu).  I haven't looked very hard att Lesstif/Motif yet.

    Of these, I think only the GTK tool bar issue could be considered a bug, as 
    tool tips for inactive menu items has not been shown previously.

    Should I fix the GTK tool bar before the release or just leave it till after?

Could you possibly take a look at all three now?
If it is hard, then give up; but maybe you will find it is easy.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: UI issue: inactive menu entries and icons
  2006-12-27 17:24 ` Jan Djärv
@ 2006-12-30  6:49   ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 12+ messages in thread
From: YAMAMOTO Mitsuharu @ 2006-12-30  6:49 UTC (permalink / raw)


>>>>> On Wed, 27 Dec 2006 18:24:55 +0100, Jan Djärv <jan.h.d@swipnet.se> said:

> I agree, but it is very hard (impossible?) to do in some toolkits.
> For example, inactive usually means that no events whatsoever are
> generated for those icons/buttons.  Things like Enter and Leave
> events that are used to determine what tooltip to show.

This reminds me that help echo strings for menu items are not
shown in any fashion on Mac Carbon.  As showing tooltip looks
really weird (and requires not-too-small change, I guess) on this
environment, they are shown in the echo area regardless of the
value of show-help-function by the patch below.  Fortunately,
targeting an inactive menu item also generates some event.

If there's no problem with this, I'll install it later (not now,
because I'm out of my usual development environment).

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/macmenu.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macmenu.c,v
retrieving revision 1.48
diff -c -p -r1.48 macmenu.c
*** src/macmenu.c	14 Nov 2006 08:22:04 -0000	1.48
--- src/macmenu.c	30 Dec 2006 06:32:10 -0000
*************** update_submenu_strings (first_wv)
*** 1450,1455 ****
--- 1450,1535 ----
  }
  
  \f
+ #if TARGET_API_MAC_CARBON
+ extern Lisp_Object Vshow_help_function;
+ 
+ static Lisp_Object
+ restore_show_help_function (old_show_help_function)
+      Lisp_Object old_show_help_function;
+ {
+   Vshow_help_function = old_show_help_function;
+ 
+   return Qnil;
+ }
+ 
+ static pascal OSStatus
+ menu_target_item_handler (next_handler, event, data)
+      EventHandlerCallRef next_handler;
+      EventRef event;
+      void *data;
+ {
+   OSStatus err, result;
+   MenuRef menu;
+   MenuItemIndex menu_item;
+   Lisp_Object help;
+ #ifdef MAC_OS8
+   GrafPtr port;
+ #endif
+   int specpdl_count = SPECPDL_INDEX ();
+ 
+   result = CallNextEventHandler (next_handler, event);
+ 
+   err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef,
+ 			   NULL, sizeof (MenuRef), NULL, &menu);
+   if (err == noErr)
+     err = GetEventParameter (event, kEventParamMenuItemIndex,
+ 			     typeMenuItemIndex, NULL,
+ 			     sizeof (MenuItemIndex), NULL, &menu_item);
+   if (err == noErr)
+     err = GetMenuItemProperty (menu, menu_item,
+ 			       MAC_EMACS_CREATOR_CODE, 'help',
+ 			       sizeof (Lisp_Object), NULL, &help);
+   if (err != noErr)
+     help = Qnil;
+ 
+   /* Temporarily bind Vshow_help_function to Qnil because we don't
+      want tooltips during menu tracking.  */
+   record_unwind_protect (restore_show_help_function, Vshow_help_function);
+   Vshow_help_function = Qnil;
+ #ifdef MAC_OS8
+   GetPort (&port);
+ #endif
+   show_help_echo (help, Qnil, Qnil, Qnil, 1);
+ #ifdef MAC_OS8
+   SetPort (port);
+ #endif
+   unbind_to (specpdl_count, Qnil);
+ 
+   return err == noErr ? noErr : result;
+ }
+ #endif
+ 
+ OSStatus
+ install_menu_target_item_handler (window)
+      WindowPtr window;
+ {
+   OSStatus err = noErr;
+ #if TARGET_API_MAC_CARBON
+   static const EventTypeSpec specs[] =
+     {{kEventClassMenu, kEventMenuTargetItem}};
+   static EventHandlerUPP menu_target_item_handlerUPP = NULL;
+ 
+   if (menu_target_item_handlerUPP == NULL)
+     menu_target_item_handlerUPP =
+       NewEventHandlerUPP (menu_target_item_handler);
+ 
+   err = InstallWindowEventHandler (window, menu_target_item_handlerUPP,
+ 				   GetEventTypeCount (specs), specs,
+ 				   NULL, NULL);
+ #endif
+   return err;
+ }
+ 
  /* Event handler function that pops down a menu on C-g.  We can only pop
     down menus if CancelMenuTracking is present (OSX 10.3 or later).  */
  
*************** add_menu_item (menu, pos, wv)
*** 2485,2490 ****
--- 2565,2574 ----
          EnableMenuItem (menu, pos);
        else
          DisableMenuItem (menu, pos);
+ 
+       if (STRINGP (wv->help))
+ 	SetMenuItemProperty (menu, pos, MAC_EMACS_CREATOR_CODE, 'help',
+ 			     sizeof (Lisp_Object), &wv->help);
  #else  /* ! TARGET_API_MAC_CARBON */
        item_name[sizeof (item_name) - 1] = '\0';
        strncpy (item_name, wv->name, sizeof (item_name) - 1);
Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.199
diff -c -p -r1.199 macterm.c
*** src/macterm.c	15 Dec 2006 08:05:35 -0000	1.199
--- src/macterm.c	30 Dec 2006 06:32:11 -0000
*************** void remove_drag_handler P_ ((WindowRef)
*** 8746,8751 ****
--- 8746,8755 ----
  extern void init_service_handler ();
  static Lisp_Object Qservice, Qpaste, Qperform;
  #endif
+ 
+ /* Showing help echo string during menu tracking  */ 
+ extern OSStatus install_menu_target_item_handler P_ ((WindowPtr));
+ 
  /* Window Event Handler */
  static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
  						EventRef, void *);
*************** install_window_handler (window)
*** 10168,10173 ****
--- 10172,10179 ----
  #endif
    if (err == noErr)
      err = install_drag_handler (window);
+   if (err == noErr)
+     err = install_menu_target_item_handler (window);
  
    return err;
  }
Index: src/macterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.h,v
retrieving revision 1.50
diff -c -p -r1.50 macterm.h
*** src/macterm.h	15 Dec 2006 08:05:42 -0000	1.50
--- src/macterm.h	30 Dec 2006 06:32:11 -0000
*************** struct scroll_bar {
*** 531,536 ****
--- 531,541 ----
  #define HOURGLASS_HEIGHT 16
  
  /* Some constants that are used locally.  */
+ /* Creator code for Emacs on Mac OS.  */
+ enum {
+   MAC_EMACS_CREATOR_CODE	= 'EMAx'
+ };
+ 
  /* Apple event descriptor types */
  enum {
    TYPE_FILE_NAME		= 'fNam'

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-12-30  6:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-27 12:34 UI issue: inactive menu entries and icons David Kastrup
2006-12-27 15:22 ` Drew Adams
2006-12-27 16:06 ` Stefan Monnier
2006-12-27 16:19   ` David Kastrup
2006-12-27 16:47   ` Drew Adams
2006-12-27 19:17     ` David Kastrup
2006-12-28 17:19   ` Richard Stallman
2006-12-27 17:24 ` Jan Djärv
2006-12-30  6:49   ` YAMAMOTO Mitsuharu
2006-12-27 21:16 ` Richard Stallman
2006-12-29 12:12   ` Jan Djärv
2006-12-29 22:58     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).