ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

Question : is it possilbe to partly manage a window? #518

Open QiangF opened 6 years ago

QiangF commented 6 years ago

This is a continuation of the old issue : https://github.com/ch11ng/exwm/issues/252

Because it has too many irrelevant comments, thus this new issue. The floating windows of ug fails to dock is solved by not managing them (inserting a line into exwm-manage.el). (sorry @ch11ng, ug has a memory of the window layout, that causes the weird behavior in the old issue, I delete its memory and everthing is fine)

(when (or
       ;; <<< inserted
       (and (string= exwm-class-name "Ugnx12")
            (not (string= exwm-instance-name "ugnx12")))
       ;; <<<
       (not
        (or (not exwm-window-type)
            (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
            (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG exwm-window-type)
            (memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type)))

But there is still one more issue, sometimes the keyboard input is not sent to the small windows that are not managed. The input hold (focus) can't be capture from the people side by mouse clicking, i.e. I can't type on the small window, all key event are sent to emacs (I see emacs responding to every key), however, the focus can be got from the window side, in that case I can type English. Because I need an input method to type Chinese, I really want these window to be partly managed: don't respond to window size or movement request, but handle the input and focus. So maybe we still need to change the present implementation of floating X windows.

I am not in a hurry, I am super happy already. Thank you!

QiangF commented 6 years ago

This is the debug output https://gist.github.com/QiangF/b164f2fb2b71b2818d16f162d18cf807 The output is recorded following:

  1. open create new file, a window popup (not managed).
  2. click on an input area (file name field), and type 1 2 3 4, no response from the window
  3. change the file type by click on an option in the popup window, now the focus is captured, the file name field is selected automatically, then I type 1 2 3 4, I can type only English.
ch11ng commented 6 years ago

Glad to hear the old issue has been partly resolved. With the latest code you can achieve the same thing with

(setq exwm-manage-configurations '(((and (string= exwm-class-name "Ugnx12")
                                         (not (string= exwm-instance-name "ugnx12")))
                                    manage nil)))

To fully resolve the problem I'm afraid we have to create a lightweight variant of floating mode which has no floating Emacs frame and can be arbitrary moved/resized by the app that creates it.

QiangF commented 6 years ago
  1. I have just read this about XEmacs: As a compile-time option, an XEmacs frame can be placed within an "external client widget" managed by another application. This allows an application to use an XEmacs frame as its text pane rather than the standard Text widget that is provided with Motif or Athena.
  2. Also GNU Emacs 23.1 supports the XEmbed specification. You can embed Emacs in another application on X11.
  3. There is a emacs application framework that Integrate PyQt program window into Emacs Frame using Xlib Reparent technology, the link is https://github.com/manateelazycat/emacs-application-framework
ch11ng commented 6 years ago

I think both of the three use XEmbed. This spec has its drawback in that both embedder and embeddee have to be aware of each other and act accordingly which literally excludes most existing applications. Actually the systemtray module of EXWM uses it.

P.S. How are they related to this issue?