summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-18 22:45:40 -0400
committerPietro Gagliardi <[email protected]>2014-08-18 22:45:40 -0400
commitf131ac432bceb9129bf62af88cdf6e301e85a488 (patch)
tree000e05fcdff3f5c79db12448ffa3154e5cd24a14
parente0e52ad83457c5c7ad9afd4ae124be68c47333a6 (diff)
Implemented the beginning of a potential solution to the Windows modality issue.
-rw-r--r--redo/winapi_windows.h2
-rw-r--r--redo/window_windows.c8
-rw-r--r--redo/window_windows.go19
3 files changed, 28 insertions, 1 deletions
diff --git a/redo/winapi_windows.h b/redo/winapi_windows.h
index e888c99..199f838 100644
--- a/redo/winapi_windows.h
+++ b/redo/winapi_windows.h
@@ -32,6 +32,8 @@ enum {
msgAreaSizeChanged,
msgAreaRepaintAll,
msgTabCurrentTabHasChildren,
+ msgBeginModal,
+ msgEndModal,
};
// uitask_windows.c
diff --git a/redo/window_windows.c b/redo/window_windows.c
index 0db16bb..8a042e0 100644
--- a/redo/window_windows.c
+++ b/redo/window_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());
diff --git a/redo/window_windows.go b/redo/window_windows.go
index 60f89d1..5789df8 100644
--- a/redo/window_windows.go
+++ b/redo/window_windows.go
@@ -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")
+ }
+}