mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 06:49:49 +01:00
fixes
This commit is contained in:
parent
2efac3eb38
commit
ab9e5bf98a
5 changed files with 42 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../helpers/varlist/VarList.hpp"
|
#include "../helpers/varlist/VarList.hpp"
|
||||||
#include "../managers/input/InputManager.hpp"
|
#include "../managers/input/InputManager.hpp"
|
||||||
|
#include "../managers/SeatManager.hpp"
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <aquamarine/input/Input.hpp>
|
#include <aquamarine/input/Input.hpp>
|
||||||
|
|
||||||
|
@ -148,6 +149,8 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_context_unref(CONTEXT);
|
xkb_context_unref(CONTEXT);
|
||||||
|
|
||||||
|
g_pSeatManager->updateActiveKeyboardData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
|
void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
|
||||||
|
@ -323,7 +326,21 @@ bool IKeyboard::updateModifiersState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IKeyboard::updateXkbStateWithKey(uint32_t xkbKey, bool pressed) {
|
void IKeyboard::updateXkbStateWithKey(uint32_t xkbKey, bool pressed) {
|
||||||
|
|
||||||
|
const auto contains = std::find(pressedXKB.begin(), pressedXKB.end(), xkbKey) != pressedXKB.end();
|
||||||
|
|
||||||
|
if (contains && pressed)
|
||||||
|
return;
|
||||||
|
if (!contains && !pressed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (contains)
|
||||||
|
std::erase(pressedXKB, xkbKey);
|
||||||
|
else
|
||||||
|
pressedXKB.emplace_back(xkbKey);
|
||||||
|
|
||||||
xkb_state_update_key(xkbState, xkbKey, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
|
xkb_state_update_key(xkbState, xkbKey, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||||
|
|
||||||
if (updateModifiersState()) {
|
if (updateModifiersState()) {
|
||||||
keyboardEvents.modifiers.emit(SModifiersEvent{
|
keyboardEvents.modifiers.emit(SModifiersEvent{
|
||||||
.depressed = modifiersState.depressed,
|
.depressed = modifiersState.depressed,
|
||||||
|
|
|
@ -89,5 +89,7 @@ class IKeyboard : public IHID {
|
||||||
WP<IKeyboard> self;
|
WP<IKeyboard> self;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearManuallyAllocd();
|
void clearManuallyAllocd();
|
||||||
|
|
||||||
|
std::vector<uint32_t> pressedXKB;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,9 +42,7 @@ CKeyboard::CKeyboard(SP<Aquamarine::IKeyboard> keeb) : keyboard(keeb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) {
|
listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) {
|
||||||
auto E = std::any_cast<Aquamarine::IKeyboard::SModifiersEvent>(d);
|
updateModifiersState();
|
||||||
|
|
||||||
updateModifiers(E.depressed, E.latched, E.locked, E.group);
|
|
||||||
|
|
||||||
keyboardEvents.modifiers.emit(SModifiersEvent{
|
keyboardEvents.modifiers.emit(SModifiersEvent{
|
||||||
.depressed = modifiersState.depressed,
|
.depressed = modifiersState.depressed,
|
||||||
|
|
|
@ -1327,7 +1327,7 @@ void CInputManager::onKeyboardMod(SP<IKeyboard> pKeyboard) {
|
||||||
|
|
||||||
const auto LAYOUT = pKeyboard->getActiveLayout();
|
const auto LAYOUT = pKeyboard->getActiveLayout();
|
||||||
|
|
||||||
pKeyboard->updateXKBTranslationState(pKeyboard->xkbKeymap);
|
Debug::log(LOG, "LAYOUT CHANGED TO {} GROUP {}", LAYOUT, MODS.group);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUT});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUT});
|
||||||
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUT}));
|
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUT}));
|
||||||
|
|
|
@ -288,6 +288,8 @@ CLinuxDMABUFFeedbackResource::CLinuxDMABUFFeedbackResource(SP<CZwpLinuxDmabufFee
|
||||||
.data = (void*)&feedback->mainDevice,
|
.data = (void*)&feedback->mainDevice,
|
||||||
};
|
};
|
||||||
resource->sendMainDevice(&deviceArr);
|
resource->sendMainDevice(&deviceArr);
|
||||||
|
|
||||||
|
// Main tranche
|
||||||
resource->sendTrancheTargetDevice(&deviceArr);
|
resource->sendTrancheTargetDevice(&deviceArr);
|
||||||
resource->sendTrancheFlags((zwpLinuxDmabufFeedbackV1TrancheFlags)0);
|
resource->sendTrancheFlags((zwpLinuxDmabufFeedbackV1TrancheFlags)0);
|
||||||
|
|
||||||
|
@ -300,6 +302,24 @@ CLinuxDMABUFFeedbackResource::CLinuxDMABUFFeedbackResource(SP<CZwpLinuxDmabufFee
|
||||||
wl_array_release(&indices);
|
wl_array_release(&indices);
|
||||||
resource->sendTrancheDone();
|
resource->sendTrancheDone();
|
||||||
|
|
||||||
|
// Scanout tranche
|
||||||
|
// FIXME: jesus fucking christ this SUCKSSSSSS ASSSSSS
|
||||||
|
resource->sendTrancheTargetDevice(&deviceArr);
|
||||||
|
resource->sendTrancheFlags(ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT);
|
||||||
|
|
||||||
|
wl_array indices2;
|
||||||
|
wl_array_init(&indices2);
|
||||||
|
for (size_t i = 0; i < feedback->tranches.size(); ++i) {
|
||||||
|
// FIXME: if the monitor gets the wrong format we'll be FUCKED by drm and no scanout will happen
|
||||||
|
if (feedback->tranches.at(i).first != DRM_FORMAT_XRGB8888 && feedback->tranches.at(i).first != DRM_FORMAT_XRGB2101010)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
*((uint16_t*)wl_array_add(&indices2, sizeof(uint16_t))) = i;
|
||||||
|
}
|
||||||
|
resource->sendTrancheFormats(&indices2);
|
||||||
|
wl_array_release(&indices2);
|
||||||
|
resource->sendTrancheDone();
|
||||||
|
|
||||||
resource->sendDone();
|
resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue