mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
shortcutWindows moved to w_global
The variable shortcutWindows is moved to w_global. Now, the shortcuts are used in whole Window Maker, not only in the current screen.
This commit is contained in:
committed by
Carlos R. Mafra
parent
6987d4aa40
commit
0de3e590ce
@@ -563,6 +563,11 @@ extern struct wmaker_global_variables {
|
||||
/* Session related */
|
||||
WMPropList *session_state;
|
||||
|
||||
/* Keyboard and shortcuts */
|
||||
struct {
|
||||
WMArray *windows[MAX_WINDOW_SHORTCUTS];
|
||||
} shortcut;
|
||||
|
||||
/* Application related */
|
||||
struct WAppIcon *app_icon_list; /* list of all aplication icons */
|
||||
|
||||
|
||||
27
src/event.c
27
src/event.c
@@ -1634,8 +1634,8 @@ static void handleKeyPress(XEvent * event)
|
||||
|
||||
widx = command - WKBD_WINDOW1;
|
||||
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMArray *list = scr->shortcutWindows[widx];
|
||||
if (w_global.shortcut.windows[widx]) {
|
||||
WMArray *list = w_global.shortcut.windows[widx];
|
||||
int cw;
|
||||
int count = WMGetArrayItemCount(list);
|
||||
WWindow *twin;
|
||||
@@ -1661,18 +1661,16 @@ static void handleKeyPress(XEvent * event)
|
||||
WMAddToArray(list, twin);
|
||||
|
||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMFreeArray(scr->shortcutWindows[widx]);
|
||||
scr->shortcutWindows[widx] = NULL;
|
||||
if (w_global.shortcut.windows[widx]) {
|
||||
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||
w_global.shortcut.windows[widx] = NULL;
|
||||
}
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
||||
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
} else {
|
||||
scr->shortcutWindows[widx] = WMCreateArray(4);
|
||||
WMAddToArray(scr->shortcutWindows[widx], wwin);
|
||||
w_global.shortcut.windows[widx] = WMCreateArray(4);
|
||||
WMAddToArray(w_global.shortcut.windows[widx], wwin);
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
@@ -1682,12 +1680,11 @@ static void handleKeyPress(XEvent * event)
|
||||
XFlush(dpy);
|
||||
|
||||
} else if (scr->selected_windows && WMGetArrayItemCount(scr->selected_windows)) {
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMFreeArray(scr->shortcutWindows[widx]);
|
||||
}
|
||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
if (w_global.shortcut.windows[widx])
|
||||
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||
|
||||
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,10 +257,6 @@ typedef struct _WScreen {
|
||||
WMHandlerID *autoRaiseTimer;
|
||||
Window autoRaiseWindow; /* window that is scheduled to be
|
||||
* raised */
|
||||
|
||||
/* for window shortcuts */
|
||||
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
|
||||
|
||||
#ifdef XDND
|
||||
char *xdestring;
|
||||
#endif
|
||||
|
||||
@@ -208,8 +208,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
||||
geometry = WMCreatePLString(buffer);
|
||||
|
||||
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (scr->shortcutWindows[i] != NULL &&
|
||||
WMGetFirstInArray(scr->shortcutWindows[i], wwin) != WANotFound)
|
||||
if (w_global.shortcut.windows[i] != NULL &&
|
||||
WMGetFirstInArray(w_global.shortcut.windows[i], wwin) != WANotFound)
|
||||
mask |= 1 << i;
|
||||
}
|
||||
|
||||
|
||||
23
src/window.c
23
src/window.c
@@ -184,14 +184,14 @@ void wWindowDestroy(WWindow *wwin)
|
||||
wwin->flags.destroyed = 1;
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (!wwin->screen_ptr->shortcutWindows[i])
|
||||
if (!w_global.shortcut.windows[i])
|
||||
continue;
|
||||
|
||||
WMRemoveFromArray(wwin->screen_ptr->shortcutWindows[i], wwin);
|
||||
WMRemoveFromArray(w_global.shortcut.windows[i], wwin);
|
||||
|
||||
if (!WMGetArrayItemCount(wwin->screen_ptr->shortcutWindows[i])) {
|
||||
WMFreeArray(wwin->screen_ptr->shortcutWindows[i]);
|
||||
wwin->screen_ptr->shortcutWindows[i] = NULL;
|
||||
if (!WMGetArrayItemCount(w_global.shortcut.windows[i])) {
|
||||
WMFreeArray(w_global.shortcut.windows[i]);
|
||||
w_global.shortcut.windows[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,10 +890,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (mask & (1 << i)) {
|
||||
if (!scr->shortcutWindows[i])
|
||||
scr->shortcutWindows[i] = WMCreateArray(4);
|
||||
if (!w_global.shortcut.windows[i])
|
||||
w_global.shortcut.windows[i] = WMCreateArray(4);
|
||||
|
||||
WMAddToArray(scr->shortcutWindows[i], wwin);
|
||||
WMAddToArray(w_global.shortcut.windows[i], wwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2272,7 +2272,7 @@ void wWindowConfigureBorders(WWindow *wwin)
|
||||
}
|
||||
}
|
||||
|
||||
void wWindowSaveState(WWindow * wwin)
|
||||
void wWindowSaveState(WWindow *wwin)
|
||||
{
|
||||
long data[10];
|
||||
int i;
|
||||
@@ -2296,10 +2296,11 @@ void wWindowSaveState(WWindow * wwin)
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (wwin->screen_ptr->shortcutWindows[i] &&
|
||||
WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin))
|
||||
if (w_global.shortcut.windows[i] &&
|
||||
WMCountInArray(w_global.shortcut.windows[i], wwin))
|
||||
data[9] |= 1 << i;
|
||||
}
|
||||
|
||||
XChangeProperty(dpy, wwin->client_win, w_global.atom.wmaker.state,
|
||||
w_global.atom.wmaker.state, 32, PropModeReplace, (unsigned char *)data, 10);
|
||||
}
|
||||
|
||||
@@ -187,24 +187,22 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
|
||||
wWindowChangeWorkspace(wwin, entry->order);
|
||||
}
|
||||
|
||||
static void makeShortcutCommand(WMenu * menu, WMenuEntry * entry)
|
||||
static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
WWindow *wwin = (WWindow *) entry->clientdata;
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
int index = entry->order - WO_ENTRIES;
|
||||
|
||||
if (scr->shortcutWindows[index]) {
|
||||
WMFreeArray(scr->shortcutWindows[index]);
|
||||
scr->shortcutWindows[index] = NULL;
|
||||
if (w_global.shortcut.windows[index]) {
|
||||
WMFreeArray(w_global.shortcut.windows[index]);
|
||||
w_global.shortcut.windows[index] = NULL;
|
||||
}
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
scr->shortcutWindows[index] = WMDuplicateArray(scr->selected_windows);
|
||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
||||
w_global.shortcut.windows[index] = WMDuplicateArray(scr->selected_windows);
|
||||
} else {
|
||||
scr->shortcutWindows[index] = WMCreateArray(4);
|
||||
WMAddToArray(scr->shortcutWindows[index], wwin);
|
||||
w_global.shortcut.windows[index] = WMCreateArray(4);
|
||||
WMAddToArray(w_global.shortcut.windows[index], wwin);
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
@@ -253,7 +251,7 @@ static void updateWorkspaceMenu(WMenu * menu)
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
|
||||
static void updateMakeShortcutMenu(WMenu * menu, WWindow * wwin)
|
||||
static void updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
{
|
||||
WMenu *smenu = menu->cascades[menu->entries[MC_SHORTCUT]->cascade];
|
||||
int i;
|
||||
@@ -271,7 +269,7 @@ static void updateMakeShortcutMenu(WMenu * menu, WWindow * wwin)
|
||||
char *tmp;
|
||||
int shortcutNo = i - WO_ENTRIES;
|
||||
WMenuEntry *entry = smenu->entries[i];
|
||||
WMArray *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
|
||||
WMArray *shortSelWindows = w_global.shortcut.windows[shortcutNo];
|
||||
|
||||
snprintf(buffer, buflen, "%s %i", _("Set Shortcut"), shortcutNo + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user