mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
fixed directory OPEN_MENU sorting bug and shortcut selection window problems
This commit is contained in:
49
src/event.c
49
src/event.c
@@ -1702,39 +1702,47 @@ handleKeyPress(XEvent *event)
|
|||||||
|
|
||||||
index = command-WKBD_WINDOW1;
|
index = command-WKBD_WINDOW1;
|
||||||
|
|
||||||
if (scr->shortcutSelectedWindows[index]) {
|
if (scr->shortcutWindows[index]) {
|
||||||
WMBag *list = scr->shortcutSelectedWindows[index];
|
WMBag *list = scr->shortcutWindows[index];
|
||||||
int cw;
|
int cw;
|
||||||
int i;
|
int i;
|
||||||
|
int count = WMGetBagItemCount(list);
|
||||||
|
WWindow *twin;
|
||||||
|
|
||||||
wUnselectWindows(scr);
|
wUnselectWindows(scr);
|
||||||
if (scr->shortcutWindow[index])
|
|
||||||
wMakeWindowVisible(scr->shortcutWindow[index]);
|
|
||||||
cw = scr->current_workspace;
|
cw = scr->current_workspace;
|
||||||
for (i = 0; i < WMGetBagItemCount(list); i++) {
|
|
||||||
|
for (i = count-1; i >= 0; i--) {
|
||||||
WWindow *wwin = WMGetFromBag(list, i);
|
WWindow *wwin = WMGetFromBag(list, i);
|
||||||
|
|
||||||
|
if (count > 1)
|
||||||
wWindowChangeWorkspace(wwin, cw);
|
wWindowChangeWorkspace(wwin, cw);
|
||||||
|
|
||||||
wMakeWindowVisible(wwin);
|
wMakeWindowVisible(wwin);
|
||||||
|
|
||||||
|
if (count > 1)
|
||||||
wSelectWindow(wwin, True);
|
wSelectWindow(wwin, True);
|
||||||
}
|
}
|
||||||
} else if (scr->shortcutWindow[index]){
|
|
||||||
|
|
||||||
wMakeWindowVisible(scr->shortcutWindow[index]);
|
/* rotate the order of windows, to create a cycling effect */
|
||||||
|
twin = WMGetFromBag(list, 0);
|
||||||
|
WMDeleteFromBag(list, 0);
|
||||||
|
WMPutInBag(list, twin);
|
||||||
|
|
||||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||||
|
|
||||||
scr->shortcutWindow[index] = wwin;
|
INITBAG(scr->shortcutWindows[index]);
|
||||||
|
WMPutInBag(scr->shortcutWindows[index], wwin);
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
WMBag *bag;
|
WMBag *selwins = scr->selected_windows;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bag = scr->selected_windows;
|
for (i = 0; i < WMGetBagItemCount(selwins); i++) {
|
||||||
INITBAG(scr->shortcutSelectedWindows[index]);
|
WWindow *tmp = WMGetFromBag(selwins, i);
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
if (tmp != wwin)
|
||||||
WWindow *tmp = WMGetFromBag(bag, i);
|
WMPutInBag(scr->shortcutWindows[index], tmp);
|
||||||
|
|
||||||
WMPutInBag(scr->shortcutSelectedWindows[index], tmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
@@ -1746,16 +1754,15 @@ handleKeyPress(XEvent *event)
|
|||||||
} else if (WMGetBagItemCount(scr->selected_windows)) {
|
} else if (WMGetBagItemCount(scr->selected_windows)) {
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
WMBag *bag;
|
WMBag *selwins = scr->selected_windows;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bag = scr->selected_windows;
|
INITBAG(scr->shortcutWindows[index]);
|
||||||
INITBAG(scr->shortcutSelectedWindows[index]);
|
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
for (i = 0; i < WMGetBagItemCount(selwins); i++) {
|
||||||
WWindow *tmp = WMGetFromBag(bag, i);
|
WWindow *tmp = WMGetFromBag(selwins, i);
|
||||||
|
|
||||||
WMPutInBag(scr->shortcutSelectedWindows[index], tmp);
|
WMPutInBag(scr->shortcutWindows[index], tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/misc.c
13
src/misc.c
@@ -116,6 +116,7 @@ MakeCPPArgs(char *path)
|
|||||||
int i;
|
int i;
|
||||||
char buffer[MAXLINE], *buf, *line;
|
char buffer[MAXLINE], *buf, *line;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
line = wmalloc(MAXLINE);
|
line = wmalloc(MAXLINE);
|
||||||
*line = 0;
|
*line = 0;
|
||||||
@@ -150,13 +151,13 @@ MakeCPPArgs(char *path)
|
|||||||
putidef(line, " -DSCR_HEIGHT=",
|
putidef(line, " -DSCR_HEIGHT=",
|
||||||
HeightOfScreen(DefaultScreenOfDisplay(dpy)));
|
HeightOfScreen(DefaultScreenOfDisplay(dpy)));
|
||||||
|
|
||||||
#if 0
|
/* put the dir where the menu is being read from to the
|
||||||
strcpy(buffer, path);
|
* search path */
|
||||||
buf = strrchr(buffer, '/');
|
tmp = wstrdup(path);
|
||||||
|
buf = strrchr(tmp, '/');
|
||||||
if (buf) *buf = 0; /* trunc filename */
|
if (buf) *buf = 0; /* trunc filename */
|
||||||
putdef(line, " -I", buffer);
|
putdef(line, " -I", tmp);
|
||||||
#endif
|
free(tmp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* this should be done just once, but it works this way */
|
/* this should be done just once, but it works this way */
|
||||||
|
|||||||
@@ -1270,8 +1270,11 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
myCompare(const void *d1, const void *d2)
|
myCompare(const void **d1, const void **d2)
|
||||||
{
|
{
|
||||||
|
d1 = *d1;
|
||||||
|
d2 = *d2;
|
||||||
|
|
||||||
return strcmp(((dir_data*) d1)->name, ((dir_data*) d2)->name);
|
return strcmp(((dir_data*) d1)->name, ((dir_data*) d2)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,8 +281,7 @@ typedef struct _WScreen {
|
|||||||
scrolled down for titlebar access */
|
scrolled down for titlebar access */
|
||||||
|
|
||||||
/* for window shortcuts */
|
/* for window shortcuts */
|
||||||
struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
|
WMBag *shortcutWindows[MAX_WINDOW_SHORTCUTS];
|
||||||
WMBag *shortcutSelectedWindows[MAX_WINDOW_SHORTCUTS];
|
|
||||||
|
|
||||||
#ifdef XDND
|
#ifdef XDND
|
||||||
char *xdestring;
|
char *xdestring;
|
||||||
|
|||||||
23
src/window.c
23
src/window.c
@@ -212,13 +212,14 @@ 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->shortcutSelectedWindows[i]) {
|
if (!wwin->screen_ptr->shortcutWindows[i])
|
||||||
WMRemoveFromBag(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);
|
continue;
|
||||||
|
|
||||||
if (!WMGetBagItemCount(wwin->screen_ptr->shortcutSelectedWindows[i])) {
|
WMRemoveFromBag(wwin->screen_ptr->shortcutWindows[i], wwin);
|
||||||
WMFreeBag(wwin->screen_ptr->shortcutSelectedWindows[i]);
|
|
||||||
wwin->screen_ptr->shortcutSelectedWindows[i] = NULL;
|
if (!WMGetBagItemCount(wwin->screen_ptr->shortcutWindows[i])) {
|
||||||
}
|
WMFreeBag(wwin->screen_ptr->shortcutWindows[i]);
|
||||||
|
wwin->screen_ptr->shortcutWindows[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,8 +803,12 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (wstate->window_shortcuts & (1<<i))
|
if (wstate->window_shortcuts & (1<<i)) {
|
||||||
scr->shortcutWindow[i] = wwin;
|
if (!scr->shortcutWindows[i])
|
||||||
|
scr->shortcutWindows[i] = WMCreateBag(4);
|
||||||
|
|
||||||
|
WMPutInBag(scr->shortcutWindows[i], wwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(wstate);
|
free(wstate);
|
||||||
@@ -2210,7 +2215,7 @@ wWindowSaveState(WWindow *wwin)
|
|||||||
data[3] = wwin->flags.hidden;
|
data[3] = wwin->flags.hidden;
|
||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (wwin->screen_ptr->shortcutWindow[i] == wwin)
|
if (WMCountInBag(wwin->screen_ptr->shortcutWindows[i], wwin))
|
||||||
data[9] |= 1<<i;
|
data[9] |= 1<<i;
|
||||||
}
|
}
|
||||||
XChangeProperty(dpy, wwin->client_win, _XA_WINDOWMAKER_STATE,
|
XChangeProperty(dpy, wwin->client_win, _XA_WINDOWMAKER_STATE,
|
||||||
|
|||||||
@@ -197,30 +197,25 @@ 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;
|
||||||
|
|
||||||
scr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
|
if (scr->shortcutWindows[index]) {
|
||||||
|
WMFreeBag(scr->shortcutWindows[index]);
|
||||||
if (scr->shortcutSelectedWindows[entry->order-WO_ENTRIES])
|
scr->shortcutWindows[index] = NULL;
|
||||||
WMFreeBag(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
}
|
||||||
|
|
||||||
if (wwin->flags.selected && scr->selected_windows) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
WMBag *bag;
|
WMBag *selwin = scr->selected_windows;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = WMCreateBag(4);
|
scr->shortcutWindows[index] = WMCreateBag(4);
|
||||||
|
|
||||||
bag = scr->selected_windows;
|
for (i = 0; i < WMGetBagItemCount(selwin); i++) {
|
||||||
|
WWindow *tmp = WMGetFromBag(selwin, i);
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
WMPutInBag(scr->shortcutWindows[index], tmp);
|
||||||
WWindow *tmp = WMGetFromBag(bag, i);
|
|
||||||
|
|
||||||
WMPutInBag(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES],
|
|
||||||
tmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
@@ -278,20 +273,17 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
|||||||
for (i=WO_ENTRIES; i<smenu->entry_no; i++) {
|
for (i=WO_ENTRIES; i<smenu->entry_no; i++) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int shortcutNo = i-WO_ENTRIES;
|
int shortcutNo = i-WO_ENTRIES;
|
||||||
WWindow *twin = wwin->screen_ptr->shortcutWindow[shortcutNo];
|
|
||||||
WMenuEntry *entry = smenu->entries[i];
|
WMenuEntry *entry = smenu->entries[i];
|
||||||
WMBag *shortSelWindows = wwin->screen_ptr->shortcutSelectedWindows[shortcutNo];
|
WMBag *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
|
||||||
|
|
||||||
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
||||||
|
|
||||||
if (!twin && !shortSelWindows) {
|
if (!shortSelWindows) {
|
||||||
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 (WMCountInBag(shortSelWindows, wwin))
|
||||||
entry->flags.indicator_type = MI_DIAMOND;
|
entry->flags.indicator_type = MI_DIAMOND;
|
||||||
else if (shortSelWindows && WMCountInBag(shortSelWindows, wwin))
|
|
||||||
entry->flags.indicator_type = MI_HIDDEN;
|
|
||||||
else
|
else
|
||||||
entry->flags.indicator_type = MI_CHECK;
|
entry->flags.indicator_type = MI_CHECK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user