From 7908c9a66bdccdef4fc1e5e7d5d564a66d4c08a0 Mon Sep 17 00:00:00 2001 From: kojima Date: Tue, 19 Oct 2004 01:53:11 +0000 Subject: [PATCH] more bug fixes.. --- src/cycling.c | 16 +++++++++++++++- src/switchpanel.c | 35 +++++++++++++++++++++++++++++++---- src/switchpanel.h | 1 + 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/cycling.c b/src/cycling.c index 6ac0a128..e11f91b7 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -26,6 +26,10 @@ #include #include +// TODO: remove non-MOX_CYCLING junk +// fix the stacking/window raising during alt-tabbing +// allow selection of icons with mouse + #define MOX_CYCLING #include "WindowMaker.h" @@ -190,13 +194,15 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next) #ifdef MOX_CYCLING WSwitchPanel *swpanel = NULL; #endif - KeyCode leftKey, rightKey; + KeyCode leftKey, rightKey, homeKey, endKey; if (!wwin) return; leftKey = XKeysymToKeycode(dpy, XK_Left); rightKey = XKeysymToKeycode(dpy, XK_Right); + homeKey = XKeysymToKeycode(dpy, XK_Home); + endKey = XKeysymToKeycode(dpy, XK_End); if (next) hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0); @@ -307,6 +313,14 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next) XRaiseWindow(dpy, newFocused->frame->core->window); } #endif /* !MOX_CYCLING */ + } else if (ev.xkey.keycode == homeKey || ev.xkey.keycode == endKey) { + if (swpanel) { + newFocused = wSwitchPanelSelectFirst(swpanel, ev.xkey.keycode != homeKey); + if (newFocused) { + wWindowFocus(newFocused, oldFocused); + oldFocused = newFocused; + } + } } else if (ev.type == MotionNotify) { WWindow *tmp; if (swpanel) { diff --git a/src/switchpanel.c b/src/switchpanel.c index f96078fd..0a070a0d 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -133,6 +133,8 @@ extern WPreferences wPreferences; static int canReceiveFocus(WWindow *wwin) { + if (wwin->frame->workspace != wwin->screen_ptr->current_workspace) + return 0; if (!wwin->flags.mapped) { if (!wwin->flags.shaded && !wwin->flags.miniaturized && !wwin->flags.hidden) @@ -142,8 +144,6 @@ static int canReceiveFocus(WWindow *wwin) } if (WFLAGP(wwin, no_focusable)) return 0; - if (wwin->frame->workspace != wwin->screen_ptr->current_workspace) - return 0; return 1; } @@ -364,7 +364,6 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace) WMMapSubwidgets(panel->win); WMRealizeWidget(panel->win); - WMMapWidget(panel->win); { WMPoint center; @@ -376,7 +375,9 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace) panel->current= WMGetFirstInArray(panel->windows, curwin); if (panel->current >= 0) changeImage(panel, panel->current, 1); - + + WMMapWidget(panel->win); + return panel; } @@ -433,6 +434,32 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back) } +WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back) +{ + WWindow *wwin; + int count = WMGetArrayItemCount(panel->windows); + + if (count == 0) + return NULL; + + if (panel->win) + changeImage(panel, panel->current, 0); + + if (!back) + panel->current = count-1; + else + panel->current = 0; + + wwin = WMGetFromArray(panel->windows, panel->current); + + if (panel->win) { + WMSetLabelText(panel->label, wwin->frame->title); + + changeImage(panel, panel->current, 1); + } + return wwin; +} + WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event) { diff --git a/src/switchpanel.h b/src/switchpanel.h index 59007ba2..855f8106 100644 --- a/src/switchpanel.h +++ b/src/switchpanel.h @@ -29,6 +29,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace); void wSwitchPanelDestroy(WSwitchPanel *panel); WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back); +WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back); WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event); -- 2.11.4.GIT