Ticket #693: 693.diff
File 693.diff, 8.0 KB (added by , 16 years ago) |
---|
-
src/servers/app/Desktop.cpp
879 879 880 880 881 881 /*! 882 Returns the virtual screen frame of the workspace specified by \a index. 883 */ 884 BRect 885 Desktop::WorkspaceFrame(int32 index) const 886 { 887 BRect frame; 888 if (index == fCurrentWorkspace) 889 frame = fVirtualScreen.Frame(); 890 else if (index >= 0 && index < fSettings->WorkspacesCount()) { 891 BMessage screenData; 892 int32 width; 893 int32 height; 894 fSettings->WorkspacesMessage(index)->FindMessage("screen", &screenData); 895 if (screenData.FindInt32("width", &width) != B_OK || screenData.FindInt32("height", &height) != B_OK) 896 frame = fVirtualScreen.Frame(); 897 else 898 frame.Set(0.0, 0.0, width - 1, height - 1); 899 } 900 return frame; 901 } 902 903 904 /*! 882 905 Changes the current workspace to the one specified by \a index. 883 906 */ 884 907 void … … 923 946 int32 previousIndex = fCurrentWorkspace; 924 947 rgb_color previousColor = fWorkspaces[fCurrentWorkspace].Color(); 925 948 bool movedMouseEventWindow = false; 949 display_mode previousMode, newMode; 950 fVirtualScreen.ScreenAt(0)->GetMode(&previousMode); 951 fVirtualScreen.RestoreConfiguration(*this, fSettings->WorkspacesMessage(index)); 952 fVirtualScreen.ScreenAt(0)->GetMode(&newMode); 953 // We only need to invalidate the entire desktop if we changed display modes 954 if (memcmp(&previousMode, &newMode, sizeof(display_mode))) 955 ScreenChanged(fVirtualScreen.ScreenAt(0), false); 926 956 927 957 if (fMouseEventWindow != NULL) { 928 958 if (fMouseEventWindow->IsNormal()) { … … 1095 1125 BRegion dirty(screen->Frame()); 1096 1126 // update our cached screen region 1097 1127 fScreenRegion.Set(screen->Frame()); 1098 1128 gInputManager->UpdateScreenBounds(screen->Frame()); 1129 1099 1130 BRegion background; 1100 1131 _RebuildClippingForAllWindows(background); 1101 1132 … … 1122 1153 fVirtualScreen.UpdateFrame(); 1123 1154 1124 1155 if (makeDefault) { 1156 StoreConfiguration(fCurrentWorkspace); 1157 } 1158 } 1159 1160 1161 status_t 1162 Desktop::StoreConfiguration(int32 workspace) 1163 { 1164 if (workspace >= 0 && workspace < fSettings->WorkspacesCount()) { 1125 1165 // store settings 1126 1166 BMessage settings; 1127 1167 fVirtualScreen.StoreConfiguration(settings); 1128 fWorkspaces[ fCurrentWorkspace].StoreConfiguration(settings);1168 fWorkspaces[workspace].StoreConfiguration(settings); 1129 1169 1130 fSettings->SetWorkspacesMessage( fCurrentWorkspace, settings);1170 fSettings->SetWorkspacesMessage(workspace, settings); 1131 1171 fSettings->Save(kWorkspacesSettings); 1172 return B_OK; 1132 1173 } 1174 1175 return B_BAD_VALUE; 1133 1176 } 1134 1177 1135 1136 1178 // #pragma mark - Methods for Window manipulation 1137 1179 1138 1180 -
src/servers/app/Desktop.h
91 91 void GetLastMouseState(BPoint* position, 92 92 int32* buttons) const; 93 93 // for use by ServerWindow 94 95 94 void ScreenChanged(Screen* screen, bool makeDefault); 96 97 95 void ScreenRemoved(Screen* screen) {} 98 96 void ScreenAdded(Screen* screen) {} 99 97 bool ReleaseScreen(Screen* screen) { return false; } 98 status_t StoreConfiguration(int32 workspace); 100 99 101 100 const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; } 102 101 DrawingEngine* GetDrawingEngine() const … … 113 112 Workspace::Private& WorkspaceAt(int32 index) 114 113 { return fWorkspaces[index]; } 115 114 status_t SetWorkspacesCount(int32 newCount); 115 BRect WorkspaceFrame(int32 index) const; 116 116 117 117 // Window methods 118 118 -
src/servers/app/Screen.cpp
22 22 #include <stdlib.h> 23 23 #include <stdio.h> 24 24 25 26 25 static float 27 26 get_mode_frequency(const display_mode& mode) 28 27 { … … 91 90 status_t 92 91 Screen::SetMode(const display_mode& mode, bool makeDefault) 93 92 { 93 display_mode current; 94 GetMode(¤t); 95 current.flags = mode.flags; 96 if (!memcmp(&mode, ¤t, sizeof(display_mode))) 97 return B_OK; 98 94 99 gBitmapManager->SuspendOverlays(); 95 100 96 101 status_t status = fHWInterface->SetMode(mode); … … 162 167 * mode.timing.v_total / 10 * int32(frequency * 10)) / 1000; 163 168 adjusted = true; 164 169 } 165 166 170 status = SetMode(mode, false); 167 171 if (status < B_OK && adjusted) { 168 172 // try again with the unchanged mode -
src/servers/app/ServerApp.cpp
2167 2167 // 2) workspace index 2168 2168 // 3) display_mode to set 2169 2169 // 4) 'makeDefault' boolean 2170 // TODO: See above: workspaces support, etc.2171 2170 2172 2171 screen_id id; 2173 2172 link.Read<screen_id>(&id); … … 2183 2182 2184 2183 if (status == B_OK && fDesktop->LockAllWindows()) { 2185 2184 display_mode oldMode; 2186 fDesktop->ScreenAt(0)->GetMode(&oldMode); 2187 if (memcmp(&oldMode, &mode, sizeof(display_mode))) { 2188 status = fDesktop->ScreenAt(0)->SetMode(mode, makeDefault); 2189 if (status == B_OK) { 2190 gInputManager->UpdateScreenBounds(fDesktop->ScreenAt(0)->Frame()); 2191 fDesktop->ScreenChanged(fDesktop->ScreenAt(0), makeDefault); 2192 } 2193 } else 2194 status = B_OK; 2185 if (workspace == (uint32)fDesktop->CurrentWorkspace()) { 2186 fDesktop->ScreenAt(0)->GetMode(&oldMode); 2187 if (memcmp(&oldMode, &mode, sizeof(display_mode))) { 2188 status = fDesktop->ScreenAt(0)->SetMode(mode, makeDefault); 2189 if (status == B_OK) { 2190 fDesktop->ScreenChanged(fDesktop->ScreenAt(0), makeDefault); 2191 } 2192 } else 2193 status = B_OK; 2194 } else { 2195 // this is perhaps not ideal - it assumes that if the 2196 // workspace is not the active one, then pull the 2197 // configuration from active and store it to the specified 2198 // workspace. This is safer since it's assumed that the 2199 // active workspace has a display mode that's usable, 2200 // but at the same time the API implies that you can set 2201 // a non-visible workspace to whatever mode you like 2202 // TODO: decide what to do here. 2203 if (makeDefault) 2204 fDesktop->StoreConfiguration(workspace); 2205 } 2195 2206 fDesktop->UnlockAllWindows(); 2196 2207 } else 2197 2208 status = B_ERROR; -
src/servers/app/VirtualScreen.cpp
167 167 fDrawingEngine = screen->GetDrawingEngine(); 168 168 fHWInterface = screen->HWInterface(); 169 169 fFrame = screen->Frame(); 170 item->frame = fFrame; 170 171 171 172 fScreenList.AddItem(item); 172 173 -
src/servers/app/WorkspacesView.cpp
80 80 BRect 81 81 WorkspacesView::_ScreenFrame(int32 i) 82 82 { 83 return Window()->Desktop()-> VirtualScreen().Frame();83 return Window()->Desktop()->WorkspaceFrame(i); 84 84 } 85 85 86 86 -
src/preferences/screen/ScreenWindow.cpp
246 246 BMenuItem *item = new BMenuItem("Current Workspace", 247 247 new BMessage(WORKSPACE_CHECK_MSG)); 248 248 249 // TODO: since per workspace settings is unimplemented (Ticket #693)250 // we force the menu to "All Workspaces" for now251 fAllWorkspacesItem->SetMarked(true);252 item->SetEnabled(false);253 254 249 popUpMenu->AddItem(item); 250 fAllWorkspacesItem->SetMarked(true); 255 251 256 252 BMenuField* workspaceMenuField = new BMenuField(BRect(0, 0, 100, 15), 257 253 "WorkspaceMenu", NULL, popUpMenu, true); … … 1008 1004 void 1009 1005 ScreenWindow::_CheckApplyEnabled() 1010 1006 { 1011 fApplyButton->SetEnabled(fSelected != fActive); 1007 fApplyButton->SetEnabled(fSelected != fActive 1008 || fAllWorkspacesItem->IsMarked()); 1012 1009 fRevertButton->SetEnabled(count_workspaces() != fOriginalWorkspaceCount 1013 1010 || fSelected != fOriginal); 1014 1011 }