blob: e82eecd78d36dd8ea3aa40f5c9c487e866a7d362 [file]
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gestures/GestureConverterCommon.h"
#include <stdint.h>
#include "android/input.h"
#include "include/gestures.h"
namespace android {
int32_t gesturesButtonToMotionEventButton(uint32_t gesturesButton) {
switch (gesturesButton) {
case GESTURES_BUTTON_LEFT:
return AMOTION_EVENT_BUTTON_PRIMARY;
case GESTURES_BUTTON_MIDDLE:
return AMOTION_EVENT_BUTTON_TERTIARY;
case GESTURES_BUTTON_RIGHT:
return AMOTION_EVENT_BUTTON_SECONDARY;
case GESTURES_BUTTON_BACK:
return AMOTION_EVENT_BUTTON_BACK;
case GESTURES_BUTTON_FORWARD:
return AMOTION_EVENT_BUTTON_FORWARD;
default:
return 0;
}
}
} // namespace android