On Tue 25.Aug'09 at 13:18:56 +0200, gasol wrote:
> > I still don't understand how in the end that works in a
> > application by application level, but hey, there are always
> > things to learn. This is what makes this interesting.
> > [...]

> Well basically each window is associated with a set of attributes,
> these attributes are stored in a proplist file called
> WMWindowAttributes. The window is matched against its WM_CLASS (class
> and/or name).
> 
> Have a peek in winspector.c  thats the file where most of the code for
> the little "Attributes windows" is.

Thanks, I've already learned a lot today in that file.

Here is a preliminary patch to add FocusAcrossWorkspace support in
the Attributes -> Advanced Options menu.

It is working here in the sense that the button appears in the 
menu (seems simple enough, but when that's is your first time
it is exciting) and when selected and asked to Save the
correct FocusAcrossWorkspace entry appears in the WMWindowAttributes
file in the GNUstep/Defaults/ folder. 

Lookie here for my test with xterm (random application I had open at
the time), this entry was there:

xterm.XTerm = {
    FocusAcrossWorkspace = Yes;
    NoAppIcon = Yes;
    Icon = Terminal.tiff;
  };
  
Cool! That is the first step. I will try to modify Martin's patch now
to look for this option.



diff --git a/src/window.h b/src/window.h
index e8275e2..6aaba23 100644
--- a/src/window.h
+++ b/src/window.h
@@ -125,6 +125,7 @@ typedef struct {
     unsigned int dont_move_off:1;
 
     unsigned int no_focusable:1;
+    unsigned int focus_across_wksp:1;
 
     unsigned int always_user_icon:1;   /* ignore client IconPixmap or
                                         * IconWindow */
diff --git a/src/winspector.c b/src/winspector.c
index 4609a7e..a865e8a 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -93,9 +93,9 @@ typedef struct InspectorPanel {
        /* 3rd page. more attributes */
        WMFrame *moreFrm;
 #ifdef XKB_BUTTON_HINT
-       WMButton *moreChk[9];
+       WMButton *moreChk[10];
 #else
-       WMButton *moreChk[8];
+       WMButton *moreChk[9];
 #endif
 
        /* 4th page. icon and workspace */
@@ -144,6 +144,7 @@ static WMPropList *AOmnipresent;
 static WMPropList *ASkipWindowList;
 static WMPropList *AKeepInsideScreen;
 static WMPropList *AUnfocusable;
+static WMPropList *AFocusAcrossWorkspace;
 static WMPropList *AAlwaysUserIcon;
 static WMPropList *AStartMiniaturized;
 static WMPropList *AStartMaximized;
@@ -198,6 +199,7 @@ static void make_keys()
        ASkipWindowList = WMCreatePLString("SkipWindowList");
        AKeepInsideScreen = WMCreatePLString("KeepInsideScreen");
        AUnfocusable = WMCreatePLString("Unfocusable");
+       AFocusAcrossWorkspace = WMCreatePLString("FocusAcrossWorkspace");
        AAlwaysUserIcon = WMCreatePLString("AlwaysUserIcon");
        AStartMiniaturized = WMCreatePLString("StartMiniaturized");
        AStartMaximized = WMCreatePLString("StartMaximized");
@@ -598,8 +600,11 @@ static void saveSettings(WMButton * button, InspectorPanel 
* panel)
        value = (WMGetButtonSelected(panel->moreChk[7]) != 0) ? Yes : No;
        different |= insertAttribute(dict, winDic, AEmulateAppIcon, value, 
flags);
 
-#ifdef XKB_BUTTON_HINT
        value = (WMGetButtonSelected(panel->moreChk[8]) != 0) ? Yes : No;
+       different |= insertAttribute(dict, winDic, AFocusAcrossWorkspace, 
value, flags);
+
+#ifdef XKB_BUTTON_HINT
+       value = (WMGetButtonSelected(panel->moreChk[9]) != 0) ? Yes : No;
        different |= insertAttribute(dict, winDic, ANoLanguageButton, value, 
flags);
 #endif
 
@@ -1306,6 +1311,7 @@ static InspectorPanel *createInspectorForWindow(WWindow * 
wwin, int xpos, int yp
                                  "to outside the screen.");
                        break;
                }
+
                panel->attrChk[i] = WMCreateSwitchButton(panel->attrFrm);
                WMMoveWidget(panel->attrChk[i], 10, 20 * (i + 1));
                WMResizeWidget(panel->attrChk[i], frame_width - 15, 20);
@@ -1323,9 +1329,9 @@ static InspectorPanel *createInspectorForWindow(WWindow * 
wwin, int xpos, int yp
 
        for (i = 0;
 #ifdef XKB_BUTTON_HINT
-            i < 9;
+            i < 10;
 #else
-            i < 8;
+            i < 9;
 #endif
             i++) {
                char *caption = NULL;
@@ -1382,8 +1388,14 @@ static InspectorPanel *createInspectorForWindow(WWindow 
* wwin, int xpos, int yp
                                  "enough information to Window Maker for a 
dockable\n"
                                  "application icon to be created.");
                        break;
-#ifdef XKB_BUTTON_HINT
                case 8:
+                       caption = _("Accept focus across workspaces");
+                       flag = WFLAGP(wwin, focus_across_wksp);
+                       descr = _("If an application requests focus in a 
workspace\n"
+                                 "different from the current, change to it 
automatically.\n");
+                       break;
+#ifdef XKB_BUTTON_HINT
+               case 9:
                        caption = _("Disable language button");
                        flag = WFLAGP(wwin, no_language_button);
                        descr = _("Remove the `toggle language' button of the 
window.");


-- 
To unsubscribe, send mail to [email protected].

Reply via email to