unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Hourglass only for X-windows?
@ 2005-02-27 17:57 Lennart Borgman
  2005-02-27 20:29 ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-02-27 17:57 UTC (permalink / raw)


I am trying to understand the implementation around hourglass cursors. When
I look through eval.c, fns.c, keyboard.c, lread.c and minibuf.c I see in
many places something like:

    #ifdef HAVE_X_WINDOWS
      if (display_hourglass_p)
        cancel_hourglass ();
    #endif

Is this really correct? It looks like displaying an hourglass cursor should
only happen if x windows is available.

Maybe it would be better to remove these ifdefs and require every Emacs
implementation to compile the lines? Does not most systems actually have the
possibility to display hourglass cursors? If they do not could the
implementation not just supply some dummies for the required functions?

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

* Re: Hourglass only for X-windows?
  2005-02-27 17:57 Hourglass only for X-windows? Lennart Borgman
@ 2005-02-27 20:29 ` Eli Zaretskii
  2005-02-28  0:20   ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-02-27 20:29 UTC (permalink / raw)
  Cc: emacs-devel

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Date: Sun, 27 Feb 2005 18:57:08 +0100
> 
> I am trying to understand the implementation around hourglass cursors. When
> I look through eval.c, fns.c, keyboard.c, lread.c and minibuf.c I see in
> many places something like:
> 
>     #ifdef HAVE_X_WINDOWS
>       if (display_hourglass_p)
>         cancel_hourglass ();
>     #endif
> 
> Is this really correct?

Yes, I think so.

> It looks like displaying an hourglass cursor should only happen if x
> windows is available.

What other systems?  If you refer to Windows, then please see
w32fns.c, where the timer-related hourglass code is ifdef'ed away
(probably because Windows doesn't emulate well Posix timers that raise
asynchronous signals).  The Windows implementation of hourglass
cursor, if I understand it correctly, is synchronous, i.e. the
redisplay code and the idle loop set and reset it.

Of other non-X ports, the MSDOS port doesn't support this feature at
all (you cannot change the Windows mouse pointer shape from a DOS
program running on Windows, and doing so on plain DOS involves
undesirable complications).

As for MacOS X, I don't know.

> Maybe it would be better to remove these ifdefs and require every Emacs
> implementation to compile the lines? Does not most systems actually have the
> possibility to display hourglass cursors? If they do not could the
> implementation not just supply some dummies for the required functions?

That'd not be a good idea, I think: firing SIGALRM signals by the
timers complicates things (e.g., you get to handle the problem of
interrupted system calls), so it shouldn't be done without a good
reason.

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

* Re: Hourglass only for X-windows?
  2005-02-27 20:29 ` Eli Zaretskii
@ 2005-02-28  0:20   ` Lennart Borgman
  2005-02-28  4:38     ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-02-28  0:20 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>
> > From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> > I am trying to understand the implementation around hourglass cursors.
When
> > I look through eval.c, fns.c, keyboard.c, lread.c and minibuf.c I see in
> > many places something like:
> >
> >     #ifdef HAVE_X_WINDOWS
> >       if (display_hourglass_p)
> >         cancel_hourglass ();
> >     #endif
> >
> > Is this really correct?
>
> Yes, I think so.
>
> > It looks like displaying an hourglass cursor should only happen if x
> > windows is available.
>
> What other systems?  If you refer to Windows, then please see
> w32fns.c, where the timer-related hourglass code is ifdef'ed away
> (probably because Windows doesn't emulate well Posix timers that raise
> asynchronous signals).  The Windows implementation of hourglass
> cursor, if I understand it correctly, is synchronous, i.e. the
> redisplay code and the idle loop set and reset it.
>
> Of other non-X ports, the MSDOS port doesn't support this feature at
> all (you cannot change the Windows mouse pointer shape from a DOS
> program running on Windows, and doing so on plain DOS involves
> undesirable complications).
>
> As for MacOS X, I don't know.
>
> > Maybe it would be better to remove these ifdefs and require every Emacs
> > implementation to compile the lines? Does not most systems actually have
the
> > possibility to display hourglass cursors? If they do not could the
> > implementation not just supply some dummies for the required functions?
>
> That'd not be a good idea, I think: firing SIGALRM signals by the
> timers complicates things (e.g., you get to handle the problem of
> interrupted system calls), so it shouldn't be done without a good
> reason.

There is clearly something I do not understand here. I do not mean the
implementation details (though I do not understand them ;-). However I can
not see how hourglass support can be implemented at all if those places
where you hide or show the hourglass is ifdef:ed away. Both start_hourglass
and cancel_hourglass are ifdef:ed away (unless HAVE_X_WINDOW is defined). Am
I perhaps misunderstanding when HAVE_X_WINDOW is defined? Can you (or
someone else) please explain this a bit more?

I was trying to see if hourglass support could be implemented for w32. It is
really needed for a first class application like Emacs!

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

* Re: Hourglass only for X-windows?
  2005-02-28  0:20   ` Lennart Borgman
@ 2005-02-28  4:38     ` Eli Zaretskii
  2005-02-28 15:57       ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-02-28  4:38 UTC (permalink / raw)
  Cc: emacs-devel

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Cc: <emacs-devel@gnu.org>
> Date: Mon, 28 Feb 2005 01:20:35 +0100
> 
> There is clearly something I do not understand here.

Perhaps you are not the only one ;-)

> However I can
> not see how hourglass support can be implemented at all if those places
> where you hide or show the hourglass is ifdef:ed away. Both start_hourglass
> and cancel_hourglass are ifdef:ed away (unless HAVE_X_WINDOW is defined). Am
> I perhaps misunderstanding when HAVE_X_WINDOW is defined?

HAVE_X_WINDOWS is defined for Emacs built on GNU or Unix systems with
X support enabled.

> I was trying to see if hourglass support could be implemented for w32. It is
> really needed for a first class application like Emacs!

So you are saying that hourglass cursor doesn't work on Windows?  I
had the impression it did, but it's possible that I was mistaken (I
don't have a Windows port where I'm typing this), so my hand-waving to
explain how it works was just that--hand-waving.  I will try to check
this later today.

So, assuming that hourglass cursor indeed doesn't work on Windows, and
that those snippets are conditioned on X _because_ that feature is not
yet implemented in the Windows port--what is it that you don't
understand in how this feature works on Unix?

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

* Re: Hourglass only for X-windows?
  2005-02-28  4:38     ` Eli Zaretskii
@ 2005-02-28 15:57       ` Lennart Borgman
  2005-02-28 23:05         ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-02-28 15:57 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>

> > However I can
> > not see how hourglass support can be implemented at all if those places
> > where you hide or show the hourglass is ifdef:ed away. Both
start_hourglass
> > and cancel_hourglass are ifdef:ed away (unless HAVE_X_WINDOW is
defined). Am
> > I perhaps misunderstanding when HAVE_X_WINDOW is defined?
>
> HAVE_X_WINDOWS is defined for Emacs built on GNU or Unix systems with
> X support enabled.

Thanks, I guessed so but was not sure.


> So you are saying that hourglass cursor doesn't work on Windows?  I

At least I can not see that it works.


> So, assuming that hourglass cursor indeed doesn't work on Windows, and
> that those snippets are conditioned on X _because_ that feature is not
> yet implemented in the Windows port--what is it that you don't
> understand in how this feature works on Unix?

What I was trying to say was this (that it probably are conditioned for X)
and that it is a problem because with
    #ifdef HAVE_X_WINDOWS
around hourglass activation/deactivation you can only get things working on
X.

For the w32 port there are also
    #if 0
around the body part of the functions that do the actual job
(start_hourglass, hide_hourglass), since it is (as far as I understand) not
implemented on w32 yet.

I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
believe most would like better - but not I) replacing them with something
like

    #ifdef HAS_HOURGLASS

Can we please do one of these so that it is possible to implement hourglass
support?

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

* Re: Hourglass only for X-windows?
  2005-02-28 15:57       ` Lennart Borgman
@ 2005-02-28 23:05         ` Eli Zaretskii
  2005-03-01  0:17           ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-02-28 23:05 UTC (permalink / raw)
  Cc: emacs-devel

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Cc: <emacs-devel@gnu.org>
> Date: Mon, 28 Feb 2005 16:57:26 +0100
> 
> What I was trying to say was this (that it probably are conditioned for X)
> and that it is a problem because with
>     #ifdef HAVE_X_WINDOWS
> around hourglass activation/deactivation you can only get things working on
> X.

Which is fine, as long as other platforms don't implement the required
infrastructure.

> For the w32 port there are also
>     #if 0
> around the body part of the functions that do the actual job
> (start_hourglass, hide_hourglass), since it is (as far as I understand) not
> implemented on w32 yet.

Exactly.

> I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> believe most would like better - but not I) replacing them with something
> like
> 
>     #ifdef HAS_HOURGLASS

We cannot do the former without adding (possibly empty) functions
called by those snippets to all ports.  And we cannot do the latter
without adding some configury stuff that would determine the value of
HAS_HOURGLASS at configure time.

Personally, I think we are fine as we are now.  Of course, if you
implement start_hourglass et al for Windows, the HAVE_X_WINDOWS
condition needs to be augmented by something that will enable it for
Windows.

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

* Re: Hourglass only for X-windows?
  2005-02-28 23:05         ` Eli Zaretskii
@ 2005-03-01  0:17           ` Lennart Borgman
  2005-03-10 23:33             ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-01  0:17 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>
> > From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>

> > I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> > believe most would like better - but not I) replacing them with
something
> > like
> >
> >     #ifdef HAS_HOURGLASS
>
> We cannot do the former without adding (possibly empty) functions
> called by those snippets to all ports.  And we cannot do the latter
> without adding some configury stuff that would determine the value of
> HAS_HOURGLASS at configure time.
>
> Personally, I think we are fine as we are now.  Of course, if you
> implement start_hourglass et al for Windows, the HAVE_X_WINDOWS
> condition needs to be augmented by something that will enable it for
> Windows.

Yes, I thought I would implement start_hourglass etc.  Maybe someone wants
to implement it in macfns.c too where the body part also has an empty body
part.

Whichever way of changing the current "#ifdef HAVE_X_WINDOWS" at those
places are enough, but removing the ifdef:s and adding a file with empty
body parts for those ports that does not implement hourglass support makes
the code easier to read IMO.

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

* Re: Hourglass only for X-windows?
  2005-03-01  0:17           ` Lennart Borgman
@ 2005-03-10 23:33             ` Lennart Borgman
  2005-03-11 13:28               ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-10 23:33 UTC (permalink / raw)
  Cc: rms, Jason Rumney, David Hunter, KOBAYASHI Yasuhiro,
	Eli Zaretskii, Jan D.

----- Original Message ----- 
From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>

> ----- Original Message ----- 
> From: "Eli Zaretskii" <eliz@gnu.org>

> > > I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> > > believe most would like better - but not I) replacing them with
> something
> > > like
> > >
> > >     #ifdef HAS_HOURGLASS
> >
> > We cannot do the former without adding (possibly empty) functions
> > called by those snippets to all ports.  And we cannot do the latter
> > without adding some configury stuff that would determine the value of
> > HAS_HOURGLASS at configure time.
> >
> > Personally, I think we are fine as we are now.  Of course, if you
> > implement start_hourglass et al for Windows, the HAVE_X_WINDOWS
> > condition needs to be augmented by something that will enable it for
> > Windows.
>
> Yes, I thought I would implement start_hourglass etc.  Maybe someone wants
> to implement it in macfns.c too where the body part also has an empty body
> part.
>
> Whichever way of changing the current "#ifdef HAVE_X_WINDOWS" at those
> places are enough, but removing the ifdef:s and adding a file with empty
> body parts for those ports that does not implement hourglass support makes
> the code easier to read IMO.

I have implemented code for hourglass on w32 now (or rather I should say
Dave Hunter has done it, I just did a small amount of typing). Could we
please get a decision on the issue above so that it is possible to get this
working with the CVS code? (The hourglass code in keyboard.c is currently
only called if HAVE_X_WINDOWS is defined.)

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

* Re: Hourglass only for X-windows?
  2005-03-10 23:33             ` Lennart Borgman
@ 2005-03-11 13:28               ` Eli Zaretskii
  2005-03-11 13:44                 ` Jason Rumney
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-03-11 13:28 UTC (permalink / raw)
  Cc: hunterd42, kobayays, emacs-devel

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Cc: "Eli Zaretskii" <eliz@gnu.org>, <rms@gnu.org>,
> 	"Jan D." <jan.h.d@swipnet.se>,
> 	"David Hunter" <hunterd42@comcast.net>,
> 	"Jason Rumney" <jasonr@gnu.org>,
> 	"KOBAYASHI Yasuhiro" <kobayays@otsukakj.co.jp>
> Date: Fri, 11 Mar 2005 00:33:16 +0100
> 
> > > Personally, I think we are fine as we are now.  Of course, if you
> > > implement start_hourglass et al for Windows, the HAVE_X_WINDOWS
> > > condition needs to be augmented by something that will enable it for
> > > Windows.
> >
> > Yes, I thought I would implement start_hourglass etc.  Maybe someone wants
> > to implement it in macfns.c too where the body part also has an empty body
> > part.
> >
> > Whichever way of changing the current "#ifdef HAVE_X_WINDOWS" at those
> > places are enough, but removing the ifdef:s and adding a file with empty
> > body parts for those ports that does not implement hourglass support makes
> > the code easier to read IMO.
> 
> I have implemented code for hourglass on w32 now (or rather I should say
> Dave Hunter has done it, I just did a small amount of typing). Could we
> please get a decision on the issue above so that it is possible to get this
> working with the CVS code? (The hourglass code in keyboard.c is currently
> only called if HAVE_X_WINDOWS is defined.)

I suggest adding WINDOWSNT to HAVE_X_WINDOWS in the condition for
calling the hourglass code.  Would that resolve the issue?

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

* Re: Hourglass only for X-windows?
  2005-03-11 13:28               ` Eli Zaretskii
@ 2005-03-11 13:44                 ` Jason Rumney
  2005-03-11 15:51                   ` Eli Zaretskii
  2005-03-11 16:03                   ` Lennart Borgman
  0 siblings, 2 replies; 28+ messages in thread
From: Jason Rumney @ 2005-03-11 13:44 UTC (permalink / raw)
  Cc: hunterd42, Lennart Borgman, kobayays, emacs-devel

Eli Zaretskii wrote:

>>From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
>>    
>>
>>I have implemented code for hourglass on w32 now (or rather I should say
>>Dave Hunter has done it, I just did a small amount of typing). Could we
>>please get a decision on the issue above so that it is possible to get this
>>working with the CVS code? (The hourglass code in keyboard.c is currently
>>only called if HAVE_X_WINDOWS is defined.)
>>    
>>
>
>I suggest adding WINDOWSNT to HAVE_X_WINDOWS in the condition for
>calling the hourglass code.  Would that resolve the issue?
>  
>

HAVE_NTGUI is better than WINDOWSNT here, I think.

I don't think anyone has tried compiling on WINDOWSNT without GUI since 
about 1995,
and it probably doesn't work anymore, but we should at least try not to 
make it worse in
case someone wants to put the effort into making a command-line only 
Emacs for W32
again.

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

* Re: Hourglass only for X-windows?
  2005-03-11 13:44                 ` Jason Rumney
@ 2005-03-11 15:51                   ` Eli Zaretskii
  2005-03-11 16:03                   ` Lennart Borgman
  1 sibling, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2005-03-11 15:51 UTC (permalink / raw)
  Cc: hunterd42, lennart.borgman.073, kobayays, emacs-devel

> Date: Fri, 11 Mar 2005 13:44:30 +0000
> From: Jason Rumney <jasonr@gnu.org>
> CC: Lennart Borgman <lennart.borgman.073@student.lu.se>, 
>  hunterd42@comcast.net,  kobayays@otsukakj.co.jp,  emacs-devel@gnu.org
> 
> HAVE_NTGUI is better than WINDOWSNT here, I think.

Agreed.

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

* Re: Hourglass only for X-windows?
  2005-03-11 13:44                 ` Jason Rumney
  2005-03-11 15:51                   ` Eli Zaretskii
@ 2005-03-11 16:03                   ` Lennart Borgman
  2005-03-11 16:15                     ` Eli Zaretskii
  1 sibling, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-11 16:03 UTC (permalink / raw)
  Cc: hunterd42, kobayays, emacs-devel

----- Original Message ----- 
From: "Jason Rumney" <jasonr@gnu.org>

> >>I have implemented code for hourglass on w32 now (or rather I should say
> >>Dave Hunter has done it, I just did a small amount of typing). Could we
> >>please get a decision on the issue above so that it is possible to get
this
> >>working with the CVS code? (The hourglass code in keyboard.c is
currently
> >>only called if HAVE_X_WINDOWS is defined.)
> >>
> >>
> >
> >I suggest adding WINDOWSNT to HAVE_X_WINDOWS in the condition for
> >calling the hourglass code.  Would that resolve the issue?
> >
> >
>
> HAVE_NTGUI is better than WINDOWSNT here, I think.

I think it would be much more readable if we had a special define. This was
my suggestion earlier:

> I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> believe most would like better - but not I) replacing them with something
> like
>
>     #ifdef HAS_HOURGLASS

In the light of your answers I do not believe you want to remove these
ifdefs so I suggest now we do something like:

   #if HAVE_HOURGLASS

I do not know where to put this definition however, "hourglass" is found in
the following files:

dispextern-jan.h
dispextern.h
macterm.h
msdos.h
w32term.h
xterm.h
eval.c
fns.c
keyboard-jan.c
keyboard.c
lread.c
macfns.c
macterm.c
minibuf.c
w32fns.c
xdisp.c
xfns-jan.c
xfns.c
xterm.c

Should it go into some header file or into the makefiles?

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

* Re: Hourglass only for X-windows?
  2005-03-11 16:03                   ` Lennart Borgman
@ 2005-03-11 16:15                     ` Eli Zaretskii
  2005-03-11 16:43                       ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-03-11 16:15 UTC (permalink / raw)
  Cc: hunterd42, emacs-devel, kobayays, jasonr

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Cc: <hunterd42@comcast.net>, <kobayays@otsukakj.co.jp>,
> 	<emacs-devel@gnu.org>
> Date: Fri, 11 Mar 2005 17:03:28 +0100
> 
> > HAVE_NTGUI is better than WINDOWSNT here, I think.
> 
> I think it would be much more readable if we had a special define.

Not in this case, IMHO; see below.

> This was my suggestion earlier:
> 
> > I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> > believe most would like better - but not I) replacing them with something
> > like
> >
> >     #ifdef HAS_HOURGLASS
> 
> In the light of your answers I do not believe you want to remove these
> ifdefs so I suggest now we do something like:
> 
>    #if HAVE_HOURGLASS

This would require to have some configury stuff that would detect
whether HAVE_HOURGLASS should be defined or not.  Since Windows
doesn't run the usual configure script (and neither does the DOS
port), adding such a define will require more hacking in these ports.
Especially since writing a test for this feature is not so easy even
for those platforms which do support hourglass (e.g., think about
Emacs configured with --without-x).

So please don't do that.  Please replace

  #ifdef HAVE_X_WINDOWS

with

  #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)

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

* Re: Hourglass only for X-windows?
  2005-03-11 16:15                     ` Eli Zaretskii
@ 2005-03-11 16:43                       ` Lennart Borgman
  2005-03-11 17:25                         ` Jan D.
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-11 16:43 UTC (permalink / raw)
  Cc: hunterd42, emacs-devel, kobayays, jasonr

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>

> > I think it would be much more readable if we had a special define.
>
> Not in this case, IMHO; see below.
>
> > This was my suggestion earlier:
> >
> > > I suggest removing the "#ifdef HAVE_X_WINDOWS" completely or (which I
> > > believe most would like better - but not I) replacing them with
something
> > > like
> > >
> > >     #ifdef HAS_HOURGLASS
> >
> > In the light of your answers I do not believe you want to remove these
> > ifdefs so I suggest now we do something like:
> >
> >    #if HAVE_HOURGLASS
>
> This would require to have some configury stuff that would detect
> whether HAVE_HOURGLASS should be defined or not.  Since Windows
> doesn't run the usual configure script (and neither does the DOS
> port), adding such a define will require more hacking in these ports.
> Especially since writing a test for this feature is not so easy even
> for those platforms which do support hourglass (e.g., think about
> Emacs configured with --without-x).
>
> So please don't do that.  Please replace
>
>   #ifdef HAVE_X_WINDOWS
>
> with
>
>   #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)

There is a lot of them. I understand your concern. However we do not have to
do anything difficult to use HAVE_HOURGLASS. After taking a look at the code
I believe HAVE_HOURGLASS should go into src\config.in. There is already an
#ifdef HAVE_X_WINDOWS and I suggest putting something like this after that
define:

   /* This is for the hourglass code in various files. */
   #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)
   #define HAVE_HOURGLASS
   #endif

IMO it will be more readable and if you want to add hourglass code for other
systems some day it is easier.

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

* Re: Hourglass only for X-windows?
  2005-03-11 16:43                       ` Lennart Borgman
@ 2005-03-11 17:25                         ` Jan D.
  2005-03-11 18:42                           ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Jan D. @ 2005-03-11 17:25 UTC (permalink / raw)
  Cc: hunterd42, Eli Zaretskii, jasonr, kobayays, emacs-devel

>> This would require to have some configury stuff that would detect
>> whether HAVE_HOURGLASS should be defined or not.  Since Windows
>> doesn't run the usual configure script (and neither does the DOS
>> port), adding such a define will require more hacking in these ports.
>> Especially since writing a test for this feature is not so easy even
>> for those platforms which do support hourglass (e.g., think about
>> Emacs configured with --without-x).
>>
>> So please don't do that.  Please replace
>>
>>   #ifdef HAVE_X_WINDOWS
>>
>> with
>>
>>   #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)
>
> There is a lot of them. I understand your concern. However we do not 
> have to
> do anything difficult to use HAVE_HOURGLASS. After taking a look at 
> the code
> I believe HAVE_HOURGLASS should go into src\config.in. There is 
> already an
> #ifdef HAVE_X_WINDOWS and I suggest putting something like this after 
> that
> define:
>
>    /* This is for the hourglass code in various files. */
>    #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)
>    #define HAVE_HOURGLASS
>    #endif
>
> IMO it will be more readable and if you want to add hourglass code for 
> other
> systems some day it is easier.

But the w32 port does not expand config.in to config.h AFAIK, so this 
does nothing when building on w32.

	Jan D.

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

* Re: Hourglass only for X-windows?
  2005-03-11 17:25                         ` Jan D.
@ 2005-03-11 18:42                           ` Lennart Borgman
  2005-03-11 20:51                             ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-11 18:42 UTC (permalink / raw)
  Cc: hunterd42, Eli Zaretskii, jasonr, kobayays, emacs-devel

----- Original Message ----- 
From: "Jan D." <jan.h.d@swipnet.se>

> > I believe HAVE_HOURGLASS should go into src\config.in. There is 
> > already an
> > #ifdef HAVE_X_WINDOWS and I suggest putting something like this after 
> > that
> > define:
> >
> >    /* This is for the hourglass code in various files. */
> >    #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)
> >    #define HAVE_HOURGLASS
> >    #endif
> >
> > IMO it will be more readable and if you want to add hourglass code for 
> > other
> > systems some day it is easier.
> 
> But the w32 port does not expand config.in to config.h AFAIK, so this 
> does nothing when building on w32.

Thanks. For w32 there is instead a config.nt where this should go too.

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

* Re: Hourglass only for X-windows?
  2005-03-11 18:42                           ` Lennart Borgman
@ 2005-03-11 20:51                             ` Eli Zaretskii
  2005-03-12  1:03                               ` Lennart Borgman
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-03-11 20:51 UTC (permalink / raw)
  Cc: hunterd42, emacs-devel, kobayays, jasonr

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Date: Fri, 11 Mar 2005 19:42:25 +0100
> Cc: hunterd42@comcast.net, Eli Zaretskii <eliz@gnu.org>, jasonr@gnu.org,
> 	kobayays@otsukakj.co.jp, emacs-devel@gnu.org
> 
> From: "Jan D." <jan.h.d@swipnet.se>
> 
> > > I believe HAVE_HOURGLASS should go into src\config.in. There is 
> > > already an
> > > #ifdef HAVE_X_WINDOWS and I suggest putting something like this after 
> > > that
> > > define:
> > >
> > >    /* This is for the hourglass code in various files. */
> > >    #if defined(HAVE_X_WINDOWS) || defined(HAVE_NTGUI)
> > >    #define HAVE_HOURGLASS
> > >    #endif

src/config.in is a generated file, so you should not make any changes
in it, anyway.

> > > IMO it will be more readable and if you want to add hourglass code for 
> > > other systems some day it is easier.

I don't see how this is more readable.  One cannot understand the
meaning of HAVE_HOURGLASS without grepping thru lots of places.

> > But the w32 port does not expand config.in to config.h AFAIK, so this 
> > does nothing when building on w32.
> 
> Thanks. For w32 there is instead a config.nt where this should go too.

But why do this?  What good will this do?  All it does is spread the
information between several differeint files, instead of keeping it
together, and on top of that, it adds a useless change in config.in
(since the Windows build doesn't use it).  I don't see any benefit in
such pseudo-configured stuff.

We already have pieces of code that are conditioned similarly, e.g.:

  #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)

So this is clearly an accepted practice in Emacs.

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

* Re: Hourglass only for X-windows?
  2005-03-11 20:51                             ` Eli Zaretskii
@ 2005-03-12  1:03                               ` Lennart Borgman
  2005-03-12  2:11                                 ` Jason Rumney
  2005-03-12 10:01                                 ` Eli Zaretskii
  0 siblings, 2 replies; 28+ messages in thread
From: Lennart Borgman @ 2005-03-12  1:03 UTC (permalink / raw)
  Cc: hunterd42, emacs-devel, kobayays, jasonr

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>

> I don't see how this is more readable.  One cannot understand the
> meaning of HAVE_HOURGLASS without grepping thru lots of places.

Hm ;-)

There is something I do not understand in your argument. How about
HAVE_MOUSE, HAVE_SOUND? They seem possible to grasp to me - and they are
used in Emacs.


> We already have pieces of code that are conditioned similarly, e.g.:
>
>   #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
>
> So this is clearly an accepted practice in Emacs.

I find it very hard to guess what this define is for without reading the
code. Using names like HAVE_MOUSE, HAVE_HOURGLASS makes it much more easy to
guess IMO. And I think that is important if you are scanning the code
quickly trying to find things, see the structure etc. It may of course
depend on how you are thinking, but for me this makes sense. I would guess
it makes sense for a lot of other people too (but I am of course not sure.)

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

* Re: Hourglass only for X-windows?
  2005-03-12  1:03                               ` Lennart Borgman
@ 2005-03-12  2:11                                 ` Jason Rumney
  2005-03-12  9:37                                   ` Lennart Borgman
  2005-03-12 13:41                                   ` Stefan Monnier
  2005-03-12 10:01                                 ` Eli Zaretskii
  1 sibling, 2 replies; 28+ messages in thread
From: Jason Rumney @ 2005-03-12  2:11 UTC (permalink / raw)
  Cc: hunterd42, Eli Zaretskii, kobayays, emacs-devel

"Lennart Borgman" <lennart.borgman.073@student.lu.se> writes:

> I find it very hard to guess what this define is for without reading the
> code. Using names like HAVE_MOUSE, HAVE_HOURGLASS makes it much more easy to
> guess IMO. And I think that is important if you are scanning the code
> quickly trying to find things, see the structure etc.

Conditional compilation constants are not comments. They are not there to
assist your reading of the code, they are there to enable that code
when appropriate. For that purpose, it is actually clearer to have the
constants named so that the conditions under which that code is
enabled is obvious. Having hourglass code surrounded by HAVE_HOURGLASS
is not adding anything, because the actual conditions under which
hourglass cursors are available depend on the platform, not some
configure test. Also someone debugging why hourglass cursors do
not work on a Mac might miss the fact that they are only enabled on X
and W32, that is not likely if we list the real conditions under which
that code is enabled.

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

* Re: Hourglass only for X-windows?
  2005-03-12  2:11                                 ` Jason Rumney
@ 2005-03-12  9:37                                   ` Lennart Borgman
  2005-03-12 11:43                                     ` Jan D.
  2005-03-12 13:41                                   ` Stefan Monnier
  1 sibling, 1 reply; 28+ messages in thread
From: Lennart Borgman @ 2005-03-12  9:37 UTC (permalink / raw)
  Cc: hunterd42, Eli Zaretskii, kobayays, emacs-devel

----- Original Message ----- 
From: "Jason Rumney" <jasonr@gnu.org>


> "Lennart Borgman" <lennart.borgman.073@student.lu.se> writes:
>
> > I find it very hard to guess what this define is for without reading the
> > code. Using names like HAVE_MOUSE, HAVE_HOURGLASS makes it much more
easy to
> > guess IMO. And I think that is important if you are scanning the code
> > quickly trying to find things, see the structure etc.
>
> Conditional compilation constants are not comments. They are not there to
> assist your reading of the code, they are there to enable that code
> when appropriate. For that purpose, it is actually clearer to have the
> constants named so that the conditions under which that code is
> enabled is obvious. Having hourglass code surrounded by HAVE_HOURGLASS
> is not adding anything, because the actual conditions under which
> hourglass cursors are available depend on the platform, not some
> configure test. Also someone debugging why hourglass cursors do
> not work on a Mac might miss the fact that they are only enabled on X
> and W32, that is not likely if we list the real conditions under which
> that code is enabled.

I do not think you can escape that the constant names have a comment purpose
too. The names should of course be choosen so that it is as easy as possible
to change and read the code. Constants like HAVE_WINDOW_SYSTEM, HAVE_MOUSE
or HAVE_SOUND are currently set up by the configuration code.in config.in. I
believed they had purposes hinted by their names. Maybe those names are
misleading? Maybe it is bad practice and maybe those names should be
removed? I actually can not see that they are used on w32 (just looking at
config.h and makefile).

I currently perhaps have some problems with the code submitted by Jan D for
enabling hourglass when using "M-x  indent-region". Hourglass is actually
shown, but I wonder if I did something wrong since the messages about "10%"
etc are not shown. I wonder if I missed some piece of the hourglass code
somewhere? It would have been easier for me if that code had been surrounded
by HAVE_HOURGLASS - if and only if (of course) the definition of
HAVE_HOURGLASS was very clear.

Can someone please tell me if the problem above exists on X Windows as well?

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

* Re: Hourglass only for X-windows?
  2005-03-12  1:03                               ` Lennart Borgman
  2005-03-12  2:11                                 ` Jason Rumney
@ 2005-03-12 10:01                                 ` Eli Zaretskii
  2005-03-12 21:40                                   ` Lennart Borgman
  1 sibling, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2005-03-12 10:01 UTC (permalink / raw)
  Cc: hunterd42, kobayays, emacs-devel

> From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
> Cc: <hunterd42@comcast.net>, <jasonr@gnu.org>,
> 	<kobayays@otsukakj.co.jp>, <emacs-devel@gnu.org>
> Date: Sat, 12 Mar 2005 02:03:45 +0100
> 
> From: "Eli Zaretskii" <eliz@gnu.org>
> 
> > I don't see how this is more readable.  One cannot understand the
> > meaning of HAVE_HOURGLASS without grepping thru lots of places.
> 
> Hm ;-)
> 
> There is something I do not understand in your argument. How about
> HAVE_MOUSE, HAVE_SOUND?

These are configure-time definitions, unlike HAVE_HOURGLASS.  They
test the basic capabilities of the underlying platform, while
HAVE_HOURGLASS tells something about Emacs support of the feature, not
about its availability on the platform.

> >   #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
> >
> > So this is clearly an accepted practice in Emacs.
> 
> I find it very hard to guess what this define is for without reading the
> code. Using names like HAVE_MOUSE, HAVE_HOURGLASS makes it much more easy to
> guess IMO. And I think that is important if you are scanning the code
> quickly trying to find things, see the structure etc. It may of course
> depend on how you are thinking, but for me this makes sense. I would guess
> it makes sense for a lot of other people too (but I am of course not sure.)

Jason responded with a clear and eloquent explanation, and I can only
say I agree with him 100%.

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

* Re: Hourglass only for X-windows?
  2005-03-12  9:37                                   ` Lennart Borgman
@ 2005-03-12 11:43                                     ` Jan D.
  0 siblings, 0 replies; 28+ messages in thread
From: Jan D. @ 2005-03-12 11:43 UTC (permalink / raw)
  Cc: hunterd42, Eli Zaretskii, emacs-devel, kobayays, Jason Rumney

> I currently perhaps have some problems with the code submitted by Jan 
> D for
> enabling hourglass when using "M-x  indent-region". Hourglass is 
> actually
> shown, but I wonder if I did something wrong since the messages about 
> "10%"
> etc are not shown. I wonder if I missed some piece of the hourglass 
> code
> somewhere? It would have been easier for me if that code had been 
> surrounded
> by HAVE_HOURGLASS - if and only if (of course) the definition of
> HAVE_HOURGLASS was very clear.
>
> Can someone please tell me if the problem above exists on X Windows as 
> well?

No, the "XX % complete" messages are shown on X.

	Jan D.

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

* Re: Hourglass only for X-windows?
  2005-03-12  2:11                                 ` Jason Rumney
  2005-03-12  9:37                                   ` Lennart Borgman
@ 2005-03-12 13:41                                   ` Stefan Monnier
  2005-03-12 15:41                                     ` Jason Rumney
  2005-03-13 15:29                                     ` Richard Stallman
  1 sibling, 2 replies; 28+ messages in thread
From: Stefan Monnier @ 2005-03-12 13:41 UTC (permalink / raw)
  Cc: hunterd42, Lennart Borgman, Eli Zaretskii, kobayays, emacs-devel

> Conditional compilation constants are not comments. They are not there to
> assist your reading of the code, they are there to enable that code
> when appropriate. For that purpose, it is actually clearer to have the
> constants named so that the conditions under which that code is
> enabled is obvious. Having hourglass code surrounded by HAVE_HOURGLASS
> is not adding anything, because the actual conditions under which
> hourglass cursors are available depend on the platform, not some
> configure test. Also someone debugging why hourglass cursors do
> not work on a Mac might miss the fact that they are only enabled on X
> and W32, that is not likely if we list the real conditions under which
> that code is enabled.

The other side of the coin is that if you add hourglass support to the
Carbon branch, you'll have to check each #ifdef HAVE_X_WINDOWS to see if it
relates to hourglass or not.

I personally like the HAVE_HOURGLASS style of coding better than the
"defined HAVE_X_WINDOWS && defined NT_GUI && ...".  But of course, an even
better approach might be to remove all those conditionals and simply always
provide all the <foo>_hourglass functions, even with an empty body
if the hourglass functionality is missing for a particular system.  It tends
to make the code more readable.



        Stefan

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

* Re: Hourglass only for X-windows?
  2005-03-12 13:41                                   ` Stefan Monnier
@ 2005-03-12 15:41                                     ` Jason Rumney
  2005-03-13  3:50                                       ` David Hunter
  2005-03-13 15:29                                     ` Richard Stallman
  1 sibling, 1 reply; 28+ messages in thread
From: Jason Rumney @ 2005-03-12 15:41 UTC (permalink / raw)
  Cc: hunterd42, Lennart Borgman, Eli Zaretskii, kobayays, emacs-devel

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

> But of course, an even better approach might be to remove all those
> conditionals and simply always provide all the <foo>_hourglass
> functions

I do think that once we have X and W32 (or X and Mac) support for a
feature like this, it is probably worth using HAVE_WINDOW_SYSTEM, and
providing a stub implementation for the other platform.

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

* Re: Hourglass only for X-windows?
  2005-03-12 10:01                                 ` Eli Zaretskii
@ 2005-03-12 21:40                                   ` Lennart Borgman
  0 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman @ 2005-03-12 21:40 UTC (permalink / raw)
  Cc: hunterd42, kobayays, emacs-devel

----- Original Message ----- 
From: "Eli Zaretskii" <eliz@gnu.org>

> > There is something I do not understand in your argument. How about
> > HAVE_MOUSE, HAVE_SOUND?
>
> These are configure-time definitions, unlike HAVE_HOURGLASS.  They
> test the basic capabilities of the underlying platform, while
> HAVE_HOURGLASS tells something about Emacs support of the feature, not
> about its availability on the platform.

I see. Then it would maybe be better to call it HOURGLASS_SUPPORTED.


> Jason responded with a clear and eloquent explanation, and I can only
> say I agree with him 100%.

You both did and that made me wonder how we could come to so different
conclusions. It seems to me like you say (as above) that the constants are
telling something about the platform in itself. That is one use of them, a
technical use.

Another use of constants could be telling if a feature is support. Then the
constant is of course still platform dependend (but on next abstraction
level so to say). That is what I propose.

However Stefan just suggested to use stubs instead to make the code more
readable. That is what I also suggested, but I thought most people here
would like the HOURGLASS_SUPPORTED better at the moment since it is perhaps
quicker to implement right now. But that assumption might just be a mistake
by me?

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

* Re: Hourglass only for X-windows?
  2005-03-12 15:41                                     ` Jason Rumney
@ 2005-03-13  3:50                                       ` David Hunter
  2005-03-14 11:28                                         ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 28+ messages in thread
From: David Hunter @ 2005-03-13  3:50 UTC (permalink / raw)
  Cc: Lennart Borgman, Eli Zaretskii, kobayays, Stefan Monnier,
	emacs-devel

Jason Rumney wrote:

> I do think that once we have X and W32 (or X and Mac) support for a
> feature like this, it is probably worth using HAVE_WINDOW_SYSTEM, and
> providing a stub implementation for the other platform.

Since most window systems use a busy cursor of some form, this makes the most sense to me.
-Dave

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

* Re: Hourglass only for X-windows?
  2005-03-12 13:41                                   ` Stefan Monnier
  2005-03-12 15:41                                     ` Jason Rumney
@ 2005-03-13 15:29                                     ` Richard Stallman
  1 sibling, 0 replies; 28+ messages in thread
From: Richard Stallman @ 2005-03-13 15:29 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel, hunterd42, kobayays, eliz,
	jasonr

Please let's not have a discussion about the philosophy of names such
as HAVE_HOURGLASS.  It is a distraction and a nuisance.  We're not
going to change the way we handle do those names.

People on the list now are too ready to enter arguments.  Please,
everyone, put your effort into getting the release ready, rather than
arguing.

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

* Re: Hourglass only for X-windows?
  2005-03-13  3:50                                       ` David Hunter
@ 2005-03-14 11:28                                         ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 28+ messages in thread
From: YAMAMOTO Mitsuharu @ 2005-03-14 11:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

>>>>> On Sat, 12 Mar 2005 22:50:43 -0500, David Hunter <hunterd42@comcast.net> said:

> Jason Rumney wrote:
>> I do think that once we have X and W32 (or X and Mac) support for a
>> feature like this, it is probably worth using HAVE_WINDOW_SYSTEM,
>> and providing a stub implementation for the other platform.

> Since most window systems use a busy cursor of some form, this makes
> the most sense to me.

The attached is a patch for "hourglass cursor" support on Carbon
Emacs.  Actually, it doesn't change the cursor shape but shows a
progress indicator at the upper-right corner of each frame.  I did so
because Apple Human Interface Guidelines discourage the use of the
busy cursor on Mac OS X, and it seemed to be easier to implement for
me.

http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGCursors/chapter_6_section_2.html

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

[-- Attachment #2: diff-hourglass.gz --]
[-- Type: application/octet-stream, Size: 6732 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

end of thread, other threads:[~2005-03-14 11:28 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-27 17:57 Hourglass only for X-windows? Lennart Borgman
2005-02-27 20:29 ` Eli Zaretskii
2005-02-28  0:20   ` Lennart Borgman
2005-02-28  4:38     ` Eli Zaretskii
2005-02-28 15:57       ` Lennart Borgman
2005-02-28 23:05         ` Eli Zaretskii
2005-03-01  0:17           ` Lennart Borgman
2005-03-10 23:33             ` Lennart Borgman
2005-03-11 13:28               ` Eli Zaretskii
2005-03-11 13:44                 ` Jason Rumney
2005-03-11 15:51                   ` Eli Zaretskii
2005-03-11 16:03                   ` Lennart Borgman
2005-03-11 16:15                     ` Eli Zaretskii
2005-03-11 16:43                       ` Lennart Borgman
2005-03-11 17:25                         ` Jan D.
2005-03-11 18:42                           ` Lennart Borgman
2005-03-11 20:51                             ` Eli Zaretskii
2005-03-12  1:03                               ` Lennart Borgman
2005-03-12  2:11                                 ` Jason Rumney
2005-03-12  9:37                                   ` Lennart Borgman
2005-03-12 11:43                                     ` Jan D.
2005-03-12 13:41                                   ` Stefan Monnier
2005-03-12 15:41                                     ` Jason Rumney
2005-03-13  3:50                                       ` David Hunter
2005-03-14 11:28                                         ` YAMAMOTO Mitsuharu
2005-03-13 15:29                                     ` Richard Stallman
2005-03-12 10:01                                 ` Eli Zaretskii
2005-03-12 21:40                                   ` Lennart Borgman

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).