Skip to content
operational 8.62 KiB
Newer Older
* COMMENT -*- mode: org -*-
#+Date: 2019-09-02
Time-stamp: <2020-06-03>
#+STARTUP: content
* notes                                                               :entry:
Yuanle Song's avatar
Yuanle Song committed
** 2020-06-03 how to make a release?
- update version number in meson.build
- update ChangeLog in README.org
- build deb
  ./create-deb.sh
- test application in a VM. I will test in s01.
- build deb for x86 as well.
- publish deb to apt repo deb.emacsos.com

** 2020-06-03 how to test dual monitor support
- dual display test: when user type in emacs frame in a
  display, zero-panel should appear in the same display.

- some elisp to test dual monitor support in dual 1920x1080 monitor.

  (zero-input-panel-quit)
  (zero-input-panel-move 0 0)
  (zero-input-panel-move 900 0)
  (zero-input-panel-move 900 500)
  (zero-input-panel-move 3208 884)
  (zero-input-panel-show)
  (zero-input-panel-hide)

** 2020-06-03 how to run with debug log when developing new features?
- kill existing zero-panel process
  (zero-input-panel-quit)

- compile program using meson.
  in emacs, just press F8.

- run program:

  cd build/
  G_MESSAGES_DEBUG=all ./zero-panel

* later                                                               :entry:
** 2019-09-03 bug: panel window should not get focus in GNOME 3 on Wayland.
currently panel keeps flashing when typing in this env.

it's focus-in focus-out problem.
when panel shows up, zero got a focus-out event, which it think user has
switched off emacs window, so it send hide() to panel. Now focus is back in
emacs, focus-in, zero wants to show the panel again. it's endless recursion.

The key problem is zero-panel should not receive focus in GNOME 3 shell.

I already set this in ui file:

    <property name="accept-focus">False</property>
    <property name="focus-on-map">False</property>

They don't work properly in Wayland.

Yuanle Song's avatar
Yuanle Song committed
- see minimal test application at ~/c/testing-only/do-not-focus/main.c

* current                                                             :entry:
** 
** 2019-09-02 support user configuration of theme and panel orientation.
is it supported by zero-el?
** 2019-09-02 remove black bg in round corner. should be transparent.
is it because I don't have a compositor that support alpha?
* done                                                                :entry:
** 2020-06-03 support dual monitor
- bug: 双显示器 zero-panel panel 没有显示到光标位置。而是在另一个屏幕右侧边缘。
  而且高度是对的。
- 先看 zero-el 发送给 zero-panel 的坐标是否正确。是否包含 monitor 信息。
  然后看 zero-panel 的响应是否正确。
- zero-input-show-candidates

  (zero-input-get-point-position)(3208 884)
  这个没问题。

  单块屏幕分辨率是 1920x1080
  这个返回的坐标是考虑了显示器相对位置的坐标。

  (zero-input-panel-move 3208 884)
  (zero-input-panel-show)

  // 这个有问题。move的时候没有考虑多显示器的情况。

  check dbus service server side.

  ~/c/zero-panel/server.c

  static void
  move_window(gint x, gint y, AppData *appdata)

  display = gdk_display_get_default();
  monitor = gdk_display_get_monitor_at_window(display, window);

  this is wrong.
  we should get the monitor for emacs window, not zero-panel window.
  we should move the zero-panel window to emacs window's monitor.
  then move the window to specific position.

  TODO add test case, dual display test: when user type in emacs frame in a
  display, zero-panel should appear in the same display.

- how to do that?

  we should get the monitor for emacs window, not zero-panel window.
  we should move the zero-panel window to emacs window's monitor.
  then move the window to specific position on that monitor.

  WONTFIX is there an API to move the window to screen position instead of
  monitor position? if there is, maybe just use that API instead? still need
  to consider borders though.

- problems
  - how to get the monitor ID where the emacs frame is running on?
    pass the monitor ID in hints.

    check elisp doc.
    Info: (elisp) Basic Parameters

    ‘display’
     The display on which to open this frame.  It should be a string of
     the form ‘HOST:DPY.SCREEN’, just like the ‘DISPLAY’ environment
     variable.  *Note Multiple Terminals::, for more details about
     display names.

    (frame-parameter nil 'display)":0"
    this is always ":0". it's X server display. not physical display.

    search: emacs get frame's display number in dual monitor setup

    (display-monitor-attributes-list)

    when there are two frames, one on each display, this is the result:
    #+BEGIN_SRC elisp
      (((name . "DP-0")
        (geometry 1920 0 1920 1080)
        (workarea 1920 0 1920 1080)
        (mm-size 527 296)
        (frames #<frame operational|zero-panel 0x1108c30>)
        (source . "Gdk"))
       ((name . "HDMI-0")
        (geometry 0 0 1920 1080)
        (workarea 0 0 1920 1080)
        (mm-size 531 299)
        (frames #<frame operational|zero-panel 0x583dce0>)
        (source . "Gdk")))
    #+END_SRC

    when there is only one frame on DP-0 display:
    (display-monitor-attributes-list)
    #+BEGIN_SRC elisp
      (((name . "DP-0")
        (geometry 1920 0 1920 1080)
        (workarea 1920 0 1920 1080)
        (mm-size 527 296)
        (frames #<frame emacs25@ryzen5 0x1108c30>)
        (source . "Gdk"))
       ((name . "HDMI-0")
        (geometry 0 0 1920 1080)
        (workarea 0 0 1920 1080)
        (mm-size 531 299)
        (frames)
        (source . "Gdk")))
    #+END_SRC

    可以根据坐标计算出当前frame在哪个display。
    geometry x y width height
    x y 可以看出display的相对位置。

    try use gdk_display_get_monitor_at_point ()
    http://localdocs.emacsos.com/gdk3/GdkDisplay.html#gdk-display-get-monitor-at-point

  - how to move window to the correct monitor?

    try just move to the coordinate.
    correct formula to calculate overflow.

    #+BEGIN_SRC sh
      (zero-panel:57769): DEBUG: on_handle_show_candidates() preedit_str=h
      (zero-panel:57769): DEBUG: show_candidates()
      (zero-panel:57769): DEBUG: move_window x=2881 y=869
      (zero-panel:57769): DEBUG: 2 monitors belong to :0
      (zero-panel:57769): DEBUG: screen size: x=1920 y=0 width=1920 height=1080
      (zero-panel:57769): DEBUG: window size:width=120 height=284
      (zero-panel:57769): DEBUG: set newx=1920-120=1800
      (zero-panel:57769): DEBUG: set newy=1080-284=796
    #+END_SRC

    it works.

** 2019-09-02 should I add README in deb file? where to install it to?
/usr/share/doc/zero-panel/README

- maybe also write a man page.
  /usr/share/man/man1/zero-panel.1.gz

  example man page
  /usr/share/man/man1/python3.5.1.gz
  /usr/share/man/man1/ls.1.gz generated by help-to-man

** 2019-09-02 issue: can't show panel in GNOME 3 shell
- it seems dbus message is resent quite a few times for the same preedit str.
  is it because I didn't send a response and dbus has auto resend?

  it's not dbus resend problem.

  I see the problem. it's focus-in focus-out problem.
  when panel shows up, zero got a focus-out event, which it think user has
  switched off emacs window, so it send hide() to panel. Now focus is back in
  emacs, focus-in, zero wants to show the panel again. it's endless recursion.

  The key problem is zero-panel should not receive focus in GNOME 3 shell.

- search: GNOME 3 shell gtk application how to add hint to not let a window get focus

  maybe it's running wayland?
  yes. confirmed only wayland is running, X is not.

  search: gtk wayland how to set hint so a window doesn't receive focus

  Using GTK+ with Wayland: GTK+ 3 Reference Manual
  https://developer.gnome.org/gtk3/stable/gtk-wayland.html

  GDK_BACKEND=wayland your-app
  that doesn't help.

  Initiatives/Wayland/GTK+ - GNOME Wiki!
  https://wiki.gnome.org/Initiatives/Wayland/GTK%2B

  search: wayland gtk3 accept-focus focus-on-map False doesn't work

  search: wayland gtk3 how to create a window that will not get focus

  1260773 – [GTK3][Wayland] Child popup gets focus-in, focus-out events
  https://bugzilla.redhat.com/show_bug.cgi?id=1260773

  [Firefox] gdk_device_grab() on popup drags focus from main app window on Wayland/mutter (#837) · Issues · GNOME / gtk · GitLab
  https://gitlab.gnome.org/GNOME/gtk/issues/837

- MOVED I can't fix this problem now. There is no doc on how to not get focus in
  wayland when a window is shown.

  search: how to not get focus in wayland when a window is shown

  Bug #1826176 “Applications do not receive focus in Wayland sessi...” : Bugs : gnome-shell package : Ubuntu
  https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1826176

** 2019-09-02 apply apache license.
* wontfix                                                             :entry: