C
C#6mo ago
Mazranel

Using Screen.FromPoint(Cursor.Position) always returns `Display 0`

I'm trying to recreate the Windows screenshot utility on Linux using Mono, but I'm unable to get the monitor that has the mouse on it. Using Screen.FromPoint(Cursor.Position) always returns Display 0 if it's run from a terminal on the secondary monitor, and returns Display 1 if run from a terminal on the primary monitor. Is this a bug or have I made a mistake?
No description
11 Replies
Mazranel
MazranelOP6mo ago
Cursor.Position also returns incorrect values. For example, the secondary monitor is 1920x1080 and it will return something like (1920, 1230) This happens on the primary monitor as well. The size is 2560x1440 and it will return something like (3078, 600)' Seems that using PointToClient makes everything work as intended except that the terminal issue now always returns the secondary monitor it is no longer working seems Mono is a bit buggy
wasabi
wasabi6mo ago
Not much serious work has been done on Mono WinForms in about a decade. It's certainly not a tool I would use to be taking screenshots, though.
Mazranel
MazranelOP6mo ago
Do you have any recommendations? I Haven't learned the WPF / XAML side of things yet, as I personally dislike it
wasabi
wasabi6mo ago
PInvoke X11 directly
Mazranel
MazranelOP6mo ago
That won't be super cross-platform though will it?
wasabi
wasabi6mo ago
No. But who cares? Just write different code for just that.
Mazranel
MazranelOP6mo ago
That makes things a lot more annoying for me. Say a certain distro doesn't have X11, I don't want to have to maintain an X11 and Wayland version And that might not even work across multiple operating systems BSD support would be a huge maybe, but I'd still like to have that option available
wasabi
wasabi6mo ago
The chances of any of this working in monos WinForms across all of that is nil, for the same reason But go for it I guess.
Mazranel
MazranelOP6mo ago
I'm thinking of moving away from Mono for this reason, I just don't know if any other decent frameworks
wasabi
wasabi6mo ago
Well there's always .net
Mazranel
MazranelOP6mo ago
Does .NET run on BSD OSes? What GUI frameworks can I use with it? I knopw there are Avalonia, Uno, Maui, WPF, etc but those all use XAML as far as I'm aware I'm not very fond of XAML app development
Want results from more Discord servers?
Add your server