New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EXPLORER] Managing hiding behavior for tray notification icons. [WIP] #418
Conversation
ComboBox_SetCurSel(hCombo, lvItem.lParam); | ||
|
||
ComboBox_SetItemData(hCombo, 0, iItem); | ||
SetWindowPos(hCombo, HWND_TOP, 190 + lv.x, pt.y + lv.y, 135, 20, SWP_SHOWWINDOW); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these magic values "190" and "135"?
InitializeListView(hwnd); | ||
break; | ||
case WM_NOTIFY: | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a level of indentation too much.
EndDialog(hwnd, IDCANCEL); | ||
break; | ||
case IDC_NOTIFICATION_BEHAVIOUR: | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this extra level of indentation.
{ | ||
HWND hListView = GetDlgItem(hDialog, IDC_NOTIFICATION_LIST); | ||
HWND hSysPager = FindWindowEx(hTrayNotify, NULL, L"SysPager", NULL); | ||
HWND hToolbar = FindWindowEx(hSysPager, NULL, L"ToolbarWindow32", NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to retrieve the correct sub-window directly from the classes? Cc @gigaherz .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a standard win32 window classes, not a custom classes with unique name. It's lucky that hTrayNotify has only one sysPager and pager has only one toolbar :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was asking this because these HWNDs are just members of the corresponding CSysPager... classes, so I was wondering whether you could somehow do a pSysPager->m_hWnd somehow (with the correct names to be determined...) and/or use a correct getter function for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not a perfect way. Tried to get toolbar HWND from CSysPager with functions like CTrayNotifyWnd_GetToolbar(m_TrayNotifyInstance) -> CSysPagerWnd_GetToolbar(&m_pager) -> Toolbar.m_hWnd field give me not null handle but it has very weird behavior: TB_BUTTONCOUNT and Toolbar.GetButtonCount() return zero, but CNotifyToolbar.GetVisibleButtonCount() return nonzero value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely an ugly way to implement an obscure feature...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yagoulas plz check is it fine now? i added functions CTrayNotifyWnd_GetTrayToolbar / CSysPagerWnd_GetTrayToolbar for getting tray toolbar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some stuff to review :)
@HBelusca all done! |
@@ -2778,6 +2778,10 @@ class CTrayWindow : | |||
SetWindowPos(hWndInsertAfter, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); | |||
} | |||
|
|||
g_TaskbarSettings.bHideInactiveIcons = newSettings->bHideInactiveIcons; | |||
g_TaskbarSettings.bShowSeconds = newSettings->bShowSeconds; | |||
g_TaskbarSettings.bGroupButtons = newSettings->bGroupButtons; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These last two lines don't seem related to tray icon hiding. What's their purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to save this flag too. yes, they not related to tray icons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bShowSeconds and bGroupButtons are saved by the modules that implement handling these two, No need to save them again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, sorry ) rollback this
ZeroMemory(&lviBehavior, sizeof(lviBehavior)); | ||
lviBehavior.mask = LVIF_TEXT; | ||
lviBehavior.iSubItem = 1; | ||
lviBehavior.cchTextMax = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't hardcode "100" but use _countof(szBehaviour).
I even think you could use here the LoadStringW functionality described here: " If [nBufferMax] parameter is 0, then lpBuffer receives a read-only pointer to the resource itself."
Or alternatively, use CStringW class since you are writing C++ code there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CStringW
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually load it using LoadStringW with _countof . 100 was a copy-paste waste )
So... I'm a bit allergic to implementing UI with no functionality behind it. We already have lots of buttons and dialogs that do nothing, and they're all really confusing for users. What can we do to avoid that? Actually implementing the feature would be one way. Somehow clearly indicating to the user that this is unimplemented could also work. Suggestions welcome. |
@ThFabba yes, there is a reason in your words. But i see that even not big PR can hang for months sinking in discussions, even if they have Approved mark. Completely implemented function requires a lot of time, which people do not have after work. I contribute as much as I can |
Here UI part only, selected behaviors not saved. Also fixed saving changes for parameters "Show seconds" and "Group buttons"
You can either add the new UI elements ni the resources but hide them (using a |
No, this is also not an option) i better finish it with as possible functionality as i can. I recently found this issue https://jira.reactos.org/browse/CORE-10849 - this was VERY helpful |
So where are we going with this? |
I stuck with saving binary registy values. And also revealed new bug - importing files with big HEX registry values wrongly counting and read lines (regproc.c / processRegLinesW). |
Maybe @katahiromz can help you with that. He made some great explorer/shell fixes recently. |
WCHAR sInactive[100]; | ||
LoadStringW(NULL, IDS_NOTIF_BEH_SHOW, sShow, _countof(sShow)); | ||
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE, sHide, _countof(sHide)); | ||
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE_INACTIVE, sInactive, _countof(sInactive)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitating in using CStringW class for the resource strings here (they would automatically deal correctly with the string sizes). @learn-more , any advice on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you hestitate?
If you (for some obscure reason) don't want to use CStrings, you can always use the LoadStringW technique of passing it a pointer, and itll point that to the raw resource string (but be careful, it is not always null terminated!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage:
CStringW str...(MAKEINTRESOURCEW(IDS_...));
|
||
WCHAR szBehavior[100]; | ||
int resId = iState == 0 ? IDS_NOTIF_BEH_SHOW : (iState == 1 ? IDS_NOTIF_BEH_HIDE : IDS_NOTIF_BEH_HIDE_INACTIVE); | ||
LoadStringW(NULL, resId, szBehavior, _countof(szBehavior)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some CStringW usage? (see comment above)
HWND hListView = GetDlgItem(hwnd, IDC_NOTIFICATION_LIST); | ||
int count = ListView_GetItemCount(hListView); | ||
WCHAR szBehavior[100]; | ||
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE_INACTIVE, szBehavior, _countof(szBehavior)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
{ | ||
ShowBehaviorCombo(hwnd, (LPNMITEMACTIVATE)lParam); | ||
} | ||
else return FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because first if-block was inside brackets, the return-FALSE should be inside brackets too (cf. our coding style).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
case WM_INITDIALOG: | ||
InitializeListView(hwnd); | ||
break; | ||
case WM_NOTIFY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add one new-line between the different 'cases' to make the code more easily readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
LoadStringW(NULL, IDS_NOTIF_BEH_SHOW, sShow, _countof(sShow)); | ||
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE, sHide, _countof(sHide)); | ||
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE_INACTIVE, sInactive, _countof(sInactive)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CStringW?
// Must keep a separate copy since the original is unioned with uTimeout. | ||
UINT uVersionCopy; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is moved to shell/explorer/precomp.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes sorry, I didn't see it.
For more details, see "sdk/lib/atl/cstringt.h". |
Here UI part only, selected behaviors not saved.
Also fixed saving changes for parameters "Show seconds" and "Group buttons"