Skip to content

Commit

Permalink
Merge pull request #9 from reupen/bugfix/drop-highlighting
Browse files Browse the repository at this point in the history
 Fix incorrect selection rendering with custom selection colours
  • Loading branch information
reupen committed Jan 22, 2019
2 parents 5efe54f + 51cd3eb commit df4e302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion foo_uie_albumlist/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

DECLARE_COMPONENT_VERSION("Album list panel",

"0.4.0-beta.4",
"0.4.0-beta.5",

"allows you to browse through your media library\n\n"
"based upon albumlist 3.1.0\n"
Expand Down
8 changes: 4 additions & 4 deletions foo_uie_albumlist/main_window_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,19 @@ std::optional<LRESULT> album_list_window::on_tree_view_wm_notify(LPNMHDR hdr)
return CDRF_DODEFAULT;
return CDRF_NOTIFYITEMDRAW;
case CDDS_ITEMPREPAINT: {
const auto is_focused = GetFocus() == hdr->hwndFrom;
const auto is_window_focused = GetFocus() == hdr->hwndFrom;
const auto is_selected = (nmtvcd->nmcd.uItemState & CDIS_SELECTED) != 0;
const auto is_drop_highlighted = TreeView_GetItemState(hdr->hwndFrom, nmtvcd->nmcd.dwItemSpec, TVIS_DROPHILITED) != 0;
const auto is_drop_highlighted = (TreeView_GetItemState(hdr->hwndFrom, nmtvcd->nmcd.dwItemSpec, TVIS_DROPHILITED) & TVIS_DROPHILITED) != 0;

cui::colours::helper colour_client(g_guid_album_list_colours);

if (is_selected || is_drop_highlighted) {
nmtvcd->clrText =
is_focused
is_window_focused
? colour_client.get_colour(cui::colours::colour_selection_text)
: colour_client.get_colour(cui::colours::colour_inactive_selection_text);
nmtvcd->clrTextBk =
is_focused
is_window_focused
? colour_client.get_colour(cui::colours::colour_selection_background)
: colour_client.get_colour(cui::colours::colour_inactive_selection_background);
}
Expand Down

0 comments on commit df4e302

Please sign in to comment.