From da192ba4dd10c8dffaff70f0105093a14e719f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 10 Mar 2006 16:53:50 +0000 Subject: [PATCH] implemented input_server notification of IM aware focus changes, not tested git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16690 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index e3642e0202..3226153efa 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -22,8 +22,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -2576,13 +2578,24 @@ BWindow::_SetFocus(BView *focusView, bool notifyInputServer) if (focusView) focusView->MakeFocus(true); - // TODO: Notify the input server if we are passing focus + // we notify the input server if we are passing focus // from a view which has the B_INPUT_METHOD_AWARE to a one // which does not, or vice-versa if (notifyInputServer) { - // TODO: Send a message to input server using - // control_input_server() + bool oldIMAware = false, newIMAware = false; + if (focusView) + newIMAware = focusView->Flags() & B_INPUT_METHOD_AWARE; + if (fFocus) + oldIMAware = fFocus->Flags() & B_INPUT_METHOD_AWARE; + if (newIMAware ^ oldIMAware) { + BMessage msg(newIMAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); + BMessage reply; + _control_input_server_(&msg, &reply); + // do we care return code ? + } } + + fFocus = focusView; }