More native window fun

In Windows, Alt-F4 doesn’t close the window in native mode, but does work in non-native mode.

Same results with command-W on Mac OS X.

In Windows, you can sometimes hit alt-spacebar to get the system menu for the window and sometimes not. I haven’t figured out the pattern, but it’s not consistent.

Sorry to gripe so much - I’m really pleased to see native window support added.

Matt

Could it just be that it won’t work unless you’ve got a close button on there?..

It doesn’t work with the demo app, on either platform. Sorry…

Matt

While I’m complaining, there’s one other minor issue. On WinXP, when you mouse over the title bar buttons of non-JUCE apps, you see a subtle highlight on the button you’re rolling over. With the latest JUCE stuff, you don’t get the roll-over highlight.

Sorry to complain so much. : )

Matt

oh that really is subtle! It’s a typo in juce_win32_Windowing.cpp, line 1850ish. Should be:

            case WM_NCMOUSEMOVE:
                if ((styleFlags & windowHasTitleBar) != 0)
                    return DefWindowProc (h, message, wParam, lParam);

[quote=“jules”]oh that really is subtle! It’s a typo in juce_win32_Windowing.cpp, line 1850ish. Should be:

[code]
case WM_NCMOUSEMOVE:
if ((styleFlags & windowHasTitleBar) != 0)
return DefWindowProc (h, message, wParam, lParam);

[/code][/quote]

I just tried it and it works fine. Nice.

I realize that this is the World’s Least Important Bug, but it’s good to have it fixed. Thanks.

For Windows, I added this to peerWindowProc and alt-F4 closes the window with the native title bar active:

			case WM_SYSCOMMAND :
				if ((styleFlags & windowHasTitleBar) != 0)
				{
					if (SC_CLOSE == wParam)
						handleUserClosingWindow();

                return DefWindowProc (h, message, wParam, lParam);
				}

				return 0;

Alt-spacebar still doesn’t work quite right; if you click on the native title bar and then hit alt-spacebar, you get the system menu every time. If you click elsewhere in the window and hit alt-spacebar, you don’t get the system menu.

Matt

Ah, nice one. Not sure about the ctl+space thing, it’s probably getting eaten by my key handler callbacks.

Looks like it should actually be this:

[code] case WM_SYSCOMMAND :
if ((styleFlags & windowHasTitleBar) != 0)
{
if (SC_CLOSE == wParam)
handleUserClosingWindow();

			}

			break; // let DefWindowProc handle it

[/code]

Otherwise, you can’t close the window from the taskbar if you’re not using native mode.

I don’t know why DefWindowProc doesn’t just issue the WM_CLOSE message in response to WM_SYSCOMMAND when you’re in native mode.

Matt

A further change:

[code] case WM_SYSCOMMAND :
if ((styleFlags & windowHasTitleBar) != 0)
{
if (SC_CLOSE == (wParam & 0xfff0))
handleUserClosingWindow();
}

			break;

[/code]

Windows uses the low four bits of wParam internally, so you have to mask it.

Matt