snails-create-frame 在第 2 块屏幕弹出问题

set-frame-position 在单个屏幕没有任何问题,但是双屏幕,就会有 x < 0 这种情况存在,这会使得 snails 的弹出框位置不在预期上。

         +------------------------------+  +-----------------------------+
         |                              |  |                             |
         |                              |  |                             |
         |          Screen 2            |  |          Screen 1           |
         |                              |  |                             |
         |                              |  |                             |
         |                              |  |                             |
         +------------------------------+  +-----------------------------+

                    x < 0                              x > 0

这是 set-frame-position 的文档说明,明确指出了 X and Y 定义的问题。

/* Set position of FRAME to (X, Y). FRAME must be a live frame and defaults to the selected one. X and Y, if positive, specify the coordinate of the left and top edge of FRAME’s outer frame in pixels relative to an origin (0, 0) of FRAME’s display. If any of X or Y is negative, it specifies the coordinates of the right or bottom edge of the outer frame of FRAME relative to the right or bottom edge of FRAME’s display. */

我目前 tweak 了 snails 的 snails-create-frame 函数。

(frame-x (if (< x 0) (- x (- (/ (- width frame-width) 2)) (/ 1366 2))
           (+ x (/ (- width frame-width) 2))))

1366 是我 Screen 1 屏幕的像素宽度 。

目前,还是不能完美解决,但是至少在我 99% 的情况下,让 snails 的弹出位置处在当前 frame 的中央。

和大家分享一下,如果有更好的解决办法,希望大家指出。

M$ Window 7 中 Control Panel\All Control Panel Items\Display\Screen Resolution

Make this my main diplay 的选项可以切换哪个是主显示器,从而避开 < 0 的情况。

这个问题我之前修复过, 我设置的Screen 2 在 Screen 1 的右边。 我还不知道x 会有小于0 的case .

最早我提个这个问题,懒猫不是说已经修复了吗?现在我没有用 snails,不清楚状况了。