summaryrefslogtreecommitdiff
path: root/uitask_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-11-05 13:35:39 -0500
committerPietro Gagliardi <[email protected]>2014-11-05 13:35:39 -0500
commitb632fef3b13dc082acbbbd8aaf6898c663da1c0b (patch)
treedb74e1e02e91e555b50e9ad6efd2eaafafae907f /uitask_windows.c
parentcd96f8ee2e0a4ae3370a57357f9bcde4e2a8c36f (diff)
Implemented TextField.ReadOnly() on Mac OS X. Began standardizing window class name access on Windows.
Diffstat (limited to 'uitask_windows.c')
-rw-r--r--uitask_windows.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/uitask_windows.c b/uitask_windows.c
index dec6ed2..49937c9 100644
--- a/uitask_windows.c
+++ b/uitask_windows.c
@@ -3,10 +3,6 @@
#include "winapi_windows.h"
#include "_cgo_export.h"
-// note that this includes the terminating '\0'
-// this also assumes WC_TABCONTROL is longer than areaWindowClass
-#define NCLASSNAME (sizeof WC_TABCONTROL / sizeof WC_TABCONTROL[0])
-
void uimsgloop_area(HWND active, HWND focus, MSG *msg)
{
MSG copy;
@@ -63,7 +59,7 @@ void uimsgloop(void)
MSG msg;
int res;
HWND active, focus;
- WCHAR classchk[NCLASSNAME];
+ WCHAR classchk[maxClassName + 1];
BOOL dodlgmessage;
for (;;) {
@@ -82,12 +78,9 @@ void uimsgloop(void)
// bit of logic involved here:
// we don't want dialog messages passed into Areas, so we don't call IsDialogMessageW() there
// as for Tabs, we can't have both WS_TABSTOP and WS_EX_CONTROLPARENT set at the same time, so we hotswap the two styles to get the behavior we want
- // theoretically we could use the class atom to avoid a wcscmp()
- // however, raymond chen advises against this - http://blogs.msdn.com/b/oldnewthing/archive/2004/10/11/240744.aspx (and we're not in control of the Tab class, before you say anything)
- // we could also theoretically just send msgAreaDefocuses directly, but what DefWindowProc() does to a WM_APP message is undocumented
focus = GetFocus();
if (focus != NULL) {
- if (GetClassNameW(focus, classchk, NCLASSNAME) == 0)
+ if (GetClassNameW(focus, classchk, maxClassName) == 0)
xpanic("error getting name of focused window class for Area check", GetLastError());
if (_wcsicmp(classchk, areaWindowClass) == 0) {
uimsgloop_area(active, focus, &msg);