From e6a70dd2856419cb039d4ceaf0dde5d9ccdaae7d Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 10 Mar 2013 08:09:21 +0000 Subject: [PATCH] *CtrlCore: Fixed GetActiveWindow issue, usvn: Fixed modality issue git-svn-id: svn://ultimatepp.org/upp/trunk@5895 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/GtkCreate.cpp | 12 ++++++++++++ uppsrc/CtrlCore/GtkCtrl.h | 1 + uppsrc/CtrlCore/GtkTop.cpp | 2 +- uppsrc/CtrlCore/GtkWnd.cpp | 6 +++++- uppsrc/usvn/SvnSync.cpp | 3 ++- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/uppsrc/CtrlCore/GtkCreate.cpp b/uppsrc/CtrlCore/GtkCreate.cpp index 7511d92ef..e02d44be0 100644 --- a/uppsrc/CtrlCore/GtkCreate.cpp +++ b/uppsrc/CtrlCore/GtkCreate.cpp @@ -78,6 +78,8 @@ void Ctrl::Create0(Ctrl *owner, bool popup) DndInit(); StateH(OPEN); + + activeCtrl = this; } void Ctrl::WndDestroy0() @@ -85,6 +87,16 @@ void Ctrl::WndDestroy0() GuiLock __; LLOG("WndDestroy " << Name()); DndExit(); + Ctrl *owner = GetOwner(); + if(owner && owner->top) { + for(int i = 0; i < wins.GetCount(); i++) + if(wins[i].ctrl && wins[i].ctrl->GetOwner() == this && wins[i].gtk) { + LLOG("Changing owner"); + gtk_window_set_transient_for((GtkWindow *)wins[i].gtk, owner->gtk()); + } + if(HasFocusDeep()) + activeCtrl = owner; + } gtk_widget_destroy(top->window); g_object_unref(top->im_context); isopen = false; diff --git a/uppsrc/CtrlCore/GtkCtrl.h b/uppsrc/CtrlCore/GtkCtrl.h index 9c5516afa..1ebee3e56 100644 --- a/uppsrc/CtrlCore/GtkCtrl.h +++ b/uppsrc/CtrlCore/GtkCtrl.h @@ -70,6 +70,7 @@ static Ptr grabwindow; static Ptr grabpopup; static Ptr sel_ctrl; + static Ptr activeCtrl; static int FindId(int id); static int FindCtrl(Ctrl *ctrl); diff --git a/uppsrc/CtrlCore/GtkTop.cpp b/uppsrc/CtrlCore/GtkTop.cpp index edce4c354..c0bcad994 100644 --- a/uppsrc/CtrlCore/GtkTop.cpp +++ b/uppsrc/CtrlCore/GtkTop.cpp @@ -134,7 +134,7 @@ void TopWindow::Open(Ctrl *owner) void TopWindow::Open() { - Open(GetActiveWindow()); //TODO! + Open(GetActiveWindow()); } void TopWindow::OpenMain() diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index ae763634a..2ffa6bc07 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -12,6 +12,8 @@ Vector Ctrl::modhot; Vector Ctrl::wins; +Ptr Ctrl::activeCtrl; + int Ctrl::WndCaretTime; bool Ctrl::WndCaretVisible; @@ -109,7 +111,9 @@ Ctrl *Ctrl::GetOwner() Ctrl *Ctrl::GetActiveCtrl() { GuiLock __; - return focusCtrl ? focusCtrl->GetTopCtrl() : NULL; + if(focusCtrl) + return focusCtrl->GetTopCtrl(); + return activeCtrl; } // Vector Ctrl::hotkey; diff --git a/uppsrc/usvn/SvnSync.cpp b/uppsrc/usvn/SvnSync.cpp index 4549b3dfb..42487d719 100644 --- a/uppsrc/usvn/SvnSync.cpp +++ b/uppsrc/usvn/SvnSync.cpp @@ -251,13 +251,14 @@ void SvnSync::DoSync() SyncList(); msgmap.Sweep(); again: - if(Execute() != IDOK || list.GetCount() == 0) { + if(Run() != IDOK || list.GetCount() == 0) { int repoi = 0; for(int i = 0; i < list.GetCount(); i++) if(list.Get(i, 0) == MESSAGE) msgmap.GetAdd(works[repoi++].working) = list.Get(i, 3); return; } + Disable(); bool changes = false; for(int i = 0; i < list.GetCount(); i++) { int action = list.Get(i, 0);