Skip to content

Commit

Permalink
screen: remove GetMainPosition()
Browse files Browse the repository at this point in the history
Apply Y offsets manually in OnMouse().  This fixes a problem when
hiding the title bar.
  • Loading branch information
MaxKellermann committed Sep 11, 2024
1 parent beb411c commit 88d2b36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/screen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,16 @@ void
ScreenManager::OnMouse(struct mpdclient &c, DelayedSeek &seek,
Point p, mmask_t bstate)
{
if (GetCurrentPage().OnMouse(c, p - GetMainPosition(), bstate))
if (options.show_title_bar) {
const int title_height = title_bar.GetHeight();
if (p.y < title_height) {
return;
}

p.y -= title_height;
}

if (GetCurrentPage().OnMouse(c, p, bstate))
return;

/* if button 2 was pressed switch screen */
Expand Down
4 changes: 0 additions & 4 deletions src/screen.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ public:
void Init(struct mpdclient *c) noexcept;
void Exit() noexcept;

Point GetMainPosition() const noexcept {
return {0, (int)title_bar.GetHeight()};
}

const PageMeta &GetCurrentPageMeta() const noexcept {
return *current_page->first;
}
Expand Down

0 comments on commit 88d2b36

Please sign in to comment.