xref: /haiku/src/preferences/input/Input.cpp (revision 15fb7d88e971c4d6c787c6a3a5c159afb1ebf77b)
1 /*
2  * Copyright 2019, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  *
5  * Author:
6  *		Preetpal Kaur <preetpalok123@gmail.com>
7  */
8 
9 
10 #include "Input.h"
11 
12 #include <GroupLayout.h>
13 #include <GroupLayoutBuilder.h>
14 
15 #include "InputConstants.h"
16 #include "InputMouse.h"
17 #include "InputWindow.h"
18 #include "MouseSettings.h"
19 #include "MouseView.h"
20 
21 
22 #undef B_TRANSLATION_CONTEXT
23 #define B_TRANSLATION_CONTEXT "InputApplication"
24 
25 const char* kSignature = "application/x-vnd.Haiku-Input";
26 
27 
28 InputApplication::InputApplication()
29 	:
30 	BApplication(kSignature)
31 {
32 	BRect rect(0, 0, 600, 500);
33 	InputWindow* window = new InputWindow(rect);
34 	window->Show();
35 }
36 
37 void
38 InputApplication::MessageReceived(BMessage* message)
39 {
40 	switch (message->what) {
41 		case kMsgMouseType:
42 		case kMsgMouseMap:
43 		case kMsgMouseFocusMode:
44 		case kMsgFollowsMouseMode:
45 		case kMsgAcceptFirstClick:
46 		case kMsgDoubleClickSpeed:
47 		case kMsgMouseSpeed:
48 		case kMsgAccelerationFactor:
49 		case kMsgDefaults:
50 		case kMsgRevert:
51 		{
52 			fWindow->PostMessage(message);
53 			break;
54 		}
55 		case SCROLL_AREA_CHANGED:
56 		case SCROLL_CONTROL_CHANGED:
57 		case TAP_CONTROL_CHANGED:
58 		case DEFAULT_SETTINGS:
59 		case REVERT_SETTINGS:
60 		{
61 			fWindow->PostMessage(message);
62 			break;
63 		}
64 		case kMsgSliderrepeatrate:
65 		case kMsgSliderdelayrate:
66 		{
67 			fWindow->PostMessage(message);
68 			break;
69 		}
70 	default:
71 		BApplication::MessageReceived(message);
72 	}
73 };
74 
75 
76 int
77 main(int /*argc*/, char** /*argv*/)
78 {
79 	InputApplication app;
80 	app.Run();
81 
82 	return 0;
83 }
84