From 3d64143151359a79f229e5ba44113a7715284759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 25 Jan 2005 23:42:59 +0000 Subject: [PATCH] added code for a bottom line window, not working git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11053 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/BottomlineWindow.cpp | 78 ++++++++++++++++++++++++++ src/servers/input/BottomlineWindow.h | 38 +++++++++++++ src/servers/input/InputServer.cpp | 38 ++++++++++--- src/servers/input/InputServer.h | 3 + src/servers/input/Jamfile | 1 + 5 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 src/servers/input/BottomlineWindow.cpp create mode 100644 src/servers/input/BottomlineWindow.h diff --git a/src/servers/input/BottomlineWindow.cpp b/src/servers/input/BottomlineWindow.cpp new file mode 100644 index 0000000000..37493253e9 --- /dev/null +++ b/src/servers/input/BottomlineWindow.cpp @@ -0,0 +1,78 @@ +// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ +// +// Copyright (c) 2004, Haiku +// +// This software is part of the Haiku distribution and is covered +// by the Haiku license. +// +// +// File: BottomlineWindow.cpp +// Author: Jérôme Duval +// Description: Input server bottomline window +// Created : January 24, 2005 +// +// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + +#include "BottomlineWindow.h" +#include "InputServer.h" + +BottomlineWindow::BottomlineWindow(const BFont *font) + : BWindow(BRect(0,0,350,20), "", + (window_look) 25/*B_FLOATING_WINDOW_LOOK*/, + B_FLOATING_ALL_WINDOW_FEEL, + B_NOT_V_RESIZABLE | B_NOT_CLOSABLE | + B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS | + B_WILL_ACCEPT_FIRST_CLICK) +{ + BRect textRect = Bounds(); + textRect.OffsetTo(B_ORIGIN); + textRect.InsetBy(1,1); + fTextView = new BTextView(Bounds(), "", textRect, font, NULL, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS); + AddChild(fTextView); + + fTextView->SetText("coucou"); + + BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame()); + BPoint pt; + pt.x = 100; + pt.y = screenFrame.Height()*2/3 - Bounds().Height()/2; + + MoveTo(pt); + Show(); +} + + +BottomlineWindow::~BottomlineWindow() +{ + + +} + + +void +BottomlineWindow::MessageReceived(BMessage *msg) +{ + switch(msg->what) + { + default: + BWindow::MessageReceived(msg); + break; + } +} + + +bool +BottomlineWindow::QuitRequested() +{ + return true; +} + + +void +BottomlineWindow::HandleInputMethodEvent(BMessage *msg, BList *list) +{ + CALLED(); + + PostMessage(msg, fTextView); +} + diff --git a/src/servers/input/BottomlineWindow.h b/src/servers/input/BottomlineWindow.h new file mode 100644 index 0000000000..2f0f390097 --- /dev/null +++ b/src/servers/input/BottomlineWindow.h @@ -0,0 +1,38 @@ +// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ +// +// Copyright (c) 2005, Haiku +// +// This software is part of the Haiku distribution and is covered +// by the Haiku license. +// +// +// File: TMWindow.h +// Author: Jérôme Duval +// Description: Input server bottomline window +// Created : January 24, 2005 +// +// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + +#ifndef BOTTOMLINEWINDOW_H +#define BOTTOMLINEWINDOW_H + +#include +#include +#include + +class BottomlineWindow : public BWindow +{ +public: + BottomlineWindow(const BFont *font); + ~BottomlineWindow(); + + void MessageReceived(BMessage *msg); + virtual bool QuitRequested(); + + void HandleInputMethodEvent(BMessage *msg, BList *list); +//private: + BTextView *fTextView; +}; + + +#endif //BOTTOMLINEWINDOW_H diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 158f108139..7d1025445c 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -910,11 +910,28 @@ InputServer::HandleGetSetKeyMap(BMessage *message, * Descr: */ status_t -InputServer::HandleFocusUnfocusIMAwareView(BMessage *, - BMessage *) +InputServer::HandleFocusUnfocusIMAwareView(BMessage *message, + BMessage *reply) { - // TODO - return B_OK; + CALLED(); + + BMessenger messenger; + status_t status = message->FindMessenger("view", &messenger); + + if (status != B_OK) + return status; + + // check if current view is ours + + if (message->what == IS_FOCUS_IM_AWARE_VIEW) { + PRINT(("HandleFocusUnfocusIMAwareView : entering\n")); + fIMAware = true; + } else { + PRINT(("HandleFocusUnfocusIMAwareView : leaving\n")); + fIMAware = false; + } + + return status; } @@ -1101,8 +1118,15 @@ InputServer::DispatchEvents(BList *eventList) for ( int32 i = 0; NULL != (event = (BMessage *)fEventsCache.ItemAt(i)); i++ ) { // now we must send each event to the app_server - DispatchEvent(event); - + if (event->what == B_INPUT_METHOD_EVENT && !fIMAware) { + if (!fBLWindow) + fBLWindow = new BottomlineWindow(be_bold_font); + + fBLWindow->HandleInputMethodEvent(event, eventList); + } else { + DispatchEvent(event); + } + delete event; } @@ -1483,7 +1507,7 @@ InputServer::MethodizeEvents(BList *events, BList newList; newList.AddList(&fMethodQueue); fMethodQueue.MakeEmpty(); - + for (int32 i=0; iCountItems(); i++) { BMessage *item = (BMessage *)events->ItemAt(i); BList filterList; diff --git a/src/servers/input/InputServer.h b/src/servers/input/InputServer.h index 0398d78300..fcac961c63 100644 --- a/src/servers/input/InputServer.h +++ b/src/servers/input/InputServer.h @@ -36,6 +36,7 @@ #include #include #include "AddOnManager.h" +#include "BottomlineWindow.h" #include "DeviceManager.h" #include "MouseSettings.h" #include "KeyboardSettings.h" @@ -224,6 +225,8 @@ private: BInputServerMethod *fActiveMethod; BList fMethodQueue; const BMessenger *fReplicantMessenger; + BottomlineWindow *fBLWindow; + bool fIMAware; #ifndef COMPILE_FOR_R5 // added this to communicate via portlink diff --git a/src/servers/input/Jamfile b/src/servers/input/Jamfile index 4a602b3c74..2f7d4ca9cc 100644 --- a/src/servers/input/Jamfile +++ b/src/servers/input/Jamfile @@ -53,6 +53,7 @@ Server input_server : MethodReplicant.cpp MethodMenuItem.cpp + BottomlineWindow.cpp # storage AddOnMonitor.cpp