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

exwm-xim issues #29

Open
rayslava opened this issue Mar 28, 2024 · 6 comments
Open

exwm-xim issues #29

rayslava opened this issue Mar 28, 2024 · 6 comments

Comments

@rayslava
Copy link

I can't figure out what's wrong with exwm-xim: after enabling it doesn't work at all in qt apps, and causes random freezes on key press in GTK apps, I tried to collect a trace after pressing a key:

        9210  70% - xcb:-connection-filter
        9208  70%  - xcb:-process-events
        9208  70%   - apply
        9205  70%    - #<compiled -0x5404a03a9d5b3a3>
        9151  69%     - exwm-xim--on-ClientMessage
        6421  49%      - exwm-xim--on-request
        6036  46%       - exwm-xim--handle-forward-event-request
        4774  36%        - exwm-xim--make-request
        2298  17%         - exwm--intern-atom
        1727  13%          - xcb:-+reply
        1727  13%           - apply
        1711  13%            - #<compiled 0x19a7cc8d7ca81a95>
         513   3%             - xcb:-process-events
         511   3%              - apply
         495   3%               - #<compiled -0x5404a03a9d5b3a3>
         348   2%                + exwm--on-PropertyNotify
          45   0%                + slot-value
          21   0%                + eieio-oset
          18   0%                + #<compiled 0x1bfc343501b5b7d7>
           1   0%                + exwm-input--on-KeyPress
         219   1%             + accept-process-output
         214   1%             + xcb:flush
         202   1%             + xcb:unmarshal
          68   0%             + slot-value
          56   0%             + make-instance
          47   0%             + run-with-timer
          43   0%             + eieio-oref
          34   0%             + #<compiled 0x1bfc343501746c97>
           9   0%             + eieio-oset
           5   0%             + #<compiled 0x1e1cf2ecdf0e9d2>
         469   3%          + xcb:-+request-unchecked
          88   0%          + make-instance
           7   0%          + slot-value
        1136   8%         + xcb:-+request
         881   6%         + xcb:marshal
         443   3%         + make-instance
         527   4%        + xcb:unmarshal
         216   1%        + xcb:keysyms:keycode->keysym
         211   1%        + make-instance
         145   1%        + xcb:flush
         108   0%        + slot-value
          14   0%        + eieio-oset
           7   0%        + xcb:keysyms:keysym->event
         285   2%       + xcb:unmarshal
          64   0%       + make-instance
        1305   9%      + xcb:-+reply
         721   5%      + xcb:unmarshal
         391   2%      + xcb:-+request-unchecked
         203   1%      + make-instance
          87   0%      + slot-value
          21   0%     + slot-value
          11   0%     + eieio-oset
           8   0%     + exwm--on-PropertyNotify
           3   0%     + exwm-input--on-ButtonPress
           1   0%     + exwm-randr--on-ConfigureNotify
           1   0%       exwm--on-ClientMessage
           2   0%  + eieio-oset

So emacs freezes for several seconds after any key pressed, though the right character is printed in the end.
As for qt apps - input method just doesn't affect them.
Where should I look for the root cause?

@rayslava
Copy link
Author

Also, I recorded a log of the process:

[00:11:26]exwm-input--on-buffer-list-update:	current-buffer=#<buffer Navigator:Mozilla Firefox> selected-window=#<window 12 on Navigator:Mozilla Firefox>
[00:11:26]exwm-layout--refresh:	frame=#<frame Navigator:Mozilla Firefox 0x559c50375150>
[00:11:26]exwm-layout--refresh-workspace:	Refresh workspace #<frame Navigator:Mozilla Firefox 0x559c50375150>
[00:11:26]exwm-layout--show:	Show #x2a0002c in #<window 12 on Navigator:Mozilla Firefox>
[00:11:26]exwm--set-geometry:	Setting #x2a0002c to 1720x1398+2560+0
[00:11:26]exwm-layout--set-state:	id=#x2a0002c
[00:11:26]exwm-layout--set-client-list-stacking:	
[00:11:26]exwm-layout--refresh:	frame=#<frame Navigator:Mozilla Firefox 0x559c50375150>
[00:11:26]exwm-layout--refresh-workspace:	Refresh workspace #<frame Navigator:Mozilla Firefox 0x559c50375150>
[00:11:26]exwm-layout--show:	Show #x2a0002c in #<window 12 on Navigator:Mozilla Firefox>
[00:11:26]exwm--set-geometry:	Setting #x2a0002c to 1720x1398+2560+0
[00:11:26]exwm-layout--set-state:	id=#x2a0002c
[00:11:26]exwm-layout--set-client-list-stacking:	
[00:11:26]exwm-input--update-focus:	focus-window=#<window 12 on Navigator:Mozilla Firefox> focus-buffer=Navigator:Mozilla Firefox
[00:11:26]exwm-input--update-focus:	Set focus on #x2a0002c
[00:11:26]exwm-randr--on-ConfigureNotify:	
[00:11:26]exwm--on-PropertyNotify:	atom=WM_STATE(391)
[00:11:26]exwm--on-PropertyNotify:	Unhandled: WM_STATE(391)
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:26]exwm--on-PropertyNotify:	atom=_NET_WM_STATE(344)
[00:11:26]exwm--on-PropertyNotify:	Unhandled: _NET_WM_STATE(344)
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:26]exwm--on-PropertyNotify:	atom=WM_STATE(391)
[00:11:26]exwm--on-PropertyNotify:	Unhandled: WM_STATE(391)
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:26]exwm--on-PropertyNotify:	atom=_NET_WM_STATE(344)
[00:11:26]exwm--on-PropertyNotify:	Unhandled: _NET_WM_STATE(344)
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:26]exwm-input--set-focus:	#x1a00018 (corrected) => #x2a0002c
[00:11:26]exwm-input--update-timestamp:	
[00:11:26]exwm--on-PropertyNotify:	atom=_TIME(563)
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:26]exwm-input--set-active-window:	
[00:11:26]exwm-xim--on-ClientMessage:	
[00:11:26]exwm-xim--on-request:	
[00:11:26]exwm-xim--on-request:	SET-IC-FOCUS
[00:11:26]exwm--on-PropertyNotify:	atom=WM_HINTS(35)
[00:11:26]exwm--update-hints:	#x2a0002c
[00:11:26]exwm-input--on-PropertyNotify:	
[00:11:27]exwm--on-PropertyNotify:	atom=WM_NAME(39)
[00:11:27]exwm--update-ctext-title:	#x1800015
[00:11:27]exwm-input--on-PropertyNotify:	
[00:11:27]exwm--on-PropertyNotify:	atom=_NET_WM_NAME(341)
[00:11:27]exwm--update-utf8-title:	#x1800015
[00:11:27]exwm-input--on-PropertyNotify:	
[00:11:27]exwm--on-PropertyNotify:	atom=WM_NAME(39)
[00:11:27]exwm--update-ctext-title:	#x1800015
[00:11:27]exwm-input--on-PropertyNotify:	
[00:11:27]exwm--on-PropertyNotify:	atom=_NET_WM_NAME(341)
[00:11:27]exwm--update-utf8-title:	#x1800015
[00:11:27]exwm-input--on-buffer-list-update:	current-buffer=#<buffer Navigator:Mozilla Firefox> selected-window=#<window 12 on Navigator:Mozilla Firefox>
[00:11:27]exwm-input--update-focus:	focus-window=#<window 12 on Navigator:Mozilla Firefox> focus-buffer=Navigator:Mozilla Firefox
[00:11:27]exwm-input--update-focus:	Set focus on #x2a0002c
[00:11:27]exwm-input--set-focus:	#x2a0002c (corrected) => #x2a0002c
[00:11:28]exwm-input--on-KeyPress:	major-mode=exwm-mode buffer=Navigator:Mozilla Firefox
[00:11:28]exwm-input--on-KeyPress-line-mode:	(102 . 3)
[00:11:28]exwm-input--mimic-read-event:	
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-input--on-buffer-list-update:	current-buffer=#<buffer  *temp*-708500> selected-window=#<window 12 on Navigator:Mozilla Firefox>
[00:11:28]exwm-xim--make-request:	
[00:11:28]exwm--on-PropertyNotify:	atom=_NET_WM_USER_TIME(367)
[00:11:28]exwm-input--on-PropertyNotify:	
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-xim--make-request:	
[00:11:28]exwm-input--update-focus:	focus-window=#<window 12 on Navigator:Mozilla Firefox> focus-buffer=Navigator:Mozilla Firefox
[00:11:28]exwm-input--update-focus:	Set focus on #x2a0002c
[00:11:28]exwm-input--set-focus:	#x2a0002c (corrected) => #x2a0002c
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-xim--make-request:	
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-xim--make-request:	
[ ... repeated 172 times ... ]
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-xim--make-request:	
[00:11:28]exwm-input--on-buffer-list-update:	current-buffer=#<buffer *XELB-DEBUG*> selected-window=#<window 76 on *XELB-DEBUG*>
[00:11:28]exwm-layout--refresh:	frame=#<frame *XELB-DEBUG* 0x559c50375150>
[00:11:28]exwm-layout--refresh-workspace:	Refresh workspace #<frame *XELB-DEBUG* 0x559c50375150>
[00:11:28]exwm-layout--show:	Show #x2a0002c in #<window 12 on Navigator:Mozilla Firefox>
[00:11:28]exwm--set-geometry:	Setting #x2a0002c to 1720x1400+2560+0
[00:11:28]exwm-layout--set-state:	id=#x2a0002c
[00:11:28]exwm-layout--set-client-list-stacking:	
[00:11:28]exwm-layout--refresh:	frame=#<frame *XELB-DEBUG* 0x559c50375150>
[00:11:28]exwm-layout--refresh-workspace:	Refresh workspace #<frame *XELB-DEBUG* 0x559c50375150>
[00:11:28]exwm-layout--show:	Show #x2a0002c in #<window 12 on Navigator:Mozilla Firefox>
[00:11:28]exwm--set-geometry:	Setting #x2a0002c to 1720x1400+2560+0
[00:11:28]exwm-layout--set-state:	id=#x2a0002c
[00:11:28]exwm-layout--set-client-list-stacking:	
[00:11:28]exwm-input--update-focus:	focus-window=#<window 76 on *XELB-DEBUG*> focus-buffer=*XELB-DEBUG*
[00:11:28]exwm-input--update-focus:	Focus on #<window 76 on *XELB-DEBUG*>
[00:11:28]exwm-input--set-active-window:	
[00:11:28]exwm-randr--on-ConfigureNotify:	
[00:11:28]exwm--on-PropertyNotify:	atom=WM_STATE(391)
[00:11:28]exwm--on-PropertyNotify:	Unhandled: WM_STATE(391)
[00:11:28]exwm-input--on-PropertyNotify:	
[00:11:28]exwm--on-PropertyNotify:	atom=_NET_WM_STATE(344)
[00:11:28]exwm--on-PropertyNotify:	Unhandled: _NET_WM_STATE(344)
[00:11:28]exwm-input--on-PropertyNotify:	
[00:11:28]exwm--on-PropertyNotify:	atom=WM_STATE(391)
[00:11:28]exwm--on-PropertyNotify:	Unhandled: WM_STATE(391)
[00:11:28]exwm-input--on-PropertyNotify:	
[00:11:28]exwm--on-PropertyNotify:	atom=_NET_WM_STATE(344)
[00:11:28]exwm--on-PropertyNotify:	Unhandled: _NET_WM_STATE(344)
[00:11:28]exwm-input--on-PropertyNotify:	
[00:11:28]exwm--on-ClientMessage:	atom=_NET_ACTIVE_WINDOW(333) id=#x1400ec4 data=(1 8676642 0 0 0)
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	FORWARD-EVENT
[00:11:28]exwm-xim--make-request:	
[00:11:28]exwm-xim--on-ClientMessage:	
[00:11:28]exwm-xim--on-request:	
[00:11:28]exwm-xim--on-request:	UNSET-IC-FOCUS
[00:11:28]exwm-input--on-buffer-list-update:	current-buffer=#<buffer *XELB-DEBUG*> selected-window=#<window 76 on *XELB-DEBUG*>
[00:11:28]exwm-input--update-focus:	focus-window=#<window 76 on *XELB-DEBUG*> focus-buffer=*XELB-DEBUG*
[00:11:28]exwm-input--update-focus:	Focus on #<window 76 on *XELB-DEBUG*>
[00:11:28]exwm-input--set-active-window:	
[00:11:28]exwm--on-ClientMessage:	atom=_NET_ACTIVE_WINDOW(333) id=#x1400ec4 data=(1 8676647 20975300 0 0)
[00:11:30]exwm--on-PropertyNotify:	atom=WM_NAME(39)
[00:11:30]exwm--update-ctext-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:	
[00:11:30]exwm--on-PropertyNotify:	atom=_NET_WM_NAME(341)
[00:11:30]exwm--update-utf8-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:	
[00:11:30]exwm--on-PropertyNotify:	atom=WM_NAME(39)
[00:11:30]exwm--update-ctext-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:	
[00:11:30]exwm--on-PropertyNotify:	atom=_NET_WM_NAME(341)
[00:11:30]exwm--update-utf8-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:	
[00:11:30]exwm--on-PropertyNotify:	atom=WM_NAME(39)
[00:11:30]exwm--update-ctext-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:	
[00:11:30]exwm--on-PropertyNotify:	atom=_NET_WM_NAME(341)
[00:11:30]exwm--update-utf8-title:	#x1800015
[00:11:30]exwm-input--on-PropertyNotify:

The loop inside on-ClientMessage/on-request continues for quite a long time which looks like freeze.
And found an interesting fact: if I press a key, and then switch to another buffer, the loop of exwm-xim--on-ClientMessage/exwm-xim--on-request: FORWARD-EVENT/exwm-xim--make-request stops, and the character is typed immediately.

So I think the issue might be somewhere in request processing.

@Stebalien
Copy link
Contributor

Probably #28?

Stebalien added a commit that referenced this issue Apr 1, 2024
* exwm.el (exwm--on-ClientMessage): Handle the case where a window is
hidden but not iconic. This code would previously error in some cases
because a buffer wouldn't have an active window even when it was not in
the iconic state, likely due to a focus race somewhere.

fixes #28
fixes #29
fixes #30
@Stebalien
Copy link
Contributor

Actually, I'm not sure if that issue is related. But if you don't mind, do you test #32 anyways?

@Stebalien
Copy link
Contributor

@rayslava
Copy link
Author

rayslava commented Apr 4, 2024

Confirmed.
Downgrading to libX11-1.8.7 resolves the issue

@rayslava
Copy link
Author

rayslava commented Apr 4, 2024

The bug is confirmed in upstream as well: https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/205

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

No branches or pull requests

2 participants