Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Rofi displays as black box #2068

Closed
2 tasks done
sshaikh opened this issue Jan 2, 2025 · 36 comments
Closed
2 tasks done

[BUG] Rofi displays as black box #2068

sshaikh opened this issue Jan 2, 2025 · 36 comments
Labels
Milestone

Comments

@sshaikh
Copy link

sshaikh commented Jan 2, 2025

Rofi version (rofi -v)

1.7.6

Configuration

https://gist.github.com/sshaikh/b283cf77b7264e6672ad6709973488cc

Theme

https://gist.github.com/sshaikh/08c0431ac1e4fda665d25e2f3adf05b8

Timing report

https://gist.github.com/sshaikh/d90cb9a61fb5b42e4861d89946eff142

Launch command

rofi -show run

Step to reproduce

Just launch

Expected behavior

To see the rofi menu

Actual behavior

A black box the exact size of the rofi menu. This still functions (via keyboard or mouse), just that nothing can be seen.

Additional information

Rolling back to 1.7.5 fixes the issue. Running on Arch via XRDP - seems to work okay on a local box.

Using wayland display server protocol

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

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

  • Yes, I have checked the problem exists in the latest stable version
@sshaikh sshaikh added the bug label Jan 2, 2025
@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Jan 2, 2025

I not sure what change would impact xrdp or this part of the drawing? on arch normally it works fine.

Any more info on your Xrdp setup?

@sshaikh
Copy link
Author

sshaikh commented Jan 2, 2025

I agree - it was the only main difference that stood out between the working and non working setups so I thought I'd mention it.

But to answer your question: It's a headless virtual machine with no GPU (virtual or otherwise). I use xrdp (and xrdpxorg) to access it.

@DaveDavenport
Copy link
Collaborator

If I find time, I'll try to reproduce. Its a weird one, beside some font stuff no drawing code had sign. change.

@flipsi
Copy link

flipsi commented Jan 2, 2025

This might be a variant/symptom of my issue: #2069

@sshaikh
Copy link
Author

sshaikh commented Jan 2, 2025

I don't really have a config and running rofi -no-config has the same behaviour, but it could definitely be a theming issue.

If you could point me to using a a custom theme I can try to recreate your solution.

@DaveDavenport
Copy link
Collaborator

Yeah, they are not related.

@tamwile
Copy link

tamwile commented Jan 3, 2025

I have the same issue on Archlinux without using XRDP.

@DaveDavenport
Copy link
Collaborator

@tamwile can you give more info about your setup? I am on arch and everything is working fine here.
Can you also try with -no-config to see if it is configuration issue.

@tamwile
Copy link

tamwile commented Jan 3, 2025

I already downgraded to 1.7.5 just after writing my previous message and it's working fine.

If you still want my config it's quite similar to sshaikh i think.

rofi -dump-config

configuration {
/*	modes: "window,drun,run,ssh";*/
/*	font: "mono 12";*/
/*	location: 0;*/
/*	yoffset: 0;*/
/*	xoffset: 0;*/
/*	fixed-num-lines: true;*/
/*	show-icons: false;*/
/*	terminal: "rofi-sensible-terminal";*/
/*	ssh-client: "ssh";*/
/*	ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/
/*	run-command: "{cmd}";*/
/*	run-list-command: "";*/
/*	run-shell-command: "{terminal} -e {cmd}";*/
/*	window-command: "wmctrl -i -R {window}";*/
/*	window-match-fields: "all";*/
/*	icon-theme: ;*/
/*	drun-match-fields: "name,generic,exec,categories,keywords";*/
/*	drun-categories: ;*/
/*	drun-show-actions: false;*/
/*	drun-display-format: "{name} [<span weight='light' size='small'><i>({generic})</i></span>]";*/
/*	drun-url-launcher: "xdg-open";*/
/*	disable-history: false;*/
/*	ignored-prefixes: "";*/
/*	sort: false;*/
/*	sorting-method: "normal";*/
/*	case-sensitive: false;*/
/*	cycle: true;*/
/*	sidebar-mode: false;*/
/*	hover-select: false;*/
/*	eh: 1;*/
/*	auto-select: false;*/
/*	parse-hosts: false;*/
/*	parse-known-hosts: true;*/
/*	combi-modes: "window,run";*/
/*	matching: "normal";*/
/*	tokenize: true;*/
/*	m: "-5";*/
/*	filter: ;*/
/*	dpi: -1;*/
/*	threads: 0;*/
/*	scroll-method: 0;*/
/*	window-format: "{w}    {c}   {t}";*/
/*	click-to-exit: true;*/
/*	max-history-size: 25;*/
/*	combi-hide-mode-prefix: false;*/
/*	combi-display-format: "{mode} {text}";*/
/*	matching-negate-char: '-' /* unsupported */;*/
/*	cache-dir: ;*/
/*	window-thumbnail: false;*/
/*	drun-use-desktop-cache: false;*/
/*	drun-reload-desktop-cache: false;*/
/*	normalize-match: false;*/
/*	steal-focus: false;*/
/*	application-fallback-icon: ;*/
/*	refilter-timeout-limit: 8192;*/
/*	xserver-i300-workaround: false;*/
/*	pid: "/run/user/1000/rofi.pid";*/
/*	display-window: ;*/
/*	display-windowcd: ;*/
/*	display-run: ;*/
/*	display-ssh: ;*/
/*	display-drun: ;*/
/*	display-combi: ;*/
/*	display-keys: ;*/
/*	display-filebrowser: ;*/
/*	kb-primary-paste: "Control+V,Shift+Insert";*/
/*	kb-secondary-paste: "Control+v,Insert";*/
/*	kb-clear-line: "Control+w";*/
/*	kb-move-front: "Control+a";*/
/*	kb-move-end: "Control+e";*/
/*	kb-move-word-back: "Alt+b,Control+Left";*/
/*	kb-move-word-forward: "Alt+f,Control+Right";*/
/*	kb-move-char-back: "Left,Control+b";*/
/*	kb-move-char-forward: "Right,Control+f";*/
/*	kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/
/*	kb-remove-word-forward: "Control+Alt+d";*/
/*	kb-remove-char-forward: "Delete,Control+d";*/
/*	kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/
/*	kb-remove-to-eol: "Control+k";*/
/*	kb-remove-to-sol: "Control+u";*/
/*	kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/
/*	kb-accept-custom: "Control+Return";*/
/*	kb-accept-custom-alt: "Control+Shift+Return";*/
/*	kb-accept-alt: "Shift+Return";*/
/*	kb-delete-entry: "Shift+Delete";*/
/*	kb-mode-next: "Shift+Right,Control+Tab";*/
/*	kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/
/*	kb-mode-complete: "Control+l";*/
/*	kb-row-left: "Control+Page_Up";*/
/*	kb-row-right: "Control+Page_Down";*/
/*	kb-row-up: "Up,Control+p";*/
/*	kb-row-down: "Down,Control+n";*/
/*	kb-row-tab: "";*/
/*	kb-element-next: "Tab";*/
/*	kb-element-prev: "ISO_Left_Tab";*/
/*	kb-page-prev: "Page_Up";*/
/*	kb-page-next: "Page_Down";*/
/*	kb-row-first: "Home,KP_Home";*/
/*	kb-row-last: "End,KP_End";*/
/*	kb-row-select: "Control+space";*/
/*	kb-screenshot: "Alt+S";*/
/*	kb-ellipsize: "Alt+period";*/
/*	kb-toggle-case-sensitivity: "grave,dead_grave";*/
/*	kb-toggle-sort: "Alt+grave";*/
/*	kb-cancel: "Escape,Control+g,Control+bracketleft";*/
/*	kb-custom-1: "Alt+1";*/
/*	kb-custom-2: "Alt+2";*/
/*	kb-custom-3: "Alt+3";*/
/*	kb-custom-4: "Alt+4";*/
/*	kb-custom-5: "Alt+5";*/
/*	kb-custom-6: "Alt+6";*/
/*	kb-custom-7: "Alt+7";*/
/*	kb-custom-8: "Alt+8";*/
/*	kb-custom-9: "Alt+9";*/
/*	kb-custom-10: "Alt+0";*/
/*	kb-custom-11: "Alt+exclam";*/
/*	kb-custom-12: "Alt+at";*/
/*	kb-custom-13: "Alt+numbersign";*/
/*	kb-custom-14: "Alt+dollar";*/
/*	kb-custom-15: "Alt+percent";*/
/*	kb-custom-16: "Alt+dead_circumflex";*/
/*	kb-custom-17: "Alt+ampersand";*/
/*	kb-custom-18: "Alt+asterisk";*/
/*	kb-custom-19: "Alt+parenleft";*/
/*	kb-select-1: "Super+1";*/
/*	kb-select-2: "Super+2";*/
/*	kb-select-3: "Super+3";*/
/*	kb-select-4: "Super+4";*/
/*	kb-select-5: "Super+5";*/
/*	kb-select-6: "Super+6";*/
/*	kb-select-7: "Super+7";*/
/*	kb-select-8: "Super+8";*/
/*	kb-select-9: "Super+9";*/
/*	kb-select-10: "Super+0";*/
/*	ml-row-left: "ScrollLeft";*/
/*	ml-row-right: "ScrollRight";*/
/*	ml-row-up: "ScrollUp";*/
/*	ml-row-down: "ScrollDown";*/
/*	me-select-entry: "MousePrimary";*/
/*	me-accept-entry: "MouseDPrimary";*/
/*	me-accept-custom: "Control+MouseDPrimary";*/
  timeout {
      action: "kb-cancel";
      delay:  0;
  }
  filebrowser {
      directories-first: true;
      sorting-method:    "name";
  }
}

rofi -dump-theme

/**
 * rofi -dump-theme output.
 * Rofi version: 1.7.5
 **/
* {
    red:                         rgba ( 220, 50, 47, 100 % );
    selected-active-foreground:  rgba ( 2, 20, 63, 100 % );
    lightfg:                     rgba ( 88, 104, 117, 100 % );
    separatorcolor:              rgba ( 219, 223, 188, 100 % );
    urgent-foreground:           rgba ( 255, 129, 255, 100 % );
    alternate-urgent-background: transparent;
    lightbg:                     rgba ( 238, 232, 213, 100 % );
    background-color:            transparent;
    border-color:                var(foreground);
    normal-background:           transparent;
    bordercolor:                 rgba ( 219, 223, 188, 100 % );
    alternate-active-background: transparent;
    active-foreground:           rgba ( 138, 196, 255, 100 % );
    blue:                        rgba ( 38, 139, 210, 100 % );
    alternate-normal-foreground: var(foreground);
    urgent-background:           transparent;
    selected-normal-foreground:  rgba ( 2, 20, 63, 100 % );
    selected-active-background:  rgba ( 138, 196, 255, 100 % );
    background:                  rgba ( 0, 0, 33, 87 % );
    selected-urgent-background:  rgba ( 255, 129, 127, 100 % );
    active-background:           transparent;
    alternate-active-foreground: var(active-foreground);
    alternate-normal-background: transparent;
    foreground:                  rgba ( 219, 223, 188, 100 % );
    alternate-urgent-foreground: var(urgent-foreground);
    selected-urgent-foreground:  rgba ( 2, 20, 63, 100 % );
    spacing:                     2;
    normal-foreground:           var(foreground);
    selected-normal-background:  rgba ( 219, 223, 188, 100 % );
}
window {
    padding:          5;
    background-color: var(background);
    border:           1;
}
mainbox {
    padding: 0;
    border:  0;
}
message {
    padding:      1px ;
    border-color: var(separatorcolor);
    border:       2px 0px 0px ;
}
textbox {
    text-color: var(foreground);
}
listview {
    padding:      2px 0px 0px ;
    scrollbar:    true;
    border-color: var(separatorcolor);
    spacing:      2px ;
    fixed-height: 0;
    border:       2px 0px 0px ;
}
element {
    padding: 1px ;
    border:  0;
}
element normal.normal {
    background-color: var(normal-background);
    text-color:       var(normal-foreground);
}
element normal.urgent {
    background-color: var(urgent-background);
    text-color:       var(urgent-foreground);
}
element normal.active {
    background-color: var(active-background);
    text-color:       var(active-foreground);
}
element selected.normal {
    background-color: var(selected-normal-background);
    text-color:       var(selected-normal-foreground);
}
element selected.urgent {
    background-color: var(selected-urgent-background);
    text-color:       var(selected-urgent-foreground);
}
element selected.active {
    background-color: var(selected-active-background);
    text-color:       var(selected-active-foreground);
}
element alternate.normal {
    background-color: var(alternate-normal-background);
    text-color:       var(alternate-normal-foreground);
}
element alternate.urgent {
    background-color: var(alternate-urgent-background);
    text-color:       var(alternate-urgent-foreground);
}
element alternate.active {
    background-color: var(alternate-active-background);
    text-color:       var(alternate-active-foreground);
}
element-text {
    background-color: inherit;
    text-color:       inherit;
}
scrollbar {
    width:        4px ;
    padding:      0;
    handle-width: 8px ;
    border:       0;
}
mode-switcher {
    border-color: var(separatorcolor);
    border:       2px 0px 0px ;
}
button {
    spacing:    0;
    text-color: var(normal-foreground);
}
button selected {
    background-color: var(selected-normal-background);
    text-color:       var(selected-normal-foreground);
}
inputbar {
    padding:    1px ;
    spacing:    0;
    text-color: var(normal-foreground);
    children:   [ "prompt","textbox-prompt-colon","entry","case-indicator" ];
}
case-indicator {
    spacing:    0;
    text-color: var(normal-foreground);
}
entry {
    spacing:    0;
    text-color: var(normal-foreground);
}
prompt {
    spacing:    0;
    text-color: var(normal-foreground);
}
textbox-prompt-colon {
    margin:     0px 0.3000em 0.0000em 0.0000em ;
    expand:     false;
    str:        ":";
    text-color: var(normal-foreground);
}

GPU is an old Nvidia

EDIT: i did try rofi -no-config before downgrading, still a black box, that's why i said i had the same issue as OP.

@DaveDavenport
Copy link
Collaborator

What is your Desktop environment?

For information, I am on AMD.

@tamwile
Copy link

tamwile commented Jan 3, 2025

stumpwm

@DaveDavenport
Copy link
Collaborator

never heard of it. lets try it

@tamwile
Copy link

tamwile commented Jan 3, 2025

@DaveDavenport
Copy link
Collaborator

Can anybody hitting this can try to make a screenshot from within rofi (alt+shift+s) and see if the screenshot shows up fine or is also black? that might give a hint.

@tamwile
Copy link

tamwile commented Jan 3, 2025

Where is saved the screenshot after alt+shift+s by default ?

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Jan 3, 2025

in the XDG picture folder.. normally ~/Pictures/

its also printed out where its stored if launched from terminal.

@tamwile
Copy link

tamwile commented Jan 3, 2025

Ok, the png image is not a black screen for me.

@DaveDavenport
Copy link
Collaborator

Interesting, so its the mapping of the cairo surface to the screen.

@DaveDavenport
Copy link
Collaborator

hmm a lot of that code has not been touched in 4 years. . .Wish I could reproduce so I could find the commit that broke it.

@tamwile
Copy link

tamwile commented Jan 3, 2025

Some code path was not hit in the past but now it is ? Is that what you think ?

@DaveDavenport
Copy link
Collaborator

Not thinking anything atm. As I am pretty confused.. (why is it failing for some and not all, and something so 'basic' )

@DaveDavenport
Copy link
Collaborator

Can you try rofi -normal-window -show run .. does that behave differently?

@tamwile
Copy link

tamwile commented Jan 3, 2025

stumpwm is a tiling window manager so the normal window is taking all the screen space.
But it's still black. (and i can launch commands by typing blindly).

@DaveDavenport
Copy link
Collaborator

Thanks. Creating a vm now, so I can do some testing.. hopefully I can reproduce.

@DaveDavenport
Copy link
Collaborator

Works fine in WM.. fun.

@DaveDavenport
Copy link
Collaborator

remmina_192 168 122 98_192 168 122 98_20250103-173908

xorgrdp also works fine for me..

@sshaikh
Copy link
Author

sshaikh commented Jan 3, 2025

A saved screenshot also displays correctly for me. And rofi -normal-window -show run also resulted in a black window.

I'm guessing @tamwile and I have some config or software installed in common.

FWIW I don't seem to have XDG setup correctly if at all and had to use ROFI_PNG_OUTPUT. Just in case that's a data point.

My theme also looks different to yours (even though my config is empty).

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Jan 3, 2025

yeah, I used the default theme of the distro I installed to test another bug :D.

The fact screenshot works, suggests it is in the cairo_xcb surface something goes wrong, but this code has not be changed a lot (in > 4 years).. Or it has to do that I only paint the window in idle time and no idle time get scheduled, but I never seen this be an issue before...

@DaveDavenport
Copy link
Collaborator

Can you run:

 G_MESSAGES_DEBUG=View rofi -show run

on a terminal, and check if you see 'redraw, expose event and Redraw view' messages?

@tamwile
Copy link

tamwile commented Jan 3, 2025

$ G_MESSAGES_DEBUG=View ./build/rofi -show run
(process:66407): View-DEBUG: 20:53:20.330: Re-size window based internal request: 960x430.
(process:66407): View-DEBUG: 20:53:20.331: Redraw view
(process:66407): View-DEBUG: 20:53:20.335: redraw 1
(process:66407): View-DEBUG: 20:53:20.335: Redraw view
(process:66407): View-DEBUG: 20:53:20.335: expose event
(process:66407): View-DEBUG: 20:53:20.336: redraw 2
(process:66407): View-DEBUG: 20:53:20.336: expose event
(process:66407): View-DEBUG: 20:53:21.531: redraw 3
(process:66407): View-DEBUG: 20:53:21.531: Redraw view
(process:66407): View-DEBUG: 20:53:21.532: expose event
(process:66407): View-DEBUG: 20:53:22.733: redraw 4
(process:66407): View-DEBUG: 20:53:22.733: Redraw view
(process:66407): View-DEBUG: 20:53:22.733: expose event
(process:66407): View-DEBUG: 20:53:23.935: Redraw view
(process:66407): View-DEBUG: 20:53:23.941: redraw 5
(process:66407): View-DEBUG: 20:53:23.941: expose event
(process:66407): View-DEBUG: 20:53:23.999: Redraw view
(process:66407): View-DEBUG: 20:53:24.001: redraw 6
(process:66407): View-DEBUG: 20:53:24.001: expose event
(process:66407): View-DEBUG: 20:53:24.116: Redraw view
(process:66407): View-DEBUG: 20:53:24.117: redraw 7
(process:66407): View-DEBUG: 20:53:24.117: expose event
(process:66407): View-DEBUG: 20:53:24.332: Redraw view
(process:66407): View-DEBUG: 20:53:24.333: redraw 8
(process:66407): View-DEBUG: 20:53:24.333: expose event
(process:66407): View-DEBUG: 20:53:24.589: Cleanup.
(process:66407): View-DEBUG: 20:53:24.589: Unmapping and free'ing window

I don't know if when you said 'redraw, expose event and Redraw view' it is supposed to be in that order exactly but in my case this is more like 'Redraw view, Redraw, expose event'.

@DaveDavenport
Copy link
Collaborator

order does not matter.. Thanks, so the idle call is not the issue.

@DaveDavenport
Copy link
Collaborator

Somebody did a bisect and found 45688b0 to be the issue.
I am unsure why this broke it (and not for everybody?)

Can somebody with this issue test this patch?

diff --git a/source/widgets/widget.c b/source/widgets/widget.c
index 54f8c955..35c574b8 100644
--- a/source/widgets/widget.c
+++ b/source/widgets/widget.c
@@ -252,7 +252,8 @@ void widget_draw(widget *wid, cairo_t *d) {
     if (left != 0 || top != 0 || right != 0 || bottom != 0) {
       // NOTE: Cairo group push/pop has same effect as cairo_save/cairo_restore,
       // thus no need for these.
-      cairo_push_group(d);
+      // cairo_push_group(d);
+      cairo_save(d);
       cairo_set_operator(d, CAIRO_OPERATOR_ADD);
       cairo_translate(d, wid->x, wid->y);
       cairo_new_path(d);
@@ -409,8 +410,9 @@ void widget_draw(widget *wid, cairo_t *d) {

         cairo_fill(d);
       }
-      cairo_pop_group_to_source(d);
-      cairo_paint(d);
+      //      cairo_pop_group_to_source(d);
+      //      cairo_paint(d);
+      cairo_restore(d);
     }
   }
 } 

@DaveDavenport
Copy link
Collaborator

bisect thanks to Zluglu

DaveDavenport added a commit that referenced this issue Jan 3, 2025
Seems to happen on nvidia systems, rendering to PNG surface is fine,
problem is with rendering to screen.
Hopefully this patch fixes it.

Issue: #2068
@DaveDavenport DaveDavenport added this to the 1.7.7 milestone Jan 3, 2025
@DaveDavenport
Copy link
Collaborator

Should be fixed in git.. please let me know if it does not work.

@tamwile
Copy link

tamwile commented Jan 3, 2025

I confirm this is working.
Thank you to Zluglu.

@sshaikh
Copy link
Author

sshaikh commented Jan 3, 2025

Fixed for me also. Many thanks to everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants