maybe this should be an option tied to focus mode? i'm using sloppy, 
and at least with that, this option is very comfortable. dunno what 
click-to-focus users might think of that...

looking for people who want to spend some time on wprefs...

>From 2260aae83a81716f6e8a21e110bfa5a96bdfc183 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Fri, 2 Apr 2010 08:38:08 +0200
Subject: [PATCH] Add new cycling option

When using Xinerama, make it possible only to cycle between those
windows that are on the currently active head - AFAICT this means
windows that have the majority of their area on the same head as
the pointer.

Patch complete with WPrefs integration, alas this being quite
unusable - for a lack of a better idea, I tucked the option on the
expert panel, making the item list too tall - making it scrollable
would be a nice addition.

The default for the new option (CycleActiveHeadOnly) should be NO,
that is, no change in default behaviour.
---
 WPrefs.app/Expert.c |    9 +++++++--
 src/WindowMaker.h   |    1 +
 src/defaults.c      |    4 +++-
 src/switchpanel.c   |    5 +++++
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index 6d4421d..b8f8b46 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -32,7 +32,7 @@ typedef struct _Panel {
 
        WMWidget *parent;
 
-       WMButton *swi[8];
+       WMButton *swi[9];
 
 } _Panel;
 
@@ -50,6 +50,7 @@ static void showData(_Panel * panel)
        WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
        WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
        WMSetButtonSelected(panel->swi[7], GetBoolForKey("SingleClickLaunch"));
+       WMSetButtonSelected(panel->swi[8], 
GetBoolForKey("CycleActiveHeadOnly"));
 }
 
 static void createPanel(Panel * p)
@@ -60,12 +61,14 @@ static void createPanel(Panel * p)
        panel->box = WMCreateBox(panel->parent);
        WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
 
-       for (i = 0; i < 8; i++) {
+       for (i = 0; i < 9; i++) {
                panel->swi[i] = WMCreateSwitchButton(panel->box);
                WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
                WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
        }
 
+       /* XXX: it would be HIGHLY desireable if this could scroll vertically */
+
        WMSetButtonText(panel->swi[0],
                        _("Disable miniwindows (icons for minimized windows). 
For use with KDE/GNOME."));
        WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific 
parameters (do not use xset)."));
@@ -75,6 +78,7 @@ static void createPanel(Panel * p)
        WMSetButtonText(panel->swi[5], _("Disable selection animation for 
selected icons."));
        WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
        WMSetButtonText(panel->swi[7], _("Launch applications and restore 
windows with a single click."));
+       WMSetButtonText(panel->swi[8], _("Cycle windows only on the active 
head."));
 
        WMSetButtonEnabled(panel->swi[6], True);
 
@@ -98,6 +102,7 @@ static void storeDefaults(_Panel * panel)
        SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
        SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
        SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "SingleClickLaunch");
+       SetBoolForKey(WMGetButtonSelected(panel->swi[8]), 
"CycleActiveHeadOnly");
 }
 
 Panel *InitExpert(WMScreen * scr, WMWidget * parent)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 1a5b323..9ec628b 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -413,6 +413,7 @@ typedef struct WPreferences {
     char workspace_border_position;     /* Where to leave a workspace border */
     char single_click;                  /* single click to lauch applications 
*/
     int history_lines;                  /* history of "Run..." dialog */
+    char cycle_active_head_only;        /* Cycle only windows on the active 
head */
 
     RImage *swtileImage;
     RImage *swbackImage[9];
diff --git a/src/defaults.c b/src/defaults.c
index a02a03b..19e35b1 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -655,7 +655,9 @@ WDefaultEntry optionList[] = {
        {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT,
         NULL, getCursor, setCursor},
        {"DialogHistoryLines", "500", NULL,
-        &wPreferences.history_lines, getInt, NULL}
+        &wPreferences.history_lines, getInt, NULL},
+       {"CycleActiveHeadOnly", "NO", NULL,
+        &wPreferences.cycle_active_head_only, getBool, NULL}
 };
 
 #if 0
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 3979728..46f5d47 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -80,6 +80,11 @@ static int canReceiveFocus(WWindow * wwin)
 {
        if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
                return 0;
+
+       if (wPreferences.cycle_active_head_only &&
+           wGetHeadForWindow(wwin) != 
wGetHeadForPointerLocation(wwin->screen_ptr))
+               return 0;
+
        if (!wwin->flags.mapped) {
                if (!wwin->flags.shaded && !wwin->flags.miniaturized && 
!wwin->flags.hidden)
                        return 0;
-- 
1.7.0


-- 
[-]

mkdir /nonexistent
From 2260aae83a81716f6e8a21e110bfa5a96bdfc183 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Fri, 2 Apr 2010 08:38:08 +0200
Subject: [PATCH] Add new cycling option

When using Xinerama, make it possible only to cycle between those
windows that are on the currently active head - AFAICT this means
windows that have the majority of their area on the same head as
the pointer.

Patch complete with WPrefs integration, alas this being quite
unusable - for a lack of a better idea, I tucked the option on the
expert panel, making the item list too tall - making it scrollable
would be a nice addition.

The default for the new option (CycleActiveHeadOnly) should be NO,
that is, no change in default behaviour.
---
 WPrefs.app/Expert.c |    9 +++++++--
 src/WindowMaker.h   |    1 +
 src/defaults.c      |    4 +++-
 src/switchpanel.c   |    5 +++++
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index 6d4421d..b8f8b46 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -32,7 +32,7 @@ typedef struct _Panel {
 
 	WMWidget *parent;
 
-	WMButton *swi[8];
+	WMButton *swi[9];
 
 } _Panel;
 
@@ -50,6 +50,7 @@ static void showData(_Panel * panel)
 	WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
 	WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
 	WMSetButtonSelected(panel->swi[7], GetBoolForKey("SingleClickLaunch"));
+	WMSetButtonSelected(panel->swi[8], GetBoolForKey("CycleActiveHeadOnly"));
 }
 
 static void createPanel(Panel * p)
@@ -60,12 +61,14 @@ static void createPanel(Panel * p)
 	panel->box = WMCreateBox(panel->parent);
 	WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < 9; i++) {
 		panel->swi[i] = WMCreateSwitchButton(panel->box);
 		WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
 		WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
 	}
 
+	/* XXX: it would be HIGHLY desireable if this could scroll vertically */
+
 	WMSetButtonText(panel->swi[0],
 			_("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
 	WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
@@ -75,6 +78,7 @@ static void createPanel(Panel * p)
 	WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
 	WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
 	WMSetButtonText(panel->swi[7], _("Launch applications and restore windows with a single click."));
+	WMSetButtonText(panel->swi[8], _("Cycle windows only on the active head."));
 
 	WMSetButtonEnabled(panel->swi[6], True);
 
@@ -98,6 +102,7 @@ static void storeDefaults(_Panel * panel)
 	SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
 	SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
 	SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "SingleClickLaunch");
+	SetBoolForKey(WMGetButtonSelected(panel->swi[8]), "CycleActiveHeadOnly");
 }
 
 Panel *InitExpert(WMScreen * scr, WMWidget * parent)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 1a5b323..9ec628b 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -413,6 +413,7 @@ typedef struct WPreferences {
     char workspace_border_position;     /* Where to leave a workspace border */
     char single_click;                  /* single click to lauch applications */
     int history_lines;                  /* history of "Run..." dialog */
+    char cycle_active_head_only;        /* Cycle only windows on the active head */
 
     RImage *swtileImage;
     RImage *swbackImage[9];
diff --git a/src/defaults.c b/src/defaults.c
index a02a03b..19e35b1 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -655,7 +655,9 @@ WDefaultEntry optionList[] = {
 	{"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT,
 	 NULL, getCursor, setCursor},
 	{"DialogHistoryLines", "500", NULL,
-	 &wPreferences.history_lines, getInt, NULL}
+	 &wPreferences.history_lines, getInt, NULL},
+	{"CycleActiveHeadOnly", "NO", NULL,
+	 &wPreferences.cycle_active_head_only, getBool, NULL}
 };
 
 #if 0
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 3979728..46f5d47 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -80,6 +80,11 @@ static int canReceiveFocus(WWindow * wwin)
 {
 	if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
 		return 0;
+
+	if (wPreferences.cycle_active_head_only &&
+	    wGetHeadForWindow(wwin) != wGetHeadForPointerLocation(wwin->screen_ptr))
+		return 0;
+
 	if (!wwin->flags.mapped) {
 		if (!wwin->flags.shaded && !wwin->flags.miniaturized && !wwin->flags.hidden)
 			return 0;
-- 
1.7.0

Reply via email to