diff options
Diffstat (limited to 'src/connect.c')
| -rw-r--r-- | src/connect.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/connect.c b/src/connect.c index 0ef12f9..9272a5c 100644 --- a/src/connect.c +++ b/src/connect.c @@ -70,20 +70,6 @@ static gboolean source_check(GSource *source) return xsource->event != NULL; } -static void redraw_window(Connection *con, xcb_window_t id) -{ - for (int i = 0; i < con->states->len; ++i) { - State *state = con->states->pdata[i]; - - // Redraw matching window - if (state->win->window == id) { - log_debug("Redrawing window [id=%d]", id); - draw_paint(state->draw, state->win); - break; - } - } -} - static gboolean source_dispatch(GSource *source, GSourceFunc callback, gpointer data) { EventSource *xsource = (EventSource *)source; @@ -113,7 +99,9 @@ static gboolean source_dispatch(GSource *source, GSourceFunc callback, gpointer case XCB_EXPOSE: { xcb_expose_event_t *expose = (xcb_expose_event_t *)xsource->event; log_debug("Processing event 'Expose' [type=%d]", XCB_EXPOSE); - redraw_window(xsource->con, expose->window); + + // Redraw + draw_paint(xsource->con->state->draw, xsource->con->state->win); break; } @@ -140,7 +128,9 @@ static gboolean source_dispatch(GSource *source, GSourceFunc callback, gpointer if (property->atom == XCB_ATOM_RESOURCE_MANAGER) { update_xrm(xsource->con); update_scale(xsource->con); - redraw_window(xsource->con, property->window); + + // Redraw + draw_paint(xsource->con->state->draw, xsource->con->state->win); } break; } @@ -259,16 +249,12 @@ Connection *connect_create() xcb_flush(con->connection); log_debug("Xcb set up"); - con->states = g_ptr_array_new(); - g_assert_nonnull(con->states); - return con; } void connect_attach_source(Connection *con) { g_assert_null(con->source); - attach_source(con); log_debug("Xcb event loop attached"); } @@ -276,14 +262,12 @@ void connect_attach_source(Connection *con) void connect_attach_state(Connection *con, State *state) { g_assert_nonnull(state); - g_ptr_array_add(con->states, state); + con->state = state; log_debug("Attached state to event loop"); } void connect_destroy(Connection *con) { - g_ptr_array_free(con->states, true); - g_source_destroy(con->source); g_source_unref(con->source); |
