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 fIcons() 32 { 33 BRect rect(0, 0, 600, 500); 34 InputWindow* window = new InputWindow(rect); 35 DeviceListItemView::SetIcons(&fIcons); 36 window->Show(); 37 } 38 39 40 void 41 InputApplication::MessageReceived(BMessage* message) 42 { 43 switch (message->what) { 44 case kMsgMouseType: 45 case kMsgMouseMap: 46 case kMsgMouseFocusMode: 47 case kMsgFollowsMouseMode: 48 case kMsgAcceptFirstClick: 49 case kMsgDoubleClickSpeed: 50 case kMsgMouseSpeed: 51 case kMsgAccelerationFactor: 52 case kMsgDefaults: 53 case kMsgRevert: 54 { 55 fWindow->PostMessage(message); 56 break; 57 } 58 case SCROLL_AREA_CHANGED: 59 case SCROLL_CONTROL_CHANGED: 60 case TAP_CONTROL_CHANGED: 61 case DEFAULT_SETTINGS: 62 case REVERT_SETTINGS: 63 { 64 fWindow->PostMessage(message); 65 break; 66 } 67 case kMsgSliderrepeatrate: 68 case kMsgSliderdelayrate: 69 { 70 fWindow->PostMessage(message); 71 break; 72 } 73 default: 74 BApplication::MessageReceived(message); 75 } 76 }; 77 78 79 int 80 main(int /*argc*/, char** /*argv*/) 81 { 82 InputApplication app; 83 app.Run(); 84 85 return 0; 86 } 87