Implemented the beginning of a potential solution to the Windows modality issue.

This commit is contained in:
Pietro Gagliardi 2014-08-18 22:45:40 -04:00
parent e0e52ad834
commit f131ac432b
3 changed files with 28 additions and 1 deletions

View File

@ -32,6 +32,8 @@ enum {
msgAreaSizeChanged,
msgAreaRepaintAll,
msgTabCurrentTabHasChildren,
msgBeginModal,
msgEndModal,
};
// uitask_windows.c

View File

@ -11,12 +11,18 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
RECT r;
LRESULT lResult;
data = getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeWindowHWND);
data = (void *) getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeWindowHWND);
if (data == NULL)
return lResult;
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
return lResult;
switch (uMsg) {
case msgBeginModal:
windowBeginModal(data);
return 0;
case msgEndModal:
windowEndModal(data);
return 0;
case WM_SIZE:
if (GetClientRect(hwnd, &r) == 0)
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());

View File

@ -14,6 +14,7 @@ import "C"
type window struct {
hwnd C.HWND
shownbefore bool
modallevel int
closing *event
@ -99,3 +100,21 @@ func windowClosing(data unsafe.Pointer) {
C.windowClose(w.hwnd)
}
}
//export windowBeginModal
func windowBeginModal(data unsafe.Pointer) {
w := (*window)(data)
C.EnableWindow(w.hwnd, C.FALSE)
w.modallevel++
}
//export windowEndModal
func windowEndModal(data unsafe.Pointer) {
w := (*window)(data)
w.modallevel--
if w.modallevel == 0 {
C.EnableWindow(w.hwnd, C.TRUE)
} else if w.modallevel < 0 {
panic("window begin/end modal mismatch")
}
}