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

Show menus of Windows applications using WINE #147

Open
probonopd opened this issue Mar 12, 2023 · 2 comments
Open

Show menus of Windows applications using WINE #147

probonopd opened this issue Mar 12, 2023 · 2 comments

Comments

@probonopd
Copy link
Member

probonopd commented Mar 12, 2023

It would be neat if we could get Menu to render the menus of Windows applications using WINE.

This woud make Windows applications work much more like native applications.

It seems that Windows applications like REAPER are using the SetMenuItemInfoA Windows API function in the winuser.h header to modify the properties of a menu item in a menu, such as its text, state, etc. This can be seen by running a Windows application in WINE like this: WINEDEBUG=+relay,+snoop wine64 ~/.wine/drive_c/Program\ Files/REAPER\ \(x64\)/reaper.exe 2>&1 | grep user32 | grep -i Menu.

According to https://github.com/wine-mirror/wine/blob/master/dlls/user32/user32.spec, there are

  • @stdcall AppendMenuA(long long long ptr)
  • @stdcall AppendMenuW(long long long ptr)
  • @stdcall CalcMenuBar(long long long long ptr) CalcMenuBar
  • @stdcall ChangeMenuA(long long ptr long long)
  • @stdcall ChangeMenuW(long long ptr long long)
  • @stdcall CheckMenuItem(long long long) NtUserCheckMenuItem
  • @stdcall CheckMenuRadioItem(long long long long long)
  • @stdcall CreateMenu()
  • @stdcall CreatePopupMenu()
  • @stdcall DeleteMenu(long long long) NtUserDeleteMenu
  • @stdcall DestroyMenu(long) NtUserDestroyMenu
  • @stdcall DrawMenuBar(long)
  • @stdcall DrawMenuBarTemp(long long ptr long long) NtUserDrawMenuBarTemp
  • @stdcall EnableMenuItem(long long long) NtUserEnableMenuItem
  • @stdcall EndMenu() NtUserEndMenu
  • @stdcall GetMenu(long)
  • @stdcall GetMenuBarInfo(long long long ptr) NtUserGetMenuBarInfo
  • @stdcall GetMenuCheckMarkDimensions()
  • @stdcall GetMenuContextHelpId(long)
  • @stdcall GetMenuDefaultItem(long long long)
  • @stub GetMenuIndex
  • @stdcall GetMenuInfo(long ptr)
  • @stdcall GetMenuItemCount(long)
  • @stdcall GetMenuItemID(long long)
  • @stdcall GetMenuItemInfoA(long long long ptr)
  • @stdcall GetMenuItemInfoW(long long long ptr)
  • @stdcall GetMenuItemRect(long long long ptr) NtUserGetMenuItemRect
  • @stdcall GetMenuState(long long long)
  • @stdcall GetMenuStringA(long long ptr long long)
  • @stdcall GetMenuStringW(long long ptr long long)
  • @stdcall GetSubMenu(long long)
  • @stdcall GetSystemMenu(long long) NtUserGetSystemMenu
  • @stdcall HiliteMenuItem(long long long long) NtUserHiliteMenuItem
  • @stdcall InsertMenuA(long long long long ptr)
  • @stdcall InsertMenuItemA(long long long ptr)
  • @stdcall InsertMenuItemW(long long long ptr)
  • @stdcall InsertMenuW(long long long long ptr)
  • @stdcall IsMenu(long)
  • @stdcall LoadMenuA(long str)
  • @stdcall LoadMenuIndirectA(ptr)
  • @stdcall LoadMenuIndirectW(ptr)
  • @stdcall LoadMenuW(long wstr)
  • @stdcall MenuItemFromPoint(long long int64)
  • @stub MenuWindowProcA
  • @stub MenuWindowProcW
  • @stdcall ModifyMenuA(long long long long ptr)
  • @stdcall ModifyMenuW(long long long long ptr)
  • @stub PaintMenuBar
  • @stdcall RemoveMenu(long long long) NtUserRemoveMenu
  • @stdcall SetMenu(long long) NtUserSetMenu
  • @stdcall SetMenuContextHelpId(long long) NtUserSetMenuContextHelpId
  • @stdcall SetMenuDefaultItem(long long long) NtUserSetMenuDefaultItem
  • @stdcall SetMenuInfo(long ptr)
  • @stdcall SetMenuItemBitmaps(long long long long long)
  • @stdcall SetMenuItemInfoA(long long long ptr)
  • @stdcall SetMenuItemInfoW(long long long ptr)
  • @stdcall SetSystemMenu(long long) NtUserSetSystemMenu
  • @stdcall TrackPopupMenu(long long long long long long ptr)
  • @stdcall TrackPopupMenuEx(long long long long long ptr) NtUserTrackPopupMenuEx

So the question is, could we intercept these calls in WINE, and export them via D-Bus instead of having them rendered by WINE?

@probonopd
Copy link
Member Author

Ableton Live Lite, which is written in Qt, appears to be using the same calls. Great!

@probonopd
Copy link
Member Author

Maybe @Gcenx knows whether this has been attempted or done before: To display Windows application menus in the Mac global menu bar (or in this case, helloSystem's).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant