ref: e200e94c00504f556beefe1ae29306fdc0727900
parent: 3d6a64e17436308b7f02530f7e2d6af6b6b3ae5a
author: aap <aap@papnet.eu>
date: Sat Aug 31 17:56:47 EDT 2024
file sys interface for creating tabs
--- a/README
+++ b/README
@@ -22,13 +22,13 @@
- simple style (TODO: maybe rename this...)
- windows 3.x
- windows 95/nt4
- - (no)title, (no)border wctl messages
+ - '(no)title', '(no)border' wctl messages
- support for different color schemes
- uses named devdraw images
- virtual desktops
- 1-2 chord on desktop opens screen menu
- - screenoffset wctl message
- - (no)sticky wctl message
+ - 'screenoffset' wctl message
+ - '(no)sticky' wctl message
- select window with mouse by reading from `pick' file
- tabbed windows (WIP)
- new tab: click window instead of dragging out rectangle
@@ -36,8 +36,8 @@
- move tab: 1-2 and 1-3 chords
- move tab across window: button 3 on tab or title bar,
click new window or background
- - TODO:
- - no fs interface yet
+ - 'newtab' wctl message
+ - 'new -id n' attach name
- misc
- 1-3 chord on desktop opens secondary menu
--- a/fs.c
+++ b/fs.c
@@ -191,7 +191,15 @@
respond(r, cmd.error);
return;
}
- w = wcreate(cmd.r, cmd.hidden, cmd.scrolling);
+ if(cmd.id > 0){
+ w = wfind(cmd.id);
+ if(w == nil){
+ respond(r, Eunkid);
+ return;
+ }
+ w = tcreate(w->w, cmd.scrolling);
+ }else
+ w = wcreate(cmd.r, cmd.hidden, cmd.scrolling);
if(w == nil){
respond(r, Ewindow);
return;
--- a/wctl.c
+++ b/wctl.c
@@ -8,12 +8,13 @@
char Ewalloc[] = "window allocation failed in wctl request";
/* >= Top are disallowed if mouse button is pressed.
- * >= New need a window. */
+ * > New need a window. */
enum
{
Screenoffset,
Screenrefresh,
New,
+ Newtab,
Resize,
Move,
Scroll,
@@ -37,6 +38,7 @@
[Screenoffset] = "screenoffset",
[Screenrefresh] = "refresh",
[New] = "new",
+ [Newtab] = "newtab",
[Resize] = "resize",
[Move] = "move",
[Scroll] = "scroll",
@@ -104,10 +106,10 @@
while(*s!='\0' && !isspacerune(*s))
s++;
for(i=0; tab[i]!=nil; i++)
- if(strncmp(tab[i], t, strlen(tab[i])) == 0){
+ if(s-t > 0 && strncmp(tab[i], t, s-t) == 0){
*sp = s;
return i;
- }
+ }
return -1;
}
@@ -278,7 +280,7 @@
cmd.r = rectonscreen(rectaddpt(r, screen->r.min));
while(isspacerune(*s))
s++;
- if(cmd.cmd != New && *s != '\0'){
+ if(cmd.cmd != New && cmd.cmd != Newtab && *s != '\0'){
cmd.error = "extraneous text in wctl message";
return cmd;
}
@@ -373,14 +375,10 @@
}
char*
-wctlnew(Wctlcmd cmd)
+wctlnew(WinTab *w, Wctlcmd cmd)
{
- WinTab *w;
char *argv[4], **args;
- w = wcreate(cmd.r, cmd.hidden, cmd.scrolling);
- if(w == nil)
- return "window creation failed";
args = nil;
if(cmd.pid == 0){
argv[0] = "rc";
@@ -432,7 +430,15 @@
refresh();
return nil;
case New:
- return wctlnew(cmd);
+ w = wcreate(cmd.r, cmd.hidden, cmd.scrolling);
+ if(w == nil)
+ return "window creation failed";
+ return wctlnew(w, cmd);
+ case Newtab:
+ w = tcreate(w->w, cmd.scrolling);
+ if(w == nil)
+ return "window creation failed";
+ return wctlnew(w, cmd);
case Set:
if(cmd.pid > 0)
wsetpid(w, cmd.pid, 0);