9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Steven McDonald <steven@steven-mcdonald.id.au>
To: 9front@9front.org
Subject: [Patch] Add scrollwheel to cocoa drawterm
Date: Thu, 5 Jul 2018 20:21:15 +0200	[thread overview]
Message-ID: <20180705202115.4d52cbc5@tuvix.steven-mcdonald.id.au> (raw)

This should match the behaviour of gui-osx, and it works for me. As far
as I can tell, this can't just be done with the existing mouseevent
function because deltaY is used to indicate both mouse movement and
scrollwheel movement, so the function needs to know for sure that it's
dealing with a scrollwheel event.

Thanks for the work on this, aiju!

diff -r 56cee9a36593 gui-cocoa/screen.m
--- a/gui-cocoa/screen.m	Tue Jul 03 23:28:16 2018 +0200
+++ b/gui-cocoa/screen.m	Thu Jul 05 20:13:55 2018 +0200
@@ -212,6 +212,7 @@
 - (void) otherMouseDown:(NSEvent*)event;
 - (void) otherMouseDragged:(NSEvent*)event;
 - (void) otherMouseUp:(NSEvent*)event;
+- (void) scrollWheel:(NSEvent*)event;
 - (BOOL) acceptsFirstResponder;
 - (void) reshape;
 - (BOOL) acceptsMouseMovedEvents;
@@ -406,6 +407,10 @@
 - (void) otherMouseDragged:(NSEvent*)event { [self mouseevent:event]; }
 - (void) otherMouseUp:(NSEvent*)event { [self mouseevent:event]; }
 
+- (void) scrollWheel:(NSEvent*)event {
+	mousetrack(0, 0, [event deltaY]>0 ? 8 : 16, ticks());
+}
+
 - (BOOL) acceptsFirstResponder {
 	return TRUE;
 }


                 reply	other threads:[~2018-07-05 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180705202115.4d52cbc5@tuvix.steven-mcdonald.id.au \
    --to=steven@steven-mcdonald.id.au \
    --cc=9front@9front.org \
    /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.
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 NNTP newsgroup(s).