Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

Getequ
Copy link
Contributor

@Getequ Getequ commented Mar 4, 2018

Here UI part only, selected behaviors not saved.
Also fixed saving changes for parameters "Show seconds" and "Group buttons"

sdk/include/psdk/windowsx.h Outdated Show resolved Hide resolved
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);
Copy link
Contributor

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:
{
Copy link
Contributor

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:
{
Copy link
Contributor

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);
Copy link
Contributor

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 .

Copy link
Contributor Author

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 :)

Copy link
Contributor

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...

Copy link
Contributor Author

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.

Copy link
Member

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...

Copy link
Contributor Author

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

Copy link
Contributor

@HBelusca HBelusca left a 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 :)

@Getequ
Copy link
Contributor Author

Getequ commented Mar 5, 2018

@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;
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CStringW please

Copy link
Contributor Author

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 )

@ThFabba
Copy link
Member

ThFabba commented Mar 5, 2018

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.

@Getequ
Copy link
Contributor Author

Getequ commented Mar 5, 2018

@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"
@Getequ Getequ changed the title [EXPLORER] Managing hiding behavior for tray notification icons. [EXPLORER] Managing hiding behavior for tray notification icons. [WIP] Mar 8, 2018
@HBelusca
Copy link
Contributor

You can either add the new UI elements ni the resources but hide them (using a | NOT WS_VISIBLE for each of them in the resources), and/or add button handling to pop up a "not yet implemented" message box.

@sanchaez sanchaez added the WIP label Mar 12, 2018
@Getequ
Copy link
Contributor Author

Getequ commented Mar 13, 2018

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

@sanchaez sanchaez added the enhancement For PRs with an enhancement/new feature. label Apr 7, 2018
@learn-more learn-more dismissed HBelusca’s stale review June 12, 2018 20:39

All comments addressed

@learn-more
Copy link
Member

So where are we going with this?

@Getequ
Copy link
Contributor Author

Getequ commented Jun 13, 2018

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).

@gonzoMD
Copy link
Member

gonzoMD commented Jul 9, 2018

Maybe @katahiromz can help you with that. He made some great explorer/shell fixes recently.

base/shell/explorer/resource.h Show resolved Hide resolved
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));
Copy link
Contributor

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?

Copy link
Member

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!)

Copy link
Contributor

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));
Copy link
Contributor

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));
Copy link
Contributor

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;
Copy link
Contributor

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).

Copy link
Contributor Author

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:
Copy link
Contributor

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.

Copy link
Contributor Author

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));
Copy link
Contributor

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;
};

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

@Getequ
Copy link
Contributor Author

Getequ commented Jul 10, 2018

@gonzoMD hi, for now i waiting for accepting patch in Wine for reading imageList ( fix in #619 ). Without them this window will not look fine on ROS, only on Windows - i tested it by copying compiled explorer to XP in VBox

@katahiromz
Copy link
Contributor

For more details, see "sdk/lib/atl/cstringt.h".

@tkreuzer tkreuzer added this to Changes requested or WIP in ReactOS PRs Dec 9, 2018
@binarymaster binarymaster marked this pull request as draft August 18, 2020 23:04
@binarymaster binarymaster removed the WIP label Aug 18, 2020
@reactos reactos deleted a comment from Saibamen Aug 18, 2020
@Getequ Getequ closed this Jan 8, 2021
ReactOS PRs automation moved this from WIP / Waiting on contributor to Done Jan 8, 2021
@binarymaster binarymaster added the incomplete PRs that were closed without a real reason (check out later) label Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For PRs with an enhancement/new feature. incomplete PRs that were closed without a real reason (check out later)
Projects
ReactOS PRs
  
Done
9 participants