* BWindow::Activate() now also unminimizes a window if necessary.
* Removed superfluous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -109,7 +109,7 @@ static property_info sWindowPropInfo[] = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"Feel", { B_GET_PROPERTY, B_SET_PROPERTY },
|
"Feel", { B_GET_PROPERTY, B_SET_PROPERTY },
|
||||||
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
|
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -161,7 +161,7 @@ static property_info sWindowPropInfo[] = {
|
|||||||
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_BOOL_TYPE }
|
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_BOOL_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
static value_info sWindowValueInfo[] = {
|
static value_info sWindowValueInfo[] = {
|
||||||
@@ -184,12 +184,12 @@ static value_info sWindowValueInfo[] = {
|
|||||||
"ResizeBy", 'WDRB', B_COMMAND_KIND,
|
"ResizeBy", 'WDRB', B_COMMAND_KIND,
|
||||||
"Resize by the offsets in the BPoint data"
|
"Resize by the offsets in the BPoint data"
|
||||||
},
|
},
|
||||||
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_set_menu_sem_(BWindow *window, sem_id sem)
|
_set_menu_sem_(BWindow *window, sem_id sem)
|
||||||
{
|
{
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
@@ -345,7 +345,7 @@ BWindow::BWindow(BMessage* data)
|
|||||||
|
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
while (data->FindMessage("_views", i++, &msg) == B_OK) {
|
while (data->FindMessage("_views", i++, &msg) == B_OK) {
|
||||||
BArchivable *obj = instantiate_object(&msg);
|
BArchivable *obj = instantiate_object(&msg);
|
||||||
BView *child = dynamic_cast<BView *>(obj);
|
BView *child = dynamic_cast<BView *>(obj);
|
||||||
if (child)
|
if (child)
|
||||||
@@ -419,10 +419,10 @@ BWindow::~BWindow()
|
|||||||
BArchivable *
|
BArchivable *
|
||||||
BWindow::Instantiate(BMessage *data)
|
BWindow::Instantiate(BMessage *data)
|
||||||
{
|
{
|
||||||
if (!validate_instantiation(data , "BWindow"))
|
if (!validate_instantiation(data , "BWindow"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return new BWindow(data);
|
return new BWindow(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ BWindow::Archive(BMessage* data, bool deep) const
|
|||||||
ret = data->AddFloat("_zoom", fMaxZoomHeight);
|
ret = data->AddFloat("_zoom", fMaxZoomHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fMinWidth != 0.0 || fMinHeight != 0.0
|
if (fMinWidth != 0.0 || fMinHeight != 0.0
|
||||||
|| fMaxWidth != 32768.0 || fMaxHeight != 32768.0) {
|
|| fMaxWidth != 32768.0 || fMaxHeight != 32768.0) {
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = data->AddFloat("_sizel", fMinWidth);
|
ret = data->AddFloat("_sizel", fMinWidth);
|
||||||
@@ -503,8 +503,8 @@ BWindow::Quit()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!IsHidden()) {
|
while (!IsHidden()) {
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fFlags & B_QUIT_ON_WINDOW_CLOSE)
|
if (fFlags & B_QUIT_ON_WINDOW_CLOSE)
|
||||||
@@ -656,7 +656,7 @@ BWindow::EndViewTransaction()
|
|||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
if (fInTransaction)
|
if (fInTransaction)
|
||||||
fLink->Flush();
|
fLink->Flush();
|
||||||
fInTransaction = false;
|
fInTransaction = false;
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -679,7 +679,7 @@ BWindow::IsFront() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::MessageReceived(BMessage *msg)
|
BWindow::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
if (!msg->HasSpecifiers()) {
|
if (!msg->HasSpecifiers()) {
|
||||||
@@ -699,7 +699,7 @@ BWindow::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
if (msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK)
|
if (msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK)
|
||||||
return BLooper::MessageReceived(msg);
|
return BLooper::MessageReceived(msg);
|
||||||
|
|
||||||
BPropertyInfo propertyInfo(sWindowPropInfo);
|
BPropertyInfo propertyInfo(sWindowPropInfo);
|
||||||
switch (propertyInfo.FindMatch(msg, index, &specifier, what, prop)) {
|
switch (propertyInfo.FindMatch(msg, index, &specifier, what, prop)) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -828,11 +828,11 @@ BWindow::MessageReceived(BMessage *msg)
|
|||||||
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
replyMsg.AddString("message", "Didn't understand the specifier(s)");
|
||||||
}
|
}
|
||||||
msg->SendReply(&replyMsg);
|
msg->SendReply(&replyMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::DispatchMessage(BMessage *msg, BHandler *target)
|
BWindow::DispatchMessage(BMessage *msg, BHandler *target)
|
||||||
{
|
{
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return;
|
return;
|
||||||
@@ -880,7 +880,7 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target)
|
|||||||
width = nextWidth;
|
width = nextWidth;
|
||||||
|
|
||||||
int32 nextHeight;
|
int32 nextHeight;
|
||||||
if (pendingMessage->FindInt32("height", &nextHeight) == B_OK)
|
if (pendingMessage->FindInt32("height", &nextHeight) == B_OK)
|
||||||
height = nextHeight;
|
height = nextHeight;
|
||||||
|
|
||||||
MessageQueue()->RemoveMessage(pendingMessage);
|
MessageQueue()->RemoveMessage(pendingMessage);
|
||||||
@@ -964,7 +964,7 @@ FrameMoved(origin);
|
|||||||
fTopView->_Activate(active);
|
fTopView->_Activate(active);
|
||||||
|
|
||||||
// we notify the input server if we are gaining or losing focus
|
// we notify the input server if we are gaining or losing focus
|
||||||
// from a view which has the B_INPUT_METHOD_AWARE on a window
|
// from a view which has the B_INPUT_METHOD_AWARE on a window
|
||||||
// (de)activation
|
// (de)activation
|
||||||
bool inputMethodAware = false;
|
bool inputMethodAware = false;
|
||||||
if (fFocus)
|
if (fFocus)
|
||||||
@@ -1055,7 +1055,7 @@ FrameMoved(origin);
|
|||||||
case B_MOUSE_DOWN:
|
case B_MOUSE_DOWN:
|
||||||
{
|
{
|
||||||
BView *view = dynamic_cast<BView *>(target);
|
BView *view = dynamic_cast<BView *>(target);
|
||||||
|
|
||||||
// Close an eventually opened menu
|
// Close an eventually opened menu
|
||||||
// unless the target is the menu itself
|
// unless the target is the menu itself
|
||||||
BMenu *menu = dynamic_cast<BMenu *>(fFocus);
|
BMenu *menu = dynamic_cast<BMenu *>(fFocus);
|
||||||
@@ -1063,9 +1063,9 @@ FrameMoved(origin);
|
|||||||
if (menu != NULL && menu != view
|
if (menu != NULL && menu != view
|
||||||
&& privMenu.State() != MENU_STATE_CLOSED) {
|
&& privMenu.State() != MENU_STATE_CLOSED) {
|
||||||
privMenu.QuitTracking();
|
privMenu.QuitTracking();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != NULL) {
|
if (view != NULL) {
|
||||||
BPoint where;
|
BPoint where;
|
||||||
msg->FindPoint("be:view_where", &where);
|
msg->FindPoint("be:view_where", &where);
|
||||||
@@ -1190,19 +1190,19 @@ FrameMoved(origin);
|
|||||||
fLink->Read<float>(&width);
|
fLink->Read<float>(&width);
|
||||||
fLink->Read<float>(&height);
|
fLink->Read<float>(&height);
|
||||||
if (origin != fFrame.LeftTop()) {
|
if (origin != fFrame.LeftTop()) {
|
||||||
// TODO: remove code duplicatation with
|
// TODO: remove code duplicatation with
|
||||||
// B_WINDOW_MOVED case...
|
// B_WINDOW_MOVED case...
|
||||||
//printf("window position was not up to date\n");
|
//printf("window position was not up to date\n");
|
||||||
fFrame.OffsetTo(origin);
|
fFrame.OffsetTo(origin);
|
||||||
FrameMoved(origin);
|
FrameMoved(origin);
|
||||||
}
|
}
|
||||||
if (width != fFrame.Width() || height != fFrame.Height()) {
|
if (width != fFrame.Width() || height != fFrame.Height()) {
|
||||||
// TODO: remove code duplicatation with
|
// TODO: remove code duplicatation with
|
||||||
// B_WINDOW_RESIZED case...
|
// B_WINDOW_RESIZED case...
|
||||||
//printf("window size was not up to date\n");
|
//printf("window size was not up to date\n");
|
||||||
fFrame.right = fFrame.left + width;
|
fFrame.right = fFrame.left + width;
|
||||||
fFrame.bottom = fFrame.top + height;
|
fFrame.bottom = fFrame.top + height;
|
||||||
|
|
||||||
_AdoptResize();
|
_AdoptResize();
|
||||||
FrameResized(width, height);
|
FrameResized(width, height);
|
||||||
}
|
}
|
||||||
@@ -1315,7 +1315,7 @@ FrameMoved(origin);
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BLooper::DispatchMessage(msg, target);
|
BLooper::DispatchMessage(msg, target);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1370,7 +1370,7 @@ BWindow::MenusEnded()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
||||||
float minHeight, float maxHeight)
|
float minHeight, float maxHeight)
|
||||||
{
|
{
|
||||||
if (minWidth > maxWidth || minHeight > maxHeight)
|
if (minWidth > maxWidth || minHeight > maxHeight)
|
||||||
@@ -1406,7 +1406,7 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::GetSizeLimits(float *minWidth, float *maxWidth,
|
BWindow::GetSizeLimits(float *minWidth, float *maxWidth,
|
||||||
float *minHeight, float *maxHeight)
|
float *minHeight, float *maxHeight)
|
||||||
{
|
{
|
||||||
// TODO: What about locking?!?
|
// TODO: What about locking?!?
|
||||||
@@ -1534,7 +1534,7 @@ BWindow::Zoom()
|
|||||||
float borderWidth = 5.0;
|
float borderWidth = 5.0;
|
||||||
float tabHeight = 26.0;
|
float tabHeight = 26.0;
|
||||||
|
|
||||||
// 1) the rectangle defined by SetZoomLimits(),
|
// 1) the rectangle defined by SetZoomLimits(),
|
||||||
float zoomedWidth = fMaxZoomWidth;
|
float zoomedWidth = fMaxZoomWidth;
|
||||||
float zoomedHeight = fMaxZoomHeight;
|
float zoomedHeight = fMaxZoomHeight;
|
||||||
|
|
||||||
@@ -1730,7 +1730,7 @@ BWindow::UpdateIfNeeded()
|
|||||||
// arrived at the server
|
// arrived at the server
|
||||||
Sync();
|
Sync();
|
||||||
|
|
||||||
// Since we're blocking the event loop, we need to retrieve
|
// Since we're blocking the event loop, we need to retrieve
|
||||||
// all messages that are pending on the port.
|
// all messages that are pending on the port.
|
||||||
_DequeueAll();
|
_DequeueAll();
|
||||||
|
|
||||||
@@ -1796,6 +1796,9 @@ BWindow::Activate(bool active)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsHidden()) {
|
if (!IsHidden()) {
|
||||||
|
fMinimized = false;
|
||||||
|
// activating a window will also unminimize it
|
||||||
|
|
||||||
fLink->StartMessage(AS_ACTIVATE_WINDOW);
|
fLink->StartMessage(AS_ACTIVATE_WINDOW);
|
||||||
fLink->Attach<bool>(active);
|
fLink->Attach<bool>(active);
|
||||||
fLink->Flush();
|
fLink->Flush();
|
||||||
@@ -1871,7 +1874,7 @@ BWindow::ConvertFromScreen(BRect rect) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BWindow::IsMinimized() const
|
BWindow::IsMinimized() const
|
||||||
{
|
{
|
||||||
// Hiding takes precendence over minimization!!!
|
// Hiding takes precendence over minimization!!!
|
||||||
@@ -2222,7 +2225,7 @@ BWindow::LastMouseMovedView() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::MoveBy(float dx, float dy)
|
BWindow::MoveBy(float dx, float dy)
|
||||||
{
|
{
|
||||||
if ((dx == 0.0 && dy == 0.0) || !Lock())
|
if ((dx == 0.0 && dy == 0.0) || !Lock())
|
||||||
@@ -2357,7 +2360,7 @@ BWindow::Hide()
|
|||||||
bool
|
bool
|
||||||
BWindow::IsHidden() const
|
BWindow::IsHidden() const
|
||||||
{
|
{
|
||||||
return fShowLevel <= 0;
|
return fShowLevel <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2450,7 +2453,7 @@ BWindow::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
// #pragma mark - Private Methods
|
// #pragma mark - Private Methods
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::_InitData(BRect frame, const char* title, window_look look,
|
BWindow::_InitData(BRect frame, const char* title, window_look look,
|
||||||
window_feel feel, uint32 flags, uint32 workspace, int32 bitmapToken)
|
window_feel feel, uint32 flags, uint32 workspace, int32 bitmapToken)
|
||||||
{
|
{
|
||||||
@@ -2553,7 +2556,7 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
|
|||||||
|
|
||||||
{
|
{
|
||||||
BPrivate::AppServerLink lockLink;
|
BPrivate::AppServerLink lockLink;
|
||||||
// we're talking to the server application using our own
|
// we're talking to the server application using our own
|
||||||
// communication channel (fLink) - we better make sure no one
|
// communication channel (fLink) - we better make sure no one
|
||||||
// interferes by locking that channel (which AppServerLink does
|
// interferes by locking that channel (which AppServerLink does
|
||||||
// implicetly)
|
// implicetly)
|
||||||
@@ -2612,7 +2615,7 @@ BWindow::_SetName(const char *title)
|
|||||||
if (title == NULL)
|
if (title == NULL)
|
||||||
title = "";
|
title = "";
|
||||||
|
|
||||||
// we will change BWindow's thread name to "w>window title"
|
// we will change BWindow's thread name to "w>window title"
|
||||||
|
|
||||||
char threadName[B_OS_NAME_LENGTH];
|
char threadName[B_OS_NAME_LENGTH];
|
||||||
strcpy(threadName, "w>");
|
strcpy(threadName, "w>");
|
||||||
@@ -2786,7 +2789,7 @@ BWindow::_ComposeType(window_look look, window_feel feel) const
|
|||||||
|
|
||||||
case B_BORDERED_WINDOW_LOOK:
|
case B_BORDERED_WINDOW_LOOK:
|
||||||
return B_BORDERED_WINDOW;
|
return B_BORDERED_WINDOW;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return B_UNTYPED_WINDOW;
|
return B_UNTYPED_WINDOW;
|
||||||
}
|
}
|
||||||
@@ -2861,7 +2864,7 @@ BWindow::_CreateTopView()
|
|||||||
// set fTopView's owner, add it to window's eligible handler list
|
// set fTopView's owner, add it to window's eligible handler list
|
||||||
// and also set its next handler to be this window.
|
// and also set its next handler to be this window.
|
||||||
|
|
||||||
STRACE(("Calling setowner fTopView = %p this = %p.\n",
|
STRACE(("Calling setowner fTopView = %p this = %p.\n",
|
||||||
fTopView, this));
|
fTopView, this));
|
||||||
|
|
||||||
fTopView->_SetOwner(this);
|
fTopView->_SetOwner(this);
|
||||||
@@ -2981,7 +2984,7 @@ BWindow::_DetermineTarget(BMessage *message, BHandler *target)
|
|||||||
return fLastMouseMovedView;
|
return fLastMouseMovedView;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3070,7 +3073,7 @@ BWindow::_UnpackMessage(unpack_cookie& cookie, BMessage** _message, BHandler** _
|
|||||||
if (gDefaultTokens.GetToken(cookie.focus_token, B_HANDLER_TOKEN, (void**)&handler) != B_OK
|
if (gDefaultTokens.GetToken(cookie.focus_token, B_HANDLER_TOKEN, (void**)&handler) != B_OK
|
||||||
|| handler->Looper() != this)
|
|| handler->Looper() != this)
|
||||||
dispatchToFocus = false;
|
dispatchToFocus = false;
|
||||||
|
|
||||||
if (dispatchToFocus && cookie.index > 0) {
|
if (dispatchToFocus && cookie.index > 0) {
|
||||||
// should this message still be dispatched by the focus view?
|
// should this message still be dispatched by the focus view?
|
||||||
bool feedFocus;
|
bool feedFocus;
|
||||||
@@ -3212,7 +3215,7 @@ BWindow::_StealMouseMessage(BMessage* message, bool& deleteMessage)
|
|||||||
int32 token;
|
int32 token;
|
||||||
if (message->FindInt32("_view_token", &token) == B_OK)
|
if (message->FindInt32("_view_token", &token) == B_OK)
|
||||||
viewUnderMouse = _FindView(token);
|
viewUnderMouse = _FindView(token);
|
||||||
|
|
||||||
fLastMouseMovedView = viewUnderMouse;
|
fLastMouseMovedView = viewUnderMouse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3323,7 +3326,7 @@ BWindow::_HandleKeyDown(BMessage* event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle shortcuts
|
// Handle shortcuts
|
||||||
if ((modifiers & B_COMMAND_KEY) != 0) {
|
if ((modifiers & B_COMMAND_KEY) != 0) {
|
||||||
// Command+q has been pressed, so, we will quit
|
// Command+q has been pressed, so, we will quit
|
||||||
|
|||||||
@@ -1535,6 +1535,13 @@ Desktop::ActivateWindow(Window* window)
|
|||||||
SetWindowWorkspaces(window, workspaces);
|
SetWindowWorkspaces(window, workspaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window->IsMinimized()) {
|
||||||
|
// Unlike WindowAction(), this is called from the application itself,
|
||||||
|
// so we will just unminimize the window here.
|
||||||
|
ShowWindow(window);
|
||||||
|
window->SetMinimized(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (window == FrontWindow()) {
|
if (window == FrontWindow()) {
|
||||||
// see if there is a normal B_AVOID_FRONT window still in front of us
|
// see if there is a normal B_AVOID_FRONT window still in front of us
|
||||||
Window* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
Window* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
||||||
@@ -2389,12 +2396,13 @@ Desktop::WindowAction(int32 windowToken, int32 action)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == B_BRING_TO_FRONT
|
if (action == B_BRING_TO_FRONT && !window->IsMinimized()) {
|
||||||
&& !window->IsMinimized()) {
|
|
||||||
// the window is visible, we just need to make it the front window
|
// the window is visible, we just need to make it the front window
|
||||||
ActivateWindow(window);
|
ActivateWindow(window);
|
||||||
} else
|
} else {
|
||||||
|
// if not, ask the window if it wants to be unminimized
|
||||||
serverWindow->NotifyMinimize(action == B_MINIMIZE_WINDOW);
|
serverWindow->NotifyMinimize(action == B_MINIMIZE_WINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
UnlockAllWindows();
|
UnlockAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user