I've added an option to FvwmIconMan which allows you to show only the window
which has the focus. I use it to make my desktop look like Mac or Gnome with
the icon of active application in the upper right corner.

Also, I cleaned the code a very little bit moving the module name
string "FvwmIconMan" into a #define.

Hope this feature will prove useful, here's the patch:

Index: modules/FvwmIconMan/FvwmIconMan.1
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.1,v
retrieving revision 1.29
diff -u -u -r1.29 FvwmIconMan.1
--- modules/FvwmIconMan/FvwmIconMan.1   30 Mar 2004 09:05:08 -0000      1.29
+++ modules/FvwmIconMan/FvwmIconMan.1   28 Apr 2004 18:59:10 -0000
@@ -115,6 +115,7 @@
 SelectColorset
 Shape           use shape extension        false
 Show            list of windows to show
+ShowOnlyFocused only focused window visible false 
 ShowOnlyIcons   only icons visible         false
 ShowTransient   transient windows visible  false
 Sort            keep managers sorted       name
@@ -370,6 +371,9 @@
 
 .IP "*FvwmIconMan: [id] ShowTransient \fIboolean\fP"
 Show transient windows in the list (default false).
+
+.IP "*FvwmIconMan: [id] ShowOnlyFocused \fIboolean\fP"
+Only the window that has focus is shown if \fIboolean\fP is true
 
 .IP "*FvwmIconMan: [id] ShowOnlyIcons \fIboolean\fP"
 Only iconified windows are shown if \fIboolean\fP is true.
Index: modules/FvwmIconMan/FvwmIconMan.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.c,v
retrieving revision 1.56
diff -u -u -r1.56 FvwmIconMan.c
--- modules/FvwmIconMan/FvwmIconMan.c   6 Jul 2003 14:34:07 -0000       1.56
+++ modules/FvwmIconMan/FvwmIconMan.c   28 Apr 2004 18:59:10 -0000
@@ -205,7 +205,7 @@
                        chdir("/home/bradym/src/FvwmIconMan");
                        execl(
                                "/usr/local/bin/ddd", "/usr/local/bin/ddd",
-                               "FvwmIconMan", buf, NULL);
+                               MODULE_NAME, buf, NULL);
                }
                else
                {
@@ -215,7 +215,7 @@
        }
 #endif
 
-       FlocaleInit(LC_CTYPE, "", "", "FvwmIconMan");
+       FlocaleInit(LC_CTYPE, "", "", MODULE_NAME);
 
        OpenConsole(OUTPUT_FILE);
 
Index: modules/FvwmIconMan/FvwmIconMan.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.h,v
retrieving revision 1.56
diff -u -u -r1.56 FvwmIconMan.h
--- modules/FvwmIconMan/FvwmIconMan.h   19 Mar 2004 09:50:18 -0000      1.56
+++ modules/FvwmIconMan/FvwmIconMan.h   28 Apr 2004 18:59:10 -0000
@@ -19,6 +19,8 @@
 #include "fvwm/fvwm.h"
 #include "libs/vpacket.h"
 
+#define MODULE_NAME "MyIconMan"
+
 #ifndef DEFAULT_ACTION
 #define DEFAULT_ACTION "Iconify"
 #endif
@@ -301,9 +303,9 @@
        int weighted_sorts_len, weighted_sorts_size;
        char *AnimCommand;
        Uchar showonlyiconic;
+  Uchar showonlyfocused;
        Uchar showtransient;
        rectangle managed_g;    /* dimensions of managed screen portion */
-       int relief_thickness;   /* relief thickness for each non-flat button */
 
        /* X11 state */
        Window theWindow, theFrame;
Index: modules/FvwmIconMan/fvwm.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/fvwm.c,v
retrieving revision 1.58
diff -u -u -r1.58 fvwm.c
--- modules/FvwmIconMan/fvwm.c  25 Aug 2003 06:47:09 -0000      1.58
+++ modules/FvwmIconMan/fvwm.c  28 Apr 2004 18:59:10 -0000
@@ -273,6 +273,11 @@
        ConsoleDebug(FVWM, "Focus Change\n");
        ConsoleDebug(FVWM, "\tID: %ld\n", app_id);
 
+       if (fvwm_focus_win &&
+           fvwm_focus_win->button &&
+           fvwm_focus_win->manager->showonlyfocused) 
+         delete_windows_button(fvwm_focus_win);
+
        if (fvwm_focus_win && win != fvwm_focus_win)
        {
                del_win_state(fvwm_focus_win, FOCUS_CONTEXT);
@@ -293,6 +298,8 @@
                win->manager->focus_button = win->button;
        }
        add_win_state(win, FOCUS_CONTEXT);
+
+       check_in_window(win);
 
        globals.focus_win = win;
        fvwm_focus_win = win;
Index: modules/FvwmIconMan/globals.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/globals.c,v
retrieving revision 1.26
diff -u -u -r1.26 globals.c
--- modules/FvwmIconMan/globals.c       19 Mar 2004 09:50:18 -0000      1.26
+++ modules/FvwmIconMan/globals.c       28 Apr 2004 18:59:10 -0000
@@ -61,8 +61,8 @@
        globals.managers[id].index = id;
        globals.managers[id].res = SHOW_PAGE;
        globals.managers[id].rev = REVERSE_NONE;
-       globals.managers[id].titlename = alloc_string("FvwmIconMan");
-       globals.managers[id].iconname = alloc_string("FvwmIconMan");
+       globals.managers[id].titlename = alloc_string(MODULE_NAME);
+       globals.managers[id].iconname = alloc_string(MODULE_NAME);
        globals.managers[id].formatstring = alloc_string("%c: %i");
        globals.managers[id].format_depend = CLASS_NAME | ICON_NAME;
        init_button_array(&globals.managers[id].buttons);
@@ -82,8 +82,8 @@
        globals.managers[id].bindings[MOUSE] = ParseMouseEntry(DEFAULT_MOUSE);
        globals.managers[id].we_are_drawing = 1;
        globals.managers[id].showonlyiconic = 0;
+       globals.managers[id].showonlyfocused = 0;
        globals.managers[id].showtransient = 0;
-       globals.managers[id].relief_thickness = 2;
 }
 
 void print_managers(void)
Index: modules/FvwmIconMan/readconfig.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/readconfig.c,v
retrieving revision 1.56
diff -u -u -r1.56 readconfig.c
--- modules/FvwmIconMan/readconfig.c    19 Mar 2004 09:50:18 -0000      1.56
+++ modules/FvwmIconMan/readconfig.c    28 Apr 2004 18:59:10 -0000
@@ -1490,6 +1490,27 @@
        ConsoleDebug(CONFIG, "Setting showtransient to: %d\n", i);
        SET_MANAGER(manager, showtransient, i);
       }
+      else if( !strcasecmp(option1, "showonlyfocused")) {
+       p = read_next_cmd(READ_ARG);
+       if (!p) {
+        ConsoleMessage("Bad line: %s\n", current_line);
+        ConsoleMessage("Need argument to showonlyfocused\n");
+        continue;
+       }
+       if (!strcasecmp(p, "true")) {
+         i = 1;
+       }
+       else if (!strcasecmp(p, "false")) {
+         i = 0;
+       }
+       else {
+         ConsoleMessage("Bad line: %s\n", current_line);
+         ConsoleMessage("What is this: %s?\n", p);
+         continue;
+       }
+       ConsoleMessage("Show only focused to: %d\n", i);
+       SET_MANAGER( manager, showonlyfocused, i);
+      }
       else if (!strcasecmp(option1, "showonlyicons")) {
        p = read_next_cmd(READ_ARG);
        if (!p) {
@@ -1950,19 +1971,6 @@
        }
        ConsoleDebug(CONFIG, "Setting usewinlist to: %d\n", i);
        SET_MANAGER(manager, usewinlist, i);
-      }
-      else if (!strcasecmp(option1, "reliefthickness")) {
-       p = read_next_cmd(READ_ARG);
-       if (!p) {
-         ConsoleMessage("Bad line: %s\n", current_line);
-         continue;
-       }
-       if (extract_int(p, &n) == 0) {
-         ConsoleMessage("This is not a number: %s\n", p);
-         ConsoleMessage("Bad line: %s\n", current_line);
-         continue;
-       }
-       SET_MANAGER(manager, relief_thickness, n);
       }
       else {
        ConsoleMessage("Bad line: %s\n", current_line);
Index: modules/FvwmIconMan/x.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/x.c,v
retrieving revision 1.75
diff -u -u -r1.75 x.c
--- modules/FvwmIconMan/x.c     29 Jun 2003 19:53:25 -0000      1.75
+++ modules/FvwmIconMan/x.c     28 Apr 2004 18:59:11 -0000
@@ -527,7 +527,7 @@
   }
 
   class.res_name = MyName;
-  class.res_class = "FvwmIconMan";
+  class.res_class = MODULE_NAME;
 
 
   XSetWMProperties (theDisplay, win, &win_name, &win_icon, NULL, 0,
Index: modules/FvwmIconMan/xmanager.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/xmanager.c,v
retrieving revision 1.84
diff -u -u -r1.84 xmanager.c
--- modules/FvwmIconMan/xmanager.c      19 Mar 2004 09:50:18 -0000      1.84
+++ modules/FvwmIconMan/xmanager.c      28 Apr 2004 18:59:11 -0000
@@ -1481,6 +1481,9 @@
     in_viewport = win_in_viewport(win);
     if (win->manager->usewinlist && DO_SKIP_WINDOW_LIST(win))
       in_viewport = 0;
+    if ((win->manager->showonlyfocused && win->state != FOCUS_CONTEXT) &&
+       (win->manager->showonlyfocused && win->state != FOCUS_SELECT_CONTEXT)) 
+       in_viewport = 0;
     if (win->button == NULL && in_viewport && is_state_selected) {
       insert_windows_button(win);
       if (win->manager->window_up == 0 && globals.got_window_list)


-- 
George 'Nephrite' Potapov

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to