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

Add ability to make window maximized #6

Closed
subsoap opened this issue May 4, 2017 · 6 comments
Closed

Add ability to make window maximized #6

subsoap opened this issue May 4, 2017 · 6 comments

Comments

@subsoap
Copy link
Owner

subsoap commented May 4, 2017

Should be this with SW_SHOWMAXIMIZED I think
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx

Could also add functions for minimizing, making window get focus, making taskbar blink / light up,

@AGulev
Copy link
Collaborator

AGulev commented May 4, 2017

I can make almost the same things on macOS, but I think we have to get most important and frequency used things and implement them.

@AGulev
Copy link
Collaborator

AGulev commented May 4, 2017

something like function
defos.set_window_mode(param)
and constants
defos.SHOW_MAXIMIZED
defos.SHOW_FULLSCREEN
defos.SHOW_WINDOWED
or something like this.

I am not sure about the cases of using : : window get focus, making taskbar blink / light up,

@subsoap
Copy link
Owner Author

subsoap commented May 4, 2017

Note: Shortcut for macOS is option key + shift + green button to get same behavior as clicking Maximize button on Windows.

I agree about important features. It's still good to list out everything we want. We'll probably want to rename some features / merge them and then do a 1.0 release then people can use that version statically so the names don't change. Then for 2.0 release and so on we can continue to refine name and list of features to what is best.

@subsoap
Copy link
Owner Author

subsoap commented May 4, 2017

WIP version going to add it in properly later

local M = {}

local ffi = package.preload.ffi()


function M.maximize_window()
	if(ffi.os == "Windows") then

	  -- definitions
	  ffi.cdef([[
			typedef unsigned int LONG;
			typedef long long LONG_PTR;
			typedef void* PVOID;
			typedef PVOID HANDLE;
			typedef HANDLE HWND;
			typedef unsigned int UINT;
			typedef bool BOOL;

			HWND GetActiveWindow();
			BOOL ShowWindow(HWND hWnd, int nCmdShow);
			
		]])

		-- load User32.dll
		local user32 = ffi.load("User32")

		local SW_SHOWMAXIMIZED = 3
		
		
		local ptr = user32.GetActiveWindow()
		
		user32.ShowWindow(ptr, SW_SHOWMAXIMIZED)
		
	end	
end	

return M

@AGulev
Copy link
Collaborator

AGulev commented May 5, 2017

Fully agree with you about version 1.0 and 2.0 .
And thanks for the maximize option ( option key + shift + green button) I never known about it =)))

@AGulev
Copy link
Collaborator

AGulev commented May 11, 2017

As I undestand this issue is done?
new methods:
defos.toggle_maximize()
and
defos.is_maximize()
was added

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