Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[9fans] Easily create/move window on left/right half of the screen

11 views
Skip to first unread message

Costin Chirvasuta

unread,
May 13, 2013, 1:33:42 PM5/13/13
to
Hello,

I made this quick little hack to do what the subject says.
Sharing for anyone who might find it useful.

diff /n/sources/plan9/sys/src/cmd/rio/rio.c /sys/src/cmd/rio/rio.c
779a780,802
> if(mouse->buttons == 0 && eqpt(mouse->xy, p)){
> p = onscreen(mouse->xy);
> if(p.x < screen->clipr.min.x + 10){
> p0.x = screen->clipr.min.x;
> p0.y = screen->clipr.min.y;
> p.x = (screen->clipr.max.x + screen->clipr.min.x) / 2;
> p.y = screen->clipr.max.y;
> }else if(p.x > screen->clipr.max.x - 10){
> p0.x = (screen->clipr.max.x + screen->clipr.min.x) / 2;
> p0.y = screen->clipr.min.y;
> p.x = screen->clipr.max.x;
> p.y = screen->clipr.max.y;
> }else
> break;
> r = Rect(p0.x, p0.y, p.x, p.y);
> i = allocwindow(wscreen, r, Refnone, 0xEEEEEEFF);
> freeimage(oi);
> if(i == nil)
> goto Rescue;
> border(i, r, Selborder, red, ZP);
> flushimage(display, 1);
> break;
> }

0 new messages