rofi icon indicating copy to clipboard operation
rofi copied to clipboard

[BUG] Weird visual glitch when using the emoji plugin

Open madprops opened this issue 1 year ago • 9 comments

Rofi version (rofi -v)

Version: 1.7.5

Configuration

https://gist.github.com/madprops/fb40662a5eb644dcfcd931b14ba5e8ab

Theme

https://gist.github.com/madprops/3ab74683add2faebfbb44a411a35722d

Timing report

No response

Launch command

rofi -modi emoji -show emoji

Step to reproduce

Search for skull

skullemoji

As you can see below the first item, the second item looks weird.

Is that a rofi bug?

Expected behavior

No glitch.

Actual behavior

Glitch.

Additional information

I'm using the emoji plugin.

Which I think is this one: https://archlinux.org/packages/extra/x86_64/rofi-emoji/

Using wayland display server protocol

  • [X] No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • [X] Yes, I have checked the problem exists in the latest stable version

madprops avatar Oct 03 '24 11:10 madprops

This is kinda a rofi bug.. rofi determines the size of a row in the listview based by creating a row and getting the size of the widget.. This is computed based on the pixel extend pango returns for a small string ("aAjb") this is then saved so it can pre-compute everything. This is for speed reasons.

If fonts has, mostly with icons, suddenly a glyph that is bigger then expected, this happens. Last time I looked (years ago) there was not a quick way to find the largest glyph in available.

DaveDavenport avatar Oct 03 '24 11:10 DaveDavenport

Pushed possible fix, if this does not fix it, I am not sure if it is easily fixable in rofi.

DaveDavenport avatar Oct 03 '24 15:10 DaveDavenport

I build it with commit 186b0e7b. when I run rofi -show drun, it receive a segmentation fault. gdb.log build command

autoreconf -i
./configure --prefix=/usr --sysconfdir=/etc --enable-imdkit
make

xsy420 avatar Oct 17 '24 14:10 xsy420

Thanks for testing and the trace.

DaveDavenport avatar Oct 17 '24 20:10 DaveDavenport

To bad I am missing entries from the trace that crashes. I don't really see how we can get this crash, with the newly added code (unless its an issue in pango). Hope I can reproduce.

DaveDavenport avatar Oct 17 '24 20:10 DaveDavenport

What distro are you using?

DaveDavenport avatar Oct 17 '24 20:10 DaveDavenport

I'm using Arch Linux

xsy420 avatar Oct 17 '24 22:10 xsy420

well, it's because variable name redefined. at line 129 in textbox.c:

  const char *font = rofi_theme_get_string(WIDGET(tb), "font", NULL);

but at line 147

 PangoFont *font = pango_context_load_font(p_context, tbfc->pfd);

I tried rename to pfont it works (no segmentation fault at least)

        PangoFont *pfont = pango_context_load_font(p_context, tbfc->pfd);
        if (pfont) {
          PangoFontMetrics *fm = pango_font_get_metrics(pfont, NULL);
          if (fm) {
            int h = pango_font_metrics_get_height(fm) / PANGO_SCALE;
            if (h > 0) {
              tbfc->height = h;
            }
            pango_font_metrics_unref(fm);
          }
          g_object_unref(pfont);
        }

xsy420 avatar Oct 18 '24 07:10 xsy420

aah stupid error by me, Thanks!

(/me goes to add -Wshadow to compile flags)

DaveDavenport avatar Oct 18 '24 20:10 DaveDavenport

Any update if the commit fixes the reported glitch ?

DaveDavenport avatar Dec 25 '24 18:12 DaveDavenport

Arch is still packaging an older version I think 1.7.5-3 - The glitch on the emoji picker is still present.

madprops avatar Dec 25 '24 21:12 madprops

rofi-2024-12-25-2221-00000

It seems not to fix it..

DaveDavenport avatar Dec 25 '24 21:12 DaveDavenport

Debugging further, the FontMetrics used by rofi to find the size, return that the distance between baselines is 22 px.. while that icon is 24 pixels high..

The bounding box for ☠ is 49. If I use that for every row it also is very odd..

DaveDavenport avatar Dec 25 '24 21:12 DaveDavenport

rofi-2024-12-25-2245-00000

You can see only the ☠ is normal... I think there is not an easy fix for this.

DaveDavenport avatar Dec 25 '24 21:12 DaveDavenport

Gave it some more thought.. I am closing this issue, I am pretty sure there is very little I can do about this beside having dynamic row height. I want to avoid this as it makes the logic in rofi more difficult and might slow it down (I need to implement this at some point to see what the impact is).

DaveDavenport avatar Dec 26 '24 13:12 DaveDavenport

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jan 27 '25 00:01 github-actions[bot]