Now sends B_SCREEN_CHANGED messages to all windows when the screen resolution changes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15167 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-26 16:56:52 +00:00
parent 6e9ab86fc5
commit df36243372
3 changed files with 30 additions and 5 deletions
+27 -5
View File
@@ -480,6 +480,28 @@ Desktop::BroadcastToAllApps(int32 code)
}
void
Desktop::ScreenChanged(Screen* screen)
{
BMessage update(B_SCREEN_CHANGED);
update.AddInt64("when", real_time_clock_usecs());
update.AddRect("frame", screen->Frame());
update.AddInt32("mode", screen->ColorSpace());
BAutolock locker(this);
// send B_SCREEN_CHANGED to windows on that screen
// TODO: currently ignores the screen argument!
for (int32 i = fWindowLayerList.CountItems(); i-- > 0;) {
WindowLayer* layer = fWindowLayerList.ItemAt(i);
ServerWindow* window = layer->Window();
window->SendMessageToClient(&update);
}
}
// #pragma mark - Methods for WindowLayer manipulation
@@ -721,9 +743,9 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
int32 count = 0;
if (team >= B_OK) {
for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WindowLayer* border = fWindowLayerList.ItemAt(i);
WindowLayer* layer = fWindowLayerList.ItemAt(i);
if (border->Window()->ClientTeam() == team)
if (layer->Window()->ClientTeam() == team)
count++;
}
} else
@@ -735,12 +757,12 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
sender.Attach<int32>(count);
for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WindowLayer* border = fWindowLayerList.ItemAt(i);
WindowLayer* layer = fWindowLayerList.ItemAt(i);
if (team >= B_OK && border->Window()->ClientTeam() != team)
if (team >= B_OK && layer->Window()->ClientTeam() != team)
continue;
sender.Attach<int32>(border->Window()->ServerToken());
sender.Attach<int32>(layer->Window()->ServerToken());
}
sender.Flush();
+2
View File
@@ -63,6 +63,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
inline ::RootLayer* RootLayer() const { return fRootLayer; }
inline CursorManager& GetCursorManager() { return fCursorManager; }
void ScreenChanged(Screen* screen);
virtual void ScreenRemoved(Screen* screen) {}
virtual void ScreenAdded(Screen* screen) {}
virtual bool ReleaseScreen(Screen* screen) { return false; }
+1
View File
@@ -2109,6 +2109,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
mode.virtual_height - 1 - bounds.Height());
gInputManager->UpdateScreenBounds(rootLayer->Bounds());
fDesktop->ScreenChanged(fDesktop->ScreenAt(0));
}
rootLayer->Unlock();