mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Added sameWindowClass().
Avoid code duplication by moving check for windows of the same WM_CLASS to the new function sameWindowClass().
This commit is contained in:
committed by
Carlos R. Mafra
parent
90675a6f04
commit
6fb2b13ec7
@@ -95,6 +95,16 @@ static int canReceiveFocus(WWindow *wwin)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool sameWindowClass(WWindow *wwin, WWindow *curwin)
|
||||||
|
{
|
||||||
|
if (!wwin->wm_class || !curwin->wm_class)
|
||||||
|
return False;
|
||||||
|
if (strcmp(wwin->wm_class, curwin->wm_class))
|
||||||
|
return False;
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
static void changeImage(WSwitchPanel *panel, int idecks, int selected)
|
static void changeImage(WSwitchPanel *panel, int idecks, int selected)
|
||||||
{
|
{
|
||||||
WMFrame *icon = WMGetFromArray(panel->icons, idecks);
|
WMFrame *icon = WMGetFromArray(panel->icons, idecks);
|
||||||
@@ -338,12 +348,9 @@ static WMArray *makeWindowListArray(WWindow *curwin, int include_unmapped, Bool
|
|||||||
for (wwin = curwin; wwin; wwin = wwin->prev) {
|
for (wwin = curwin; wwin; wwin = wwin->prev) {
|
||||||
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
|
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
|
||||||
(wwin->flags.mapped || include_unmapped)) {
|
(wwin->flags.mapped || include_unmapped)) {
|
||||||
if (class_only) {
|
if (class_only)
|
||||||
if (!wwin->wm_class || !curwin->wm_class)
|
if (!sameWindowClass(wwin, curwin))
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(wwin->wm_class, curwin->wm_class))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WFLAGP(wwin, skip_switchpanel))
|
if (!WFLAGP(wwin, skip_switchpanel))
|
||||||
WMAddToArray(windows, wwin);
|
WMAddToArray(windows, wwin);
|
||||||
@@ -357,13 +364,9 @@ static WMArray *makeWindowListArray(WWindow *curwin, int include_unmapped, Bool
|
|||||||
for (wwin = curwin; wwin && wwin != curwin; wwin = wwin->prev) {
|
for (wwin = curwin; wwin && wwin != curwin; wwin = wwin->prev) {
|
||||||
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
|
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
|
||||||
(wwin->flags.mapped || include_unmapped)) {
|
(wwin->flags.mapped || include_unmapped)) {
|
||||||
if (class_only) {
|
if (class_only)
|
||||||
if (!wwin->wm_class || !curwin->wm_class)
|
if (!sameWindowClass(wwin, curwin))
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(wwin->wm_class, curwin->wm_class))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WFLAGP(wwin, skip_switchpanel))
|
if (!WFLAGP(wwin, skip_switchpanel))
|
||||||
WMAddToArray(windows, wwin);
|
WMAddToArray(windows, wwin);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user