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
Fix #3868 - Menu key does not work in Project Panel #3871
Conversation
@@ -44,8 +44,8 @@ | |||
#define INDEX_LEAF 5 | |||
#define INDEX_LEAF_INVALID 6 | |||
|
|||
#define GET_X_LPARAM(lp) LOWORD(lp) | |||
#define GET_Y_LPARAM(lp) HIWORD(lp) | |||
#define GET_X_LPARAM(lp) static_cast<short>(LOWORD(lp)) |
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.
Aren't those already defined in Windows headers?
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.
@CookiePLMonster Yes, you're right. I've included the header now. Thanks!
@luisffranca This change doesn't work for me... GetCursorPos(&p) gets the current position of the mouse cursor, and not the position of the selected treeview item. In my testing, your code will only pop up the apps menu if the mouse is positioned over a workspace item. I think you need to use something like this, to grab the bounding rectangle of the selected item. |
@DavidHansen-0x454d43 Thanks for the tip! I've changed the code and now the apps menu will pop up when a treeview item is selected. |
RECT selectedItemRect; | ||
if (TreeView_GetItemRect(_treeView.getHSelf(), selectedItem, &selectedItemRect, TRUE)) | ||
{ | ||
showContextMenuFromMenuKey(selectedItem, selectedItemRect.left, selectedItemRect.top); |
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.
Its working correctly now, good job @luisffranca !
My only suggestion would be to change the offset a bit so the apps menu doesn't entirely obscure the selected item:
showContextMenuFromMenuKey(selectedItem, (selectedItemRect.left+selectedItemRect.right)/2, (selectedItemRect.top+ selectedItemRect.bottom)/2);
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.
@DavidHansen-0x454d43 I've done the change you suggested, and it looks better now :) Thanks!
If the context menu is generated from the keyboard (for example, by the Menu key), then the x- and y-coordinates are -1 and the application should display the context menu at the location of the current selection.