Skip to content
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

[Mac] Cannot de-maximize a manually maximized form #1512

Open
msasso69 opened this issue Nov 17, 2019 · 4 comments
Open

[Mac] Cannot de-maximize a manually maximized form #1512

msasso69 opened this issue Nov 17, 2019 · 4 comments
Milestone

Comments

@msasso69
Copy link
Contributor

If I manually maximize a form clicking on the green system buttom to maximize it, I'm no more able to programmatically de-maximize it.
I also noticed that if I programmatically maximize a form with the Maximize() method I don't really maximize it but rather change its dimensions to fit the available screen, it is an intended behaviour?
Anyway both maximized ways of maximizing a form have the WindowState to Maximized.

Expected Behavior

Setting WindowState = WindowState.Normal to a manually maximized form should de-maximize it

Actual Behavior

Setting WindowState = WindowState.Normal to a manually maximized form has no effect

Steps to Reproduce the Problem

  1. run the repro
  2. click on the green system button to maximize the form
    image
  3. click the button "Click Me" of the form
    The code this.WindowState = WindowState.Normal; get executed but the WindowState (and the form) remains Maximized

Code that Demonstrates the Problem

using System;
using Eto;
using Eto.Forms;
namespace VisualSEO.EtoFormGui
{
	public class Program
	{
		[STAThread]
		public static void Main(string[] args)
		{
			new Application(Platform.Detect).Run(new MainForm());
		}

		public class MainForm : Form
		{
			public MainForm()
			{
				this.Width = 500;
				this.Height = 250;
				//this.Maximize();
				Button button1 = new Button() { Text = "Click Me!" };
				button1.Click += (sender, e) =>
				{
					this.WindowState = WindowState.Normal;
				};
				Content = button1;
			}
		}
	}
}

Specifications

  • Version: Eto pull of 25th October 2019
  • Platform(s): XamMac2
  • Operating System(s): macOS 10.13
@cwensley
Copy link
Member

Thanks for submitting the issue!

@cwensley cwensley added this to the 2.x milestone Nov 19, 2019
@cwensley
Copy link
Member

cwensley commented Nov 20, 2019

Hm, you're probably confusing "Full Screen" with maximized. The Maximize()/Unmaximize() is the same as "zooming" on Mac. On recent macOS versions you have to ALT+Click the green button to "Maximize" the window.

There is no API mapping for to enter/exit full screen mode in Eto currently, but you can do it via NSWindow.ToggleFullScreen().

@msasso69
Copy link
Contributor Author

ok, got it
Anyway the Maximized state is the status I have in the WindowState of the form when in full screen mode (not only when I maximize the form). Is there a way to detect if I'm in full screen programmatically?
Thanks for the hint on how to toggle the full screen mode, but how can I invoke your piece of code? (forgive my ignorance, lol)

@cwensley
Copy link
Member

To determine if the window is maximized you can use NSWindow.StyleMask.HasFlag(NSWindowStyle.FullScreenWindow).

Native code is usually implemented in your Mac-specific launcher app via a style or by creating your own form subclass.

I've done a very rough partial implementation to support WindowState.FullScreen macOS in #1519, but it still needs a lot of work to add support for WinForms, Wpf, and Gtk as it isn't straightforward to do that with those platforms. I hope that helps point you in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants