From 04df76330e9ec77683cc66029091840d4d702efd Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 12 Jan 2013 16:13:57 +0000 Subject: [PATCH] *CtrlCore: Gtk fixed issue with delayed activatation (#411) git-svn-id: svn://ultimatepp.org/upp/trunk@5707 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/GtkCtrl.h | 1 - uppsrc/CtrlCore/GtkEvent.cpp | 27 ++++++--------------------- uppsrc/CtrlCore/GtkWnd.cpp | 1 + 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/uppsrc/CtrlCore/GtkCtrl.h b/uppsrc/CtrlCore/GtkCtrl.h index 59f88271b..18ed78e46 100644 --- a/uppsrc/CtrlCore/GtkCtrl.h +++ b/uppsrc/CtrlCore/GtkCtrl.h @@ -56,7 +56,6 @@ void Proc(); bool SweepConfigure(bool wait); bool SweepFocus(bool wait); - void ProcessFocusEvent(const Event& e); static bool EventMouseValid; static Point EventMousePos; diff --git a/uppsrc/CtrlCore/GtkEvent.cpp b/uppsrc/CtrlCore/GtkEvent.cpp index 4e0ab0cae..7fbb5a2df 100644 --- a/uppsrc/CtrlCore/GtkEvent.cpp +++ b/uppsrc/CtrlCore/GtkEvent.cpp @@ -124,11 +124,13 @@ gboolean Ctrl::GtkEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data) case GDK_DELETE: break; case GDK_FOCUS_CHANGE: - if(p) + if(p) { if(((GdkEventFocus *)event)->in) gtk_im_context_focus_in(p->top->im_context); else gtk_im_context_focus_in(p->top->im_context); + AddEvent(user_data, EVENT_NONE, value); + } return false; case GDK_LEAVE_NOTIFY: EventMouseValid = false; @@ -461,9 +463,6 @@ void Ctrl::Proc() } return; } -// case GDK_FOCUS_CHANGE: -// ProcessFocusEvent(CurrentEvent); -// return; case GDK_CONFIGURE: { Rect rect = CurrentEvent.value; if(GetRect() != rect) @@ -477,21 +476,6 @@ void Ctrl::Proc() _this->PostInput(); } -void Ctrl::ProcessFocusEvent(const Event& e) -{ - LLOG("FocusChange in: " << (bool)e.value << ", focusCtrlWnd " << Upp::Name(focusCtrlWnd)); - if((bool)e.value) { - gtk_im_context_focus_in(top->im_context); - if(this != focusCtrlWnd) { - LLOG("Activate " << Name()); - SetFocusWnd(); - } - } - else { - gtk_im_context_focus_out(top->im_context); - KillFocusWnd(); - } -} bool Ctrl::ProcessEvent0(bool *quit, bool fetch) { @@ -526,11 +510,12 @@ bool Ctrl::ProcessEvent0(bool *quit, bool fetch) FocusSync(); if(w) w->Proc(); - FocusSync(); r = true; } if(quit) *quit = IsEndSession(); + FocusSync(); + SyncCaret(); return r; } @@ -540,7 +525,7 @@ bool Ctrl::ProcessEvent(bool *quit) } gboolean Ctrl::TimeHandler(GtkWidget *) -{ +{ // we only need timer to periodically break blocking g_main_context_iteration return true; } diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index 29f0902be..f0c0b2c1c 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -331,6 +331,7 @@ void Ctrl::FocusSync() ctrl = focus; if(ctrl) ctrl->SetFocusWnd(); + SyncCaret(); } }