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

Focus doesn't return after running dmenu (X11/i3) #3710

Closed
Deewiant opened this issue May 10, 2020 · 7 comments
Closed

Focus doesn't return after running dmenu (X11/i3) #3710

Deewiant opened this issue May 10, 2020 · 7 comments

Comments

@Deewiant
Copy link

Noticed while testing #3709: Running dmenu from within Alacritty doesn't return focus correctly. That is, Alacritty does have keyboard focus after dmenu exits, but it thinks it doesn't (renders a hollow cursor).

System

alacritty --version: alacritty 0.4.2, but reproduces also on alacritty 0.5.0-dev (2c2104a) (current master)
dmenu -v: dmenu-4.9
Platform: Arch Linux, X11, i3

Logs

From alacritty --persistent-logging --print-events -e sh -c "echo foo | dmenu; sleep 2" on 0.4.2:

[2020-05-10 14:52:17.563849422] [INFO] Welcome to Alacritty
[2020-05-10 14:52:17.563886471] [INFO] Configuration loaded from "/home/deewiant/.config/alacritty/alacritty.yml"
[2020-05-10 14:52:17.637146123] [INFO] Device pixel ratio: 1.1666666666666667
[2020-05-10 14:52:17.640714989] [INFO] Initializing glyph cache...
[2020-05-10 14:52:17.698843053] [INFO] ... finished initializing glyph cache in 0.058108495s
[2020-05-10 14:52:17.698869212] [INFO] Cell Size: 10 x 20
[2020-05-10 14:52:17.698873862] [INFO] Padding: 0 x 0
[2020-05-10 14:52:17.698883172] [INFO] Width: 800, Height: 600
[2020-05-10 14:52:17.704596765] [INFO] PTY Dimensions: Line(30) x Column(80)
[2020-05-10 14:52:17.708734484] [INFO] Initialisation complete
[2020-05-10 14:52:17.708756004] [INFO] glutin event: NewEvents(Init)
[2020-05-10 14:52:17.709283708] [INFO] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(10))), event: Key(KeyboardInput { scancode: 28, state: Released, virtual_keycode: Some(Return), modifiers: (empty) }) }
[2020-05-10 14:52:17.709528441] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: Resized(PhysicalSize { width: 2556, height: 1202 }) }
[2020-05-10 14:52:17.709590219] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: CursorEntered { device_id: DeviceId(X(DeviceId(2))) } }
[2020-05-10 14:52:17.709606779] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: PhysicalPosition { x: 635.0, y: 433.0 }, modifiers: (empty) } }
[2020-05-10 14:52:17.709616059] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: Moved(PhysicalPosition { x: 0, y: 37 }) }
[2020-05-10 14:52:17.709656777] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: Focused(true) }
[2020-05-10 14:52:17.709662997] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: PhysicalPosition { x: 635.0, y: 433.0 }, modifiers: (empty) } }
[2020-05-10 14:52:17.709680527] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:17.709686397] [INFO] glutin event: RedrawRequested(WindowId(X(WindowId(100663300))))
[2020-05-10 14:52:17.709691046] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:17.710515272] [INFO] Width: 2556, Height: 1202
[2020-05-10 14:52:17.720180420] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14578, tv_nsec: 342211064 }, requested_resume: None })
[2020-05-10 14:52:17.720199350] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:17.720204519] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:17.724705368] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14578, tv_nsec: 345706491 }, requested_resume: None })
[2020-05-10 14:52:17.725011829] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: ModifiersChanged((empty)) }
[2020-05-10 14:52:17.725027699] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: Focused(false) }
[2020-05-10 14:52:17.725253852] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:17.725262942] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:17.726579624] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14578, tv_nsec: 351075545 }, requested_resume: None })
[2020-05-10 14:52:17.726743629] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:17.726751748] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:17.728486568] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14578, tv_nsec: 352254090 }, requested_resume: None })
[2020-05-10 14:52:17.728497237] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:17.728502107] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:18.746497442] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14578, tv_nsec: 354003809 }, requested_resume: None })
[2020-05-10 14:52:18.746549551] [INFO] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(10))), event: Key(KeyboardInput { scancode: 28, state: Pressed, virtual_keycode: Some(Return), modifiers: (empty) }) }
[2020-05-10 14:52:18.746560310] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:18.746563860] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:18.748478345] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14579, tv_nsec: 372065082 }, requested_resume: None })
[2020-05-10 14:52:18.748896833] [INFO] glutin event: UserEvent(Wakeup)
[2020-05-10 14:52:18.748908952] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:18.748913532] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:18.749260152] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14579, tv_nsec: 374756434 }, requested_resume: None })
[2020-05-10 14:52:18.749269482] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:18.749272252] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:18.754751352] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14579, tv_nsec: 374772314 }, requested_resume: None })
[2020-05-10 14:52:18.754769641] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:18.754774101] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:18.810399727] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14579, tv_nsec: 380274833 }, requested_resume: None })
[2020-05-10 14:52:18.810419607] [INFO] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(10))), event: Key(KeyboardInput { scancode: 28, state: Released, virtual_keycode: Some(Return), modifiers: (empty) }) }
[2020-05-10 14:52:18.810560823] [INFO] glutin event: WindowEvent { window_id: WindowId(X(WindowId(100663300))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 28, state: Released, virtual_keycode: Some(Return), modifiers: (empty) }, is_synthetic: false } }
[2020-05-10 14:52:18.810571552] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:18.810574832] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:20.749886306] [INFO] glutin event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14579, tv_nsec: 436075744 }, requested_resume: None })
[2020-05-10 14:52:20.749925235] [INFO] glutin event: UserEvent(Exit)
[2020-05-10 14:52:20.749929804] [INFO] glutin event: UserEvent(Wakeup)
[2020-05-10 14:52:20.749933064] [INFO] glutin event: MainEventsCleared
[2020-05-10 14:52:20.749936324] [INFO] glutin event: RedrawEventsCleared
[2020-05-10 14:52:20.750229026] [INFO] glutin event: LoopDestroyed
[2020-05-10 14:52:20.760732849] [INFO] Goodbye

Here I waited about a second before pressing enter on dmenu, causing it to print "foo" to stdout and exit. At that point Alacritty should receive focus, but doesn't. Seems that glutin is not sending Focused(true) for some reason.

This doesn't seem to happen with other programs than dmenu, so I guess it's something special to do with the way dmenu draws on top of other windows. However it also happens only with Alacritty and not (at least) xterm or st.

@kchibisov
Copy link
Member

kchibisov commented May 10, 2020

nice, that's the other issue I've seen on X11 somewhere in alacritty, but I was never able to repro it and gather logs myself, since I'm not using X11, thx for reporting.

@kchibisov
Copy link
Member

upstream issue rust-windowing/winit#1565

@mbaz
Copy link

mbaz commented May 10, 2020

I'm not sure I can reproduce (Arch Linux, x11, openbox, alacritty 0.4.2). When I press enter, I see foo and a full (not hollow) cursor on the next line.

@kchibisov
Copy link
Member

It's pretty random to repro it IIRC, like it could happen sometimes.

@nemya9066
Copy link

can confirm this bug I would like to add that this cause copy/paste to no longer work within alacritty.
it's also not random for me It happen every time I run dmenu(on bspwm x11)

@mahkoh
Copy link
Contributor

mahkoh commented Dec 2, 2021

I believe this was caused by a bug in dmenu 4.9 and has been fixed for a long time now.

@chrisduerr
Copy link
Member

I believe this was caused by a bug in dmenu 4.9 and has been fixed for a long time now.

Thanks for letting me know. Closing. If someone can still reproduce, let me know.

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

No branches or pull requests

7 participants
@Deewiant @mbaz @mahkoh @chrisduerr @kchibisov @nemya9066 and others