From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from palpatine.steven-mcdonald.id.au ([173.230.144.109]) by ewsd; Thu Jul 5 14:21:26 EDT 2018 Received: from tuvix.steven-mcdonald.id.au (ip-213-127-108-113.ip.prioritytelecom.net [213.127.108.113]) by palpatine.steven-mcdonald.id.au (Postfix) with ESMTPSA id 790E612F for <9front@9front.org>; Fri, 6 Jul 2018 04:21:19 +1000 (AEST) Received: from tuvix.steven-mcdonald.id.au (localhost [127.0.0.1]) by tuvix.steven-mcdonald.id.au (OpenSMTPD) with ESMTP id 686895b5 for <9front@9front.org>; Thu, 5 Jul 2018 20:21:17 +0200 (CEST) Date: Thu, 5 Jul 2018 20:21:15 +0200 From: Steven McDonald To: 9front@9front.org Subject: [Patch] Add scrollwheel to cocoa drawterm Message-ID: <20180705202115.4d52cbc5@tuvix.steven-mcdonald.id.au> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-unknown-openbsd6.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: injection polling-oriented manager 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; }