[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No subject
- To: inferno@interstice.com
- Subject: No subject
- From: philw@plan9.bell-labs.com
I wrote this for Berry after he complained about 'losing'
windows. It allows you to manage another window without
using its titlebar.
the cursor is uuencoded and should be installed in /icons/tk/cursor.win
phil.
begin 0664 cursor.win
M8V]M<')E<W-E9 H@(" @(" @(" @," @(" @(" @(" @," @(" @(" @(" @
M," @(" @(" @(" Q-B @(" @(" @(" S,B @(" @(" @(" S,B @(" @(" @
M(" Y-B"! "!?\"!?\"!?\"!?\"!?\"!< "!=_Z!=_Z!=_Z!!_Z!!_Z!!_Z!
M!_Z!!_Z! "!_^"!@""!@""!@""!@""!@""!C_^!B &!B &!B &!^ &!" &!
+" &!" &!" &!#_^!
end
#
# winctl.b
#
implement WmWinctl;
include "sys.m";
sys: Sys;
include "draw.m";
draw: Draw;
Display, Image: import draw;
include "tk.m";
tk: Tk;
include "tklib.m";
tklib: Tklib;
include "wmlib.m";
wmlib: Wmlib;
include "version.m";
WmWinctl: module
{
init: fn(ctxt: ref Draw->Context, argv: list of string);
};
win_cfg := array[] of {
"frame .mouse",
"bind .mouse <Button> { send mouse %X,%Y }",
"button .b.raise -text Raise -command {send cmd raise}",
"button .b.lower -text Lower -command {send cmd lower}",
"button .b.del -text Delete -command {send cmd del}",
"button .b.move -text Move -command {send cmd move}",
"button .b.hide -text Hide -command {send cmd hide}",
"frame .b",
"pack .b.raise .b.lower .b.del .b.move .b.hide -fill x",
"pack .Wm_t -fill x",
"pack .b -fill x",
"pack propagate . 0",
"update",
};
init(ctxt: ref Draw->Context, argv: list of string)
{
sys = load Sys Sys->PATH;
draw = load Draw Draw->PATH;
tk = load Tk Tk->PATH;
wmlib= load Wmlib Wmlib->PATH;
tklib= load Tklib Tklib->PATH;
tklib->init(ctxt);
wmlib->init();
tkargs := "";
argv = tl argv;
if(argv != nil) {
tkargs = hd argv;
argv = tl argv;
}
t := tk->toplevel(ctxt.screen, tkargs+" -borderwidth 2 -relief raised");
menubut := wmlib->titlebar(t, "Wm ", Wmlib->Hide);
cmd := chan of string;
mouse := chan of string;
tk->namechan(t, cmd, "cmd");
tk->namechan(t, mouse, "mouse");
tklib->tkcmds(t, win_cfg);
spawn ico(menubut);
for(;;) alt {
menu := <-menubut =>
if(menu[0] == 'e')
return;
wmlib->titlectl(t, menu);
s := <-cmd =>
tk->cmd(t, "cursor -bitmap cursor.win; grab set .mouse");
posn := <-mouse;
tk->cmd(t, "cursor -default; grab release .mouse");
p := which(ctxt.screen, posn);
if(p == nil || p == t)
break;
case s {
"raise" =>
tk->cmd(p, "raise .");
"lower" =>
tk->cmd(p, "lower .");
"del" =>
tk->cmd(p, "destroy .");
"move" =>
wmlib->titlectl(p, "move");
"hide" =>
spawn wmlib->titlectl(p, "task");
}
p = nil;
}
}
ico(m: chan of string)
{
m <-= "task";
}
which(screen: ref Draw->Screen, posn: string): ref Tk->Toplevel
{
x := int posn;
for(i := 0; posn[i] != ','; i++)
;
y := int posn[i+1:];
return tk->intop(screen, x, y);
}
- Prev by Date: Re: Inferno Availability
- Next by Date: Re: No subject
- Prev by thread: Useful program: mc
- Next by thread: Re: No subject
- Index(es):