From 54f92239a2cca528b78c0aa1b457d0e63fb5ca50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 8 Oct 2008 07:46:27 +0000 Subject: [PATCH] * The ServerWindow now memorizes the original BDirectWindow feel when switching to full screen. Since BDirectWindows can have any feel, this does now correctly restore it instead of always reverting to B_NORMAL_WINDOW_FEEL. * This fixes part of bug #2808. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27920 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerWindow.cpp | 10 ++++++++-- src/servers/app/ServerWindow.h | 5 +++-- src/servers/app/Window.cpp | 12 ++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index e57ee3f12d..2801baa27a 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -167,7 +167,8 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app, fCurrentDrawingRegion(), fCurrentDrawingRegionValid(false), - fDirectWindowData(NULL) + fDirectWindowData(NULL), + fDirectWindowFeel(B_NORMAL_WINDOW_FEEL) { STRACE(("ServerWindow(%s)::ServerWindow()\n", title)); @@ -184,6 +185,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app, fDeathSemaphore = create_sem(0, "window death"); } + #ifdef PROFILE_MESSAGE_LOOP static int compare_message_profiles(const void* _a, const void* _b) @@ -1087,14 +1089,18 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) case AS_DIRECT_WINDOW_SET_FULLSCREEN: { // TODO: maybe there is more to do than this? + // (like resizing it to screen size?) bool enable; link.Read(&enable); status_t status = B_OK; if (!fWindow->IsOffscreenWindow()) { //fDesktop->UnlockSingleWindow(); + if (enable) + fDirectWindowFeel = fWindow->Feel(); + fDesktop->SetWindowFeel(fWindow, - enable ? kWindowScreenFeel : B_NORMAL_WINDOW_FEEL); + enable ? kWindowScreenFeel : fDirectWindowFeel); //fDesktop->LockSingleWindow(); } else status = B_BAD_TYPE; diff --git a/src/servers/app/ServerWindow.h b/src/servers/app/ServerWindow.h index d81f19da55..053a77e4ba 100644 --- a/src/servers/app/ServerWindow.h +++ b/src/servers/app/ServerWindow.h @@ -50,7 +50,7 @@ struct window_info; class ServerWindow : public MessageLooper { public: ServerWindow(const char *title, ServerApp *app, - port_id clientPort, port_id looperPort, + port_id clientPort, port_id looperPort, int32 clientToken); virtual ~ServerWindow(); @@ -91,7 +91,7 @@ public: // related thread/team_id(s). inline team_id ClientTeam() const { return fClientTeam; } - + void HandleDirectConnection(int32 bufferState = -1, int32 driverState = -1); @@ -163,6 +163,7 @@ private: bool fCurrentDrawingRegionValid; direct_window_data* fDirectWindowData; + window_feel fDirectWindowFeel; }; #endif // SERVER_WINDOW_H diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index d675bb19d1..8928f0a72e 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -151,7 +151,7 @@ Window::Window(const BRect& frame, const char *name, // _ResizeBy() will adapt the frame for validity before resizing if (feel == kDesktopWindowFeel) { // the desktop window spans over the whole screen - // ToDo: this functionality should be moved somewhere else + // TODO: this functionality should be moved somewhere else // (so that it is always used when the workspace is changed) uint16 width, height; uint32 colorSpace; @@ -1435,7 +1435,7 @@ Window::HasModal() const /*! \brief Returns the windows that's in behind of the backmost position this window can get. - Returns NULL is this window can be the backmost window. + Returns NULL is this window can be the backmost window. */ Window* Window::Backmost(Window* window, int32 workspace) @@ -1464,7 +1464,7 @@ Window::Backmost(Window* window, int32 workspace) /*! \brief Returns the windows that's in front of the frontmost position this window can get. - Returns NULL if this window can be the frontmost window. + Returns NULL if this window can be the frontmost window. */ Window* Window::Frontmost(Window* first, int32 workspace) @@ -1505,6 +1505,10 @@ Window::RemoveFromSubset(Window* window) } +/*! Returns whether or not a window is in the subset of this window. + If a window is in the subset of this window, it means it should always + appear behind this window. +*/ bool Window::HasInSubset(const Window* window) const { @@ -1516,7 +1520,7 @@ Window::HasInSubset(const Window* window) const // of their application if (fFeel == kMenuWindowFeel) return window->ServerWindow()->App() == ServerWindow()->App(); - else if (window->Feel() == kMenuWindowFeel) + if (window->Feel() == kMenuWindowFeel) return false; // we have a few special feels that have a fixed order