TaskbarXI icon indicating copy to clipboard operation
TaskbarXI copied to clipboard

[Request] Rewriting of the whole Project

Open HerXayah opened this issue 4 years ago • 11 comments

First of all:

Why?

  • Well GDI itself has no feature of Antialiasing Corners.
  • Easier Project Structure because its kinda messy

What to do then?

  • Rewriting it in GDI+ and or DirectX
  • Clean up Project Tree.

HerXayah avatar Jan 23 '22 16:01 HerXayah

@PrincessAkira Maybe in the future... but... De taskbar can only be given rounded corners using setwindowrgn https://www.pinvoke.net/default.aspx/user32.setwindowrgn

It's basically changing the shape of the taskbars window. A limitation is that it does not have Antialiasing. In Windows 11 there is a new thing I can use that might fix that. Going to GDI+ and or DirectX won't fix this because TaskbarXI is not drawing anything behind the icons.

When i get the time i will add notes and do a big cleanup. I may also add a template so anyone can see how it works and how the code is structured ;)

ChrisAnd1998 avatar Jan 23 '22 17:01 ChrisAnd1998

I know that @officialLennox tried to rewrite it in GDI+ and had it working but it was flickering and stuff a common issue on GDI+ btw

HerXayah avatar Jan 23 '22 19:01 HerXayah

I know that @officialLennox tried to rewrite it in GDI+ and had it working but it was flickering and stuff a common issue on GDI+ btw

there were a lot of issues and it wasnt really working but well... i tried

lennoxlotl avatar Jan 23 '22 19:01 lennoxlotl

@PrincessAkira @officialLennox Well... the taskbar has this annoying habit of constantly wanting to refresh itself causing those flickers. Playing with WM_SETREDRAW can drastically reduce it when used at the right time. After 2 years I got it finally under control in TaskbarX but the Windows 11 taskbar is behaving very differently. Sure you might be able too hook into the shell (Explorer.exe) but I want this to work for any update of Windows 11.

There is this piece of code I am experimenting with that maybe makes it possible to add smooth corners but it only has 4 sizes. It's used to give a window rounded corners like every other window you see in Windows 11. So far I only got it to work on a window but not it's region. Maybe it works if the taskbar(s) parent window Shell_TrayWnd can be resized without it wanting to go back to it's original state.

HRESULT UpdateWindows11RoundCorners(HWND hWnd)
{
	typedef HRESULT(WINAPI* PFNSETWINDOWATTRIBUTE)(HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
	enum DWMWINDOWATTRIBUTE
	{
		DWMWA_WINDOW_CORNER_PREFERENCE = 33
	};
	enum DWM_WINDOW_CORNER_PREFERENCE
	{
		DWMWCP_DEFAULT = 0,
		DWMWCP_DONOTROUND = 1,
		DWMWCP_ROUND = 2,
		DWMWCP_ROUNDSMALL = 3
	};
	HMODULE hDwmApi = ::LoadLibrary(TEXT("dwmapi.dll"));
	if (hDwmApi)
	{
		auto* pfnSetWindowAttribute = reinterpret_cast<PFNSETWINDOWATTRIBUTE>(
			::GetProcAddress(hDwmApi, "DwmSetWindowAttribute"));
		if (pfnSetWindowAttribute)
		{
			auto preference = static_cast<DWM_WINDOW_CORNER_PREFERENCE>(2);
			return pfnSetWindowAttribute(hWnd, DWMWA_WINDOW_CORNER_PREFERENCE,
				&preference, sizeof(DWM_WINDOW_CORNER_PREFERENCE));
		}
		::FreeLibrary(hDwmApi);
	}
	return E_FAIL;
}

As you can see the full taskbar can be given smooth rounded corners but, it does not apply to it's region. Untitled Untitled

ChrisAnd1998 avatar Jan 24 '22 07:01 ChrisAnd1998

this looks like some sort of progress on smooth corners, would it be able for you to open a new branch with your changes so i can experiement with them?

lennoxlotl avatar Jan 24 '22 13:01 lennoxlotl

@officialLennox Currently not at home but... The code is already in there.

If you paste this line at line 1109 in Taskbar11.cpp you will get the same result as in the screenshots UpdateWindows11RoundCorners(Shell_TrayWnd);

ChrisAnd1998 avatar Jan 24 '22 13:01 ChrisAnd1998

@officialLennox Currently not at home but... The code is already in there.

If you paste this line at line 1109 in Taskbar11.cpp you will get the same result as in the screenshots UpdateWindows11RoundCorners(Shell_TrayWnd);

Alright thanks, got it, will try around a bit to see if i can trick the win api

lennoxlotl avatar Jan 24 '22 14:01 lennoxlotl

Wasn't able to get anything working yet unfortunately

lennoxlotl avatar Jan 24 '22 17:01 lennoxlotl

@officialLennox Me neither... Only result was a taskbar that completely glitched out because i didn't like to be resized XD. Maybe another time ;)

ChrisAnd1998 avatar Jan 24 '22 17:01 ChrisAnd1998

Yeah

lennoxlotl avatar Jan 24 '22 21:01 lennoxlotl

I am brand new to github and was directed to this amazing download as I try to learn windows 11 now. It would be really cool if the taskbar could be customized by desktop.I would love the ability to have a different taskbar for my work desktop verses my home/personal desktop. I may also be pushing my luck but it would be even cooler if I could load a different microsoft profile for one desktop verses another, the heart wants what the heart wants :) I may have some of these options and just don't know it yet.

JSnowGIT avatar Jan 29 '22 15:01 JSnowGIT