Implemented the beginning of a potential solution to the Windows modality issue.
This commit is contained in:
parent
e0e52ad834
commit
f131ac432b
|
@ -32,6 +32,8 @@ enum {
|
|||
msgAreaSizeChanged,
|
||||
msgAreaRepaintAll,
|
||||
msgTabCurrentTabHasChildren,
|
||||
msgBeginModal,
|
||||
msgEndModal,
|
||||
};
|
||||
|
||||
// uitask_windows.c
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue