MCPcopy Create free account
hub / github.com/audacity/audacity / IsWindowAccessible

Function IsWindowAccessible

src/ProjectWindow.cpp:85–108  ·  view source on GitHub ↗

true iff we have enough of the top bar to be able to reposition the window.

Source from the content-addressed store, hash-verified

83
84// true iff we have enough of the top bar to be able to reposition the window.
85bool IsWindowAccessible(wxRect *requestedRect)
86{
87 wxDisplay display;
88 wxRect targetTitleRect(requestedRect->GetLeftTop(), requestedRect->GetBottomRight());
89 // Hackery to approximate a window top bar size from a window size.
90 // and exclude the open/close and borders.
91 targetTitleRect.x += 15;
92 targetTitleRect.width -= 100;
93 if (targetTitleRect.width < 165) targetTitleRect.width = 165;
94 targetTitleRect.height = 15;
95 int targetBottom = targetTitleRect.GetBottom();
96 int targetRight = targetTitleRect.GetRight();
97 // This looks like overkill to check each and every pixel in the ranges.
98 // and decide that if any is visible on screen we are OK.
99 for (int i = targetTitleRect.GetLeft(); i < targetRight; i++) {
100 for (int j = targetTitleRect.GetTop(); j < targetBottom; j++) {
101 int monitor = display.GetFromPoint(wxPoint(i, j));
102 if (monitor != wxNOT_FOUND) {
103 return TRUE;
104 }
105 }
106 }
107 return FALSE;
108}
109
110// BG: The default size and position of the first window
111void GetDefaultWindowRect(wxRect *defRect)

Callers 1

GetNextWindowPlacementFunction · 0.85

Calls 2

GetRightMethod · 0.80
wxPointClass · 0.70

Tested by

no test coverage detected