GNOME Bugzilla – Bug 775964
Incorrect position of tasks inside lists view, in HIDPI devices.
Last modified: 2017-03-02 12:01:23 UTC
Created attachment 341786 [details] gnome-todo screenshot of the problem. In HIDPI devices like Retina Macbook Pro 15, when yo create a list with no tasks. The label "No tasks" doesn't appear in center, appears outside of the list. Also the "...", when it exists a lot of tasks, appears in the middle and not in the bottom.
Created attachment 341787 [details] [review] Put in center "No tasks" label in HIDPI devices. In line 88 of src/views/gtd-list-selector-grid-item.c THUMBNAIL_SIZE it's multiplied by scale_factor and asigned to width variable. "width = THUMBNAIL_SIZE * scale_factor;" Also in line 144 of src/views/gtd-list-selector-grid-item.c to set width of the layaout, the width it's another time multiplyied by the scale_factor. "pango_layout_set_width (layout, (width - margin.left - margin.right) * PANGO_SCALE * scale_factor)" The problem it's that, in HDIPI devices where the scale factor has the value of 2,the width of the pango layaout it's increased by factor of 2. So when the instruction "pango_layaout_set_aligment(layout, PANGO_ALIGN_CENTER)" it's executed, center the label "No tasks" in this new width, so it doesn't appears correctly, it's appear outside of the GTKImage widget. Also in the line 198 of the same file above described. The instruction: "if (y + font_height + 4 + margin.bottom + padding.bottom > THUMBNAIL_SIZE)" Doesn't take account of devices with scale-factor of 2, so draws "..." in the midle of the GTKImage and not in the bottom. To fix this, simply delete the multiply by scale_factor when we are setting the pango layout, and add to the if condition a product of THUMBNAIL_SIZE and scale_factor. This changes doesn't affects in non HIDPI devices, because the scale_factor have a value of 1, so the behaviour of the app is correct.
Review of attachment 341787 [details] [review]: The code looks good, and the commit message is, simply put, perfect :) Could you please rebase this patch against master? It doesn't apply on top of master right now. I'll mark it as needs-work until there.
Created attachment 347007 [details] [review] Patch to the bug (In reply to Georges Basile Stavracas Neto from comment #2) > Review of attachment 341787 [details] [review] [review]: > > The code looks good, and the commit message is, simply put, perfect :) > > Could you please rebase this patch against master? It doesn't apply on top > of master right now. I'll mark it as needs-work until there. I sent the old patch with my old account, so I can't mark it as obsolete.
Thanks for the patch!