mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
fixed bugs, re-enabled circulate raise
This commit is contained in:
@@ -693,7 +693,7 @@ createPanel(Panel *p)
|
||||
|
||||
box = WMCreateBox(vbox);
|
||||
WMSetBoxHorizontal(box, True);
|
||||
WMAddBoxSubview(vbox, WMWidgetView(box), True, True, 20, 0, 4);
|
||||
WMAddBoxSubview(vbox, WMWidgetView(box), True, True, 20, 0, 0);
|
||||
|
||||
panel->styleL = WMCreateList(box);
|
||||
WMAddBoxSubview(box, WMWidgetView(panel->styleL), True, True, 0, 0, 4);
|
||||
|
||||
@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
|
||||
|
||||
|
||||
|
||||
AM_INIT_AUTOMAKE(WindowMaker, 0.85.0)
|
||||
AM_INIT_AUTOMAKE(WindowMaker, 0.90.0)
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
|
||||
200
src/cycling.c
200
src/cycling.c
@@ -30,8 +30,6 @@
|
||||
// fix the stacking/window raising during alt-tabbing
|
||||
// allow selection of icons with mouse
|
||||
|
||||
#define MOX_CYCLING
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "GNUstep.h"
|
||||
#include "screen.h"
|
||||
@@ -51,133 +49,19 @@ extern WPreferences wPreferences;
|
||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef MOX_CYCLING
|
||||
static WWindow*
|
||||
nextToFocusAfter(WWindow *wwin)
|
||||
static void raiseWindow(WSwitchPanel *swpanel, WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->prev;
|
||||
if (wwin->flags.mapped) {
|
||||
Window win[2];
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
win[0]= wSwitchPanelGetWindow(swpanel);
|
||||
win[1]= wwin->frame->core->window;
|
||||
|
||||
tmp = wwin;
|
||||
/* start over from the beginning of the list */
|
||||
while (tmp->next)
|
||||
tmp = tmp->next;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
static WWindow*
|
||||
nextToFocusBefore(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->next;
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
/* start over from the beginning of the list */
|
||||
tmp = wwin;
|
||||
while (tmp->prev)
|
||||
tmp = tmp->prev;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static WWindow*
|
||||
nextFocusWindow(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp, *closest, *min;
|
||||
Window d;
|
||||
|
||||
if (!wwin)
|
||||
return NULL;
|
||||
tmp = wwin->prev;
|
||||
closest = NULL;
|
||||
min = wwin;
|
||||
d = 0xffffffff;
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp)
|
||||
&& (!WFLAGP(tmp, skip_window_list)|| tmp->flags.internal_window)) {
|
||||
if (min->client_win > tmp->client_win)
|
||||
min = tmp;
|
||||
if (tmp->client_win > wwin->client_win
|
||||
&& (!closest
|
||||
|| (tmp->client_win - wwin->client_win) < d)) {
|
||||
closest = tmp;
|
||||
d = tmp->client_win - wwin->client_win;
|
||||
XRestackWindows(dpy, win, 2);
|
||||
}
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
if (!closest||closest==wwin)
|
||||
return min;
|
||||
return closest;
|
||||
}
|
||||
|
||||
|
||||
static WWindow*
|
||||
prevFocusWindow(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp, *closest, *max;
|
||||
Window d;
|
||||
|
||||
if (!wwin)
|
||||
return NULL;
|
||||
tmp = wwin->prev;
|
||||
closest = NULL;
|
||||
max = wwin;
|
||||
d = 0xffffffff;
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) &&
|
||||
(!WFLAGP(tmp, skip_window_list) || tmp->flags.internal_window)) {
|
||||
if (max->client_win < tmp->client_win)
|
||||
max = tmp;
|
||||
if (tmp->client_win < wwin->client_win
|
||||
&& (!closest
|
||||
|| (wwin->client_win - tmp->client_win) < d)) {
|
||||
closest = tmp;
|
||||
d = wwin->client_win - tmp->client_win;
|
||||
}
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
if (!closest||closest==wwin)
|
||||
return max;
|
||||
return closest;
|
||||
}
|
||||
#endif /* !MOX_CYCLING */
|
||||
|
||||
|
||||
void
|
||||
StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
@@ -191,12 +75,10 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
Bool hasModifier;
|
||||
Bool somethingElse = False;
|
||||
XEvent ev;
|
||||
#ifdef MOX_CYCLING
|
||||
WSwitchPanel *swpanel = NULL;
|
||||
#endif
|
||||
KeyCode leftKey, rightKey, homeKey, endKey;
|
||||
|
||||
if (!wwin)
|
||||
if (!wwin || wwin->frame->workspace != scr->current_workspace)
|
||||
return;
|
||||
|
||||
leftKey = XKeysymToKeycode(dpy, XK_Left);
|
||||
@@ -221,7 +103,6 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
|
||||
scr->flags.doing_alt_tab = 1;
|
||||
|
||||
#ifdef MOX_CYCLING
|
||||
swpanel = wInitSwitchPanel(scr, wwin, scr->current_workspace);
|
||||
oldFocused = wwin;
|
||||
|
||||
@@ -230,28 +111,13 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
if (newFocused) {
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise)
|
||||
raiseWindow(swpanel, newFocused);
|
||||
}
|
||||
}
|
||||
else
|
||||
newFocused= wwin;
|
||||
#else /* !MOX_CYCLING */
|
||||
if (next) {
|
||||
if (wPreferences.windows_cycling)
|
||||
newFocused = nextToFocusAfter(wwin);
|
||||
else
|
||||
newFocused = nextFocusWindow(wwin);
|
||||
} else {
|
||||
if (wPreferences.windows_cycling)
|
||||
newFocused = nextToFocusBefore(wwin);
|
||||
else
|
||||
newFocused = prevFocusWindow(wwin);
|
||||
}
|
||||
|
||||
if (wPreferences.circ_raise)
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
wWindowFocus(newFocused, scr->focused_window);
|
||||
oldFocused = newFocused;
|
||||
#endif /* !MOX_CYCLING */
|
||||
|
||||
while (hasModifier && !done) {
|
||||
WMMaskEvent(dpy, KeyPressMask|KeyReleaseMask|ExposureMask|PointerMotionMask, &ev);
|
||||
@@ -271,54 +137,45 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers)
|
||||
|| ev.xkey.keycode == rightKey) {
|
||||
|
||||
#ifdef MOX_CYCLING
|
||||
if (swpanel) {
|
||||
newFocused = wSwitchPanelSelectNext(swpanel, False);
|
||||
if (newFocused) {
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
}
|
||||
}
|
||||
#else /* !MOX_CYCLING */
|
||||
newFocused = nextToFocusAfter(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
raiseWindow(swpanel, newFocused);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !MOX_CYCLING */
|
||||
} else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers)
|
||||
|| ev.xkey.keycode == leftKey) {
|
||||
|
||||
#ifdef MOX_CYCLING
|
||||
if (swpanel) {
|
||||
newFocused = wSwitchPanelSelectNext(swpanel, True);
|
||||
if (newFocused) {
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
}
|
||||
}
|
||||
#else /* !MOX_CYCLING */
|
||||
newFocused = nextToFocusBefore(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
raiseWindow(swpanel, newFocused);
|
||||
}
|
||||
}
|
||||
}
|
||||
#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;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
CommitStacking(scr);
|
||||
raiseWindow(swpanel, newFocused);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ev.type == MotionNotify) {
|
||||
@@ -365,25 +222,20 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
}
|
||||
|
||||
if (newFocused) {
|
||||
wSetFocusTo(scr, newFocused);
|
||||
CommitStacking(scr);
|
||||
if (!newFocused->flags.mapped)
|
||||
wMakeWindowVisible(newFocused);
|
||||
wSetFocusTo(scr, newFocused);
|
||||
wRaiseFrame(newFocused->frame->core);
|
||||
}
|
||||
|
||||
#ifdef MOX_CYCLING
|
||||
if (swpanel)
|
||||
wSwitchPanelDestroy(swpanel);
|
||||
#endif
|
||||
|
||||
if (wPreferences.circ_raise && newFocused) {
|
||||
wRaiseFrame(newFocused->frame->core);
|
||||
CommitStacking(scr);
|
||||
}
|
||||
|
||||
scr->flags.doing_alt_tab = 0;
|
||||
|
||||
if (somethingElse) {
|
||||
if (somethingElse)
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -466,7 +466,8 @@ check_defaults()
|
||||
{
|
||||
char *path;
|
||||
|
||||
path = wdefaultspathfordomain("");
|
||||
path = wdefaultspathfordomain("WindowMaker");
|
||||
|
||||
if (access(path, R_OK)!=0) {
|
||||
#if 0
|
||||
wfatal(_("could not find user GNUstep directory (%s).\n"
|
||||
|
||||
@@ -128,7 +128,7 @@ extern WPreferences wPreferences;
|
||||
|
||||
#define ICON_IDEAL_SIZE 48
|
||||
#define ICON_EXTRASPACE 16
|
||||
|
||||
#define LABEL_HEIGHT 25
|
||||
|
||||
|
||||
static int canReceiveFocus(WWindow *wwin)
|
||||
@@ -288,7 +288,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
||||
return panel;
|
||||
}
|
||||
|
||||
height= iconWidth + 20 + 10 + ICON_EXTRASPACE + 10;
|
||||
height= iconWidth + LABEL_HEIGHT + 10 + ICON_EXTRASPACE + 10;
|
||||
|
||||
panel->icons= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
||||
panel->images= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
||||
@@ -307,7 +307,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
||||
WMSetBoxHorizontal(vbox, False);
|
||||
|
||||
panel->label = WMCreateLabel(vbox);
|
||||
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->label), False, True, 20, 0, 0);
|
||||
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->label), False, True, LABEL_HEIGHT, 0, 0);
|
||||
if (scr->focused_window && scr->focused_window->frame->title)
|
||||
WMSetLabelText(panel->label, scr->focused_window->frame->title);
|
||||
else
|
||||
@@ -317,7 +317,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
||||
WMColor *color;
|
||||
WMFont *boldFont= WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||
|
||||
WMSetLabelRelief(panel->label, WRSimple);
|
||||
WMSetLabelRelief(panel->label, WRSunken);
|
||||
WMSetLabelFont(panel->label, boldFont);
|
||||
color = WMDarkGrayColor(scr->wmscreen);
|
||||
WMSetWidgetBackgroundColor(panel->label, color);
|
||||
@@ -477,3 +477,7 @@ WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event)
|
||||
}
|
||||
|
||||
|
||||
Window wSwitchPanelGetWindow(WSwitchPanel *swpanel)
|
||||
{
|
||||
return WMWidgetXID(swpanel->win);
|
||||
}
|
||||
|
||||
@@ -33,4 +33,6 @@ WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back);
|
||||
|
||||
WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event);
|
||||
|
||||
Window wSwitchPanelGetWindow(WSwitchPanel *swpanel);
|
||||
|
||||
#endif /* _SWITCHPANEL_H_ */
|
||||
|
||||
@@ -269,12 +269,12 @@
|
||||
#define DEF_FRAME_COLOR "white"
|
||||
|
||||
|
||||
#define DEF_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=12"
|
||||
#define DEF_MENU_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=12"
|
||||
#define DEF_MENU_ENTRY_FONT "Trebuchet MS,Luxi Sans:pixelsize=12"
|
||||
#define DEF_ICON_TITLE_FONT "Trebuchet MS,Luxi Sans:pixelsize=8"
|
||||
#define DEF_CLIP_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=10"
|
||||
#define DEF_INFO_TEXT_FONT "Trebuchet MS,Luxi Sans:pixelsize=12"
|
||||
#define DEF_TITLE_FONT "\"Trebuchet MS,Luxi Sans:bold:pixelsize=12\""
|
||||
#define DEF_MENU_TITLE_FONT "\"Trebuchet MS,Luxi Sans:bold:pixelsize=12\""
|
||||
#define DEF_MENU_ENTRY_FONT "\"Trebuchet MS,Luxi Sans:pixelsize=12\""
|
||||
#define DEF_ICON_TITLE_FONT "\"Trebuchet MS,Luxi Sans:pixelsize=8\""
|
||||
#define DEF_CLIP_TITLE_FONT "\"Trebuchet MS,Luxi Sans:bold:pixelsize=10\""
|
||||
#define DEF_INFO_TEXT_FONT "\"Trebuchet MS,Luxi Sans:pixelsize=12\""
|
||||
|
||||
#define DEF_WORKSPACE_NAME_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=24"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user