After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775964 - Incorrect position of tasks inside lists view, in HIDPI devices.
Incorrect position of tasks inside lists view, in HIDPI devices.
Status: RESOLVED FIXED
Product: gnome-todo
Classification: Other
Component: User Interface
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME To Do maintainer(s)
GNOME To Do maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-12-11 23:20 UTC by Kevin Lopez
Modified: 2017-03-02 12:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-todo screenshot of the problem. (64.90 KB, image/png)
2016-12-11 23:20 UTC, Kevin Lopez
  Details
Put in center "No tasks" label in HIDPI devices. (2.92 KB, patch)
2016-12-11 23:27 UTC, Kevin Lopez
needs-work Details | Review
Patch to the bug (2.77 KB, patch)
2017-03-01 22:27 UTC, Kevin Lopez
committed Details | Review

Description Kevin Lopez 2016-12-11 23:20:03 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.
Comment 1 Kevin Lopez 2016-12-11 23:27:20 UTC
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.
Comment 2 Georges Basile Stavracas Neto 2017-03-01 21:30:16 UTC
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.
Comment 3 Kevin Lopez 2017-03-01 22:27:17 UTC
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.
Comment 4 Georges Basile Stavracas Neto 2017-03-02 12:01:15 UTC
Thanks for the patch!