mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
fixed cycling
This commit is contained in:
@@ -216,14 +216,16 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
scr->flags.doing_alt_tab = 1;
|
scr->flags.doing_alt_tab = 1;
|
||||||
|
|
||||||
#ifdef MOX_CYCLING
|
#ifdef MOX_CYCLING
|
||||||
swpanel = wInitSwitchPanel(scr, scr->current_workspace);
|
swpanel = wInitSwitchPanel(scr, wwin, scr->current_workspace);
|
||||||
oldFocused = wwin;
|
oldFocused = wwin;
|
||||||
|
|
||||||
if (swpanel) {
|
if (swpanel) {
|
||||||
newFocused = wSwitchPanelSelectNext(swpanel, next);
|
newFocused = wSwitchPanelSelectNext(swpanel, !next);
|
||||||
wWindowFocus(newFocused, oldFocused);
|
wWindowFocus(newFocused, oldFocused);
|
||||||
oldFocused = newFocused;
|
oldFocused = newFocused;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
newFocused= wwin;
|
||||||
#else /* !MOX_CYCLING */
|
#else /* !MOX_CYCLING */
|
||||||
if (next) {
|
if (next) {
|
||||||
if (wPreferences.windows_cycling)
|
if (wPreferences.windows_cycling)
|
||||||
|
|||||||
@@ -1076,7 +1076,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = *fwin->title_clearance + TITLEBAR_EXTEND_SPACE - 1;
|
y = *fwin->title_clearance + TITLEBAR_EXTEND_SPACE;
|
||||||
h = WMFontHeight(*fwin->font);
|
h = WMFontHeight(*fwin->font);
|
||||||
|
|
||||||
/* We use a w+2 buffer to have an extra pixel on the left and
|
/* We use a w+2 buffer to have an extra pixel on the left and
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ int MonitorLoop(int argc, char **argv)
|
|||||||
char **child_argv= wmalloc(sizeof(char*)*(argc+2));
|
char **child_argv= wmalloc(sizeof(char*)*(argc+2));
|
||||||
int i, status;
|
int i, status;
|
||||||
time_t last_start;
|
time_t last_start;
|
||||||
|
|
||||||
for (i= 0; i < argc; i++)
|
for (i= 0; i < argc; i++)
|
||||||
child_argv[i]= argv[i];
|
child_argv[i]= argv[i];
|
||||||
child_argv[i++]= "--for-real";
|
child_argv[i++]= "--for-real";
|
||||||
@@ -128,7 +128,7 @@ int MonitorLoop(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
child_argv[argc]= "--for-real-";
|
child_argv[argc]= "--for-real-";
|
||||||
|
|
||||||
/* Check if the wmaker process exited due to a crash */
|
/* Check if the wmaker process exited due to a crash */
|
||||||
if (WIFSIGNALED(status) &&
|
if (WIFSIGNALED(status) &&
|
||||||
(WTERMSIG(status) == SIGSEGV ||
|
(WTERMSIG(status) == SIGSEGV ||
|
||||||
|
|||||||
@@ -208,135 +208,147 @@ static void addIconForWindow(WSwitchPanel *panel, WWindow *wwin, int iconWidth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WSwitchPanel *wInitSwitchPanel(WScreen *scr, int workspace)
|
WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WSwitchPanel *panel= wmalloc(sizeof(WSwitchPanel));
|
WSwitchPanel *panel= wmalloc(sizeof(WSwitchPanel));
|
||||||
int i;
|
int i;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int iconWidth = ICON_IDEAL_SIZE;
|
int iconWidth = ICON_IDEAL_SIZE;
|
||||||
WMBox *vbox;
|
WMBox *vbox;
|
||||||
|
|
||||||
panel->current= 0;
|
panel->defIcon= NULL;
|
||||||
panel->defIcon= NULL;
|
|
||||||
|
panel->normalColor = WMGrayColor(scr->wmscreen);
|
||||||
|
panel->selectColor = WMWhiteColor(scr->wmscreen);
|
||||||
|
|
||||||
|
panel->scr= scr;
|
||||||
|
panel->windows= WMCreateArray(10);
|
||||||
|
|
||||||
|
for (wwin= curwin; wwin; wwin= wwin->prev) {
|
||||||
|
if (wwin->frame->workspace == workspace && wWindowCanReceiveFocus(wwin) &&
|
||||||
|
(!WFLAGP(wwin, skip_window_list) || wwin->flags.internal_window)) {
|
||||||
|
WMInsertInArray(panel->windows, 0, wwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wwin = curwin;
|
||||||
|
/* start over from the beginning of the list */
|
||||||
|
while (wwin->next)
|
||||||
|
wwin = wwin->next;
|
||||||
|
|
||||||
panel->normalColor = WMGrayColor(scr->wmscreen);
|
for (wwin= curwin; wwin && wwin != curwin; wwin= wwin->prev) {
|
||||||
panel->selectColor = WMWhiteColor(scr->wmscreen);
|
if (wwin->frame->workspace == workspace && wWindowCanReceiveFocus(wwin) &&
|
||||||
|
(!WFLAGP(wwin, skip_window_list) || wwin->flags.internal_window)) {
|
||||||
|
WMInsertInArray(panel->windows, 0, wwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
panel->scr= scr;
|
width= (iconWidth + ICON_EXTRASPACE)*WMGetArrayItemCount(panel->windows);
|
||||||
panel->windows= WMCreateArray(10);
|
|
||||||
|
if (width > WMScreenWidth(scr->wmscreen))
|
||||||
for (wwin= scr->focused_window; wwin; wwin= wwin->prev) {
|
{
|
||||||
if (wwin->frame->workspace == workspace && wWindowCanReceiveFocus(wwin) &&
|
width= WMScreenWidth(scr->wmscreen) - 100;
|
||||||
(!WFLAGP(wwin, skip_window_list) || wwin->flags.internal_window)) {
|
iconWidth = width / WMGetArrayItemCount(panel->windows) - ICON_EXTRASPACE;
|
||||||
WMInsertInArray(panel->windows, 0, wwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
width= (iconWidth + ICON_EXTRASPACE)*WMGetArrayItemCount(panel->windows);
|
|
||||||
|
|
||||||
if (width > WMScreenWidth(scr->wmscreen))
|
|
||||||
{
|
|
||||||
width= WMScreenWidth(scr->wmscreen) - 100;
|
|
||||||
iconWidth = width / WMGetArrayItemCount(panel->windows) - ICON_EXTRASPACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iconWidth < 16 || WMGetArrayItemCount(panel->windows) == 0)
|
|
||||||
{
|
|
||||||
/* if there are too many windows, don't bother trying to show the panel */
|
|
||||||
WMFreeArray(panel->windows);
|
|
||||||
wfree(panel);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
height= iconWidth + 20 + 10 + ICON_EXTRASPACE;
|
|
||||||
|
|
||||||
panel->icons= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
|
||||||
panel->images= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
|
||||||
|
|
||||||
panel->win = WMCreateWindow(scr->wmscreen, "");
|
|
||||||
WMResizeWidget(panel->win, width + 10, height);
|
|
||||||
|
|
||||||
{
|
|
||||||
WMFrame *frame = WMCreateFrame(panel->win);
|
|
||||||
WMSetFrameRelief(frame, WRSimple);
|
|
||||||
WMSetViewExpandsToParent(WMWidgetView(frame), 0, 0, 0, 0);
|
|
||||||
|
|
||||||
vbox = WMCreateBox(panel->win);
|
|
||||||
}
|
|
||||||
WMSetViewExpandsToParent(WMWidgetView(vbox), 5, 5, 5, 5);
|
|
||||||
WMSetBoxHorizontal(vbox, False);
|
|
||||||
|
|
||||||
panel->label = WMCreateLabel(vbox);
|
|
||||||
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->label), False, True, 20, 0, 0);
|
|
||||||
if (scr->focused_window && scr->focused_window->frame->title)
|
|
||||||
WMSetLabelText(panel->label, scr->focused_window->frame->title);
|
|
||||||
else
|
|
||||||
WMSetLabelText(panel->label, "");
|
|
||||||
{
|
|
||||||
WMColor *color;
|
|
||||||
WMFont *boldFont= WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
|
||||||
|
|
||||||
WMSetLabelRelief(panel->label, WRSimple);
|
|
||||||
WMSetLabelFont(panel->label, boldFont);
|
|
||||||
color = WMDarkGrayColor(scr->wmscreen);
|
|
||||||
WMSetWidgetBackgroundColor(panel->label, color);
|
|
||||||
WMReleaseColor(color);
|
|
||||||
color = WMWhiteColor(scr->wmscreen);
|
|
||||||
WMSetLabelTextColor(panel->label, color);
|
|
||||||
WMReleaseColor(color);
|
|
||||||
|
|
||||||
WMReleaseFont(boldFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RImage *tmp= NULL;
|
|
||||||
RColor bgColor;
|
|
||||||
char *path = FindImage(wPreferences.pixmap_path, "swtile.png");
|
|
||||||
if (path) {
|
|
||||||
tmp = RLoadImage(panel->scr->rcontext, path, 0);
|
|
||||||
wfree(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp)
|
if (iconWidth < 16 || WMGetArrayItemCount(panel->windows) == 0)
|
||||||
tmp= RGetImageFromXPMData(scr->rcontext, tile_xpm);
|
{
|
||||||
|
/* if there are too many windows, don't bother trying to show the panel */
|
||||||
|
WMFreeArray(panel->windows);
|
||||||
|
wfree(panel);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
height= iconWidth + 20 + 10 + ICON_EXTRASPACE;
|
||||||
|
|
||||||
|
panel->icons= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
||||||
|
panel->images= WMCreateArray(WMGetArrayItemCount(panel->windows));
|
||||||
|
|
||||||
|
panel->win = WMCreateWindow(scr->wmscreen, "");
|
||||||
|
WMResizeWidget(panel->win, width + 10, height);
|
||||||
|
|
||||||
|
{
|
||||||
|
WMFrame *frame = WMCreateFrame(panel->win);
|
||||||
|
WMSetFrameRelief(frame, WRSimple);
|
||||||
|
WMSetViewExpandsToParent(WMWidgetView(frame), 0, 0, 0, 0);
|
||||||
|
|
||||||
|
vbox = WMCreateBox(panel->win);
|
||||||
|
}
|
||||||
|
WMSetViewExpandsToParent(WMWidgetView(vbox), 5, 5, 5, 5);
|
||||||
|
WMSetBoxHorizontal(vbox, False);
|
||||||
|
|
||||||
panel->tile = RScaleImage(tmp, iconWidth+ICON_EXTRASPACE, iconWidth+ICON_EXTRASPACE);
|
panel->label = WMCreateLabel(vbox);
|
||||||
|
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->label), False, True, 20, 0, 0);
|
||||||
|
if (scr->focused_window && scr->focused_window->frame->title)
|
||||||
|
WMSetLabelText(panel->label, scr->focused_window->frame->title);
|
||||||
|
else
|
||||||
|
WMSetLabelText(panel->label, "");
|
||||||
|
|
||||||
bgColor.alpha = 255;
|
{
|
||||||
bgColor.red = WMRedComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
WMColor *color;
|
||||||
bgColor.green = WMGreenComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
WMFont *boldFont= WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||||
bgColor.blue = WMBlueComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
|
||||||
|
WMSetLabelRelief(panel->label, WRSimple);
|
||||||
RCombineImageWithColor(panel->tile, &bgColor);
|
WMSetLabelFont(panel->label, boldFont);
|
||||||
|
color = WMDarkGrayColor(scr->wmscreen);
|
||||||
RReleaseImage(tmp);
|
WMSetWidgetBackgroundColor(panel->label, color);
|
||||||
}
|
WMReleaseColor(color);
|
||||||
|
color = WMWhiteColor(scr->wmscreen);
|
||||||
|
WMSetLabelTextColor(panel->label, color);
|
||||||
|
WMReleaseColor(color);
|
||||||
|
|
||||||
|
WMReleaseFont(boldFont);
|
||||||
|
}
|
||||||
|
|
||||||
panel->hbox = WMCreateBox(vbox);
|
{
|
||||||
WMSetBoxHorizontal(panel->hbox, True);
|
RImage *tmp= NULL;
|
||||||
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->hbox), True, True, 20, 0, 2);
|
RColor bgColor;
|
||||||
|
char *path = FindImage(wPreferences.pixmap_path, "swtile.png");
|
||||||
WM_ITERATE_ARRAY(panel->windows, wwin, i) {
|
if (path) {
|
||||||
addIconForWindow(panel, wwin, iconWidth);
|
tmp = RLoadImage(panel->scr->rcontext, path, 0);
|
||||||
changeImage(panel, i, 0);
|
wfree(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMMapSubwidgets(panel->win);
|
if (!tmp)
|
||||||
WMRealizeWidget(panel->win);
|
tmp= RGetImageFromXPMData(scr->rcontext, tile_xpm);
|
||||||
WMMapWidget(panel->win);
|
|
||||||
{
|
panel->tile = RScaleImage(tmp, iconWidth+ICON_EXTRASPACE, iconWidth+ICON_EXTRASPACE);
|
||||||
WMPoint center;
|
|
||||||
|
bgColor.alpha = 255;
|
||||||
center= wGetPointToCenterRectInHead(scr, wGetHeadForPointerLocation(scr),
|
bgColor.red = WMRedComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
||||||
width+10, height);
|
bgColor.green = WMGreenComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
||||||
WMMoveWidget(panel->win, center.x, center.y);
|
bgColor.blue = WMBlueComponentOfColor(WMGrayColor(scr->wmscreen))>>8;
|
||||||
}
|
|
||||||
|
RCombineImageWithColor(panel->tile, &bgColor);
|
||||||
changeImage(panel, 0, 1);
|
|
||||||
|
RReleaseImage(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
return panel;
|
panel->hbox = WMCreateBox(vbox);
|
||||||
|
WMSetBoxHorizontal(panel->hbox, True);
|
||||||
|
WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->hbox), True, True, 20, 0, 4);
|
||||||
|
|
||||||
|
WM_ITERATE_ARRAY(panel->windows, wwin, i) {
|
||||||
|
addIconForWindow(panel, wwin, iconWidth);
|
||||||
|
changeImage(panel, i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
WMMapSubwidgets(panel->win);
|
||||||
|
WMRealizeWidget(panel->win);
|
||||||
|
WMMapWidget(panel->win);
|
||||||
|
{
|
||||||
|
WMPoint center;
|
||||||
|
|
||||||
|
center= wGetPointToCenterRectInHead(scr, wGetHeadForPointerLocation(scr),
|
||||||
|
width+10, height);
|
||||||
|
WMMoveWidget(panel->win, center.x, center.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
panel->current= WMGetFirstInArray(panel->windows, curwin);
|
||||||
|
changeImage(panel, panel->current, 1);
|
||||||
|
|
||||||
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
typedef struct SwitchPanel WSwitchPanel;
|
typedef struct SwitchPanel WSwitchPanel;
|
||||||
|
|
||||||
WSwitchPanel *wInitSwitchPanel(WScreen *scr, int workspace);
|
WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace);
|
||||||
|
|
||||||
void wSwitchPanelDestroy(WSwitchPanel *panel);
|
void wSwitchPanelDestroy(WSwitchPanel *panel);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user