9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Nick Owens <mischief@offblast.org>
To: 9front@9front.org
Subject: bug: replclipr(2) allows line(2) to escape the window
Date: Wed, 17 Oct 2018 17:09:51 -0700	[thread overview]
Message-ID: <CAH_zEu6SFqR=yGy1ifpqUhONLLpy9AkAQdAG4WRohjxPyh+iVg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

the attached program will draw lines in the upper left corner of rio,
regardless of the position of the rio window it is executed from.

this is not an issue with, for example, ellipse(2), otherwise you
would see an ellipse as well as lines.

[-- Attachment #2: line.c --]
[-- Type: text/x-csrc, Size: 988 bytes --]

#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>

void
usage(void)
{
	fprint(2, "usage: %s\n", argv0);
	exits("usage");
}

Rectangle lol[] = {
	{{50, 50}, {50, 100}},
	{{50, 100}, {75, 100}},

	{{100, 50}, {100, 100}},
	{{100, 100}, {125, 100}},
	{{125, 100}, {125, 50}},
	{{125, 50}, {100, 50}},

	{{150, 50}, {150, 100}},
	{{150, 100}, {175, 100}},};

void
main(int argc, char *argv[])
{
	int i;

	ARGBEGIN{
	default:
		usage();
	}ARGEND

	initdraw(nil, nil, argv0);
	einit(Emouse);
	for(;;){
		while(ecanmouse())
			emouse();

		replclipr(screen, 0, Rect(0, 0, 9000, 9000));

		for(i = 0; i < nelem(lol); i++){
			line(screen, lol[i].min, lol[i].max, 0, 0, 5, display->black, ZP);
		}

		//draw(screen, Rect(0, 0, 9000, 9000), display->black, nil, ZP);
		ellipse(screen, Pt(100, 75), 100, 75, 3, display->black, ZP);

		flushimage(display, 1);
	}

	exits(nil);
}

void
eresized(int new)
{
	if(new && getwindow(display, Refnone) < 0)
		sysfatal("getwindow: %r");
}

                 reply	other threads:[~2018-10-18  0:10 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='CAH_zEu6SFqR=yGy1ifpqUhONLLpy9AkAQdAG4WRohjxPyh+iVg@mail.gmail.com' \
    --to=mischief@offblast.org \
    --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).