gui icon indicating copy to clipboard operation
gui copied to clipboard

get-display-left-top-inset returns non-zero offset for monitor 0 on linux

Open tgbugs opened this issue 5 years ago • 3 comments

Following and investigation into tooltips being misplaced in https://github.com/alex-hhh/gui-widget-mixins/issues/3, we determined that the underlying issue is that for some reason on my system I have a non-zero offsets when calling get-display-left-top-inset for monitor zero. This is at variance with the docs.

(require racket/gui)
(get-display-left-top-inset #:monitor 0)
-1200
-370

The full display info is '(linux cs "8.0.0.11" 2 (0 1920 1080 -1200 -370) (1 1200 1920 0 0)) when running

(begin
  (require racket/gui)
  (define (get-display-info)
    (append (list (system-type 'os*) (system-type 'gc) (version) (get-display-count))
            (for/list ([monitor (in-range (get-display-count))])
              (let-values ([(x y) (get-display-size #:monitor monitor)]
                           [(dx dy) (get-display-left-top-inset #:monitor monitor)])
                (list
                 monitor
                 x y dx dy)))))
  (get-display-info))

See also this thread in slack https://racket.slack.com/archives/C06V96CKX/p1618503646014800.

Here is the monitor layout if it helps. mon-0 mon-1

tgbugs avatar Apr 15 '21 23:04 tgbugs

While there is a difference between the documentation for get-display-left-top-inset and the actual behavior in this case, it is not clear to me if the documentation is incorrect or the implementation.

If I follow the implementation correctly, get-display-top-left-inset is implemented in terms of display-origin, which is platform specific. For GTK, display-origin simply queries the GDK layer:

https://github.com/racket/gui/blob/a00b2b32e40f519887c5877b8a01a8887fad0bc4/gui-lib/mred/private/wx/gtk/frame.rkt#L594

alex-hhh avatar Apr 15 '21 23:04 alex-hhh

I'm getting the issue after requiring racket/pkgs/gui-lib/mred/private/wx/gtk/frame.rkt directly, so the issue does seem to stem from something unexpected in the gtk layer.

(let ([a (box 0)] [b (box 0)]) (display-origin a b #f 0 (λ () "oops")) (values a b))
'#&-1200
'#&-370

tgbugs avatar Apr 16 '21 00:04 tgbugs

This issue has been mentioned on Racket Discussions. There might be relevant details there:

https://racket.discourse.group/t/frames-and-displays/2026/9