This part of the drawbar function is really confusing:

        if (m == selmon) { /* status is only drawn on selected monitor */       
           
                w = TEXTW(stext);
                x = m->ww - w;
                if (x < xx) {
                        x = xx;
                        w = m->ww - xx;
                }
                drw_text(drw, x, 0, w, bh, stext, 0);
        } else
                x = m->ww;

Why is it confusing? Because TEXTW is just an alias for drw_text:

        #define TEXTW(X)        (drw_text(drw, 0, 0, 0, 0, (X)) + 
drw->fonts[0]->h)

In other words, before calling drw_text (which needs to know the width of the 
thing to be drawn) on line 739, we call drw_text with no parameters on line 733 
to get the width of the thing to be drawn.

I think it would be better if another function was defined to get the width, 
and drw_text only had to draw the text. Then w could be a required parameter.

Then again, drw_font_getexts_width already exists and could be used for this 
purpose. But it overlaps the functionality provided by drw_font_getexts. Maybe 
drw_font_getexts should be used wherever pixel dimensions are required.

Thoughts? Should I just submit a patch?                                         
  

Reply via email to