unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Strange code in nsterm.m
@ 2010-11-01 20:08 Eli Zaretskii
  2010-11-01 21:36 ` Jan Djärv
  0 siblings, 1 reply; 2+ messages in thread
From: Eli Zaretskii @ 2010-11-01 20:08 UTC (permalink / raw)
  To: emacs-devel

Here's mouseExited from nsterm.m:

  - (void)mouseExited: (NSEvent *)theEvent
  {
    NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
    NSRect r;
    struct ns_display_info *dpyinfo
      = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL;

    NSTRACE (mouseExited);

    if (dpyinfo || !emacsframe)  <<<<<<<<<<<<<<<<<<<<<<<
      return;

    last_mouse_movement_time = EV_TIMESTAMP (theEvent);

    if (emacsframe == dpyinfo->mouse_face_mouse_frame)
      {
	clear_mouse_face (dpyinfo);
	dpyinfo->mouse_face_mouse_frame = 0;
      }
  }

Isn't the line marked with <<<<<<<<<<<<<<<<<<<<<<< wrong?  It should
say

    if (!dpyinfo || !emacsframe)
      return;

right?  Because if dpyinfo is NULL, we cannot dereference it two lines
after that.  Am I missing something?



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

* Re: Strange code in nsterm.m
  2010-11-01 20:08 Strange code in nsterm.m Eli Zaretskii
@ 2010-11-01 21:36 ` Jan Djärv
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Djärv @ 2010-11-01 21:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel



Eli Zaretskii skrev 2010-11-01 21.08:
> Here's mouseExited from nsterm.m:
>
>    - (void)mouseExited: (NSEvent *)theEvent
>    {
>      NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
>      NSRect r;
>      struct ns_display_info *dpyinfo
>        = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL;
>
>      NSTRACE (mouseExited);
>
>      if (dpyinfo || !emacsframe)<<<<<<<<<<<<<<<<<<<<<<<
>        return;
>
>      last_mouse_movement_time = EV_TIMESTAMP (theEvent);
>
>      if (emacsframe == dpyinfo->mouse_face_mouse_frame)
>        {
> 	clear_mouse_face (dpyinfo);
> 	dpyinfo->mouse_face_mouse_frame = 0;
>        }
>    }
>
> Isn't the line marked with<<<<<<<<<<<<<<<<<<<<<<<  wrong?  It should
> say
>
>      if (!dpyinfo || !emacsframe)
>        return;
>
> right?  Because if dpyinfo is NULL, we cannot dereference it two lines
> after that.  Am I missing something?

No your analysis is correct.  However, mouseExited doesn't seem to get called 
on OSX.  Not sure if the mouse face gets cleared someplace else.  Initial 
testing indicates that it does, probably when loosing focus.

	Jan D.




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

end of thread, other threads:[~2010-11-01 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 20:08 Strange code in nsterm.m Eli Zaretskii
2010-11-01 21:36 ` Jan Djärv

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