Refresh the TODO comments

Removed the outdated ones, clarified some of them, and assigned them to
me.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-08-30 15:25:58 +01:00
parent cdb9765802
commit 8c1b0657ff
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
15 changed files with 52 additions and 54 deletions

View File

@ -144,8 +144,6 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
pixman_region32_subtract(&reg_visible, &reg_visible, t->reg_ignore); pixman_region32_subtract(&reg_visible, &reg_visible, t->reg_ignore);
} }
// TODO Bind root pixmap
if (ps->backend_data->ops->prepare) { if (ps->backend_data->ops->prepare) {
ps->backend_data->ops->prepare(ps->backend_data, &reg_paint); ps->backend_data->ops->prepare(ps->backend_data, &reg_paint);
} }
@ -191,10 +189,10 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
} }
// Blur window background // Blur window background
// TODO since the background might change the content of the window (e.g. /* TODO(yshui) since the backend might change the content of the window
// with shaders), we should consult the background whether the window * (e.g. with shaders), we should consult the backend whether the window
// is transparent or not. for now we will just rely on the * is transparent or not. for now we will just rely on the force_win_blend
// force_win_blend option * option */
auto real_win_mode = w->mode; auto real_win_mode = w->mode;
if (w->blur_background && if (w->blur_background &&

View File

@ -72,7 +72,7 @@ struct backend_operations {
/// Here is how you should choose target window: /// Here is how you should choose target window:
/// 1) if ps->overlay is not XCB_NONE, use that /// 1) if ps->overlay is not XCB_NONE, use that
/// 2) use ps->root otherwise /// 2) use ps->root otherwise
/// TODO make the target window a parameter // TODO(yshui) make the target window a parameter
backend_t *(*init)(session_t *)attr_nonnull(1); backend_t *(*init)(session_t *)attr_nonnull(1);
void (*deinit)(backend_t *backend_data) attr_nonnull(1); void (*deinit)(backend_t *backend_data) attr_nonnull(1);

View File

@ -233,6 +233,7 @@ bool build_shadow(xcb_connection_t *c, xcb_drawable_t d, double opacity, const i
auto maximum_row = auto maximum_row =
to_u16_checked(clamp(maximum_image_size / shadow_image->stride, 0, UINT16_MAX)); to_u16_checked(clamp(maximum_image_size / shadow_image->stride, 0, UINT16_MAX));
if (maximum_row <= 0) { if (maximum_row <= 0) {
// TODO(yshui) Upload image with XShm
log_error("X server request size limit is too restrictive, or the shadow " log_error("X server request size limit is too restrictive, or the shadow "
"image is too wide for us to send a single row of the shadow " "image is too wide for us to send a single row of the shadow "
"image. Shadow size: %dx%d", "image. Shadow size: %dx%d",

View File

@ -501,7 +501,7 @@ x_rect_to_coords(int nrects, const rect_t *rects, int dst_x, int dst_y, int text
} }
} }
// TODO: make use of reg_visible // TODO(yshui) make use of reg_visible
void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y, void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
const region_t *reg_tgt, const region_t *reg_visible attr_unused) { const region_t *reg_tgt, const region_t *reg_visible attr_unused) {
auto gd = (struct gl_data *)base; auto gd = (struct gl_data *)base;

View File

@ -334,7 +334,7 @@ static void present(backend_t *base, const region_t *region) {
free(e); free(e);
return; return;
} }
// TODO don't block wait for present completion // TODO(yshui) don't block wait for present completion
xcb_present_generic_event_t *pev = xcb_present_generic_event_t *pev =
(void *)xcb_wait_for_special_event(base->c, xd->present_event); (void *)xcb_wait_for_special_event(base->c, xd->present_event);
if (!pev) { if (!pev) {
@ -466,7 +466,7 @@ static bool image_op(backend_t *base, enum image_operations op, void *image,
return true; return true;
} }
// TODO: use copy-on-write // TODO(yshui): use copy-on-write
static void *copy(backend_t *base, const void *image, const region_t *reg) { static void *copy(backend_t *base, const void *image, const region_t *reg) {
const struct _xrender_image_data *img = image; const struct _xrender_image_data *img = image;
struct _xrender_data *xd = (void *)base; struct _xrender_data *xd = (void *)base;

View File

@ -383,7 +383,7 @@ c2_lptr_t *c2_parse(c2_lptr_t **pcondlst, const char *pattern, void *data) {
goto fail; \ goto fail; \
} while (0) } while (0)
// TODO Not a very good macro // TODO(yshui) Not a very good macro, should probably be a function
#define C2H_SKIP_SPACES() \ #define C2H_SKIP_SPACES() \
{ \ { \
while (isspace(pattern[offset])) \ while (isspace(pattern[offset])) \
@ -1255,7 +1255,7 @@ static void c2_dump(c2_ptr_t p) {
switch (pleaf->ptntype) { switch (pleaf->ptntype) {
case C2_L_PTINT: printf("%ld", pleaf->ptnint); break; case C2_L_PTINT: printf("%ld", pleaf->ptnint); break;
case C2_L_PTSTRING: case C2_L_PTSTRING:
// TODO: Escape string before printing out? // TODO(yshui) Escape string before printing out?
printf("\"%s\"", pleaf->ptnstr); printf("\"%s\"", pleaf->ptnstr);
break; break;
default: assert(0); break; default: assert(0); break;

View File

@ -255,9 +255,9 @@ typedef struct session {
struct x_convolution_kernel **blur_kerns_cache; struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit /// If we should quit
bool quit:1; bool quit:1;
// TODO(yshui) use separate flags for dfferent kinds of updates so we don't
// waste our time.
/// Whether there are pending updates, like window creation, etc. /// Whether there are pending updates, like window creation, etc.
/// TODO use separate flags for dfferent kinds of updates so we don't
/// waste our time.
bool pending_updates:1; bool pending_updates:1;
// === Expose event related === // === Expose event related ===

View File

@ -155,7 +155,7 @@ conv *parse_blur_kern(const char *src, const char **endptr, bool *hasneg) {
// Detect trailing characters // Detect trailing characters
for (; *pc && *pc != ';'; pc++) { for (; *pc && *pc != ';'; pc++) {
if (!isspace(*pc) && *pc != ',') { if (!isspace(*pc) && *pc != ',') {
// TODO isspace is locale aware, be careful // TODO(yshui) isspace is locale aware, be careful
log_error("Trailing characters in blur kernel string."); log_error("Trailing characters in blur kernel string.");
goto err2; goto err2;
} }
@ -197,7 +197,7 @@ err1:
* @return the kernels * @return the kernels
*/ */
struct conv **parse_blur_kern_lst(const char *src, bool *hasneg, int *count) { struct conv **parse_blur_kern_lst(const char *src, bool *hasneg, int *count) {
// TODO just return a predefined kernels, not parse predefined strings... // TODO(yshui) just return a predefined kernels, not parse predefined strings...
static const struct { static const struct {
const char *name; const char *name;
const char *kern_str; const char *kern_str;

View File

@ -46,7 +46,8 @@
/// When top half finished, we enter the render stage, where no server state should be /// When top half finished, we enter the render stage, where no server state should be
/// queried. All rendering should be done with our internal knowledge of the server state. /// queried. All rendering should be done with our internal knowledge of the server state.
/// ///
/// TODO the things described above
// TODO(yshui) the things described above
/** /**
* Get a window's name from window ID. * Get a window's name from window ID.

View File

@ -575,9 +575,9 @@ static void configure_root(session_t *ps) {
log_fatal("Failed to re-initialize backend after root " log_fatal("Failed to re-initialize backend after root "
"change, aborting..."); "change, aborting...");
ps->quit = true; ps->quit = true;
// TODO only event handlers should request ev_break, /* TODO(yshui) only event handlers should request
// otherwise it's too hard to keep track of what can break * ev_break, otherwise it's too hard to keep track of what
// the event loop * can break the event loop */
ev_break(ps->loop, EVBREAK_ALL); ev_break(ps->loop, EVBREAK_ALL);
return; return;
} }
@ -704,9 +704,9 @@ static struct managed_win *paint_preprocess(session_t *ps, bool *fade_running) {
w->g.y >= ps->root_height || w->state == WSTATE_UNMAPPED || w->g.y >= ps->root_height || w->state == WSTATE_UNMAPPED ||
((double)w->opacity * MAX_ALPHA < 1 && !w->blur_background) || ((double)w->opacity * MAX_ALPHA < 1 && !w->blur_background) ||
w->paint_excluded) { w->paint_excluded) {
// TODO: for consistency, even a window has 0 opacity, we still /* TODO(yshui) for consistency, even a window has 0 opacity, we
// probably need to blur its background, so to_paint shouldn't be * still probably need to blur its background, so to_paint
// false for them. * shouldn't be false for them. */
to_paint = false; to_paint = false;
} }
@ -1407,9 +1407,9 @@ static void _draw_callback(EV_P_ session_t *ps, int revents attr_unused) {
} }
} }
// TODO have a stripped down version of paint_preprocess that is used when screen /* TODO(yshui) Have a stripped down version of paint_preprocess that is used when
// is not redirected. its sole purpose should be to decide whether the screen * screen is not redirected. its sole purpose should be to decide whether the
// should be redirected. * screen should be redirected. */
bool fade_running = false; bool fade_running = false;
bool was_redirected = ps->redirected; bool was_redirected = ps->redirected;
auto bottom = paint_preprocess(ps, &fade_running); auto bottom = paint_preprocess(ps, &fade_running);
@ -1421,8 +1421,8 @@ static void _draw_callback(EV_P_ session_t *ps, int revents attr_unused) {
// so we rerun _draw_callback to make sure the rendering decision we make // so we rerun _draw_callback to make sure the rendering decision we make
// is up-to-date, and all the new flags got handled. // is up-to-date, and all the new flags got handled.
// //
// TODO This is not ideal, we should try to avoid setting window flags in // TODO(yshui) This is not ideal, we should try to avoid setting window
// paint_preprocess. // flags in paint_preprocess.
log_debug("Re-run _draw_callback"); log_debug("Re-run _draw_callback");
return _draw_callback(EV_A_ ps, revents); return _draw_callback(EV_A_ ps, revents);
} }
@ -1456,7 +1456,8 @@ static void _draw_callback(EV_P_ session_t *ps, int revents attr_unused) {
if (!fade_running) if (!fade_running)
ps->fade_time = 0L; ps->fade_time = 0L;
// TODO xcb_ungrab_server // TODO(yshui) Investigate how big the X critical section needs to be. There are
// suggestions that rendering should be in the critical section as well.
ps->redraw_needed = false; ps->redraw_needed = false;
} }

View File

@ -32,11 +32,7 @@ enum root_flags {
}; };
// == Functions == // == Functions ==
// TODO move static inline functions that are only used in picom.c, into // TODO(yshui) move static inline functions that are only used in picom.c, into picom.c
// picom.c
// inline functions must be made static to compile correctly under clang:
// http://clang.llvm.org/compatibility.html#inline
void add_damage(session_t *ps, const region_t *damage); void add_damage(session_t *ps, const region_t *damage);

View File

@ -790,7 +790,7 @@ win_blur_background(session_t *ps, struct managed_win *w, xcb_render_picture_t t
} break; } break;
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
case BKEND_GLX: case BKEND_GLX:
// TODO: Handle frame opacity // TODO(compton) Handle frame opacity
glx_blur_dst(ps, x, y, wid, hei, (float)ps->psglx->z - 0.5f, glx_blur_dst(ps, x, y, wid, hei, (float)ps->psglx->z - 0.5f,
(float)factor_center, reg_paint, &w->glx_blur_cache); (float)factor_center, reg_paint, &w->glx_blur_cache);
break; break;

View File

@ -37,13 +37,13 @@
#endif #endif
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
// TODO remove this include // TODO(yshui) Get rid of this include
#include "opengl.h" #include "opengl.h"
#endif #endif
#include "win.h" #include "win.h"
// TODO Make more window states internal // TODO(yshui) Make more window states internal
struct managed_win_internal { struct managed_win_internal {
struct managed_win base; struct managed_win base;
}; };
@ -901,7 +901,7 @@ void win_update_opacity_rule(session_t *ps, struct managed_win *w) {
/** /**
* Function to be called on window data changes. * Function to be called on window data changes.
* *
* TODO need better name * TODO(yshui) need better name
*/ */
void win_on_factor_change(session_t *ps, struct managed_win *w) { void win_on_factor_change(session_t *ps, struct managed_win *w) {
log_debug("Window %#010x (%s) factor change", w->base.id, w->name); log_debug("Window %#010x (%s) factor change", w->base.id, w->name);
@ -1734,12 +1734,12 @@ static void destroy_win_finish(session_t *ps, struct win *w) {
} }
// Invalidate reg_ignore of windows below this one // Invalidate reg_ignore of windows below this one
// TODO what if next_w is not mapped?? // TODO(yshui) what if next_w is not mapped??
// TODO seriously figure out how reg_ignore behaves. /* TODO(yshui) seriously figure out how reg_ignore behaves.
// I think if `w` is unmapped, and destroyed after * I think if `w` is unmapped, and destroyed after
// paint happened at least once, w->reg_ignore_valid would * paint happened at least once, w->reg_ignore_valid would
// be true, and there is no need to invalid w->next->reg_ignore * be true, and there is no need to invalid w->next->reg_ignore
// when w is destroyed. * when w is destroyed. */
if (next_w) { if (next_w) {
rc_region_unref(&next_w->reg_ignore); rc_region_unref(&next_w->reg_ignore);
next_w->reg_ignore_valid = false; next_w->reg_ignore_valid = false;
@ -1759,7 +1759,7 @@ static void destroy_win_finish(session_t *ps, struct win *w) {
// Drop w from all prev_trans to avoid accessing freed memory in // Drop w from all prev_trans to avoid accessing freed memory in
// repair_win() // repair_win()
// TODO there can only be one prev_trans pointing to w // TODO(yshui) there can only be one prev_trans pointing to w
win_stack_foreach_managed(w2, &ps->window_stack) { win_stack_foreach_managed(w2, &ps->window_stack) {
if (mw == w2->prev_trans) { if (mw == w2->prev_trans) {
w2->prev_trans = NULL; w2->prev_trans = NULL;
@ -2005,8 +2005,8 @@ bool win_skip_fading(session_t *ps, struct managed_win *w) {
* *
* Return an index >= 0, or -1 if not found. * Return an index >= 0, or -1 if not found.
* *
* TODO move to x.c * TODO(yshui) move to x.c
* TODO use xrandr * TODO(yshui) use xrandr
*/ */
void win_update_screen(session_t *ps, struct managed_win *w) { void win_update_screen(session_t *ps, struct managed_win *w) {
w->xinerama_scr = -1; w->xinerama_scr = -1;
@ -2108,7 +2108,7 @@ void map_win_start(session_t *ps, struct managed_win *w) {
log_debug("Window (%#010x) has type %s", w->base.id, WINTYPES[w->window_type]); log_debug("Window (%#010x) has type %s", w->base.id, WINTYPES[w->window_type]);
// TODO can we just replace calls below with win_on_factor_change? // TODO(yshui) can we just replace calls below with win_on_factor_change?
// Update window focus state // Update window focus state
win_update_focused(ps, w); win_update_focused(ps, w);
@ -2277,8 +2277,9 @@ struct managed_win *find_toplevel(session_t *ps, xcb_window_t id) {
* @return struct _win object of the found window, NULL if not found * @return struct _win object of the found window, NULL if not found
*/ */
struct managed_win *find_managed_window_or_parent(session_t *ps, xcb_window_t wid) { struct managed_win *find_managed_window_or_parent(session_t *ps, xcb_window_t wid) {
// TODO this should probably be an "update tree", then find_toplevel. // TODO(yshui) this should probably be an "update tree", then find_toplevel.
// current approach is a bit more "racy" // current approach is a bit more "racy", as the server state might be ahead of
// our state
struct win *w = NULL; struct win *w = NULL;
// We traverse through its ancestors to find out the frame // We traverse through its ancestors to find out the frame
@ -2314,7 +2315,7 @@ static inline bool rect_is_fullscreen(const session_t *ps, int x, int y, int wid
/** /**
* Check if a window is fulscreen using EWMH * Check if a window is fulscreen using EWMH
* *
* TODO cache this property * TODO(yshui) cache this property
*/ */
static inline bool static inline bool
win_is_fullscreen_xcb(xcb_connection_t *c, const struct atom *a, const xcb_window_t w) { win_is_fullscreen_xcb(xcb_connection_t *c, const struct atom *a, const xcb_window_t w) {
@ -2383,7 +2384,7 @@ bool win_is_fullscreen(const session_t *ps, const struct managed_win *w) {
/** /**
* Check if a window has BYPASS_COMPOSITOR property set * Check if a window has BYPASS_COMPOSITOR property set
* *
* TODO cache this property * TODO(yshui) cache this property
*/ */
bool win_is_bypassing_compositor(const session_t *ps, const struct managed_win *w) { bool win_is_bypassing_compositor(const session_t *ps, const struct managed_win *w) {
bool ret = false; bool ret = false;

View File

@ -99,7 +99,7 @@ struct managed_win {
struct managed_win *prev_trans; struct managed_win *prev_trans;
/// Number of windows above this window /// Number of windows above this window
int stacking_rank; int stacking_rank;
// TODO rethink reg_ignore // TODO(yshui) rethink reg_ignore
// Core members // Core members
/// The "mapped state" of this window, doesn't necessary /// The "mapped state" of this window, doesn't necessary

View File

@ -366,7 +366,7 @@ _x_strerror(unsigned long serial, uint8_t major, uint16_t minor, uint8_t error_c
#define CASESTRRET2(s) \ #define CASESTRRET2(s) \
case XCB_##s: name = #s; break case XCB_##s: name = #s; break
// TODO separate error code out from session_t // TODO(yshui) separate error code out from session_t
o = error_code - ps->xfixes_error; o = error_code - ps->xfixes_error;
switch (o) { CASESTRRET2(XFIXES_BAD_REGION); } switch (o) { CASESTRRET2(XFIXES_BAD_REGION); }