mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add a function for getting the active modifiers
This commit is contained in:
@@ -854,7 +854,22 @@ void Editor::run_timer_proc() {
|
|||||||
idle_timer_proc();
|
idle_timer_proc();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<POINT> Editor::get_current_pointer_position() const {
|
std::optional<uint16_t> Editor::get_active_modifiers() const noexcept {
|
||||||
|
xcb_generic_error_t* error = nullptr;
|
||||||
|
const xcb_query_pointer_cookie_t query_pointer_cookie =
|
||||||
|
xcb_query_pointer(x11_connection.get(), wine_window);
|
||||||
|
const std::unique_ptr<xcb_query_pointer_reply_t> query_pointer_reply(
|
||||||
|
xcb_query_pointer_reply(x11_connection.get(), query_pointer_cookie,
|
||||||
|
&error));
|
||||||
|
if (error) {
|
||||||
|
free(error);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return query_pointer_reply->mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<POINT> Editor::get_current_pointer_position() const noexcept {
|
||||||
xcb_generic_error_t* error = nullptr;
|
xcb_generic_error_t* error = nullptr;
|
||||||
const xcb_query_pointer_cookie_t query_pointer_cookie =
|
const xcb_query_pointer_cookie_t query_pointer_cookie =
|
||||||
xcb_query_pointer(x11_connection.get(), wine_window);
|
xcb_query_pointer(x11_connection.get(), wine_window);
|
||||||
|
|||||||
@@ -263,6 +263,14 @@ class Editor {
|
|||||||
const bool use_xembed;
|
const bool use_xembed;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* Get the X11 event mask containing the current keyboard modifiers. Because
|
||||||
|
* we don't want to link with `xcb-xkb` and we also can't really use
|
||||||
|
* key/motion events for this, we'll do this by querying the pointer
|
||||||
|
* position instead. Will return a nullopt if that query fails.
|
||||||
|
*/
|
||||||
|
std::optional<uint16_t> get_active_modifiers() const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current cursor position, in Win32 screen coordinates. This is
|
* Get the current cursor position, in Win32 screen coordinates. This is
|
||||||
* needed for our `LeaveNotify` handling because `GetCursorPos()` only
|
* needed for our `LeaveNotify` handling because `GetCursorPos()` only
|
||||||
@@ -273,7 +281,7 @@ class Editor {
|
|||||||
*
|
*
|
||||||
* If we cannot obtain the X11 cursor position, then this returns a nullopt.
|
* If we cannot obtain the X11 cursor position, then this returns a nullopt.
|
||||||
*/
|
*/
|
||||||
std::optional<POINT> get_current_pointer_position() const;
|
std::optional<POINT> get_current_pointer_position() const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the currently active window (as per
|
* Returns `true` if the currently active window (as per
|
||||||
|
|||||||
Reference in New Issue
Block a user