mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
Window shortcuts will apply to a group of selected windows, too.
This commit is contained in:
51
src/event.c
51
src/event.c
@@ -56,6 +56,7 @@
|
||||
#include "framewin.h"
|
||||
#include "properties.h"
|
||||
#include "balloon.h"
|
||||
#include "list.h"
|
||||
#ifdef GNOME_STUFF
|
||||
# include "gnome.h"
|
||||
#endif
|
||||
@@ -1672,16 +1673,54 @@ handleKeyPress(XEvent *event)
|
||||
case WKBD_WINDOW9:
|
||||
case WKBD_WINDOW10:
|
||||
#endif
|
||||
if (scr->shortcutWindow[command-WKBD_WINDOW1]) {
|
||||
if ( scr->shortcutSelectedWindows[command-WKBD_WINDOW1]) {
|
||||
LinkedList *list = scr->shortcutSelectedWindows[command-WKBD_WINDOW1];
|
||||
int cw;
|
||||
|
||||
wUnselectWindows(scr);
|
||||
if (scr->shortcutWindow[command-WKBD_WINDOW1])
|
||||
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
|
||||
cw = scr->current_workspace;
|
||||
while (list) {
|
||||
wWindowChangeWorkspace(list->head, cw);
|
||||
wMakeWindowVisible(list->head);
|
||||
wSelectWindow(list->head, True);
|
||||
list = list->tail;
|
||||
}
|
||||
} else if (scr->shortcutWindow[command-WKBD_WINDOW1]) {
|
||||
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
|
||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||
scr->shortcutWindow[command-WKBD_WINDOW1] = wwin;
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
XFlush(dpy);
|
||||
wusleep(3000);
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
XFlush(dpy);
|
||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
||||
LinkedList *sl;
|
||||
|
||||
sl = scr->selected_windows;
|
||||
list_free(scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
||||
|
||||
while (sl) {
|
||||
scr->shortcutSelectedWindows[command-WKBD_WINDOW1] = list_cons(sl->head,scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
||||
sl = sl->tail;
|
||||
}
|
||||
}
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
XFlush(dpy);
|
||||
wusleep(3000);
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
XFlush(dpy);
|
||||
} else if (scr->selected_windows) {
|
||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
||||
LinkedList *sl;
|
||||
|
||||
sl = scr->selected_windows;
|
||||
list_free(scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
||||
|
||||
while (sl) {
|
||||
scr->shortcutSelectedWindows[command-WKBD_WINDOW1] = list_cons(sl->head,scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
||||
sl = sl->tail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case WKBD_NEXTWSLAYER:
|
||||
case WKBD_PREVWSLAYER:
|
||||
|
||||
13
src/window.c
13
src/window.c
@@ -51,6 +51,7 @@
|
||||
#include "stacking.h"
|
||||
#include "defaults.h"
|
||||
#include "workspace.h"
|
||||
#include "list.h"
|
||||
|
||||
#ifdef MWM_HINTS
|
||||
# include "motif.h"
|
||||
@@ -208,9 +209,15 @@ wWindowDestroy(WWindow *wwin)
|
||||
wwin->flags.destroyed = 1;
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (wwin->screen_ptr->shortcutWindow[i] == wwin) {
|
||||
wwin->screen_ptr->shortcutWindow[i] = NULL;
|
||||
}
|
||||
wwin->screen_ptr->shortcutSelectedWindows[i] = list_remove_elem(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);
|
||||
if (wwin->screen_ptr->shortcutWindow[i] == wwin) {
|
||||
if (wwin->screen_ptr->shortcutSelectedWindows[i]) {
|
||||
LinkedList *list = wwin->screen_ptr->shortcutSelectedWindows[i];
|
||||
wwin->screen_ptr->shortcutWindow[i] =
|
||||
list->head;
|
||||
}
|
||||
else wwin->screen_ptr->shortcutWindow[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (wwin->normal_hints)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "dialog.h"
|
||||
#include "stacking.h"
|
||||
#include "icon.h"
|
||||
#include "list.h"
|
||||
|
||||
#define MC_MAXIMIZE 0
|
||||
#define MC_MINIATURIZE 1
|
||||
@@ -195,8 +196,24 @@ static void
|
||||
makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
WWindow *wwin = (WWindow*)entry->clientdata;
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
|
||||
wwin->screen_ptr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
|
||||
scr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
|
||||
list_free(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = NULL;
|
||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
||||
LinkedList *sl;
|
||||
|
||||
sl = scr->selected_windows;
|
||||
|
||||
while (sl) {
|
||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = list_cons(sl->head,scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
||||
sl = sl->tail;
|
||||
}
|
||||
}
|
||||
else {
|
||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = NULL;
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
XFlush(dpy);
|
||||
@@ -259,14 +276,16 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
|
||||
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
||||
|
||||
if (!twin) {
|
||||
if (!twin && !wwin->screen_ptr->shortcutSelectedWindows[shortcutNo]) {
|
||||
entry->flags.indicator_on = 0;
|
||||
} else {
|
||||
entry->flags.indicator_on = 1;
|
||||
if (twin != wwin)
|
||||
entry->flags.indicator_type = MI_CHECK;
|
||||
else
|
||||
if (twin == wwin)
|
||||
entry->flags.indicator_type = MI_DIAMOND;
|
||||
else if (list_find(wwin->screen_ptr->shortcutSelectedWindows[shortcutNo], wwin))
|
||||
entry->flags.indicator_type = MI_HIDDEN;
|
||||
else
|
||||
entry->flags.indicator_type = MI_CHECK;
|
||||
}
|
||||
|
||||
if (strcmp(buffer, entry->text)!=0) {
|
||||
|
||||
Reference in New Issue
Block a user