X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfafa7029d8d5b19b348f1b080cd71a42829d804..3317223b08943c74ee4c7956b6aa9a3e72f87d77:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index a452a8a00e..ebd05bfd52 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -179,7 +179,7 @@ static void TranslateKbdEventToMouse(wxWindowMSW *win, static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win); // find the window for the mouse event at the specified position -static wxWindowMSW *FindWindowForMouseEvent(wxWindow *win, int *x, int *y); +static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y); //TW:REQ:Univ // wrapper around BringWindowToTop() API static inline void wxBringWindowToTop(HWND hwnd) @@ -413,7 +413,10 @@ bool wxWindowMSW::Create(wxWindow *parent, #ifdef __WXUNIVERSAL__ // no borders, we draw them ourselves - exstyle = 0; + exstyle &= ~(WS_EX_DLGMODALFRAME | + WS_EX_STATICEDGE | + WS_EX_CLIENTEDGE | + WS_EX_WINDOWEDGE); msflags &= ~WS_BORDER; #endif // wxUniversal @@ -1996,12 +1999,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) return TRUE; } else // no default button -#endif // wxUSE_BUTTON { - // no special function for enter and don't even - // let IsDialogMessage() have it: it seems to - // do something really strange with it - return FALSE; +#endif // wxUSE_BUTTON + // this is a quick and dirty test for a text + // control + if ( !(lDlgCode & DLGC_HASSETSEL) ) + { + // don't process Enter, the control might + // need it for itself and don't let + // ::IsDialogMessage() have it as it can + // eat the Enter events sometimes + return FALSE; + } + //else: treat Enter as TAB: pass to the next + // control as this is the best thing to do + // if the text doesn't handle Enter itself } } } @@ -2412,9 +2424,15 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam y = GET_Y_LPARAM(lParam); // redirect the event to a static control if necessary - wxWindow *win = FindWindowForMouseEvent(this, &x, &y); - - processed = win->HandleMouseEvent(message, x, y, wParam); + if (this == GetCapture()) + { + processed = HandleMouseEvent(message, x, y, wParam); + } + else + { + wxWindowMSW *win = FindWindowForMouseEvent(this, &x, &y); //TW:REQ:Univ + processed = win->HandleMouseEvent(message, x, y, wParam); + } } } break; @@ -2828,6 +2846,9 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, int& x, int& y, int& w, int& h) const { + static const int DEFAULT_Y = 200; + static const int DEFAULT_H = 250; + bool nonDefault = FALSE; if ( pos.x == -1 ) @@ -2839,8 +2860,11 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, } else { + // OTOH, if x is not set to CW_USEDEFAULT, y shouldn't be set to it + // neither because it is not handled as a special value by Windows then + // and so we have to choose some default value for it x = pos.x; - y = pos.y == -1 ? CW_USEDEFAULT : pos.y; + y = pos.y == -1 ? DEFAULT_Y : pos.y; nonDefault = TRUE; } @@ -2863,14 +2887,15 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, */ if ( size.x == -1 ) { - // as abobe, h is not used at all in this case anyhow + // as above, h is not used at all in this case anyhow w = h = CW_USEDEFAULT; } else { + // and, again as above, we can't set the height to CW_USEDEFAULT here w = size.x; - h = size.y == -1 ? CW_USEDEFAULT : size.y; + h = size.y == -1 ? DEFAULT_H : size.y; nonDefault = TRUE; } @@ -2893,31 +2918,19 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass, wxWindow *parent = GetParent(); bool isChild = (style & WS_CHILD) != 0; HWND hParent; - if ( GetWindowStyleFlag() & wxPOPUP_WINDOW ) + if ( (isChild || HasFlag(wxPOPUP_WINDOW) || HasFlag(wxFRAME_TOOL_WINDOW)) ) { - // popup windows should have desktop as parent because they shouldn't - // be limited to the parents client area as child windows usually are - hParent = ::GetDesktopWindow(); + // this is either a normal child window, a popup window or a top level + // window with wxFRAME_TOOL_WINDOW style (see below) + hParent = parent ? GetHwndOf(parent) : NULL; } - else // !popup + else { - if ( (isChild || HasFlag(wxFRAME_TOOL_WINDOW)) && parent ) - { - // this is either a normal child window or a top level window with - // wxFRAME_TOOL_WINDOW style (see below) - hParent = GetHwndOf(parent); - } - else - { - // this is either a window for which no parent was specified (not - // much we can do then) or a frame without wxFRAME_TOOL_WINDOW - // style: we should use NULL parent HWND for it or it would be - // always on top of its parent which is not what we usually want - // (in fact, we only want it for frames with the special - // wxFRAME_TOOL_WINDOW as above) - hParent = NULL; - } - + // this is a frame without wxFRAME_TOOL_WINDOW style: we should use + // NULL parent HWND for it or it would be always on top of its parent + // which is not what we usually want (in fact, we only want it for + // frames with the special wxFRAME_TOOL_WINDOW as above) + hParent = NULL; } // controlId is menu handle for the top level windows, so set it to 0 @@ -3970,7 +3983,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event, // Notice that this is not done for the mouse move events because this could // (would?) be too slow, but only for clicks which means that the static texts // still don't get move, enter nor leave events. -static wxWindowMSW *FindWindowForMouseEvent(wxWindow *win, int *x, int *y) +static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y) //TW:REQ:Univ { wxCHECK_MSG( x && y, win, _T("NULL pointer in FindWindowForMouseEvent") );