C
C#3w 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
Mazranel3w 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
wasabi3w 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
Mazranel3w ago
Do you have any recommendations? I Haven't learned the WPF / XAML side of things yet, as I personally dislike it
wasabi
wasabi3w ago
PInvoke X11 directly
Mazranel
Mazranel3w ago
That won't be super cross-platform though will it?
wasabi
wasabi3w ago
No. But who cares? Just write different code for just that.
Mazranel
Mazranel3w 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
wasabi2w 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
Mazranel2w ago
I'm thinking of moving away from Mono for this reason, I just don't know if any other decent frameworks
wasabi
wasabi2w ago
Well there's always .net
Mazranel
Mazranel2w 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