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 autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 20009 invoked from network); 14 Apr 2021 06:12:27 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 14 Apr 2021 06:12:27 -0000 Received: from mail-wm1-f45.google.com ([209.85.128.45]) by 1ess; Wed Apr 14 02:04:03 -0400 2021 Received: by mail-wm1-f45.google.com with SMTP id w186so5379160wmg.3 for <9front@9front.org>; Tue, 13 Apr 2021 23:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:date:to:subject:mime-version :content-transfer-encoding; bh=+gK1Uj7OvngXRE/enw8gxZ3sTfZhOe/d9EZWDO8yXC0=; b=FpMaBNGxTYLhh7sJ2x6jvYG3ipPgySHk+y1LC1DwRwGGz3IyckWD/UeCzE3J+qPHrD AmFdmrOjTEbHPLYSmxEbZi/kse5vrcbAKVOKsk1+7cY5E2rGgwPBplMurUq5ZChmO+Vi 1Bu43qrX9RdYEzVRHWDyNd86tRu/4UFwkR6PQ3TnUbQfbc6tFVtsMumCHrcSeQhhVytn +Z3L04KvEmiq0D44izNEPL4F8aNW1dFrdEXwYdZDpewWK3OGTr748pgYqS4cQysCaZkL oJTajUFD62FlH2DxH1KWY6dlG3wQnJY0+1eXv2hVlWmL+vSeUVBoXkl+yGLy9VYLb30a rPYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-transfer-encoding; bh=+gK1Uj7OvngXRE/enw8gxZ3sTfZhOe/d9EZWDO8yXC0=; b=NCWubcpwJtt0NPaZo/5b6BBzhCbHPksOZrPmVBXt4LDXeasl91pYMkmtoz1EjtfG7n VhydzyufYTffpXVJE9TDgXE1rVg+UE5B0XWIjHSi/n3uYZeOH5oZC17q3B/kLnSIp520 IbzRa8Y6gXcmO9tMpFGEqDCJ8tEBrx2yoo+xcvIWlignEO41hKJLn/hMwTHmyFqCBd7i XgmJC1ti+azu5FgeE76Ac1nLCI8mpj071y0HqKIuLgbDFS1JA2MFXiXzaFK/9axf2kDM dwEN0237U2blk8dog1u+ppXoeMD8OSaG2575aXVPfjr5asUWZtrAgzh98hOWKYkBW71t J/6A== X-Gm-Message-State: AOAM530AUjGBVMrZ/D4cFOjAJr6QKRReWhC2ZqFaBBWHOZHbQ+qRncwy y+gA+HCNiEaWHWJ6eoYV8QU= X-Google-Smtp-Source: ABdhPJxVLIKDneXFnBwA4oYspaV/8/5vBs6UKjBeID805GQ+WDwqaYc167dISU7nFuIPWqWiV+fOjw== X-Received: by 2002:a1c:9850:: with SMTP id a77mr1205442wme.174.1618380233799; Tue, 13 Apr 2021 23:03:53 -0700 (PDT) Return-Path: Received: from hades (lfbn-idf1-1-1290-137.w90-79.abo.wanadoo.fr. [90.79.221.137]) by smtp.gmail.com with ESMTPSA id c2sm4148399wmr.22.2021.04.13.23.03.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Apr 2021 23:03:53 -0700 (PDT) From: telephil9@gmail.com X-Google-Original-From: pme@gmail.com Message-ID: <54D0DFB7C443777FB95F48DA583D5F84@gmail.com> Date: Wed, 14 Apr 2021 08:03:51 +0200 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: object-oriented anonymous DOM-scale cache service full-stack-oriented control Subject: [9front] focus bug in libdraw program Reply-To: 9front@9front.org Precedence: bulk Hi, I have noticed a strange behaviour in a libdraw program where mouse events are wrongfully retriggered when the window focus is "stolen" by another window because of an event. To illustrate this, here is a test case (full code below): - A window has a clickable area where a right-click plumbs a mail message. This opens a nedmail window so focus is no more on the main window. - Hide our window through winwatch or the rio menu, you'll see the nedmail window open once again - Unhide our window, nedmail window for the third time This 2 last steps highlight the bug where our main window still receives event and the Mouse struct read from the Mousectl chan has coordinates inside our window whereas we're not there anymore. I'll try to dig into this but I'm not quite sure, at this stage, where the issue might be. Any kind of help/hints would be appreciated. --phil #include #include #include #include #include #include #include enum { Emouse, Eresize, Ekeyboard }; Rectangle clickr; void redraw(void) { clickr = insetrect(screen->r, 20); draw(screen, screen->r, display->white, nil, ZP); border(screen, clickr, 1, display->black, ZP); flushimage(display, 1); } void plumbmsg(void) { int fd; fd = plumbopen("send", OWRITE|OCEXEC); if(fd<0) return; plumbsendtext(fd, "test", nil, nil, "/mail/fs/mbox/1"); close(fd); } void threadmain(int argc, char *argv[]) { USED(argc); USED(argv); Mousectl *mctl; Keyboardctl *kctl; Mouse m; Rune k; Alt alts[] = { { nil, &m, CHANRCV }, { nil, nil, CHANRCV }, { nil, &k, CHANRCV }, { nil, nil, CHANEND }, }; if(initdraw(nil, nil, "test")<0) sysfatal("initdraw: %r"); if((mctl = initmouse(nil, screen))==nil) sysfatal("initmouse: %r"); if((kctl = initkeyboard(nil))==nil) sysfatal("initkeyboard: %r"); alts[Emouse].c = mctl->c; alts[Eresize].c = mctl->resizec; alts[Ekeyboard].c = kctl->c; redraw(); for(;;){ switch(alt(alts)){ case Emouse: if(ptinrect(m.xy, clickr)){ if(m.buttons&4) plumbmsg(); } break; case Eresize: if(getwindow(display, Refnone)<0) sysfatal("getwindow: %r"); redraw(); break; case Ekeyboard: if(k=='q' || k==Kdel) threadexitsall(nil); break; } } }