mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38: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 "framewin.h"
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "balloon.h"
|
#include "balloon.h"
|
||||||
|
#include "list.h"
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
# include "gnome.h"
|
# include "gnome.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -1672,16 +1673,54 @@ handleKeyPress(XEvent *event)
|
|||||||
case WKBD_WINDOW9:
|
case WKBD_WINDOW9:
|
||||||
case WKBD_WINDOW10:
|
case WKBD_WINDOW10:
|
||||||
#endif
|
#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]);
|
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
|
||||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||||
scr->shortcutWindow[command-WKBD_WINDOW1] = wwin;
|
scr->shortcutWindow[command-WKBD_WINDOW1] = wwin;
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
||||||
XFlush(dpy);
|
LinkedList *sl;
|
||||||
wusleep(3000);
|
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
sl = scr->selected_windows;
|
||||||
XFlush(dpy);
|
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;
|
break;
|
||||||
case WKBD_NEXTWSLAYER:
|
case WKBD_NEXTWSLAYER:
|
||||||
case WKBD_PREVWSLAYER:
|
case WKBD_PREVWSLAYER:
|
||||||
|
|||||||
13
src/window.c
13
src/window.c
@@ -51,6 +51,7 @@
|
|||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
#ifdef MWM_HINTS
|
#ifdef MWM_HINTS
|
||||||
# include "motif.h"
|
# include "motif.h"
|
||||||
@@ -208,9 +209,15 @@ wWindowDestroy(WWindow *wwin)
|
|||||||
wwin->flags.destroyed = 1;
|
wwin->flags.destroyed = 1;
|
||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (wwin->screen_ptr->shortcutWindow[i] == wwin) {
|
wwin->screen_ptr->shortcutSelectedWindows[i] = list_remove_elem(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);
|
||||||
wwin->screen_ptr->shortcutWindow[i] = NULL;
|
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)
|
if (wwin->normal_hints)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
#define MC_MAXIMIZE 0
|
#define MC_MAXIMIZE 0
|
||||||
#define MC_MINIATURIZE 1
|
#define MC_MINIATURIZE 1
|
||||||
@@ -195,8 +196,24 @@ static void
|
|||||||
makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
WWindow *wwin = (WWindow*)entry->clientdata;
|
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);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
@@ -259,14 +276,16 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
|||||||
|
|
||||||
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
||||||
|
|
||||||
if (!twin) {
|
if (!twin && !wwin->screen_ptr->shortcutSelectedWindows[shortcutNo]) {
|
||||||
entry->flags.indicator_on = 0;
|
entry->flags.indicator_on = 0;
|
||||||
} else {
|
} else {
|
||||||
entry->flags.indicator_on = 1;
|
entry->flags.indicator_on = 1;
|
||||||
if (twin != wwin)
|
if (twin == wwin)
|
||||||
entry->flags.indicator_type = MI_CHECK;
|
|
||||||
else
|
|
||||||
entry->flags.indicator_type = MI_DIAMOND;
|
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) {
|
if (strcmp(buffer, entry->text)!=0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user