xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Desktop.cpp File Reference
#include "Desktop.h"
#include <gdiplus.h>

Functions

LRESULT CALLBACK DesktopWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

const char szDesktopName [] = "BBDesktop"
 
DesktoppDesktop
 
SettingspSettings
 
MenuCommonpMenuCommon
 
ToolbarpToolbar
 
TaskbarpTaskbar
 
WorkspacespWorkspaces
 
int desktopMessageSubscription [] = { BB_RECONFIGURE, BB_WINDOWSHADE, BB_WINDOWLOWER, BB_WINDOWRAISE, BB_WINDOWGROWHEIGHT, BB_WINDOWGROWWIDTH, 0 }
 

Function Documentation

◆ DesktopWndProc()

LRESULT CALLBACK DesktopWndProc ( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam )
152{
153
154 switch (message)
155 {
156 //====================
157
158 case BB_RECONFIGURE:
159 case WM_DISPLAYCHANGE:
160 {
161 // Update the desktop's dimensions if the screen resolution changes...
162 pDesktop->GetClockText(true);
163 pDesktop->GetGreetingText(true);
164 pDesktop->UpdateDesktopWindow();
165
167 else if (message == WM_DISPLAYCHANGE)
168 {
169 int tempMonitors = GetSystemMetrics(SM_CMONITORS);
170 if (pDesktop->numberOfDisplayMonitors != tempMonitors)
171 {
172 char msg[255];
173 if (tempMonitors > pDesktop->numberOfDisplayMonitors) strcpy(msg, "System -> Display monitor attached.");
174 else if (tempMonitors < pDesktop->numberOfDisplayMonitors) strcpy(msg, "System -> Display monitor removed.");
175 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
176
177 pDesktop->numberOfDisplayMonitors = tempMonitors;
178 }
179 }
180 break;
181 }
182
183 case WM_SETTINGCHANGE:
184 {
185 if (wParam == SPI_SETWORKAREA)
186 {
187 // Update the desktop's dimensions and position if the work area changes...
188 // (e.g. if the Explorer taskbar is moved to another screen edge)
189 pDesktop->UpdateDesktopWindow();
190
191 // ...and notify plugins that the desktop work area has changed...
192 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DESKTOP, 0);
193 }
194 return 0;
195 }
196/*
197 case WM_WINDOWPOSCHANGED:
198 {
199 // Move the desktop window back to the bottom of the z-order if its place in it changes...
200// SetWindowPos(pDesktop->hDesktopWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
201// SetWindowPos(pDesktop->hDesktopWnd, GetDesktopWindow(), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
202// SetWindowPos(pDesktop->hDesktopWnd, GetDesktopWindow(), pDesktop->DesktopX, pDesktop->DesktopX, pDesktop->DesktopWidth, pDesktop->DesktopHeight, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
203// SetWindowPos(pDesktop->hDesktopWnd, GetDesktopWindow(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOOWNERZORDER);
204 if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)"WM_WINDOWPOSCHANGED");
205// if (pSettings->debugLogging) Log("Desktop: WM_WINDOWPOSCHANGED", "");
206 return 0;
207 }
208*/
209/*
210 case WM_GETMINMAXINFO:
211 {
212 // Not sure if this is really needed since we don't allow the desktop window to be moved/resized anyway, but just in case... ;)
213 MINMAXINFO* mmi = (MINMAXINFO*)lParam;
214 mmi->ptMaxPosition.x = pDesktop->DesktopX;
215 mmi->ptMaxPosition.y = pDesktop->DesktopY;
216 mmi->ptMaxSize.x = pDesktop->DesktopWidth;
217 mmi->ptMaxSize.y = pDesktop->DesktopHeight;
218 return 0;
219 }
220*/
221 //====================
222
223 case WM_TIMER:
224 {
225 // Is it time to update the desktop clock/weekday/date?
226 if (!pSettings->desktopClockHidden || !pSettings->desktopWeekdayHidden || !pSettings->desktopDateHidden || !pSettings->desktopGreetingHidden)
227 {
228 if (pDesktop->GetClockText(false))
229 {
230 // Clock timestamp has changed; update the other widgets too, then the Desktop...
231 pDesktop->GetGreetingText(true);
232 pDesktop->UpdateDesktopWindow();
233 }
234 }
235 return 0;
236 }
237
238 //====================
239
240 case WM_CLOSE:
241 return 0;
242
243 //====================
244
245 case WM_MOUSEACTIVATE:
246 return MA_NOACTIVATE;
247/*
248 case WM_ACTIVATE:
249 {
250 if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) SetActiveWindow(hwnd);
251 return 0;
252 }
253 break;
254*/
255 //====================
256
257 case WM_NCHITTEST:
258 return HTCLIENT;
259
260 case WM_LBUTTONDOWN:
261 case WM_LBUTTONUP:
262// case WM_LBUTTONDBLCLK:
263 case WM_RBUTTONDOWN:
264 case WM_RBUTTONUP:
265 case WM_MBUTTONDOWN:
266 case WM_MBUTTONUP:
267 case WM_XBUTTONDOWN:
268 case WM_XBUTTONUP:
269 case WM_MOUSEWHEEL:
270 case WM_MOUSEHWHEEL:
271 case WM_DROPFILES:
272 {
273 // First we set focus to the main Blackbox window, in order to prevent the
274 // focus from going back to the previous task after e.g. the menu is closed...
275 SetForegroundWindow(GetBBWnd());
276 pDesktop->MouseAndDropHandler(pDesktop->hDesktopWnd, message, wParam, lParam);
277 return 0;
278 }
279 break;
280
281 //====================
282
283 case BB_WINDOWSHADE:
284 pDesktop->ShadeWindow();
285 break;
287 pDesktop->GrowWindowHeight();
288 break;
290 pDesktop->GrowWindowWidth();
291 break;
292 case BB_WINDOWLOWER:
293 pDesktop->LowerWindow();
294 break;
295 case BB_WINDOWRAISE:
296 pDesktop->RaiseWindow();
297 break;
298
299 //====================
300
301 default:
302 return DefWindowProc(hwnd, message, wParam, lParam);
303
304 //====================
305 }
306
307 return 0;
308}
Desktop * pDesktop
Definition Blackbox.cpp:37
Settings * pSettings
Definition Blackbox.cpp:46
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define CONSOLE_REGULAR_MESSAGE
Definition BBApi.h:297
#define BB_REDRAWGUI
Definition BBApi.h:220
#define BB_RECONFIGURE
Definition BBApi.h:147
#define BB_WINDOWSHADE
Definition BBApi.h:202
#define BB_WINDOWGROWHEIGHT
Definition BBApi.h:203
#define BB_WINDOWLOWER
Definition BBApi.h:205
#define BBRG_DESKTOP
Definition BBApi.h:225
#define BB_WINDOWRAISE
Definition BBApi.h:208
#define BB_WINDOWGROWWIDTH
Definition BBApi.h:204
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_RECONFIGURE
Definition Sounds.h:39

Variable Documentation

◆ szDesktopName

const char szDesktopName[] = "BBDesktop"

◆ pDesktop

Desktop* pDesktop
extern

◆ pSettings

Settings* pSettings
extern

◆ pMenuCommon

MenuCommon* pMenuCommon
extern

◆ pToolbar

Toolbar* pToolbar
extern

◆ pTaskbar

Taskbar* pTaskbar
extern

◆ pWorkspaces

Workspaces* pWorkspaces
extern

◆ desktopMessageSubscription