diff --git a/uppsrc/CtrlCore/CocoCreate.mm b/uppsrc/CtrlCore/CocoCreate.mm index 84b4d170e..4700ad891 100644 --- a/uppsrc/CtrlCore/CocoCreate.mm +++ b/uppsrc/CtrlCore/CocoCreate.mm @@ -44,6 +44,7 @@ Upp::Ctrl *Upp::Ctrl::GetActiveCtrl() bool Upp::Ctrl::SetWndFocus() { GuiLock __; + DLOG("SetWndFocus " << Name()); if(top && top->coco) { [top->coco->window orderFront:top->coco->window]; [top->coco->window makeKeyWindow]; @@ -107,7 +108,7 @@ void Upp::Ctrl::Create(Ctrl *owner, dword style, bool active) void Upp::Ctrl::WndDestroy() { - DLOG("WndDestroy " << this); + DLOG("WndDestroy " << Name()); if(!top) return; Ptr owner = GetOwner(); @@ -146,7 +147,7 @@ bool Upp::Ctrl::IsWndOpen() const { void Upp::Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost) { - Create(owner, NSWindowStyleMaskBorderless, activate); + Create(owner, NSWindowStyleMaskBorderless, false); } Upp::dword Upp::TopWindow::GetMMStyle() const diff --git a/uppsrc/CtrlCore/CocoDraw.mm b/uppsrc/CtrlCore/CocoDraw.mm index c26a5c6d8..b068a1210 100644 --- a/uppsrc/CtrlCore/CocoDraw.mm +++ b/uppsrc/CtrlCore/CocoDraw.mm @@ -74,21 +74,6 @@ void SystemDraw::OffsetOp(Point p) offset.Top() += p; } -#if 0 -CGRect SystemDraw::AsCG(const Rect& r) -{ - Point p = r.TopLeft(); - Size sz = r.GetSize(); - Convert(p.x, p.y); - CGRect cgr; - cgr.origin.x = p.x; - cgr.origin.y = p.y; - cgr.size.width = sz.cx; - cgr.size.height = sz.cy; - return cgr; -} -#endif - PointCG SystemDraw::Convert(int x, int y) { Point p = GetOffset(); // TODO: Optimize @@ -118,7 +103,6 @@ RectCG SystemDraw::MakeRectCG(const Rect& r) void SystemDraw::ClipCG(const Rect& r) { - DLOG("ClipCG " << r); CGContextClipToRect(cgHandle, MakeRectCG(r)); } diff --git a/uppsrc/CtrlCore/CocoProc.mm b/uppsrc/CtrlCore/CocoProc.mm index 766b2f0fa..f976b4837 100644 --- a/uppsrc/CtrlCore/CocoProc.mm +++ b/uppsrc/CtrlCore/CocoProc.mm @@ -77,7 +77,6 @@ struct MMImp { static void Paint(Upp::Ctrl *ctrl, Upp::SystemDraw& w, const Rect& r) { - DLOG("MMPaint " << r); ctrl->fullrefresh = false; ctrl->UpdateArea(w, r); } @@ -121,10 +120,8 @@ struct MMImp { static void DoClose(Upp::Ctrl *ctrl) { - DLOG("DoClose"); ctrl->MMClose(); } - }; }; @@ -192,12 +189,12 @@ struct MMImp { //TODO: more layout changes - (void)windowDidBecomeKey:(NSNotification *)notification { - DLOG("DidBecomeKey"); + DLOG("DidBecomeKey" << ctrl->Name()); Upp::MMImp::BecomeKey(ctrl); } - (void)windowDidResignKey:(NSNotification *)notification { - DLOG("DidResignKey"); + DLOG("DidResignKey " << ctrl->Name()); Upp::MMImp::ResignKey(ctrl); } diff --git a/uppsrc/CtrlCore/CtrlDraw.cpp b/uppsrc/CtrlCore/CtrlDraw.cpp index 7c0997c25..eddbf18a0 100644 --- a/uppsrc/CtrlCore/CtrlDraw.cpp +++ b/uppsrc/CtrlCore/CtrlDraw.cpp @@ -2,7 +2,7 @@ namespace Upp { -#define LLOG(x) DLOG(x) +#define LLOG(x) // DLOG(x) #define LTIMING(x) // TIMING(x) bool Ctrl::globalbackpaint; @@ -351,12 +351,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) { LTIMING("CtrlPaint"); Rect rect = GetRect().GetSize(); Rect orect = rect.Inflated(overpaint); - DDUMP(Name()); - DDUMP(orect); - DDUMP(clip); if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect)) return; - DLOG("2"); Ctrl *q; Rect view = rect; for(int i = 0; i < frame.GetCount(); i++) { diff --git a/uppsrc/CtrlCore/CtrlKbd.cpp b/uppsrc/CtrlCore/CtrlKbd.cpp index 88b9b24d4..d1bc9f0dd 100644 --- a/uppsrc/CtrlCore/CtrlKbd.cpp +++ b/uppsrc/CtrlCore/CtrlKbd.cpp @@ -2,7 +2,7 @@ namespace Upp { -#define LLOG(x) // DLOG(x) +#define LLOG(x) DLOG(x) Ptr Ctrl::focusCtrl; Ptr Ctrl::focusCtrlWnd; @@ -238,7 +238,11 @@ bool Ctrl::SetFocus0(bool activate) Ptr topwindow = GetTopWindow(); Ptr topctrl = GetTopCtrl(); Ptr _this = this; +#ifdef PLATFORM_COCOA + topwindow = topctrl; +#else if(!topwindow) topwindow = topctrl; +#endif LLOG("SetFocus -> SetWndFocus: topwindow = " << UPP::Name(topwindow) << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd)); if(!topwindow->HasWndFocus() && !topwindow->SetWndFocus()) return false;// cxl 31.1.2004 #ifdef PLATFORM_OSX11 // ugly temporary hack - popups not behaving right in MacOS @@ -372,9 +376,6 @@ String GetKeyDesc(dword key) if(key == 0) return desc; - DDUMPHEX(key); - DDUMPHEX(K_DELETE); - if(key & K_KEYUP) desc << t_("key\vUP "); if(key & K_CTRL) desc << t_("key\vCtrl+"); if(key & K_ALT) desc << t_("key\vAlt+"); @@ -383,8 +384,7 @@ String GetKeyDesc(dword key) if(key & K_OPTION) desc << t_("key\vOption+"); #endif - - key &= ~(K_CTRL | K_ALT | K_SHIFT | K_KEYUP); + key &= ~(K_CTRL | K_ALT | K_SHIFT | K_OPTION | K_KEYUP); #ifdef PLATFORM_COCOA key &= ~(K_OPTION); #endif @@ -460,14 +460,11 @@ String GetKeyDesc(dword key) { K_BACKSLASH, tt_("key\v[\\]") }, { K_RBRACKET, tt_("key\v[]]") }, { K_QUOTEDBL, tt_("key\v[']") }, { 0, NULL } }; - for(int i = 0; nkey[i].key; i++) { - DDUMPHEX(nkey[i].key); - DDUMP(nkey[i].name); + for(int i = 0; nkey[i].key; i++) if(nkey[i].key == key) { desc << GetLngString(nkey[i].name); return desc; } - } desc << Format("%04x", (int)key); } return desc; diff --git a/uppsrc/CtrlLib/PopupTable.cpp b/uppsrc/CtrlLib/PopupTable.cpp index 578d63cca..a04a9988b 100644 --- a/uppsrc/CtrlLib/PopupTable.cpp +++ b/uppsrc/CtrlLib/PopupTable.cpp @@ -27,7 +27,7 @@ void PopUpTable::DoClose() { } void PopUpTable::PopupDeactivate() { - if(open) { + if(open) {DLOG("Deactivate"); DoClose(); IgnoreMouseClick(); WhenCancel();