~eliasnaur/gio

4 2

Set min/max size on Windows...

Details
Message ID
<KW41CQ.UWF9VB91J4O41@sweatyballs.es>
DKIM signature
missing
Download raw message
Hi everybody,

I have submitted patches to allow us to force a minimum and/or maximum 
window size on x11 and macOS. However, with Windows I'm stumped.

I suspect some code could go into DefWindowProc. Something like this:

    LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
    lpMMI->ptMinTrackSize.x = 300;
    lpMMI->ptMinTrackSize.y = 300;

I was able to pretty much guess with the other platforms but I have no 
idea how I would translate the above to Go.

Cheers,
Jason.
Details
Message ID
<C3IPUDB9GLUW.1OREU1VIU5WZS@testmac>
In-Reply-To
<KW41CQ.UWF9VB91J4O41@sweatyballs.es> (view parent)
DKIM signature
pass
Download raw message
On Tue Jun 16, 2020 at 9:36 PM CEST, Jason wrote:
> Hi everybody,
>
> I have submitted patches to allow us to force a minimum and/or maximum 
> window size on x11 and macOS. However, with Windows I'm stumped.
>
> I suspect some code could go into DefWindowProc. Something like this:
>
>     LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
>     lpMMI->ptMinTrackSize.x = 300;
>     lpMMI->ptMinTrackSize.y = 300;
>
> I was able to pretty much guess with the other platforms but I have no 
> idea how I would translate the above to Go.
>

Do you mean testing your change? You can use

	$ GOOS=window go run/test -exec=wine ...

on Linux if you have Wine installed. The Windows port is special in that
it has no native dependencies.

-- elias
Details
Message ID
<HZ51CQ.25EFJ7C6O7MD2@sweatyballs.es>
In-Reply-To
<C3IPUDB9GLUW.1OREU1VIU5WZS@testmac> (view parent)
DKIM signature
missing
Download raw message

On Tue, 16 Jun, 2020 at 19:51, Elias Naur <mail@eliasnaur.com> wrote:
> On Tue Jun 16, 2020 at 9:36 PM CEST, Jason wrote:
>>  Hi everybody,
>> 
>>  I have submitted patches to allow us to force a minimum and/or 
>> maximum
>>  window size on x11 and macOS. However, with Windows I'm stumped.
>> 
>>  I suspect some code could go into DefWindowProc. Something like 
>> this:
>> 
>>      LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
>>      lpMMI->ptMinTrackSize.x = 300;
>>      lpMMI->ptMinTrackSize.y = 300;
>> 
>>  I was able to pretty much guess with the other platforms but I have 
>> no
>>  idea how I would translate the above to Go.
>> 
> 
> Do you mean testing your change? You can use
> 
> 	$ GOOS=window go run/test -exec=wine ...
> 
> on Linux if you have Wine installed. The Windows port is special in 
> that
> it has no native dependencies.
> 
> -- elias

The problem is not with testing. I have Wine and a Windows VM.

The problem I have is translating the code I mentioned. I think that 
code is the key to getting max/min working for windows.

It should be run in the event WM_GETMINMAXINFO (0x0024)
Details
Message ID
<C3IQCKIB5BKO.3PBNTPKBBP9XQ@testmac>
In-Reply-To
<HZ51CQ.25EFJ7C6O7MD2@sweatyballs.es> (view parent)
DKIM signature
pass
Download raw message
On Tue Jun 16, 2020 at 9:59 PM CEST, Jason wrote:
>
>
> On Tue, 16 Jun, 2020 at 19:51, Elias Naur <mail@eliasnaur.com> wrote:
> > On Tue Jun 16, 2020 at 9:36 PM CEST, Jason wrote:
> >>  Hi everybody,
> >> 
> >>  I have submitted patches to allow us to force a minimum and/or 
> >> maximum
> >>  window size on x11 and macOS. However, with Windows I'm stumped.
> >> 
> >>  I suspect some code could go into DefWindowProc. Something like 
> >> this:
> >> 
> >>      LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
> >>      lpMMI->ptMinTrackSize.x = 300;
> >>      lpMMI->ptMinTrackSize.y = 300;
> >> 
> >>  I was able to pretty much guess with the other platforms but I have 
> >> no
> >>  idea how I would translate the above to Go.
> >> 
> > 
> > Do you mean testing your change? You can use
> > 
> > 	$ GOOS=window go run/test -exec=wine ...
> > 
> > on Linux if you have Wine installed. The Windows port is special in 
> > that
> > it has no native dependencies.
> > 
> > -- elias
>
> The problem is not with testing. I have Wine and a Windows VM.
>
> The problem I have is translating the code I mentioned. I think that 
> code is the key to getting max/min working for windows.
>
> It should be run in the event WM_GETMINMAXINFO (0x0024)

I'd guess:

- Define a WM_GETMINMAXINFO const
- Define MINMAXINFO:

	type MINMAXINFO struct {
		ptReserved POINT
		ptMaxSize POINT
		...
	}

then, in windowProc's VM_GETMINMAXINFO case:

	minmax := (*windows.MINMAXINFO)(unsafe.Pointer(uintptr(lParam)))
	minmax.ptMaxSize.x = ...

-- elias
Details
Message ID
<UR81CQ.X7WARYRQTUZ52@sweatyballs.es>
In-Reply-To
<C3IQCKIB5BKO.3PBNTPKBBP9XQ@testmac> (view parent)
DKIM signature
missing
Download raw message

On Tue, 16 Jun, 2020 at 20:15, Elias Naur <mail@eliasnaur.com> wrote:
> On Tue Jun 16, 2020 at 9:59 PM CEST, Jason wrote:
>> 
>> 
>>  On Tue, 16 Jun, 2020 at 19:51, Elias Naur <mail@eliasnaur.com> 
>> wrote:
>>  > On Tue Jun 16, 2020 at 9:36 PM CEST, Jason wrote:
>>  >>  Hi everybody,
>>  >>
>>  >>  I have submitted patches to allow us to force a minimum and/or
>>  >> maximum
>>  >>  window size on x11 and macOS. However, with Windows I'm stumped.
>>  >>
>>  >>  I suspect some code could go into DefWindowProc. Something like
>>  >> this:
>>  >>
>>  >>      LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
>>  >>      lpMMI->ptMinTrackSize.x = 300;
>>  >>      lpMMI->ptMinTrackSize.y = 300;
>>  >>
>>  >>  I was able to pretty much guess with the other platforms but I 
>> have
>>  >> no
>>  >>  idea how I would translate the above to Go.
>>  >>
>>  >
>>  > Do you mean testing your change? You can use
>>  >
>>  > 	$ GOOS=window go run/test -exec=wine ...
>>  >
>>  > on Linux if you have Wine installed. The Windows port is special 
>> in
>>  > that
>>  > it has no native dependencies.
>>  >
>>  > -- elias
>> 
>>  The problem is not with testing. I have Wine and a Windows VM.
>> 
>>  The problem I have is translating the code I mentioned. I think that
>>  code is the key to getting max/min working for windows.
>> 
>>  It should be run in the event WM_GETMINMAXINFO (0x0024)
> 
> I'd guess:
> 
> - Define a WM_GETMINMAXINFO const
> - Define MINMAXINFO:
> 
> 	type MINMAXINFO struct {
> 		ptReserved POINT
> 		ptMaxSize POINT
> 		...
> 	}
> 
> then, in windowProc's VM_GETMINMAXINFO case:
> 
> 	minmax := (*windows.MINMAXINFO)(unsafe.Pointer(uintptr(lParam)))
> 	minmax.ptMaxSize.x = ...
> 
> -- elias

Thanks!

I already had the struct and the event defined. I got stuck on the 
casting. I'll finish it up tomorrow.
Export thread (mbox)