mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +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 */
|
/* Session related */
|
||||||
WMPropList *session_state;
|
WMPropList *session_state;
|
||||||
|
|
||||||
|
/* Keyboard and shortcuts */
|
||||||
|
struct {
|
||||||
|
WMArray *windows[MAX_WINDOW_SHORTCUTS];
|
||||||
|
} shortcut;
|
||||||
|
|
||||||
/* Application related */
|
/* Application related */
|
||||||
struct WAppIcon *app_icon_list; /* list of all aplication icons */
|
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;
|
widx = command - WKBD_WINDOW1;
|
||||||
|
|
||||||
if (scr->shortcutWindows[widx]) {
|
if (w_global.shortcut.windows[widx]) {
|
||||||
WMArray *list = scr->shortcutWindows[widx];
|
WMArray *list = w_global.shortcut.windows[widx];
|
||||||
int cw;
|
int cw;
|
||||||
int count = WMGetArrayItemCount(list);
|
int count = WMGetArrayItemCount(list);
|
||||||
WWindow *twin;
|
WWindow *twin;
|
||||||
@@ -1661,18 +1661,16 @@ static void handleKeyPress(XEvent * event)
|
|||||||
WMAddToArray(list, twin);
|
WMAddToArray(list, twin);
|
||||||
|
|
||||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||||
if (scr->shortcutWindows[widx]) {
|
if (w_global.shortcut.windows[widx]) {
|
||||||
WMFreeArray(scr->shortcutWindows[widx]);
|
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||||
scr->shortcutWindows[widx] = NULL;
|
w_global.shortcut.windows[widx] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
|
||||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
|
||||||
} else {
|
} else {
|
||||||
scr->shortcutWindows[widx] = WMCreateArray(4);
|
w_global.shortcut.windows[widx] = WMCreateArray(4);
|
||||||
WMAddToArray(scr->shortcutWindows[widx], wwin);
|
WMAddToArray(w_global.shortcut.windows[widx], wwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
@@ -1682,12 +1680,11 @@ static void handleKeyPress(XEvent * event)
|
|||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
} else if (scr->selected_windows && WMGetArrayItemCount(scr->selected_windows)) {
|
} else if (scr->selected_windows && WMGetArrayItemCount(scr->selected_windows)) {
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
if (scr->shortcutWindows[widx]) {
|
if (w_global.shortcut.windows[widx])
|
||||||
WMFreeArray(scr->shortcutWindows[widx]);
|
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||||
}
|
|
||||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -257,10 +257,6 @@ typedef struct _WScreen {
|
|||||||
WMHandlerID *autoRaiseTimer;
|
WMHandlerID *autoRaiseTimer;
|
||||||
Window autoRaiseWindow; /* window that is scheduled to be
|
Window autoRaiseWindow; /* window that is scheduled to be
|
||||||
* raised */
|
* raised */
|
||||||
|
|
||||||
/* for window shortcuts */
|
|
||||||
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
|
|
||||||
|
|
||||||
#ifdef XDND
|
#ifdef XDND
|
||||||
char *xdestring;
|
char *xdestring;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -208,8 +208,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
geometry = WMCreatePLString(buffer);
|
geometry = WMCreatePLString(buffer);
|
||||||
|
|
||||||
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (scr->shortcutWindows[i] != NULL &&
|
if (w_global.shortcut.windows[i] != NULL &&
|
||||||
WMGetFirstInArray(scr->shortcutWindows[i], wwin) != WANotFound)
|
WMGetFirstInArray(w_global.shortcut.windows[i], wwin) != WANotFound)
|
||||||
mask |= 1 << i;
|
mask |= 1 << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
src/window.c
23
src/window.c
@@ -184,14 +184,14 @@ void 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->shortcutWindows[i])
|
if (!w_global.shortcut.windows[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WMRemoveFromArray(wwin->screen_ptr->shortcutWindows[i], wwin);
|
WMRemoveFromArray(w_global.shortcut.windows[i], wwin);
|
||||||
|
|
||||||
if (!WMGetArrayItemCount(wwin->screen_ptr->shortcutWindows[i])) {
|
if (!WMGetArrayItemCount(w_global.shortcut.windows[i])) {
|
||||||
WMFreeArray(wwin->screen_ptr->shortcutWindows[i]);
|
WMFreeArray(w_global.shortcut.windows[i]);
|
||||||
wwin->screen_ptr->shortcutWindows[i] = NULL;
|
w_global.shortcut.windows[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,10 +890,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (mask & (1 << i)) {
|
if (mask & (1 << i)) {
|
||||||
if (!scr->shortcutWindows[i])
|
if (!w_global.shortcut.windows[i])
|
||||||
scr->shortcutWindows[i] = WMCreateArray(4);
|
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];
|
long data[10];
|
||||||
int i;
|
int i;
|
||||||
@@ -2296,10 +2296,11 @@ void wWindowSaveState(WWindow * wwin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (wwin->screen_ptr->shortcutWindows[i] &&
|
if (w_global.shortcut.windows[i] &&
|
||||||
WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin))
|
WMCountInArray(w_global.shortcut.windows[i], wwin))
|
||||||
data[9] |= 1 << i;
|
data[9] |= 1 << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
XChangeProperty(dpy, wwin->client_win, w_global.atom.wmaker.state,
|
XChangeProperty(dpy, wwin->client_win, w_global.atom.wmaker.state,
|
||||||
w_global.atom.wmaker.state, 32, PropModeReplace, (unsigned char *)data, 10);
|
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);
|
wWindowChangeWorkspace(wwin, entry->order);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void makeShortcutCommand(WMenu * menu, WMenuEntry * entry)
|
static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
WWindow *wwin = (WWindow *) entry->clientdata;
|
WWindow *wwin = (WWindow *) entry->clientdata;
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
int index = entry->order - WO_ENTRIES;
|
int index = entry->order - WO_ENTRIES;
|
||||||
|
|
||||||
if (scr->shortcutWindows[index]) {
|
if (w_global.shortcut.windows[index]) {
|
||||||
WMFreeArray(scr->shortcutWindows[index]);
|
WMFreeArray(w_global.shortcut.windows[index]);
|
||||||
scr->shortcutWindows[index] = NULL;
|
w_global.shortcut.windows[index] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
scr->shortcutWindows[index] = WMDuplicateArray(scr->selected_windows);
|
w_global.shortcut.windows[index] = WMDuplicateArray(scr->selected_windows);
|
||||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
|
||||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
|
||||||
} else {
|
} else {
|
||||||
scr->shortcutWindows[index] = WMCreateArray(4);
|
w_global.shortcut.windows[index] = WMCreateArray(4);
|
||||||
WMAddToArray(scr->shortcutWindows[index], wwin);
|
WMAddToArray(w_global.shortcut.windows[index], wwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
@@ -253,7 +251,7 @@ static void updateWorkspaceMenu(WMenu * menu)
|
|||||||
wMenuRealize(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];
|
WMenu *smenu = menu->cascades[menu->entries[MC_SHORTCUT]->cascade];
|
||||||
int i;
|
int i;
|
||||||
@@ -271,7 +269,7 @@ static void updateMakeShortcutMenu(WMenu * menu, WWindow * wwin)
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
int shortcutNo = i - WO_ENTRIES;
|
int shortcutNo = i - WO_ENTRIES;
|
||||||
WMenuEntry *entry = smenu->entries[i];
|
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);
|
snprintf(buffer, buflen, "%s %i", _("Set Shortcut"), shortcutNo + 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user