unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
@ 2018-10-12  1:53 Keith David Bershatsky
  2018-10-12  8:54 ` Alan Third
  0 siblings, 1 reply; 5+ messages in thread
From: Keith David Bershatsky @ 2018-10-12  1:53 UTC (permalink / raw)
  To: Emacs Devel

Given the latest revisions to nsterm.m that provide compatibility with Mojave, I have been unable to get the drafts of feature requests #17684 (crosshairs) and #22873 (multiple fake cursors) to work properly.

The draft feature request work by calling from xdisp.c:

  FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y, cursor_type,
                                     cursor_width, true, active_cursor_p);

And, I modify a few settings such as color, coordinates, (x, y, fx, fy and h), cursor_type ...

As far as I can see, ns_clip_to_row (within ns_draw_window_cursor) does not return ON/TRUE with the drafts of feature requests #17684 / #22873.

If I play around by bypassing ns_clip_to_row and force ON/TRUE within ns_draw_window_cursor, the lines containing the fake cursors are inverted -- like Emacs is upside down.

Any ideas how I can properly convince ns_clip_to_row to return ON/TRUE and also have the fake cursors appear right-side-up at the non-inverted frame-Y coordinate?


BROKEN SCREENSHOT:

https://www.lawlist.com/images/17684_22873_broken_10_11_2018.png


WORKING SCREENSHOT:

https://www.lawlist.com/images/17684_22873_working_10_11_2018.png



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

* Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
  2018-10-12  1:53 nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) Keith David Bershatsky
@ 2018-10-12  8:54 ` Alan Third
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Third @ 2018-10-12  8:54 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: Emacs-Devel devel

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

On Fri, 12 Oct 2018, 02:54 Keith David Bershatsky, <esq@lawlist.com> wrote:

> Given the latest revisions to nsterm.m that provide compatibility with
> Mojave, I have been unable to get the drafts of feature requests #17684
> (crosshairs) and #22873 (multiple fake cursors) to work properly.
>
> The draft feature request work by calling from xdisp.c:
>
>   FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y, cursor_type,
>                                      cursor_width, true, active_cursor_p);
>
> And, I modify a few settings such as color, coordinates, (x, y, fx, fy and
> h), cursor_type ...
>
> As far as I can see, ns_clip_to_row (within ns_draw_window_cursor) does
> not return ON/TRUE with the drafts of feature requests #17684 / #22873.
>
> If I play around by bypassing ns_clip_to_row and force ON/TRUE within
> ns_draw_window_cursor, the lines containing the fake cursors are inverted
> -- like Emacs is upside down.
>
> Any ideas how I can properly convince ns_clip_to_row to return ON/TRUE and
> also have the fake cursors appear right-side-up at the non-inverted frame-Y
> coordinate?
>

Hi Keith, this looks a bit strange.

The idea is that when running redisplay cocoa does not let you draw to the
screen, so ns_clip_to_rect, etc., marks the area as needing to be redrawn
later, and returns NO so you know not to try drawing to the frame.

Later drawRect is called with a list of the areas that have been marked as
needing redrawn and it calls expose on those areas and so Emacs runs the
drawing functions again, but this time ns_clip_to_rect returns YES so you
know you can go ahead and draw.

For some reason NSTRACE doesn't show the functions being called from within
drawRect, so if you're relying on that it may mislead you.

I don't know what's going on with your code, is there somewhere I can have
a look?

>

[-- Attachment #2: Type: text/html, Size: 2562 bytes --]

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

* Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
@ 2018-10-13  2:17 Keith David Bershatsky
  2018-10-14 18:03 ` Alan Third
  0 siblings, 1 reply; 5+ messages in thread
From: Keith David Bershatsky @ 2018-10-13  2:17 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

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

Thank you Alan for taking a look at this thread.  Here is the code ...

Using a build of the master branch as of today (10/12/2018):

git reset --hard 9c231a447014823ed1955e16b6693adbe041ca99

git apply /path/to/attached/patch.diff

Build a GUI version of Emacs --with-ns

Open up the newly built Emacs and type:

M-x mc-test

or

M-x +-mode

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [10-12-2018 01:54:15] <12 Oct 2018 09:54:15 +0100>
> From: Alan Third <athird@googlemail.com>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: Emacs-Devel devel <emacs-devel@gnu.org>
> Subject: Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
> 
> * * *
> 
> Hi Keith, this looks a bit strange.
> 
> The idea is that when running redisplay cocoa does not let you draw to the screen, so ns_clip_to_rect, etc., marks the area as needing to be redrawn later, and returns
> NO so you know not to try drawing to the frame.
> 
> Later drawRect is called with a list of the areas that have been marked as needing redrawn and it calls expose on those areas and so Emacs runs the drawing functions
> again, but this time ns_clip_to_rect returns YES so you know you can go ahead and draw.
> 
> For some reason NSTRACE doesn't show the functions being called from within drawRect, so if you're relying on that it may mislead you.
> 
> I don't know what's going on with your code, is there somewhere I can have a look?


[-- Attachment #2: 10_12_2018__19_05_57_685.diff --]
[-- Type: application/diff, Size: 331979 bytes --]

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

* Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
  2018-10-13  2:17 Keith David Bershatsky
@ 2018-10-14 18:03 ` Alan Third
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Third @ 2018-10-14 18:03 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

OK, I don’t know what’s going on, but I *can* tell that as soon as
+-mode is enabled ns_draw_window_cursor is never called from within
drawRect, which implies it’s not being called by expose_frame. I don’t
know why not, but that’s the bit that does the actual drawing.

At a guess you have to add another call somewhere in xdisp.c to draw
the cursor(s) when expose_frame is happening.
-- 
Alan Third



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

* Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
@ 2018-10-15  0:05 Keith David Bershatsky
  0 siblings, 0 replies; 5+ messages in thread
From: Keith David Bershatsky @ 2018-10-15  0:05 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

Thank you, Alan.  Your observations led me to the location where I had suppressed display_and_set_cursor within update_window_cursor.  +-mode and mc-test both work now (after removing the aforementioned restrictions).

Your help is greatly appreciated!

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [10-14-2018 11:03:38] <14 Oct 2018 19:03:38 +0100>
> From: Alan Third <alan@idiocy.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) ...
> 
> OK, I don't know what's going on, but I *can* tell that as soon as
> +-mode is enabled ns_draw_window_cursor is never called from within
> drawRect, which implies it's not being called by expose_frame. I don't
> know why not, but that's the bit that does the actual drawing.
> 
> At a guess you have to add another call somewhere in xdisp.c to draw
> the cursor(s) when expose_frame is happening.
> --
> Alan Third



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

end of thread, other threads:[~2018-10-15  0:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-12  1:53 nsterm.m: How to play nice with Mojave revisions -- #17684 (crosshairs) and #22873 (multiple fake cursors) Keith David Bershatsky
2018-10-12  8:54 ` Alan Third
  -- strict thread matches above, loose matches on Subject: below --
2018-10-13  2:17 Keith David Bershatsky
2018-10-14 18:03 ` Alan Third
2018-10-15  0:05 Keith David Bershatsky

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