Display:set: and window:set: to essentially the same thing.
We only need one.
Signed-off-by: NeilBrown <neil@brown.name>
This is a request for the display to close - may be rejected if it is
the only display left.
-## Display:set:ATTR
+## window:set:ATTR
Set any attribute on the display pane.
## Display management commands
Display:close
-Display:set:no-close
+window:set:no-close
Display:external-viewer
Display:fullscreen
Display:new
if (!val)
return Enoarg;
- if (ci->str)
- attr_set_str(&ci->home->attrs, val, ci->str);
+ attr_set_str(&ci->home->attrs, val, ci->str);
return 1;
}
{
/* If this is only display, then refuse to close this one */
struct call_return cr;
- char *nc = attr_find(ci->home->attrs, "no-close");
+ char *nc = pane_attr_get(ci->home, "no-close");
if (nc) {
call("Message", ci->focus, 0, NULL, nc);
return 1;
}
-DEF_CMD(nc_set_attr)
-{
- const char *attr = ci->str2;
-
- if (!attr)
- attr = ksuffix(ci, "Display:set:");
- attr_set_str(&ci->home->attrs, attr, ci->str);
- return 1;
-}
-
static int nc_putc(int ch)
{
if (current_dd)
nc_map = key_alloc();
key_add(nc_map, "Display:refresh", &force_redraw);
key_add(nc_map, "Display:close", &nc_close_display);
- key_add_prefix(nc_map, "Display:set:", &nc_set_attr);
key_add(nc_map, "Display:external-viewer", &nc_external_viewer);
key_add(nc_map, "Close", &nc_close);
key_add(nc_map, "Draw:clear", &nc_clear);
{
/* If this is only display, then refuse to close this one */
struct call_return cr;
- char *nc = attr_find(ci->home->attrs, "no-close");
+ char *nc = pane_attr_get(ci->home, "no-close");
if (nc) {
call("Message", ci->focus, 0, NULL, nc);
return 1;
}
-DEF_CMD(xcb_set_attr)
-{
- const char *attr = ci->str2;
-
- if (!attr)
- attr = ksuffix(ci, "Display:set:");
- attr_set_str(&ci->home->attrs, attr, ci->str);
- return 1;
-}
-
static void wait_for(struct xcb_data *xd safe)
{
struct pids **pp = &xd->pids;
xcb_map = key_alloc();
key_add(xcb_map, "Display:close", &xcb_close_display);
- key_add_prefix(xcb_map, "Display:set:", &xcb_set_attr);
key_add(xcb_map, "Display:external-viewer", &xcb_external_viewer);
key_add(xcb_map, "Display:fullscreen", &xcb_fullscreen);
key_add(xcb_map, "Display:new", &xcb_new_display);
0, NULL, getenv("XAUTHORITY"));
if (!first_window)
first_window = p;
- call("Display:set:no-close", p, 1, NULL,
+ call("window:set:no-close", p, 1, NULL,
"Cannot close primary display");
}
}
else
scale = 12 * scale / 10;
snprintf(num, sizeof(num)-1, "%d", scale);
- call("Display:set:scale", p, 0, NULL, num);
+ call("window:set:scale", p, 0, NULL, num);
return 1;
}
focus.call("Message", "Cannot close only window.")
return 1
- def handle_set_noclose(self, key, str1, str2, **a):
- "handle-prefix:Display:set:"
- attr = str2
- if not attr:
- attr = key[12:]
- self[attr] = str1
- return 1
-
def handle_fullscreen(self, key, num, **a):
"handle:Display:fullscreen"
if num > 0:
self.add_notify(d, "Notify:Close")
self.doc = d
if self.term:
- self.term.call("Display:set:no-close",
+ self.term.call("window:set:no-close",
"Cannot close display until document done - use 'C-x #'")
self.sock.send(b"OK")
return 1
return 1
if cmd == "close":
if self.disp:
- self.disp.call("Display:set:no-close")
+ self.disp.call("window:set:no-close")
self.disp.call("Display:close")
self.disp = None
self.call("event:free", self.read)
# same as doc:done
self.doc = None
if self.term:
- self.term.call("Display:set:no-close")
+ self.term.call("window:set:no-close")
self.term.call("Display:close")
self.sock.send(b"Done")
return 1
"handle:doc:done"
if str != "test":
if self.term:
- self.term.call("Display:set:no-close")
+ self.term.call("window:set:no-close")
self.term.call("Display:close")
self.sock.send(b"Done")
return 1