From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 22363 invoked from network); 6 Apr 2022 17:12:15 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 6 Apr 2022 17:12:15 -0000 Received: from mail-wr1-f47.google.com ([209.85.221.47]) by 4ess; Wed Apr 6 12:47:56 -0400 2022 Received: by mail-wr1-f47.google.com with SMTP id q19so4119153wrc.6 for <9front@9front.org>; Wed, 06 Apr 2022 09:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:date:subject:to:mime-version :content-transfer-encoding; bh=Ybjx+3ro1PGv4hnmyIu86NDcOh2vgZUzLMBZRTi71no=; b=nibEdusn4GsyQ2QJXF/nGA/EZpXr/U6zfGxcfxFz6DdC7s3s2ptWTRb5qTkFMgLR2w OkxFtP7Wq90ympR7KHl2Klx725xBvm8kmEqKMB4sHI3leeErCJ0U78n76XBBJ/JG3UpN hSHi9+bVZCFMYg45y+Lgh2/2IJxyT7wBYurPPzFpMFzNW/owe3aSGXSJtUzKCxIVYLyp Dl3IWY5F5EC0hwu5mIbMuKJbtTfcBMJepZidNd5DWM81usDde6PenIIZM38QB0Ul5Nj8 gLkZy9WNnrDKj33DHeydNTrSs/iNH/LfO2OYYUww7zFyoVyOxfZF/XHTRge/do1e7CNb teRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:date:subject:to:mime-version :content-transfer-encoding; bh=Ybjx+3ro1PGv4hnmyIu86NDcOh2vgZUzLMBZRTi71no=; b=eud4p/E8MQXxAOgqGD7oToraXMmuKrN9tCX+tC0rvBNPe1b1qvNKpOOLwy1Lyr2D8r Yzx7FMmZFJk2uh9FVIE3gkecViOyuZGxugnaaN/7eIVNyWFCj+Z3gPJGuZkaJo3McBZg 3lKcUBTTdsZ0TlL/Y87ShhoKH7SZjrbecqtqa73fGuSatFYCUPbZjfWAD2lvfgRb4dxG yr8uQXS2tA9BIYvph5wDiOsbhCTpfm6/8hiixPx1BJLVi6PmuFWrJS40HAk6QSr4Hw8P JgqT18AxuyK8Dy6akvs1a5xrqWj0/GPj95xk8QqM8vqsPImPB2eB4J313q45go9BMTGU iy8w== X-Gm-Message-State: AOAM5336FerRNWHcgePC0dyUvLb13VCqzmkagSpjtMoFXV+jtJkzzK11 MC8nvvEBn9pJnCfT+YmLceY= X-Google-Smtp-Source: ABdhPJzBr9LKv/geUGdaAw4X0TIONiGKinkaNrL6ZkhD379c6V2ffprhRTxk+29qCxr332M3M3DsHQ== X-Received: by 2002:adf:e981:0:b0:206:15af:7291 with SMTP id h1-20020adfe981000000b0020615af7291mr7254340wrm.631.1649263667919; Wed, 06 Apr 2022 09:47:47 -0700 (PDT) Return-Path: Received: from hades (lfbn-idf1-1-2195-152.w92-151.abo.wanadoo.fr. [92.151.114.152]) by smtp.gmail.com with ESMTPSA id w8-20020a1cf608000000b0038c8fdc93d6sm4861551wmc.28.2022.04.06.09.47.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Apr 2022 09:47:47 -0700 (PDT) From: phil9 Message-ID: Date: Wed, 06 Apr 2022 15:29:41 +0000 To: 9front@9front.org 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: realtime XML over HTML markup package Subject: [9front] [PATCH] mothra: enable mousewheel scrolling in history list Reply-To: 9front@9front.org Precedence: bulk In the history list, scrolling was only possible using the scrollbar but not the mousewheel like in the text panel. --- diff 909205036de4762628fdcdd295e209309817a604 887366a22c1bc50c238668af61664112259a4365 --- a/sys/src/cmd/mothra/mothra.c Tue Apr 5 01:09:49 2022 +++ b/sys/src/cmd/mothra/mothra.c Wed Apr 6 17:29:41 2022 @@ -140,11 +140,11 @@ return 0; } -void scrolltext(int dy, int whence) +void scrollpanel(Panel *p, int dy, int whence) { Scroll s; - s = plgetscroll(text); + s = plgetscroll(p); switch(whence){ case 0: s.pos.y = dy; @@ -160,7 +160,7 @@ s.pos.y = s.size.y; if(s.pos.y < 0) s.pos.y = 0; - plsetscroll(text, s); + plsetscroll(p, s); } void sidescroll(int dx, int whence) @@ -404,22 +404,22 @@ plkeyboard(e.kbdc); break; case Khome: - scrolltext(0, 0); + scrollpanel(text, 0, 0); break; case Kup: - scrolltext(-text->size.y/4, 1); + scrollpanel(text, -text->size.y/4, 1); break; case Kpgup: - scrolltext(-text->size.y/2, 1); + scrollpanel(text, -text->size.y/2, 1); break; case Kdown: - scrolltext(text->size.y/4, 1); + scrollpanel(text, text->size.y/4, 1); break; case Kpgdown: - scrolltext(text->size.y/2, 1); + scrollpanel(text, text->size.y/2, 1); break; case Kend: - scrolltext(-text->size.y, 2); + scrollpanel(text, -text->size.y, 2); break; case Kack: search(); @@ -438,11 +438,18 @@ break; case Emouse: mouse=e.mouse; + if(mouse.buttons & (8|16) && ptinrect(mouse.xy, list->r) && defdisplay){ + if(mouse.buttons & 8) + scrollpanel(list, list->r.min.y - mouse.xy.y, 1); + else + scrollpanel(list, mouse.xy.y - list->r.min.y, 1); + break; + } if(mouse.buttons & (8|16) && ptinrect(mouse.xy, text->r)){ if(mouse.buttons & 8) - scrolltext(text->r.min.y - mouse.xy.y, 1); + scrollpanel(text, text->r.min.y - mouse.xy.y, 1); else - scrolltext(mouse.xy.y - text->r.min.y, 1); + scrollpanel(text, mouse.xy.y - text->r.min.y, 1); break; } plmouse(root, &mouse);