Fix compilation with gcc 8
Apparently some nitwit Linux distros have made an unreleased compiler their default compiler. Fixes #376 Fixes various new warnings that GCC 8 issues
This commit is contained in:
parent
0333da991d
commit
527255e3a1
@ -8,7 +8,7 @@
|
|||||||
#include "names.h"
|
#include "names.h"
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
all_words(PyObject *self UNUSED) {
|
all_words(PYNOARG) {
|
||||||
PyObject *ans = PyTuple_New(arraysz(idx_to_word));
|
PyObject *ans = PyTuple_New(arraysz(idx_to_word));
|
||||||
if (!ans) return NULL;
|
if (!ans) return NULL;
|
||||||
for (size_t i = 0; i < arraysz(idx_to_word); i++) {
|
for (size_t i = 0; i < arraysz(idx_to_word); i++) {
|
||||||
|
|||||||
@ -199,8 +199,9 @@ static void wakeup_talk_loop(bool);
|
|||||||
static bool talk_thread_started = false;
|
static bool talk_thread_started = false;
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
start(ChildMonitor *self) {
|
start(PyObject *s, PyObject *a UNUSED) {
|
||||||
#define start_doc "start() -> Start the I/O thread"
|
#define start_doc "start() -> Start the I/O thread"
|
||||||
|
ChildMonitor *self = (ChildMonitor*)s;
|
||||||
if (self->talk_fd > -1 || self->listen_fd > -1) {
|
if (self->talk_fd > -1 || self->listen_fd > -1) {
|
||||||
if (pthread_create(&self->talk_thread, NULL, talk_loop, self) != 0) return PyErr_SetFromErrno(PyExc_OSError);
|
if (pthread_create(&self->talk_thread, NULL, talk_loop, self) != 0) return PyErr_SetFromErrno(PyExc_OSError);
|
||||||
talk_thread_started = true;
|
talk_thread_started = true;
|
||||||
@ -213,7 +214,7 @@ start(ChildMonitor *self) {
|
|||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
wakeup(ChildMonitor UNUSED *self) {
|
wakeup(PYNOARG) {
|
||||||
#define wakeup_doc "wakeup() -> wakeup the ChildMonitor I/O thread, forcing it to exit from poll() if it is waiting there."
|
#define wakeup_doc "wakeup() -> wakeup the ChildMonitor I/O thread, forcing it to exit from poll() if it is waiting there."
|
||||||
wakeup_io_loop(false);
|
wakeup_io_loop(false);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@ -286,7 +287,7 @@ needs_write(ChildMonitor UNUSED *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
shutdown_monitor(ChildMonitor *self) {
|
shutdown_monitor(ChildMonitor *self, PyObject *a UNUSED) {
|
||||||
#define shutdown_monitor_doc "shutdown_monitor() -> Shutdown the monitor loop."
|
#define shutdown_monitor_doc "shutdown_monitor() -> Shutdown the monitor loop."
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
signal(SIGTERM, SIG_DFL);
|
signal(SIGTERM, SIG_DFL);
|
||||||
@ -734,7 +735,7 @@ process_pending_resizes(double now) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
main_loop(ChildMonitor *self) {
|
main_loop(ChildMonitor *self, PyObject *a UNUSED) {
|
||||||
#define main_loop_doc "The main thread loop"
|
#define main_loop_doc "The main thread loop"
|
||||||
bool has_open_windows = true;
|
bool has_open_windows = true;
|
||||||
|
|
||||||
@ -1256,7 +1257,7 @@ PyTypeObject ChildMonitor_Type = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
safe_pipe(PyObject *self UNUSED) {
|
safe_pipe(PYNOARG) {
|
||||||
int fds[2] = {0};
|
int fds[2] = {0};
|
||||||
if (!self_pipe(fds)) return PyErr_SetFromErrno(PyExc_OSError);
|
if (!self_pipe(fds)) return PyErr_SetFromErrno(PyExc_OSError);
|
||||||
return Py_BuildValue("ii", fds[0], fds[1]);
|
return Py_BuildValue("ii", fds[0], fds[1]);
|
||||||
|
|||||||
@ -133,7 +133,7 @@ as_color(ColorProfile *self, PyObject *val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
reset_color_table(ColorProfile *self) {
|
reset_color_table(ColorProfile *self, PyObject *a UNUSED) {
|
||||||
#define reset_color_table_doc "Reset all customized colors back to defaults"
|
#define reset_color_table_doc "Reset all customized colors back to defaults"
|
||||||
memcpy(self->color_table, self->orig_color_table, sizeof(FG_BG_256));
|
memcpy(self->color_table, self->orig_color_table, sizeof(FG_BG_256));
|
||||||
self->dirty = true;
|
self->dirty = true;
|
||||||
@ -179,7 +179,7 @@ copy_color_table_to_buffer(ColorProfile *self, color_type *buf, int offset, size
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
color_table_address(ColorProfile *self) {
|
color_table_address(ColorProfile *self, PyObject *a UNUSED) {
|
||||||
#define color_table_address_doc "Pointer address to start of color table"
|
#define color_table_address_doc "Pointer address to start of color table"
|
||||||
return PyLong_FromVoidPtr((void*)self->color_table);
|
return PyLong_FromVoidPtr((void*)self->color_table);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -253,7 +253,7 @@ cursor_as_sgr(Cursor *self, Cursor *prev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
reset_display_attrs(Cursor *self) {
|
reset_display_attrs(Cursor *self, PyObject *a UNUSED) {
|
||||||
#define reset_display_attrs_doc "Reset all display attributes to unset"
|
#define reset_display_attrs_doc "Reset all display attributes to unset"
|
||||||
cursor_reset_display_attrs(self);
|
cursor_reset_display_attrs(self);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@ -272,7 +272,7 @@ void cursor_copy_to(Cursor *src, Cursor *dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
copy(Cursor *self);
|
copy(Cursor *self, PyObject*);
|
||||||
#define copy_doc "Create a clone of this cursor"
|
#define copy_doc "Create a clone of this cursor"
|
||||||
|
|
||||||
// Boilerplate {{{
|
// Boilerplate {{{
|
||||||
@ -342,7 +342,7 @@ cursor_copy(Cursor *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
copy(Cursor *self) {
|
copy(Cursor *self, PyObject *a UNUSED) {
|
||||||
return (PyObject*)cursor_copy(self);
|
return (PyObject*)cursor_copy(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ handle_sigchld(int UNUSED signum, siginfo_t *sinfo, void UNUSED *unused) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
install_sigchld_handler(PyObject UNUSED *self) {
|
install_sigchld_handler(PYNOARG) {
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sa.sa_flags = SA_SIGINFO;
|
sa.sa_flags = SA_SIGINFO;
|
||||||
sa.sa_sigaction = handle_sigchld;
|
sa.sa_sigaction = handle_sigchld;
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#define OPENGL_REQUIRED_VERSION_MAJOR 3
|
#define OPENGL_REQUIRED_VERSION_MAJOR 3
|
||||||
#define OPENGL_REQUIRED_VERSION_MINOR 3
|
#define OPENGL_REQUIRED_VERSION_MINOR 3
|
||||||
#define UNUSED __attribute__ ((unused))
|
#define UNUSED __attribute__ ((unused))
|
||||||
|
#define PYNOARG PyObject *__a1 UNUSED, PyObject *__a2 UNUSED
|
||||||
#define EXPORTED __attribute__ ((visibility ("default")))
|
#define EXPORTED __attribute__ ((visibility ("default")))
|
||||||
#define LIKELY(x) __builtin_expect (!!(x), 1)
|
#define LIKELY(x) __builtin_expect (!!(x), 1)
|
||||||
#define UNLIKELY(x) __builtin_expect (!!(x), 0)
|
#define UNLIKELY(x) __builtin_expect (!!(x), 0)
|
||||||
@ -208,7 +209,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define clear_sprite_position(cell) (cell).sprite_x = 0; (cell).sprite_y = 0; (cell).sprite_z = 0;
|
#define clear_sprite_position(cell) (cell).sprite_x = 0; (cell).sprite_y = 0; (cell).sprite_z = 0;
|
||||||
|
|
||||||
#define left_shift_line(line, at, num) \
|
#define left_shift_line(line, at, num) { \
|
||||||
for(index_type __i__ = (at); __i__ < (line)->xnum - (num); __i__++) { \
|
for(index_type __i__ = (at); __i__ < (line)->xnum - (num); __i__++) { \
|
||||||
COPY_CELL(line, __i__ + (num), line, __i__) \
|
COPY_CELL(line, __i__ + (num), line, __i__) \
|
||||||
} \
|
} \
|
||||||
@ -216,7 +217,8 @@ typedef struct {
|
|||||||
(line)->cells[(at)].ch = BLANK_CHAR; \
|
(line)->cells[(at)].ch = BLANK_CHAR; \
|
||||||
(line)->cells[(at)].attrs = BLANK_CHAR ? 1 : 0; \
|
(line)->cells[(at)].attrs = BLANK_CHAR ? 1 : 0; \
|
||||||
clear_sprite_position((line)->cells[(at)]); \
|
clear_sprite_position((line)->cells[(at)]); \
|
||||||
}
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
#define ensure_space_for(base, array, type, num, capacity, initial_cap, zero_mem) \
|
#define ensure_space_for(base, array, type, num, capacity, initial_cap, zero_mem) \
|
||||||
if ((base)->capacity < num) { \
|
if ((base)->capacity < num) { \
|
||||||
|
|||||||
@ -1066,7 +1066,7 @@ concat_cells(PyObject UNUSED *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
current_fonts(PyObject UNUSED *self) {
|
current_fonts(PYNOARG) {
|
||||||
PyObject *ans = PyDict_New();
|
PyObject *ans = PyDict_New();
|
||||||
if (!ans) return NULL;
|
if (!ans) return NULL;
|
||||||
#define SET(key, val) {if (PyDict_SetItemString(ans, #key, fonts.fonts[val].face) != 0) { goto error; }}
|
#define SET(key, val) {if (PyDict_SetItemString(ans, #key, fonts.fonts[val].face) != 0) { goto error; }}
|
||||||
|
|||||||
@ -532,7 +532,8 @@ render_glyphs_in_cells(PyObject *f, bool bold, bool italic, hb_glyph_info_t *inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
display_name(Face *self) {
|
display_name(PyObject *s, PyObject *a UNUSED) {
|
||||||
|
Face *self = (Face*)s;
|
||||||
const char *psname = FT_Get_Postscript_Name(self->face);
|
const char *psname = FT_Get_Postscript_Name(self->face);
|
||||||
if (psname) return Py_BuildValue("s", psname);
|
if (psname) return Py_BuildValue("s", psname);
|
||||||
Py_INCREF(self->path);
|
Py_INCREF(self->path);
|
||||||
@ -540,8 +541,8 @@ display_name(Face *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
extra_data(Face *self) {
|
extra_data(PyObject *self, PyObject *a UNUSED) {
|
||||||
return PyLong_FromVoidPtr(self->extra_data);
|
return PyLong_FromVoidPtr(((Face*)self)->extra_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boilerplate {{{
|
// Boilerplate {{{
|
||||||
|
|||||||
22
kitty/glfw.c
22
kitty/glfw.c
@ -481,7 +481,7 @@ glfw_init(PyObject UNUSED *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
glfw_terminate(PyObject UNUSED *self) {
|
glfw_terminate(PYNOARG) {
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
@ -499,13 +499,13 @@ glfw_wait_events(PyObject UNUSED *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
glfw_post_empty_event(PyObject UNUSED *self) {
|
glfw_post_empty_event(PYNOARG) {
|
||||||
glfwPostEmptyEvent();
|
glfwPostEmptyEvent();
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
glfw_poll_events(PyObject UNUSED *self) {
|
glfw_poll_events(PYNOARG) {
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ get_physical_dpi(GLFWmonitor *m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
glfw_get_physical_dpi(PyObject UNUSED *self) {
|
glfw_get_physical_dpi(PYNOARG) {
|
||||||
GLFWmonitor *m = glfwGetPrimaryMonitor();
|
GLFWmonitor *m = glfwGetPrimaryMonitor();
|
||||||
if (m == NULL) { PyErr_SetString(PyExc_ValueError, "Failed to get primary monitor"); return NULL; }
|
if (m == NULL) { PyErr_SetString(PyExc_ValueError, "Failed to get primary monitor"); return NULL; }
|
||||||
return get_physical_dpi(m);
|
return get_physical_dpi(m);
|
||||||
@ -548,14 +548,14 @@ glfw_window_hint(PyObject UNUSED *self, PyObject *args) {
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
get_clipboard_string(PyObject UNUSED *self) {
|
get_clipboard_string(PYNOARG) {
|
||||||
OSWindow *w = current_os_window();
|
OSWindow *w = current_os_window();
|
||||||
if (w) return Py_BuildValue("s", glfwGetClipboardString(w->handle));
|
if (w) return Py_BuildValue("s", glfwGetClipboardString(w->handle));
|
||||||
return Py_BuildValue("s", "");
|
return Py_BuildValue("s", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
get_content_scale_for_window(PyObject UNUSED *self) {
|
get_content_scale_for_window(PYNOARG) {
|
||||||
OSWindow *w = global_state.callback_os_window ? global_state.callback_os_window : global_state.os_windows;
|
OSWindow *w = global_state.callback_os_window ? global_state.callback_os_window : global_state.os_windows;
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
glfwGetWindowContentScale(w->handle, &xscale, &yscale);
|
glfwGetWindowContentScale(w->handle, &xscale, &yscale);
|
||||||
@ -572,7 +572,7 @@ set_clipboard_string(PyObject UNUSED *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
toggle_fullscreen(PyObject UNUSED *self) {
|
toggle_fullscreen(PYNOARG) {
|
||||||
GLFWmonitor *monitor;
|
GLFWmonitor *monitor;
|
||||||
OSWindow *w = current_os_window();
|
OSWindow *w = current_os_window();
|
||||||
if (!w) Py_RETURN_NONE;
|
if (!w) Py_RETURN_NONE;
|
||||||
@ -662,14 +662,14 @@ should_os_window_close(OSWindow* w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
primary_monitor_size(PyObject UNUSED *self) {
|
primary_monitor_size(PYNOARG) {
|
||||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
return Py_BuildValue("ii", mode->width, mode->height);
|
return Py_BuildValue("ii", mode->width, mode->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
primary_monitor_content_scale(PyObject UNUSED *self) {
|
primary_monitor_content_scale(PYNOARG) {
|
||||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
|
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
|
||||||
@ -677,7 +677,7 @@ primary_monitor_content_scale(PyObject UNUSED *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
x11_display(PyObject UNUSED *self) {
|
x11_display(PYNOARG) {
|
||||||
if (glfwGetX11Display) {
|
if (glfwGetX11Display) {
|
||||||
return PyLong_FromVoidPtr(glfwGetX11Display());
|
return PyLong_FromVoidPtr(glfwGetX11Display());
|
||||||
} else log_error("Failed to load glfwGetX11Display");
|
} else log_error("Failed to load glfwGetX11Display");
|
||||||
@ -699,7 +699,7 @@ x11_window_id(PyObject UNUSED *self, PyObject *os_wid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
get_primary_selection(PyObject UNUSED *self) {
|
get_primary_selection(PYNOARG) {
|
||||||
if (glfwGetX11SelectionString) {
|
if (glfwGetX11SelectionString) {
|
||||||
return Py_BuildValue("y", glfwGetX11SelectionString());
|
return Py_BuildValue("y", glfwGetX11SelectionString());
|
||||||
} else log_error("Failed to load glfwGetX11SelectionString");
|
} else log_error("Failed to load glfwGetX11SelectionString");
|
||||||
|
|||||||
@ -509,7 +509,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_
|
|||||||
|
|
||||||
static inline const char*
|
static inline const char*
|
||||||
create_add_response(GraphicsManager UNUSED *self, bool data_loaded, uint32_t iid) {
|
create_add_response(GraphicsManager UNUSED *self, bool data_loaded, uint32_t iid) {
|
||||||
static char rbuf[sizeof(add_response)/sizeof(add_response[0])];
|
static char rbuf[sizeof(add_response)/sizeof(add_response[0]) + 64];
|
||||||
if (iid) {
|
if (iid) {
|
||||||
if (!has_add_respose) {
|
if (!has_add_respose) {
|
||||||
if (!data_loaded) return NULL;
|
if (!data_loaded) return NULL;
|
||||||
|
|||||||
@ -215,7 +215,7 @@ as_text(HistoryBuf *self, PyObject *args) {
|
|||||||
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
dirty_lines(HistoryBuf *self) {
|
dirty_lines(HistoryBuf *self, PyObject *a UNUSED) {
|
||||||
#define dirty_lines_doc "dirty_lines() -> Line numbers of all lines that have dirty text."
|
#define dirty_lines_doc "dirty_lines() -> Line numbers of all lines that have dirty text."
|
||||||
PyObject *ans = PyList_New(0);
|
PyObject *ans = PyList_New(0);
|
||||||
for (index_type i = 0; i < self->ynum; i++) {
|
for (index_type i = 0; i < self->ynum; i++) {
|
||||||
|
|||||||
10
kitty/keys.h
generated
10
kitty/keys.h
generated
@ -1747,6 +1747,7 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x01\x0d";
|
return "\x01\x0d";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
case 2: // REPEAT
|
case 2: // REPEAT
|
||||||
switch (mods & 0xf) {
|
switch (mods & 0xf) {
|
||||||
@ -3005,8 +3006,10 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x01\x0d";
|
return "\x01\x0d";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
} // end switch(action) in mode NORMAL
|
} // end switch(action) in mode NORMAL
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case APPLICATION:
|
case APPLICATION:
|
||||||
@ -4271,6 +4274,7 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x01\x0d";
|
return "\x01\x0d";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
case 2: // REPEAT
|
case 2: // REPEAT
|
||||||
switch (mods & 0xf) {
|
switch (mods & 0xf) {
|
||||||
@ -5529,8 +5533,10 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x01\x0d";
|
return "\x01\x0d";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
} // end switch(action) in mode APPLICATION
|
} // end switch(action) in mode APPLICATION
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case EXTENDED:
|
case EXTENDED:
|
||||||
@ -9134,6 +9140,7 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x05\x4b\x72\x50\x42\x68";
|
return "\x05\x4b\x72\x50\x42\x68";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
case 1: // PRESS
|
case 1: // PRESS
|
||||||
switch (mods & 0xf) {
|
switch (mods & 0xf) {
|
||||||
@ -12738,6 +12745,7 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x05\x4b\x70\x50\x42\x68";
|
return "\x05\x4b\x70\x50\x42\x68";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
case 2: // REPEAT
|
case 2: // REPEAT
|
||||||
switch (mods & 0xf) {
|
switch (mods & 0xf) {
|
||||||
@ -16342,8 +16350,10 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) {
|
|||||||
return "\x05\x4b\x74\x50\x42\x68";
|
return "\x05\x4b\x74\x50\x42\x68";
|
||||||
} // end switch(key)
|
} // end switch(key)
|
||||||
} // end switch(mods)
|
} // end switch(mods)
|
||||||
|
break;
|
||||||
|
|
||||||
} // end switch(action) in mode EXTENDED
|
} // end switch(action) in mode EXTENDED
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -336,13 +336,15 @@ def generate_key_table():
|
|||||||
ind('return NULL;')
|
ind('return NULL;')
|
||||||
i -= 2
|
i -= 2
|
||||||
i -= 1
|
i -= 1
|
||||||
ind('} // end switch(mods)\n')
|
ind('} // end switch(mods)')
|
||||||
|
ind('break;\n')
|
||||||
i -= 1
|
i -= 1
|
||||||
else:
|
else:
|
||||||
ind('return NULL;\n')
|
ind('return NULL;\n')
|
||||||
i -= 1
|
i -= 1
|
||||||
i -= 1
|
i -= 1
|
||||||
ind('}} // end switch(action) in mode {}\n\n'.format(mode))
|
ind('}} // end switch(action) in mode {}'.format(mode))
|
||||||
|
ind('break;\n\n')
|
||||||
i -= 1
|
i -= 1
|
||||||
i -= 1
|
i -= 1
|
||||||
ind('}')
|
ind('}')
|
||||||
|
|||||||
@ -46,7 +46,7 @@ linebuf_mark_line_clean(LineBuf *self, index_type y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
clear(LineBuf *self) {
|
clear(LineBuf *self, PyObject *a UNUSED) {
|
||||||
#define clear_doc "Clear all lines in this LineBuf"
|
#define clear_doc "Clear all lines in this LineBuf"
|
||||||
linebuf_clear(self, BLANK_CHAR);
|
linebuf_clear(self, BLANK_CHAR);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@ -167,7 +167,7 @@ set_continued(LineBuf *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
dirty_lines(LineBuf *self) {
|
dirty_lines(LineBuf *self, PyObject *a UNUSED) {
|
||||||
#define dirty_lines_doc "dirty_lines() -> Line numbers of all lines that have dirty text."
|
#define dirty_lines_doc "dirty_lines() -> Line numbers of all lines that have dirty text."
|
||||||
PyObject *ans = PyList_New(0);
|
PyObject *ans = PyList_New(0);
|
||||||
for (index_type i = 0; i < self->ynum; i++) {
|
for (index_type i = 0; i < self->ynum; i++) {
|
||||||
|
|||||||
@ -263,7 +263,7 @@ line_as_ansi(Line *self, Py_UCS4 *buf, index_type buflen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
as_ansi(Line* self) {
|
as_ansi(Line* self, PyObject *a UNUSED) {
|
||||||
#define as_ansi_doc "Return the line's contents with ANSI (SGR) escape codes for formatting"
|
#define as_ansi_doc "Return the line's contents with ANSI (SGR) escape codes for formatting"
|
||||||
static Py_UCS4 t[5120] = {0};
|
static Py_UCS4 t[5120] = {0};
|
||||||
index_type num = line_as_ansi(self, t, 5120);
|
index_type num = line_as_ansi(self, t, 5120);
|
||||||
@ -272,7 +272,7 @@ as_ansi(Line* self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
is_continued(Line* self) {
|
is_continued(Line* self, PyObject *a UNUSED) {
|
||||||
#define is_continued_doc "Return the line's continued flag"
|
#define is_continued_doc "Return the line's continued flag"
|
||||||
PyObject *ans = self->continued ? Py_True : Py_False;
|
PyObject *ans = self->continued ? Py_True : Py_False;
|
||||||
Py_INCREF(ans);
|
Py_INCREF(ans);
|
||||||
|
|||||||
@ -219,7 +219,7 @@ screen_change_scrollback_size(Screen *self, unsigned int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
reset_callbacks(Screen *self) {
|
reset_callbacks(Screen *self, PyObject *a UNUSED) {
|
||||||
Py_CLEAR(self->callbacks);
|
Py_CLEAR(self->callbacks);
|
||||||
self->callbacks = Py_None;
|
self->callbacks = Py_None;
|
||||||
Py_INCREF(self->callbacks);
|
Py_INCREF(self->callbacks);
|
||||||
@ -1444,8 +1444,8 @@ screen_open_url(Screen *self) {
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// Python interface {{{
|
// Python interface {{{
|
||||||
#define WRAP0(name) static PyObject* name(Screen *self) { screen_##name(self); Py_RETURN_NONE; }
|
#define WRAP0(name) static PyObject* name(Screen *self, PyObject *a UNUSED) { screen_##name(self); Py_RETURN_NONE; }
|
||||||
#define WRAP0x(name) static PyObject* xxx_##name(Screen *self) { screen_##name(self); Py_RETURN_NONE; }
|
#define WRAP0x(name) static PyObject* xxx_##name(Screen *self, PyObject *a UNUSED) { screen_##name(self); Py_RETURN_NONE; }
|
||||||
#define WRAP1(name, defval) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; if(!PyArg_ParseTuple(args, "|I", &v)) return NULL; screen_##name(self, v); Py_RETURN_NONE; }
|
#define WRAP1(name, defval) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; if(!PyArg_ParseTuple(args, "|I", &v)) return NULL; screen_##name(self, v); Py_RETURN_NONE; }
|
||||||
#define WRAP1B(name, defval) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; int b=false; if(!PyArg_ParseTuple(args, "|Ip", &v, &b)) return NULL; screen_##name(self, v, b); Py_RETURN_NONE; }
|
#define WRAP1B(name, defval) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; int b=false; if(!PyArg_ParseTuple(args, "|Ip", &v, &b)) return NULL; screen_##name(self, v, b); Py_RETURN_NONE; }
|
||||||
#define WRAP1E(name, defval, ...) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; if(!PyArg_ParseTuple(args, "|I", &v)) return NULL; screen_##name(self, v, __VA_ARGS__); Py_RETURN_NONE; }
|
#define WRAP1E(name, defval, ...) static PyObject* name(Screen *self, PyObject *args) { unsigned int v=defval; if(!PyArg_ParseTuple(args, "|I", &v)) return NULL; screen_##name(self, v, __VA_ARGS__); Py_RETURN_NONE; }
|
||||||
@ -1458,7 +1458,7 @@ as_text(Screen *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
refresh_sprite_positions(Screen *self) {
|
refresh_sprite_positions(Screen *self, PyObject *a UNUSED) {
|
||||||
self->is_dirty = true;
|
self->is_dirty = true;
|
||||||
for (index_type i = 0; i < self->lines; i++) {
|
for (index_type i = 0; i < self->lines; i++) {
|
||||||
linebuf_mark_line_dirty(self->main_linebuf, i);
|
linebuf_mark_line_dirty(self->main_linebuf, i);
|
||||||
@ -1572,13 +1572,13 @@ set_mode(Screen *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
reset_dirty(Screen *self) {
|
reset_dirty(Screen *self, PyObject *a UNUSED) {
|
||||||
screen_reset_dirty(self);
|
screen_reset_dirty(self);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
is_using_alternate_linebuf(Screen *self) {
|
is_using_alternate_linebuf(Screen *self, PyObject *a UNUSED) {
|
||||||
if (self->linebuf == self->alt_linebuf) Py_RETURN_TRUE;
|
if (self->linebuf == self->alt_linebuf) Py_RETURN_TRUE;
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
}
|
}
|
||||||
@ -1631,7 +1631,7 @@ change_scrollback_size(Screen *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
text_for_selection(Screen *self) {
|
text_for_selection(Screen *self, PyObject *a UNUSED) {
|
||||||
FullSelectionBoundary start, end;
|
FullSelectionBoundary start, end;
|
||||||
full_selection_limits_(selection, &start, &end);
|
full_selection_limits_(selection, &start, &end);
|
||||||
PyObject *ans = NULL;
|
PyObject *ans = NULL;
|
||||||
@ -1747,26 +1747,26 @@ screen_update_selection(Screen *self, index_type x, index_type y, bool ended) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
mark_as_dirty(Screen *self) {
|
mark_as_dirty(Screen *self, PyObject *a UNUSED) {
|
||||||
self->is_dirty = true;
|
self->is_dirty = true;
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
current_char_width(Screen *self) {
|
current_char_width(Screen *self, PyObject *a UNUSED) {
|
||||||
#define current_char_width_doc "The width of the character under the cursor"
|
#define current_char_width_doc "The width of the character under the cursor"
|
||||||
return PyLong_FromUnsignedLong(screen_current_char_width(self));
|
return PyLong_FromUnsignedLong(screen_current_char_width(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
is_main_linebuf(Screen *self) {
|
is_main_linebuf(Screen *self, PyObject *a UNUSED) {
|
||||||
PyObject *ans = (self->linebuf == self->main_linebuf) ? Py_True : Py_False;
|
PyObject *ans = (self->linebuf == self->main_linebuf) ? Py_True : Py_False;
|
||||||
Py_INCREF(ans);
|
Py_INCREF(ans);
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
toggle_alt_screen(Screen *self) {
|
toggle_alt_screen(Screen *self, PyObject *a UNUSED) {
|
||||||
screen_toggle_screen_buffer(self);
|
screen_toggle_screen_buffer(self);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -587,9 +587,8 @@ end:
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PYWRAP0(name) static PyObject* py##name(PyObject UNUSED *self)
|
#define PYWRAP0(name) static PyObject* py##name(PYNOARG)
|
||||||
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)
|
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)
|
||||||
#define PYWRAP2(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args, PyObject *kw)
|
|
||||||
#define PA(fmt, ...) if(!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
|
#define PA(fmt, ...) if(!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
|
||||||
#define ONE_INT(name) PYWRAP1(name) { name(PyLong_AsSsize_t(args)); Py_RETURN_NONE; }
|
#define ONE_INT(name) PYWRAP1(name) { name(PyLong_AsSsize_t(args)); Py_RETURN_NONE; }
|
||||||
#define TWO_INT(name) PYWRAP1(name) { int a, b; PA("ii", &a, &b); name(a, b); Py_RETURN_NONE; }
|
#define TWO_INT(name) PYWRAP1(name) { int a, b; PA("ii", &a, &b); name(a, b); Py_RETURN_NONE; }
|
||||||
|
|||||||
@ -268,9 +268,8 @@ os_window_regions(OSWindow *os_window, Region *central, Region *tab_bar) {
|
|||||||
|
|
||||||
|
|
||||||
// Python API {{{
|
// Python API {{{
|
||||||
#define PYWRAP0(name) static PyObject* py##name(PyObject UNUSED *self)
|
#define PYWRAP0(name) static PyObject* py##name(PYNOARG)
|
||||||
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)
|
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)
|
||||||
#define PYWRAP2(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args, PyObject *kw)
|
|
||||||
#define PA(fmt, ...) if(!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
|
#define PA(fmt, ...) if(!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
|
||||||
#define ONE_UINT(name) PYWRAP1(name) { name((unsigned int)PyLong_AsUnsignedLong(args)); Py_RETURN_NONE; }
|
#define ONE_UINT(name) PYWRAP1(name) { name((unsigned int)PyLong_AsUnsignedLong(args)); Py_RETURN_NONE; }
|
||||||
#define TWO_UINT(name) PYWRAP1(name) { unsigned int a, b; PA("II", &a, &b); name(a, b); Py_RETURN_NONE; }
|
#define TWO_UINT(name) PYWRAP1(name) { unsigned int a, b; PA("II", &a, &b); name(a, b); Py_RETURN_NONE; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user