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,
|
msgAreaSizeChanged,
|
||||||
msgAreaRepaintAll,
|
msgAreaRepaintAll,
|
||||||
msgTabCurrentTabHasChildren,
|
msgTabCurrentTabHasChildren,
|
||||||
|
msgBeginModal,
|
||||||
|
msgEndModal,
|
||||||
};
|
};
|
||||||
|
|
||||||
// uitask_windows.c
|
// uitask_windows.c
|
||||||
|
|
|
@ -11,12 +11,18 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
RECT r;
|
RECT r;
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
|
|
||||||
data = getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeWindowHWND);
|
data = (void *) getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeWindowHWND);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return lResult;
|
return lResult;
|
||||||
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
|
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
|
||||||
return lResult;
|
return lResult;
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
case msgBeginModal:
|
||||||
|
windowBeginModal(data);
|
||||||
|
return 0;
|
||||||
|
case msgEndModal:
|
||||||
|
windowEndModal(data);
|
||||||
|
return 0;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (GetClientRect(hwnd, &r) == 0)
|
if (GetClientRect(hwnd, &r) == 0)
|
||||||
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());
|
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());
|
||||||
|
|
|
@ -14,6 +14,7 @@ import "C"
|
||||||
type window struct {
|
type window struct {
|
||||||
hwnd C.HWND
|
hwnd C.HWND
|
||||||
shownbefore bool
|
shownbefore bool
|
||||||
|
modallevel int
|
||||||
|
|
||||||
closing *event
|
closing *event
|
||||||
|
|
||||||
|
@ -99,3 +100,21 @@ func windowClosing(data unsafe.Pointer) {
|
||||||
C.windowClose(w.hwnd)
|
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