You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: context menu on Ubuntu/x11 in the top left of the screen on 29.0.0-beta.3 #41143
Though the function does work in its invocations up until the moment we create a popup, so it may be that we need to change the order of our actions when creating a popup 🤔
Just leaving more breadcrumbs: I noticed there had been some followup changes to the upstream ui/gfx/ code so I tested out the gist Electron main -- expecting it to work, so that I could find the right commit to cherry-pick back to e29 -- but it's still broken in v30.0.0-nightly.20240207
One workaround is to pass in the same x, y that came from the context-menu props:
mainWindow.webContents.on('context-menu',(event,props)=>{const{ x, y }=props;consttemplate=[{label: 'Edit',},{label: 'Hello From Electron!'}]Menu.buildFromTemplate(template).popup({window: mainWindow, x, y });});
Every 0,0 that I'm seeing is coming from GetRootCursorLocationFromEvent() in ui/events/platform/x11/x11_event_source.cc returning 0,0 whenever it receives an x11::Input::CrossingEvent.
There are two different CrossingEvent classes: x11::Input::CrossingEvent and x11::CrossingEvent.
In ui/events/platform/x11/x11_event_source.cc , GetRootCursorLocationFromEvent() calls ui::EventSystemLocationFromXEvent() on an event if it's the former. But EventLocationFromXEvent() igores that type and looks for the latter.
IDK why there are two types but this mismatch is the root of the problem & it can be resolved by checking for x11::Input::CrossingEvent in EventTimeFromXEvent(). We can add a patches/chromium/ patch to fix this for e29 and submit a fix upstream.
Activity
Kilian commentedon Feb 1, 2024
Still present in beta.4 and beta.5 as well.
ckerr commentedon Feb 7, 2024
v29.0.0-beta.2...v29.0.0-beta.3
ckerr commentedon Feb 7, 2024
Haven't tracked down the root cause, but here's a breadcrumb:
In
MenuViews::PopupAt(),display::Screen::GetScreen()->GetCursorScreenPoint()is returning meaningful values in 29.0.0-beta.2, but0, 0in beta.3.ckerr commentedon Feb 7, 2024
X11ScreenOzone::GetCursorScreenPoint()is returning 0,0 (which it gets fromui::X11EventSource::GetInstance()->last_cursor_location()) after for us after https://chromium-review.googlesource.com/c/chromium/src/+/5214873 .Though the function does work in its invocations up until the moment we create a popup, so it may be that we need to change the order of our actions when creating a popup 🤔
ckerr commentedon Feb 7, 2024
Just leaving more breadcrumbs: I noticed there had been some followup changes to the upstream
ui/gfx/code so I tested out the gist Electronmain-- expecting it to work, so that I could find the right commit to cherry-pick back to e29 -- but it's still broken inv30.0.0-nightly.20240207ckerr commentedon Feb 8, 2024
One workaround is to pass in the same
x, ythat came from thecontext-menuprops:That avoids the broken lookup.
ckerr commentedon Feb 8, 2024
Every 0,0 that I'm seeing is coming from
GetRootCursorLocationFromEvent()inui/events/platform/x11/x11_event_source.ccreturning0,0whenever it receives anx11::Input::CrossingEvent.It gets the value from
EventSystemLocationFromXEvent()which returns root_x, root_y for CrossingEvents:And this seems pretty reasonable. https://tronche.com/gui/x/xlib/events/window-entry-exit/ describes those fields:
ckerr commentedon Feb 8, 2024
OK I found it. It's an upstream bug.
There are two different CrossingEvent classes:
x11::Input::CrossingEventandx11::CrossingEvent.In
ui/events/platform/x11/x11_event_source.cc,GetRootCursorLocationFromEvent()callsui::EventSystemLocationFromXEvent()on an event if it's the former. ButEventLocationFromXEvent()igores that type and looks for the latter.IDK why there are two types but this mismatch is the root of the problem & it can be resolved by checking for
x11::Input::CrossingEventinEventTimeFromXEvent(). We can add apatches/chromium/patch to fix this for e29 and submit a fix upstream.