It seems more consistent to capitalise these Windows now that I can.
Signed-off-by: NeilBrown <neil@brown.name>
# Window/input
-## window:request:FOO
+## Window:request:FOO
Ask to receive notification "FOO" send to current window.
-## window:notify:FOO
+## Window:notify:FOO
Send notification "FOO" to current window.
from this display), it should generally refuse, as closing the last
display can be awkward.
-## window:close
+## Window:close
This is a request for the display to close - may be rejected if it is
the only display left.
-## window:set:ATTR
+## Window:set:ATTR
Set any attribute on the display pane.
-The attribute "no-close" affects closing. If a window:close request
+The attribute "no-close" affects closing. If a Window:close request
arrives when "no-close" attribute is a non-empty string, that string
should be reported via a message, and the close should be rejected.
-## window:external-viewer
+## Window:external-viewer
str1 is a filename and str2 is (optionally) a basename template
containing "XXXXXX". An external viewer (typically xdg-open) should be
file is stored, some action might be taken to copy it and provide a
local names, based on str2.
-## window:fullscreen
+## Window:fullscreen
If num1 > 0, display should switch to full-screen mode if possible.
If num1 <= 0, display should switch away from full-screen mode.
-## window:new
+## Window:new
If it is possible to duplicate the display (e.g. similar window on same
output), do that.
## Window management commands
-window:close
-window:set:no-close
-window:external-viewer
-window:fullscreen
-window:new
+Window:close
+Window:set:no-close
+Window:external-viewer
+Window:fullscreen
+Window:new
all-displays
DEF_CMD(request_notify)
{
- pane_add_notify(ci->focus, ci->home, ksuffix(ci, "window:request:"));
+ pane_add_notify(ci->focus, ci->home, ksuffix(ci, "Window:request:"));
return 1;
}
DEF_CMD(send_notify)
{
- /* window:notify:... */
- return home_pane_notify(ci->home, ksuffix(ci, "window:notify:"),
+ /* Window:notify:... */
+ return home_pane_notify(ci->home, ksuffix(ci, "Window:notify:"),
ci->focus,
ci->num, ci->mark, ci->str,
ci->num2, ci->mark2, ci->str2, ci->comm2);
DEF_CMD(window_set)
{
- const char *val = ksuffix(ci, "window:set:");
+ const char *val = ksuffix(ci, "Window:set:");
if (!*val)
val = ci->str2;
{
window_map = key_alloc();
- key_add_prefix(window_map, "window:request:", &request_notify);
- key_add_prefix(window_map, "window:notify:", &send_notify);
+ key_add_prefix(window_map, "Window:request:", &request_notify);
+ key_add_prefix(window_map, "Window:notify:", &send_notify);
- key_add(window_map, "window:close", &window_close);
+ key_add(window_map, "Window:close", &window_close);
- key_add_prefix(window_map, "window:set:", &window_set);
+ key_add_prefix(window_map, "Window:set:", &window_set);
key_add(window_map, "selection:claim", &selection_claim);
key_add(window_map, "selection:commit", &selection_commit);
key_add(window_map, "Notify:Close", &close_notify);
key_add(window_map, "Draw:scale-image", &scale_image);
- key_add(window_map, "window:activate-display",
+ key_add(window_map, "Window:activate-display",
&window_activate_display);
call_comm("global-set-command", ed, &window_attach, 0, NULL,
"attach-display-ncurses");
nc_map = key_alloc();
- key_add(nc_map, "window:refresh", &force_redraw);
- key_add(nc_map, "window:close", &nc_close_display);
- key_add(nc_map, "window:external-viewer", &nc_external_viewer);
+ key_add(nc_map, "Window:refresh", &force_redraw);
+ key_add(nc_map, "Window:close", &nc_close_display);
+ key_add(nc_map, "Window:external-viewer", &nc_external_viewer);
key_add(nc_map, "Close", &nc_close);
key_add(nc_map, "Draw:clear", &nc_clear);
key_add(nc_map, "Draw:text-size", &nc_text_size);
cme->format == 32 &&
cme->window == xd->win &&
cme->data.data32[0] == xd->atoms[a_WM_DELETE_WINDOW]) {
- call("window:close", pane_focus(home));
+ call("Window:close", pane_focus(home));
return;
}
xcb_flush(xd->conn);
}
if (xcb_connection_has_error(xd->conn)) {
- call("window:close", ci->home->parent);
+ call("Window:close", ci->home->parent);
pane_close(ci->home);
}
return ret;
p = xcb_display_init(d, disp_auth, ci->focus);
if (strcmp(ci->key, "interactive-cmd-x11window") == 0)
p = home_call_ret(pane, p,
- "window:activate-display", ci->focus);
+ "Window:activate-display", ci->focus);
if (p)
comm_call(ci->comm2, "cb", p);
return 1;
xcb_map = key_alloc();
- key_add(xcb_map, "window:close", &xcb_close_display);
- key_add(xcb_map, "window:external-viewer", &xcb_external_viewer);
- key_add(xcb_map, "window:fullscreen", &xcb_fullscreen);
- key_add(xcb_map, "window:new", &xcb_new_display);
+ key_add(xcb_map, "Window:close", &xcb_close_display);
+ key_add(xcb_map, "Window:external-viewer", &xcb_external_viewer);
+ key_add(xcb_map, "Window:fullscreen", &xcb_fullscreen);
+ key_add(xcb_map, "Window:new", &xcb_new_display);
key_add(xcb_map, "Close", &xcb_close);
key_add(xcb_map, "Draw:clear", &xcb_clear);
char *e;
e = getenv("SSH_CONNECTION");
if (e && *e)
- call("window:set:REMOTE_SESSION", p,
+ call("Window:set:REMOTE_SESSION", p,
0, NULL, "yes");
- call("window:set:DISPLAY", p,
+ call("Window:set:DISPLAY", p,
0, NULL, getenv("DISPLAY"));
- call("window:set:XAUTHORITY", p,
+ call("Window:set:XAUTHORITY", p,
0, NULL, getenv("XAUTHORITY"));
if (!first_window)
first_window = p;
- call("window:set:no-close", p, 1, NULL,
+ call("Window:set:no-close", p, 1, NULL,
"Cannot close primary display");
- home_call(p, "window:activate-display", doc);
+ home_call(p, "Window:activate-display", doc);
}
}
if (gtk) {
p = call_ret(pane, "attach-display-gtk",
ed, 0, NULL, getenv("DISPLAY"));
- home_call(p, "window:activate-display", doc);
+ home_call(p, "Window:activate-display", doc);
if (!first_window)
first_window = p;
}
p = call_ret(pane, "attach-display-x11",
ed, 0, NULL, getenv("DISPLAY"),
0, NULL, getenv("XAUTHORITY"));
- home_call(p, "window:activate-display", doc);
+ home_call(p, "Window:activate-display", doc);
if (!first_window)
first_window = p;
}
free((void*)im->context);
im->context = strdup(ci->str2);
attr_set_str(&ci->home->attrs, "display-context", im->context);
- call("window:notify:display-context", ci->home);
+ call("Window:notify:display-context", ci->home);
}
report_status(ci->focus, im);
return 1;
free((void*)im->context);
im->context = strdup(ci->str2);
attr_set_str(&ci->home->attrs, "display-context", im->context);
- call("window:notify:display-context", ci->home);
+ call("Window:notify:display-context", ci->home);
}
im->num = ci->num;
im->num2 = ci->num;
if (!ci->str)
return Enoarg;
- call("window:notify:Keystroke-notify", ci->home, 0, NULL, ci->str);
+ call("Window:notify:Keystroke-notify", ci->home, 0, NULL, ci->str);
log_add(im, "K", ci->str);
im->mode = strdup("");
if (!ci->str)
return Enoarg;
- call("window:notify:Mouse-event-notify", ci->home,
+ call("Window:notify:Mouse-event-notify", ci->home,
ci->num, NULL, ci->str,
ci->num2);
log_add(im, "M", ci->str);
0, NULL, "attach-menubar");
menubar_map = key_alloc();
- key_add(menubar_map, "window:border", &menubar_border);
+ key_add(menubar_map, "Window:border", &menubar_border);
key_add(menubar_map, "Refresh:size", &menubar_refresh_size);
key_add(menubar_map, "Child-Notify", &menubar_child_notify);
key_add(menubar_map, "Refresh:view", &menubar_refresh);
if (ci->str && (strcmp(ci->key, "Message:default") != 0 ||
mli->message == NULL)) {
if (!mli->message) {
- call("window:request:Keystroke-notify", ci->home);
- call("window:request:Mouse-event-notify", ci->home);
+ call("Window:request:Keystroke-notify", ci->home);
+ call("Window:request:Mouse-event-notify", ci->home);
}
if (strcmp(ci->key, "Message:modal") == 0) {
free(mli->modal);
struct mlinfo *mli = ci->home->data;
if (!mli->message) {
- call("window:request:Keystroke-notify", ci->home);
- call("window:request:Mouse-event-notify", ci->home);
+ call("Window:request:Keystroke-notify", ci->home);
+ call("Window:request:Mouse-event-notify", ci->home);
}
free(mli->message);
mli->message = strdup("ABORTED");
return;
messageline_map = key_alloc();
key_add(messageline_map, "Clone", &messageline_clone);
- key_add(messageline_map, "window:border", &messageline_border);
+ key_add(messageline_map, "Window:border", &messageline_border);
key_add(messageline_map, "Message", &messageline_msg);
key_add(messageline_map, "Message:modal", &messageline_msg);
key_add(messageline_map, "Message:default", &messageline_msg);
call("doc:request:doc:replaced", p);
call("doc:request:mark:moving", p);
/* And update display-context */
- call("window:request:display-context", p);
+ call("Window:request:display-context", p);
return p;
}
DEF_CMD(basic_refresh)
{
- call("window:refresh", ci->focus);
+ call("Window:refresh", ci->focus);
return 1;
}
} else {
/* Move point to middle and refresh */
call("Move-View-Line", ci->focus, 0, ci->mark);
- call("window:refresh", ci->focus);
+ call("Window:refresh", ci->focus);
}
call("Mode:set-num2", ci->focus, N2_recentre | (step << 16));
return 1;
{CMD(emacs_simple), "Tile:split-x", "K:CX-3"},
{CMD(emacs_simple), "Tile:close", "K:CX-0"},
{CMD(emacs_simple), "Tile:bury", "K:A-B"},
- {CMD(emacs_simple), "window:new", "K:CX5-2"},
- {CMD(emacs_simple), "window:close", "K:CX5-0"},
+ {CMD(emacs_simple), "Window:new", "K:CX5-2"},
+ {CMD(emacs_simple), "Window:close", "K:CX5-0"},
{CMD(emacs_simple), "lib-server:done", "K:CX-#"},
{CMD(emacs_simple), "mode-swap-mark", "K:CX:C-X"},
{CMD(emacs_simple), "Abort", "K:C-G"},
else
scale = 12 * scale / 10;
snprintf(num, sizeof(num)-1, "%d", scale);
- call("window:set:scale", p, 0, NULL, num);
+ call("Window:set:scale", p, 0, NULL, num);
return 1;
}
return 1
def handle_close_window(self, key, focus, **a):
- "handle:window:close"
+ "handle:Window:close"
nc = self['no-close']
if nc:
focus.call("Message", nc)
return 1
def handle_fullscreen(self, key, num, **a):
- "handle:window:fullscreen"
+ "handle:Window:fullscreen"
if num > 0:
self.win.fullscreen()
else:
return 1
def handle_new(self, key, focus, **a):
- "handle:window:new"
+ "handle:Window:new"
p = focus.call("attach-window-core", ret='pane')
if not p:
return edlib.Efail
newdisp = EdDisplay(p, self['DISPLAY'])
- newdisp.call("window:activate-display", focus)
+ newdisp.call("Window:activate-display", focus)
return 1
def handle_external(self, key, str, **a):
- "handle:window:external-viewer"
+ "handle:Window:external-viewer"
disp = self['DISPLAY']
if not str or not disp:
return edlib.Enoarg
# This must not happen. What should I do?
def close_win(self, *a):
- self.call("window:close")
+ self.call("Window:close")
return True
def destroy_win(self, *a):
- self.parent("window:close")
+ self.parent("Window:close")
return False
def create_ui(self):
return edlib.Efail;
disp = EdDisplay(p, display)
if key == "interactive-cmd-gtkwindow":
- p = disp.call("window:activate-display", focus, ret='pane')
+ p = disp.call("Window:activate-display", focus, ret='pane')
if comm2:
comm2('callback', p)
return 1
while root.parent != root:
root = root.parent
edlib.Pane.__init__(self, root)
- focus.call("window:request:Keystroke-notify", self)
- focus.call("window:request:macro:capture-active", self)
- focus.call("window:request:macro:capture-done", self)
+ focus.call("Window:request:Keystroke-notify", self)
+ focus.call("Window:request:macro:capture-active", self)
+ focus.call("Window:request:macro:capture-done", self)
focus.call("Mode:set-mode", str2 = "()")
self.line = []
return ret
def start_capture(key, focus, **a):
- if focus.call("window:notify:macro:capture-active") >= 1:
+ if focus.call("Window:notify:macro:capture-active") >= 1:
# capture currently active
return edlib.Efalse
CapturePane(focus)
- if focus.call("window:notify:macro:capture-active") >= 1:
+ if focus.call("Window:notify:macro:capture-active") >= 1:
# Good, it is active now
return 1
return edlib.Efail
def end_capture(key, focus, num, **a):
try:
- if focus.call("window:notify:macro:capture-active") <= 0:
+ if focus.call("Window:notify:macro:capture-active") <= 0:
# capture currently active
return edlib.Efalse
except edlib.commandfailed:
return edlib.Efalse
- ret = focus.call("window:notify:macro:capture-done", num)
+ ret = focus.call("Window:notify:macro:capture-done", num)
if ret == 0:
return edlib.Efalse
if ret > 0:
if not msg :
if self.disp:
- self.disp.call("window:close")
+ self.disp.call("Window:close")
if self.sock:
self.sock.close()
self.sock = None
self.add_notify(d, "Notify:Close")
self.doc = d
if self.term:
- self.term.call("window: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
arg, env['XAUTHORITY'], ret='pane')
if p:
for v in env:
- p.call("window:set:", env[v], v)
+ p.call("Window:set:", env[v], v)
p.call("Tile:bury")
self.term = p
p = p.call("attach-display-ncurses", path, env['TERM'],
ret='pane')
for v in env:
- p.call("window:set:", env[v], v)
- p = p.call("window:activate-display", ret='pane')
+ p.call("Window:set:", env[v], v)
+ p = p.call("Window:activate-display", ret='pane')
self.term = p
self.disp = self.term
self.add_notify(self.disp, "Notify:Close")
return 1
if cmd == "close":
if self.disp:
- self.disp.call("window:set:no-close")
- self.disp.call("window:close")
+ self.disp.call("Window:set:no-close")
+ self.disp.call("Window:close")
self.disp = None
self.call("event:free", self.read)
self.sock.close()
# same as doc:done
self.doc = None
if self.term:
- self.term.call("window:set:no-close")
- self.term.call("window:close")
+ self.term.call("Window:set:no-close")
+ self.term.call("Window:close")
self.sock.send(b"Done")
return 1
"handle:doc:done"
if str != "test":
if self.term:
- self.term.call("window:set:no-close")
- self.term.call("window:close")
+ self.term.call("Window:set:no-close")
+ self.term.call("Window:close")
self.sock.send(b"Done")
return 1
self.sock.close()
self.sock = None
if self.disp:
- self.disp.call("window:close")
+ self.disp.call("Window:close")
self.disp = None
global server_sock
if url:
focus.call("Message", "Url: <%s>" % url)
if self.displayed_tag == tag:
- focus.call("window:external-viewer", url)
+ focus.call("Window:external-viewer", url)
self.displayed_tag = tag
else:
focus.call("Message", "URL tag %s not found" % tag)
fd, path = tempfile.mkstemp(ext, prefix)
os.write(fd, content)
os.close(fd)
- focus.call("window:external-viewer", path, prefix+"XXXXX"+ext)
+ focus.call("Window:external-viewer", path, prefix+"XXXXX"+ext)
return 1
def handle_map_attr(self, key, focus, mark, str, str2, comm2, **a):
"handle:K:A-f"
if self.borderless:
self.call("Tile:border", 1)
- self.call("window:border", 1)
- self.call("window:fullscreen", -1)
+ self.call("Window:border", 1)
+ self.call("Window:fullscreen", -1)
self.borderless = False
else:
self.call("Tile:border", -1)
- self.call("window:border", -1)
- self.call("window:fullscreen", 1)
+ self.call("Window:border", -1)
+ self.call("Window:fullscreen", 1)
self.borderless = True
return 1
return 1
def handle_refresh(self, key, focus, mark, **a):
- "handle:window:refresh"
+ "handle:Window:refresh"
# Refresh causes presentation page to recenter
# page-down just moves down to start of next page.
focus.call("doc:notify:doc:Recentre", mark)