9front - general discussion about 9front
 help / color / mirror / Atom feed
* [Patch] Add scrollwheel to cocoa drawterm
@ 2018-07-05 18:21 Steven McDonald
  0 siblings, 0 replies; only message in thread
From: Steven McDonald @ 2018-07-05 18:21 UTC (permalink / raw)
  To: 9front

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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-05 18:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 18:21 [Patch] Add scrollwheel to cocoa drawterm Steven McDonald

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