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
This commit is contained in:
Jérôme Duval 2005-01-25 23:42:59 +00:00
parent ea3df577a3
commit 3d64143151
5 changed files with 151 additions and 7 deletions

View File

@ -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);
}

View File

@ -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 <Message.h>
#include <TextView.h>
#include <Window.h>
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

View File

@ -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; i<events->CountItems(); i++) {
BMessage *item = (BMessage *)events->ItemAt(i);
BList filterList;

View File

@ -36,6 +36,7 @@
#include <InputServerFilter.h>
#include <InputServerMethod.h>
#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

View File

@ -53,6 +53,7 @@ Server input_server :
MethodReplicant.cpp
MethodMenuItem.cpp
BottomlineWindow.cpp
# storage
AddOnMonitor.cpp