-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add _NET_WM_PID atom to Linux X11 window #17470
base: master
Are you sure you want to change the base?
Conversation
e64354a
to
8438a62
Compare
You can test this PR using the following package version. |
|
||
// If _NET_WM_PID is set, the ICCCM-specified property WM_CLIENT_MACHINE MUST also be set. | ||
// the hostname can change, so we can't cache it | ||
// gethostname(3) on Linux just calls uname(2), so do it ourselves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we just P/Invoke gethostname
instead of that complex machinery in GetUtsName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks I copy from qt:
// https://github.com/qt/qtbase/blob/44876fb45e702c2554fca98ed19af57feb1c0511/src/corelib/global/qsysinfo.cpp#L948-L957
QString QSysInfo::machineHostName()
{
// the hostname can change, so we can't cache it
#if defined(Q_OS_LINUX)
// gethostname(3) on Linux just calls uname(2), so do it ourselves
// and avoid a memcpy
struct utsname u;
if (uname(&u) == 0)
return QString::fromLocal8Bit(u.nodename);
return QString();
}
_renderHandle = XCreateWindow(_x11.Display, _handle, 0, 0, defaultWidth, defaultHeight, 0, depth, | ||
(int)CreateWindowArgs.InputOutput, | ||
visual, | ||
new UIntPtr((uint)(SetWindowValuemask.BorderPixel | SetWindowValuemask.BitGravity | | ||
SetWindowValuemask.WinGravity | SetWindowValuemask.BackingStore)), ref attr); | ||
AppendPid(_renderHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a child window, apps aren't supposed to set pid properties for those, iirc
// and avoid a memcpy | ||
using var utsName = UtsName.GetUtsName(); | ||
|
||
var WM_CLIENT_MACHINE = XInternAtom(_x11.Display, "WM_CLIENT_MACHINE", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to the main list of x11 atoms instead
What does the pull request do?
Append the
_NET_WM_PID
atom to Linux X11 window.I learn from gtk3:
And I learn from qt:
What is the current behavior?
Miss the
_NET_WM_PID
atom in Avalonia Linux x11 window.What is the updated/expected behavior with this PR?
We can find the
_NET_WM_PID
atom in Avalonia Linux x11 window. And we get the the Process Id from Avalonia Linux x11 window by_NET_WM_PID
atom.How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #17444