Merge branch 'blender-v4.5-release'

This commit is contained in:
Campbell Barton
2025-07-08 10:38:10 +10:00
2 changed files with 25 additions and 1 deletions

View File

@@ -166,7 +166,19 @@ const char *WM_ghost_backend();
enum eWM_CapabilitiesFlag {
/** Ability to warp the cursor (set its location). */
WM_CAPABILITY_CURSOR_WARP = (1 << 0),
/** Ability to access window positions & move them. */
/**
* Window position access, support for the following.
* - Getting window positions.
* - Setting window positions.
* - Setting positions for new windows.
*
* Currently there is no need to distinguish between these different cases
* so a single flag is used.
*
* When omitted, it isn't possible to know where windows are located in relation to each other.
* Operations such as applying events from one window to another or detecting the non-active
* window under the cursor are not supported.
*/
WM_CAPABILITY_WINDOW_POSITION = (1 << 1),
/**
* The windowing system supports a separate primary clipboard

View File

@@ -2672,6 +2672,18 @@ wmWindow *WM_window_find_under_cursor(wmWindow *win,
const int event_xy[2],
int r_event_xy_other[2])
{
if ((WM_capabilities_flag() & WM_CAPABILITY_WINDOW_POSITION) == 0) {
/* Window positions are unsupported, so this function can't work as intended.
* Perform the bare minimum, return the active window if the event is within it. */
rcti rect;
WM_window_rect_calc(win, &rect);
if (!BLI_rcti_isect_pt_v(&rect, event_xy)) {
return nullptr;
}
copy_v2_v2_int(r_event_xy_other, event_xy);
return win;
}
int temp_xy[2];
copy_v2_v2_int(temp_xy, event_xy);
wm_cursor_position_to_ghost_screen_coords(win, &temp_xy[0], &temp_xy[1]);