mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Open window menu on right-click in window list menu
When doing right-click in a window list menu open window menu. Can be useful for sending here window from another workspace. Original-patch-by: Pavel S. Khmelinsky <hmepas@yauza.ru> Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
This commit is contained in:
committed by
Carlos R. Mafra
parent
afebdb50fa
commit
cc629f342c
@@ -58,6 +58,8 @@ void InitializeSwitchMenu(void);
|
|||||||
|
|
||||||
void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard);
|
void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard);
|
||||||
|
|
||||||
|
void OpenWindowMenu2(WWindow *wwin, int x, int y, int keyboard);
|
||||||
|
|
||||||
void OpenMiniwindowMenu(WWindow *wwin, int x, int y);
|
void OpenMiniwindowMenu(WWindow *wwin, int x, int y);
|
||||||
|
|
||||||
void OpenWorkspaceMenu(WScreen *scr, int x, int y);
|
void OpenWorkspaceMenu(WScreen *scr, int x, int y);
|
||||||
|
|||||||
18
src/menu.c
18
src/menu.c
@@ -1776,6 +1776,7 @@ static void delaySelection(void *data)
|
|||||||
|
|
||||||
static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||||
{
|
{
|
||||||
|
WWindow *wwin;
|
||||||
XButtonEvent *bev = &event->xbutton;
|
XButtonEvent *bev = &event->xbutton;
|
||||||
WMenu *menu = desc->parent;
|
WMenu *menu = desc->parent;
|
||||||
WMenu *smenu;
|
WMenu *smenu;
|
||||||
@@ -1856,7 +1857,22 @@ static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (!delayed_select) {
|
} else if (!delayed_select) {
|
||||||
selectEntry(menu, entry_no);
|
if (menu == scr->switch_menu && event->xbutton.button == Button3) {
|
||||||
|
selectEntry(menu, entry_no);
|
||||||
|
OpenWindowMenu2((WWindow *)entry->clientdata,
|
||||||
|
event->xbutton.x_root,
|
||||||
|
event->xbutton.y_root, False);
|
||||||
|
wwin = (WWindow *)entry->clientdata;
|
||||||
|
desc = &wwin->screen_ptr->window_menu->menu->descriptor;
|
||||||
|
event->xany.send_event = True;
|
||||||
|
(*desc->handle_mousedown)(desc, event);
|
||||||
|
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
selectEntry(menu, -1);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
selectEntry(menu, entry_no);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wPreferences.wrap_menus && !wPreferences.scrollable_menus) {
|
if (!wPreferences.wrap_menus && !wPreferences.scrollable_menus) {
|
||||||
|
|||||||
@@ -632,6 +632,54 @@ void OpenWindowMenu(WWindow * wwin, int x, int y, int keyboard)
|
|||||||
wMenuMapAt(menu, x, y, keyboard);
|
wMenuMapAt(menu, x, y, keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenWindowMenu2(WWindow *wwin, int x, int y, int keyboard)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
WMenu *menu;
|
||||||
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
WMRect rect;
|
||||||
|
|
||||||
|
wwin->flags.menu_open_for_me = 1;
|
||||||
|
|
||||||
|
if (!scr->window_menu) {
|
||||||
|
scr->window_menu = createWindowMenu(scr);
|
||||||
|
|
||||||
|
/* hack to save some memory allocation/deallocation */
|
||||||
|
wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
|
||||||
|
wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
|
||||||
|
wfree(scr->window_menu->entries[MC_SHADE]->text);
|
||||||
|
} else {
|
||||||
|
updateWorkspaceMenu(scr->workspace_submenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu = scr->window_menu;
|
||||||
|
if (menu->flags.mapped) {
|
||||||
|
wMenuUnmap(menu);
|
||||||
|
if (menu->entries[0]->clientdata == wwin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMenuForWindow(menu, wwin);
|
||||||
|
|
||||||
|
for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
|
||||||
|
scr->workspace_submenu->entries[i]->clientdata = wwin;
|
||||||
|
wMenuSetEnabled(scr->workspace_submenu, i, True);
|
||||||
|
}
|
||||||
|
|
||||||
|
x -= menu->frame->core->width / 2;
|
||||||
|
|
||||||
|
rect = wGetRectForHead(menu->frame->screen_ptr,
|
||||||
|
wGetHeadForPointerLocation(menu->frame->screen_ptr));
|
||||||
|
if (x < rect.pos.x - menu->frame->core->width / 2)
|
||||||
|
x = rect.pos.x - menu->frame->core->width / 2;
|
||||||
|
if (y < rect.pos.y)
|
||||||
|
y = rect.pos.y;
|
||||||
|
|
||||||
|
if (!wwin->flags.internal_window)
|
||||||
|
wMenuMapAt(menu, x, y, keyboard);
|
||||||
|
}
|
||||||
|
|
||||||
void OpenMiniwindowMenu(WWindow * wwin, int x, int y)
|
void OpenMiniwindowMenu(WWindow * wwin, int x, int y)
|
||||||
{
|
{
|
||||||
WMenu *menu;
|
WMenu *menu;
|
||||||
|
|||||||
Reference in New Issue
Block a user