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 "InputDeviceView.h" 17 #include "InputTouchpadPrefView.h" 18 #include "InputWindow.h" 19 20 21 #undef B_TRANSLATION_CONTEXT 22 #define B_TRANSLATION_CONTEXT "InputApplication" 23 24 const char* kSignature = "application/x-vnd.Haiku-Input"; 25 26 27 InputApplication::InputApplication() 28 : 29 BApplication(kSignature), 30 fIcons() 31 { 32 BRect rect(0, 0, 600, 500); 33 InputWindow* window = new InputWindow(rect); 34 DeviceListItemView::SetIcons(&fIcons); 35 window->Show(); 36 } 37 38 39 void 40 InputApplication::MessageReceived(BMessage* message) 41 { 42 switch (message->what) { 43 case kMsgMouseType: 44 case kMsgMouseMap: 45 case kMsgMouseFocusMode: 46 case kMsgFollowsMouseMode: 47 case kMsgAcceptFirstClick: 48 case kMsgDoubleClickSpeed: 49 case kMsgMouseSpeed: 50 case kMsgAccelerationFactor: 51 case kMsgDefaults: 52 case kMsgRevert: 53 { 54 fWindow->PostMessage(message); 55 break; 56 } 57 case SCROLL_AREA_CHANGED: 58 case SCROLL_CONTROL_CHANGED: 59 case TAP_CONTROL_CHANGED: 60 case DEFAULT_SETTINGS: 61 case REVERT_SETTINGS: 62 { 63 fWindow->PostMessage(message); 64 break; 65 } 66 case kMsgSliderrepeatrate: 67 case kMsgSliderdelayrate: 68 { 69 fWindow->PostMessage(message); 70 break; 71 } 72 default: 73 BApplication::MessageReceived(message); 74 } 75 }; 76 77 78 int 79 main(int /*argc*/, char** /*argv*/) 80 { 81 InputApplication app; 82 app.Run(); 83 84 return 0; 85 } 86