parent
868c1d634b
commit
08ee77d11c
@ -34,6 +34,9 @@ version 0.6.0 [future]
|
||||
- Add more options to customize the tab-bar's appearance (font styles and
|
||||
separator)
|
||||
|
||||
- Allow drag and drop of files into kitty. On drop kitty will paste the
|
||||
file path to the running program.
|
||||
|
||||
|
||||
version 0.5.1 [2017-12-01]
|
||||
---------------------------
|
||||
|
||||
@ -255,6 +255,13 @@ class Boss:
|
||||
if w is not None:
|
||||
w.focus_changed(focused)
|
||||
|
||||
def on_drop(self, os_window_id, paths):
|
||||
tm = self.os_window_map.get(os_window_id)
|
||||
if tm is not None:
|
||||
w = tm.active_window
|
||||
if w is not None:
|
||||
w.paste('\n'.join(paths))
|
||||
|
||||
def on_os_window_closed(self, os_window_id, viewport_width, viewport_height):
|
||||
cached_values['window-size'] = viewport_width, viewport_height
|
||||
tm = self.os_window_map.pop(os_window_id, None)
|
||||
|
||||
14
kitty/glfw.c
14
kitty/glfw.c
@ -154,6 +154,19 @@ window_focus_callback(GLFWwindow *w, int focused) {
|
||||
}
|
||||
global_state.callback_os_window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
drop_callback(GLFWwindow *w, int count, const char **paths) {
|
||||
if (!set_callback_window(w)) return;
|
||||
PyObject *p = PyTuple_New(count);
|
||||
if (p) {
|
||||
for (int i = 0; i < count; i++) PyTuple_SET_ITEM(p, i, PyUnicode_FromString(paths[i]));
|
||||
WINDOW_CALLBACK(on_drop, "O", p);
|
||||
Py_CLEAR(p);
|
||||
}
|
||||
global_state.callback_os_window = NULL;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
void
|
||||
@ -266,6 +279,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
||||
glfwSetCursorPosCallback(glfw_window, cursor_pos_callback);
|
||||
glfwSetKeyCallback(glfw_window, key_callback);
|
||||
glfwSetWindowFocusCallback(glfw_window, window_focus_callback);
|
||||
glfwSetDropCallback(glfw_window, drop_callback);
|
||||
#ifdef __APPLE__
|
||||
if (OPT(macos_hide_titlebar)) {
|
||||
if (glfwGetCocoaWindow) { if (!cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window))) { PyErr_Print(); } }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user