2 * Copyright 2011, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
11 #include <Application.h>
14 #include "CaptureWindow.h"
15 #include "PanelWindow.h"
18 #undef B_TRANSLATION_CONTEXT
19 #define B_TRANSLATION_CONTEXT "Switcher"
22 const char* kSignature
= "application/x-vnd.Haiku-Switcher";
27 BApplication(kSignature
),
39 Switcher::ReadyToRun()
41 CaptureWindow
* window
= new CaptureWindow();
44 fCaptureMessenger
= window
;
49 Switcher::MessageReceived(BMessage
* message
)
51 switch (message
->what
) {
52 case kMsgLocationTrigger
:
54 uint32 location
= (uint32
)message
->FindInt32("location");
55 if ((location
& fOccupiedLocations
) == 0) {
56 // TODO: make function configurable
57 uint32 which
= kShowApplicationWindows
;
58 if ((location
& (kTopEdge
| kBottomEdge
)) != 0)
59 which
= kShowApplications
;
61 new PanelWindow(location
, which
,
62 (team_id
)message
->FindInt32("team"));
63 fOccupiedLocations
|= location
;
68 case kMsgLocationFree
:
71 if (message
->FindInt32("location", (int32
*)&location
) == B_OK
)
72 fOccupiedLocations
&= ~location
;
76 case kMsgHideWhenMouseMovedOut
:
77 fCaptureMessenger
.SendMessage(message
);
81 BApplication::MessageReceived(message
);
91 main(int /*argc*/, char** /*argv*/)