diff --git a/kitty/graphics.c b/kitty/graphics.c index 33dff46a5..40b54a16b 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -842,8 +842,8 @@ grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint case 't': case 'T': case 'q': - iid = g->id; - if (g->action == 'q') { q_iid = iid; iid = 0; if (!q_iid) { REPORT_ERROR("Query graphics command without image id"); break; } } + iid = g->id; q_iid = iid; + if (g->action == 'q') { iid = 0; if (!q_iid) { REPORT_ERROR("Query graphics command without image id"); break; } } image = handle_add_command(self, g, payload, is_dirty, iid); ret = create_add_response(self, image != NULL, g->action == 'q' ? q_iid: self->last_init_graphics_command.id); if (self->last_init_graphics_command.action == 'T' && image && image->data_loaded) handle_put_command(self, &self->last_init_graphics_command, c, is_dirty, image); diff --git a/kitty/mouse.c b/kitty/mouse.c index b327792c5..766767313 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -163,7 +163,7 @@ detect_url(Window *w, Screen *screen, unsigned int x, unsigned int y) { HANDLER(handle_move_event) { - unsigned int x, y; + unsigned int x = 0, y = 0; if (OPT(focus_follows_mouse)) { Tab *t = global_state.tabs + global_state.active_tab; if (window_idx != t->active_window) { @@ -327,7 +327,7 @@ void mouse_event(int button, int modifiers) { MouseShape old_cursor = mouse_cursor_shape; bool in_tab_bar; - unsigned int window_idx; + unsigned int window_idx = 0; Window *w = window_for_event(&window_idx, &in_tab_bar); if (in_tab_bar) { mouse_cursor_shape = HAND; @@ -346,7 +346,7 @@ scroll_event(double UNUSED xoffset, double yoffset) { if (s == 0) return; bool upwards = s > 0; bool in_tab_bar; - unsigned int window_idx; + unsigned int window_idx = 0; Window *w = window_for_event(&window_idx, &in_tab_bar); if (w) { Screen *screen = w->render_data.screen; diff --git a/kitty/screen.c b/kitty/screen.c index c96fff9c7..35697edae 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -140,7 +140,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) { bool is_main = self->linebuf == self->main_linebuf; index_type num_content_lines_before, num_content_lines_after; - index_type num_content_lines; + index_type num_content_lines = 0; // Resize main linebuf HistoryBuf *nh = realloc_hb(self->historybuf, self->historybuf->ynum, columns); diff --git a/setup.py b/setup.py index 0d0914b56..af5003e67 100755 --- a/setup.py +++ b/setup.py @@ -130,7 +130,10 @@ def init_env( missing_braces = '' if ccver < (5, 2) and cc == 'gcc': missing_braces = '-Wno-missing-braces' - optimize = '-g3' if debug or sanitize else '-O3' + df = '-g3' + if ccver >= (5, 0): + df += ' -Og' + optimize = df if debug or sanitize else '-O3' sanitize_args = get_sanitize_args(cc, ccver) if sanitize else set() cflags = os.environ.get( 'OVERRIDE_CFLAGS', (