[UI] Image post-processing and full presentation/window rework
[GPU] Add FXAA post-processing [UI] Add FidelityFX FSR and CAS post-processing [UI] Add blue noise dithering from 10bpc to 8bpc [GPU] Apply the DC PWL gamma ramp closer to the spec, supporting fully white color [UI] Allow the GPU CP thread to present on the host directly, bypassing the UI thread OS paint event [UI] Allow variable refresh rate (or tearing) [UI] Present the newest frame (restart) on DXGI [UI] Replace GraphicsContext with a far more advanced Presenter with more coherent surface connection and UI overlay state management [UI] Connect presentation to windows via the Surface class, not native window handles [Vulkan] Switch to simpler Vulkan setup with no instance/device separation due to interdependencies and to pass fewer objects around [Vulkan] Lower the minimum required Vulkan version to 1.0 [UI/GPU] Various cleanup, mainly ComPtr usage [UI] Support per-monitor DPI awareness v2 on Windows [UI] DPI-scale Dear ImGui [UI] Replace the remaining non-detachable window delegates with unified window event and input listeners [UI] Allow listeners to safely destroy or close the window, and to register/unregister listeners without use-after-free and the ABA problem [UI] Explicit Z ordering of input listeners and UI overlays, top-down for input, bottom-up for drawing [UI] Add explicit window lifecycle phases [UI] Replace Window virtual functions with explicit desired state, its application, actual state, its feedback [UI] GTK: Apply the initial size to the drawing area [UI] Limit internal UI frame rate to that of the monitor [UI] Hide the cursor using a timer instead of polling due to no repeated UI thread paints with GPU CP thread presentation, and only within the window
This commit is contained in:
@@ -80,47 +80,22 @@ void WinKeyInputDriver::ParseKeyBinding(ui::VirtualKey output_key,
|
||||
}
|
||||
}
|
||||
|
||||
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
|
||||
: InputDriver(window), packet_number_(1) {
|
||||
// Register a key listener.
|
||||
window->on_key_down.AddListener([this](ui::KeyEvent* evt) {
|
||||
if (!is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
|
||||
KeyEvent key;
|
||||
key.virtual_key = evt->virtual_key();
|
||||
key.transition = true;
|
||||
key.prev_state = evt->prev_state();
|
||||
key.repeat_count = evt->repeat_count();
|
||||
key_events_.push(key);
|
||||
});
|
||||
window->on_key_up.AddListener([this](ui::KeyEvent* evt) {
|
||||
if (!is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
|
||||
KeyEvent key;
|
||||
key.virtual_key = evt->virtual_key();
|
||||
key.transition = false;
|
||||
key.prev_state = evt->prev_state();
|
||||
key.repeat_count = evt->repeat_count();
|
||||
key_events_.push(key);
|
||||
});
|
||||
|
||||
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window,
|
||||
size_t window_z_order)
|
||||
: InputDriver(window, window_z_order), window_input_listener_(*this) {
|
||||
#define XE_HID_WINKEY_BINDING(button, description, cvar_name, \
|
||||
cvar_default_value) \
|
||||
ParseKeyBinding(xe::ui::VirtualKey::kXInputPad##button, description, \
|
||||
cvars::cvar_name);
|
||||
#include "winkey_binding_table.inc"
|
||||
#undef XE_HID_WINKEY_BINDING
|
||||
|
||||
window->AddInputListener(&window_input_listener_, window_z_order);
|
||||
}
|
||||
|
||||
WinKeyInputDriver::~WinKeyInputDriver() = default;
|
||||
WinKeyInputDriver::~WinKeyInputDriver() {
|
||||
window()->RemoveInputListener(&window_input_listener_);
|
||||
}
|
||||
|
||||
X_STATUS WinKeyInputDriver::Setup() { return X_STATUS_SUCCESS; }
|
||||
|
||||
@@ -162,7 +137,7 @@ X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
|
||||
int16_t thumb_rx = 0;
|
||||
int16_t thumb_ry = 0;
|
||||
|
||||
if (window()->has_focus() && is_active()) {
|
||||
if (window()->HasFocus() && is_active()) {
|
||||
bool capital = IsKeyToggled(VK_CAPITAL) || IsKeyDown(VK_SHIFT);
|
||||
for (const KeyBinding& b : key_bindings_) {
|
||||
if (((b.lowercase == b.uppercase) || (b.lowercase && !capital) ||
|
||||
@@ -331,6 +306,29 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||
return result;
|
||||
}
|
||||
|
||||
void WinKeyInputDriver::WinKeyWindowInputListener::OnKeyDown(ui::KeyEvent& e) {
|
||||
driver_.OnKey(e, true);
|
||||
}
|
||||
|
||||
void WinKeyInputDriver::WinKeyWindowInputListener::OnKeyUp(ui::KeyEvent& e) {
|
||||
driver_.OnKey(e, false);
|
||||
}
|
||||
|
||||
void WinKeyInputDriver::OnKey(ui::KeyEvent& e, bool is_down) {
|
||||
if (!is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KeyEvent key;
|
||||
key.virtual_key = e.virtual_key();
|
||||
key.transition = is_down;
|
||||
key.prev_state = e.prev_state();
|
||||
key.repeat_count = e.repeat_count();
|
||||
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
key_events_.push(key);
|
||||
}
|
||||
|
||||
} // namespace winkey
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
Reference in New Issue
Block a user