Giter VIP home page Giter VIP logo

Comments (5)

maxkatz6 avatar maxkatz6 commented on August 29, 2024 1

X11 window uses current position to calculate PointToScreen.
And current position set via OnEvent -

Dispatcher.UIThread.Post(() =>
{
if (_configure == null)
return;
var cev = _configure.Value;
var npos = _configurePoint.Value;
_configure = null;
_configurePoint = null;
var nsize = new PixelSize(cev.width, cev.height);
var changedSize = _realSize != nsize;
var changedPos = _position == null || npos != _position;
_realSize = nsize;
_position = npos;

As a workaround, you should be able to listen for PositionChanged, and call PointToScreen there.

from avalonia.

maxkatz6 avatar maxkatz6 commented on August 29, 2024

What distributive and windowing system are you using? Is it wayland based?

from avalonia.

lindexi avatar lindexi commented on August 29, 2024

Thank you @maxkatz6 .

I test it in UOS and Kylin system which both are debian base system and it uses X11.


More info about my system:

>$ loginctl show-session 1 -p Type
Type=x11

UOS:

>$ cat /etc/os-version
[Version]
SystemName=UnionTech OS Desktop
SystemName[zh_CN]=统信桌面操作系统
ProductType=Desktop
ProductType[zh_CN]=桌面
EditionName=E
EditionName[zh_CN]=E
MajorVersion=20
MinorVersion=1050
OsBuild=11068.102
>$ cat /etc/os-release
PRETTY_NAME="UnionTech OS Desktop 20 E"
NAME="uos"
VERSION_ID="20"
VERSION="20"
ID=uos
HOME_URL="https://www.chinauos.com/"
BUG_REPORT_URL="http://bbs.chinauos.com"
VERSION_CODENAME=uranus
>$ uname -r
4.19.0-amd64-desktop
>$ cat /etc/debian_version
10.10

Kylin:

>$ cat /etc/.kyinfo
[dist]
name=Kylin
milestone=Desktop-V10-SP1-General-Release-TSM-lindexi-20230217
arch=arm64
beta=False
time=2023-02-17 19:01:29
>$ uname -r
5.4.18-53sy01-generic
>$ cat /etc/debian_version
bullseye/sid

from avalonia.

maxkatz6 avatar maxkatz6 commented on August 29, 2024

@kekekeks can XTranslateCoordinates be used relatively to the desktop root? Or we could at least use XGetWindowProperty

from avalonia.

lindexi avatar lindexi commented on August 29, 2024

Thank you @maxkatz6 .

I can get the correct position in PositionChanged event

    private void MainWindow_PositionChanged(object? sender, PixelPointEventArgs e)
    {
        var pointToScreen = this.PointToScreen(new Point(0, 0));
        Console.WriteLine($"PositionChanged PointToScreen={pointToScreen}");
    }

But I still think it would be better if Avalonia can run as same in Windows and Linux.

from avalonia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.