exwm icon indicating copy to clipboard operation
exwm copied to clipboard

exwm-xim issues

Open rayslava opened this issue 1 year ago • 6 comments
trafficstars

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 avatar Mar 28 '24 07:03 rayslava

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.

rayslava avatar Mar 28 '24 08:03 rayslava

Probably https://github.com/emacs-exwm/exwm/issues/28?

Stebalien avatar Apr 01 '24 01:04 Stebalien

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

Stebalien avatar Apr 01 '24 19:04 Stebalien

https://bbs.archlinux.org/viewtopic.php?id=294301

Stebalien avatar Apr 03 '24 21:04 Stebalien

Confirmed. Downgrading to libX11-1.8.7 resolves the issue

rayslava avatar Apr 04 '24 06:04 rayslava

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

rayslava avatar Apr 04 '24 06:04 rayslava