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] Implement taskbar application grouping #6889

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

StartForKiller
Copy link
Contributor

@StartForKiller StartForKiller commented May 14, 2024

Purpose

I've implemented the task grouping function to taskbar.

JIRA issue: CORE-16134

Proposed changes

  • Added Taskbar grouping function.
  • Added option to enable and disable this function.
  • Maybe some hidden Windows Registry magic needs to be added to how tasks are grouped.

TODO

  • Find and solve related issues with themes

@github-actions github-actions bot added the shell All PR's related to the shell (and shell extensions) label May 14, 2024
@@ -216,3 +217,5 @@
#define ID_SHELL_CMD_CUST_NOTIF (411)
#define ID_SHELL_CMD_ADJUST_DAT (412)
#define ID_SHELL_CMD_RESTORE_ALL (413)
#define ID_SHELL_CMD_MINIMIZE_GRP (414)
#define ID_SHELL_CMD_CLOSE_GRP (415)
Copy link
Contributor

Choose a reason for hiding this comment

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

If PR #6872 is merged before this (likely) then you need to adjust ID_SHELL_CMD_LAST before merging (likely a conflict).

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 i know, currently it's a TODO PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only thing is that ID_SHELL_CMD_LAST was 0x7FEF so it should be fine

Copy link
Contributor

Choose a reason for hiding this comment

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

It was yes but not after my PR is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, then, totally true

base/shell/explorer/taskswnd.cpp Outdated Show resolved Hide resolved
@binarymaster binarymaster added the enhancement For PRs with an enhancement/new feature. label May 15, 2024
@binarymaster binarymaster added this to New PRs in ReactOS PRs via automation May 15, 2024
@binarymaster binarymaster changed the title [EXPLORER] Implement Taskbar Application Grouping [EXPLORER] Implement taskbar application grouping May 15, 2024
@HBelusca
Copy link
Contributor

src\base\shell\explorer\taskswnd.cpp(988): error C2065: '__INT_MAX__': undeclared identifier
Please use INT_MAX instead.

base/shell/explorer/util.cpp Outdated Show resolved Hide resolved
base/shell/explorer/util.cpp Outdated Show resolved Hide resolved
base/shell/explorer/lang/en-US.rc Outdated Show resolved Hide resolved
base/shell/explorer/taskswnd.cpp Show resolved Hide resolved
base/shell/explorer/taskswnd.cpp Outdated Show resolved Hide resolved
@HBelusca HBelusca self-requested a review May 15, 2024 17:54
@HBelusca
Copy link
Contributor

There's something weird happening when the MSVC builders compile the (modified) explorer.rc ...

base/shell/explorer/lang/cs-CZ.rc Outdated Show resolved Hide resolved
ReactOS PRs automation moved this from New PRs to WIP / Waiting on contributor May 16, 2024
@HBelusca
Copy link
Contributor

For information, builds are now working, except for those that have a problem in the github actions.

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.

1st part of final review

@@ -55,6 +55,7 @@

#define IDM_STARTMENU 204
#define IDM_TRAYWND 205
#define IDM_TASKGRP 210
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 210 and not 206? You want to reserve space for extra menus for tray/taskbar here?

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 don't exactly remember right now if this is right but i think that was xp behaviour. I don't exactly remember as this was added like a year ago

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that doesn't matter then yeah, we can use 206

Copy link
Contributor

Choose a reason for hiding this comment

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

We can leave this, I would just add a comment explaining where you got the numbers from.

Comment on lines +264 to +266
GetProcessPath(IN DWORD dwProcessId,
OUT LPWSTR szBuffer,
IN DWORD cbBufLen)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
GetProcessPath(IN DWORD dwProcessId,
OUT LPWSTR szBuffer,
IN DWORD cbBufLen)
GetProcessPath(
_In_ DWORD dwProcessId,
_Out_ LPWSTR szBuffer,
_In_ DWORD cbBufLen)

Comment on lines +268 to +278
HANDLE hTaskProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId);
BOOL bRet = FALSE;
if (hTaskProc != NULL)
{
if (GetModuleFileNameExW(hTaskProc, NULL, szBuffer, cbBufLen))
bRet = TRUE;

CloseHandle(hTaskProc);
}

return bRet;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are in C++ we can put the variables in the middle of the code:

Suggested change
HANDLE hTaskProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId);
BOOL bRet = FALSE;
if (hTaskProc != NULL)
{
if (GetModuleFileNameExW(hTaskProc, NULL, szBuffer, cbBufLen))
bRet = TRUE;
CloseHandle(hTaskProc);
}
return bRet;
HANDLE hTaskProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId);
if (!hTaskProc)
return FALSE;
BOOL bRet = (GetModuleFileNameExW(hTaskProc, NULL, szBuffer, cbBufLen) != 0);
CloseHandle(hTaskProc);
return bRet;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True

Comment on lines +232 to +235
if (bRet == FALSE && cbTranslate >= sizeof(LANGCODEPAGE))
{
//Try to use the first language as a fallback

Copy link
Contributor

@HBelusca HBelusca May 16, 2024

Choose a reason for hiding this comment

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

Suggested change
if (bRet == FALSE && cbTranslate >= sizeof(LANGCODEPAGE))
{
//Try to use the first language as a fallback
if (!bRet && cbTranslate >= sizeof(LANGCODEPAGE))
{
// Try to use the first language as a fallback

Comment on lines +237 to +241
_countof(szSubBlock),
L"\\StringFileInfo\\%04X%04X\\%s",
lpTranslate[0].wLanguage,
lpTranslate[0].wCodePage,
szVersionInfo);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_countof(szSubBlock),
L"\\StringFileInfo\\%04X%04X\\%s",
lpTranslate[0].wLanguage,
lpTranslate[0].wCodePage,
szVersionInfo);
_countof(szSubBlock),
L"\\StringFileInfo\\%04X%04X\\%s",
lpTranslate[0].wLanguage,
lpTranslate[0].wCodePage,
szVersionInfo);

RECT rcBitmap = nmtbcd->nmcd.rc;
RECT rcArrow = nmtbcd->nmcd.rc;
InflateRect(&rcText, -GetSystemMetrics(SM_CXEDGE), 0);
rcText.left += bitmapWidth + 6; //TODO Default list gap
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rcText.left += bitmapWidth + 6; //TODO Default list gap
rcText.left += bitmapWidth + 6; // TODO: Default list gap

rcBitmap.top++;
}

rcArrow.left = max(rcArrow.left, rcArrow.right - 13);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this "13" about?

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 think is a prepcalculated x offset, i could try to add the formula there, but u think is always a constant and always the same

Copy link
Contributor

Choose a reason for hiding this comment

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

You could add a #define for this that uses the calculation.

ImageList_Draw(m_ImageList, TaskGroup->Index, nmtbcd->nmcd.hdc, rcBitmap.left, rcBitmap.top, (btni.fsState & CDIS_MARKED) ? ILD_BLEND50 | ILD_TRANSPARENT : ILD_TRANSPARENT);

WCHAR TaskCountText[20];
StringCbPrintfW(TaskCountText, 20, L"(%d)", TaskGroup->dwTaskCount);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
StringCbPrintfW(TaskCountText, 20, L"(%d)", TaskGroup->dwTaskCount);
StringCbPrintfW(TaskCountText, sizeof(TaskCountText), L"(%d)", TaskGroup->dwTaskCount);

INT x, y;
HPEN hPen, hOldPen;

if (!(hPen = CreatePen( PS_SOLID, 1, nmtbcd->clrText)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!(hPen = CreatePen( PS_SOLID, 1, nmtbcd->clrText)))
if (!(hPen = CreatePen(PS_SOLID, 1, nmtbcd->clrText)))

@@ -1747,27 +2640,31 @@ class CTaskSwitchWnd :

switch (nmh->code)
{
case NM_CUSTOMDRAW:
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure the reformatting here is useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's exactly to comply with the formatting rules

@StartForKiller
Copy link
Contributor Author

I will solve all the requests tomorrow

@cbialorucki cbialorucki added the help wanted Request for help. label May 21, 2024
Copy link
Contributor

@cbialorucki cbialorucki left a comment

Choose a reason for hiding this comment

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

This PR will need some work before it can get merged. The author of this PR suggested in the past that he was willing to have us finish this work without needing his intervention since he is busy. I reached out to him to make sure he is still okay with this. If he allows us, we will commit fixes directly to this PR to clean it up before merging it.

Update: He says he will be back in about a week, but we can help clean it up in the meantime.

@@ -55,6 +55,7 @@

#define IDM_STARTMENU 204
#define IDM_TRAYWND 205
#define IDM_TASKGRP 210
Copy link
Contributor

Choose a reason for hiding this comment

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

We can leave this, I would just add a comment explaining where you got the numbers from.

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. help wanted Request for help. shell All PR's related to the shell (and shell extensions)
Projects
ReactOS PRs
  
WIP / Waiting on contributor
5 participants