zimba's patch
authorBrenden Matthews <brenden1@rty.ca>
Sat, 20 Aug 2005 19:43:06 +0000 (19:43 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Sat, 20 Aug 2005 19:43:06 +0000 (19:43 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@119 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
README
conky.c
conky.h
conkyrc.sample
doc/docs.html
x11.c

index c6baa79..a692e9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # $Id$
 
+2005-08-20
+       * Applied patch from zimba-tm, closes bug 1260225
+
 2005-08-12
        * Multiple unit additions and modifications
 
diff --git a/README b/README
index 4118ecf..baefbb3 100644 (file)
--- a/README
+++ b/README
@@ -58,7 +58,7 @@
        
                Conf                                Meaning                        
        alignment             Aligned position on screen, may be top_left,         
-                                                                top_right, bottom_left, bottom_right                 
+                                                                top_right, bottom_left, bottom_right, none                 
        background            Boolean value, if true, Conky will be forked to     
                                                                 background when started                              
        on_bottom                                Set conky on the bottom of all other applications
        
        Argument                          Description                        
        -V           Prints version and exits                                  
-       -a ALIGNMENT Text alignment on screen, {top,bottom}_{left,right}       
+       -a ALIGNMENT Text alignment on screen, {top,bottom}_{left,right} | none       
        -b           Use double buffering (eliminates flicker)                 
        -c FILE      Config file to load instead of $HOME/.conkyrc            
        -d           Daemonize, fork to background                             
diff --git a/conky.c b/conky.c
index 6b0f520..d1de495 100644 (file)
--- a/conky.c
+++ b/conky.c
@@ -41,6 +41,7 @@ enum alignment {
        TOP_RIGHT,
        BOTTOM_LEFT,
        BOTTOM_RIGHT,
+       NONE
 };
 
 
@@ -2744,10 +2745,18 @@ static void update_text_area()
                x = workarea[2] - text_width - gap_x;
                y = workarea[3] - text_height - gap_y;
                break;
+       
+       case NONE: // Let the WM manage the window
+               x = window.x;
+               y = window.y;
+
+               fixed_pos  = 1;
+               fixed_size = 1;
+               break;
        }
 
 #ifdef OWN_WINDOW
-       if (own_window) {
+       if (own_window && !fixed_pos) {
                x += workarea[0];
                y += workarea[1];
                text_start_x = border_margin + 1;
@@ -3664,7 +3673,8 @@ static enum alignment string_to_alignment(const char *s)
                return BOTTOM_LEFT;
        else if (strcasecmp(s, "br") == 0)
                return BOTTOM_RIGHT;
-
+       else if (strcasecmp(s, "none") == 0)
+               return NONE;
        return TOP_LEFT;
 }
 #endif /* X11 */
@@ -4379,10 +4389,20 @@ int main(int argc, char **argv)
 #ifdef X11
        update_text_area();     /* to get initial size of the window */
 
+#if defined OWN_WINDOW
        init_window
            (own_window,
-            text_width
-            + border_margin * 2 + 1, text_height + border_margin * 2 + 1, on_bottom);
+            text_width + border_margin * 2 + 1,
+            text_height + border_margin * 2 + 1,
+            on_bottom, fixed_pos);
+#else
+       init_winow
+               (own_window,
+                text_width + border_margin * 2 + 1,
+                text_height + border_margin * 2 + 1,
+                on_bottom);
+       
+#endif
 
        update_text_area();     /* to position text/window on screen */
 #endif /* X11 */
@@ -4394,7 +4414,7 @@ int main(int argc, char **argv)
 
 #ifdef X11
 #ifdef OWN_WINDOW
-       if (own_window)
+       if (own_window && !fixed_pos)
                XMoveWindow(display, window.window, window.x, window.y);
 #endif
 
diff --git a/conky.h b/conky.h
index ea5822a..c5fb1e1 100644 (file)
--- a/conky.h
+++ b/conky.h
@@ -229,7 +229,11 @@ extern int workarea[4];
 extern struct conky_window window;
 
 void init_X11();
+#if defined OWN_WINDOW
+void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos);
+#else
 void init_window(int use_own_window, int width, int height, int on_bottom);
+#endif
 void create_gc();
 void set_transparent_background(Window win);
 long get_x11_color(const char *);
index 43b28c5..1294a7f 100644 (file)
@@ -83,6 +83,7 @@ default_outline_color black
 #alignment top_right
 alignment bottom_left
 #alignment bottom_right
+#alignment none
 
 # Gap between borders of screen and text
 # same thing as passing -x at command line
index 7050e81..1dc4d00 100644 (file)
@@ -1,4 +1,4 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>conky</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id2447358"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>conky &#8212; a system monitor for X originally based on the torsmo code, but more kickass.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">conky</tt>  [<i class="replaceable"><tt>options</tt></i>]</p></div></div><div class="refsect1" lang="en"><a name="id2476574"></a><h2>Description</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>conky</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id257346"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>conky &#8212; a system monitor for X originally based on the torsmo code, but more kickass.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">conky</tt>  [<i class="replaceable"><tt>options</tt></i>]</p></div></div><div class="refsect1" lang="en"><a name="id222072"></a><h2>Description</h2><p>
     Conky is a system monitor for X originally based on the torsmo code. 
     Since it's original conception, Conky has changed a fair bit from it's predecessor.  
     Conky can display just about anything, either on your root desktop or in it's own window.  
@@ -9,7 +9,7 @@
                Please use the facilities at SourceForge to make bug reports, feature requests, and submit patches.
                </p><p>
                Thanks for your interest in Conky.
-               </p></div><div class="refsect1" lang="en"><a name="id2476601"></a><h2>Compiling</h2><p>
+               </p></div><div class="refsect1" lang="en"><a name="id222093"></a><h2>Compiling</h2><p>
                To compile and run Conky with all optional components (If you run Gentoo, see the "Ebuild" Section below):
                </p><div class="variablelist"><dl><dt><span class="term">
                                        <span><b class="command"><tt class="option">./configure </tt></b></span><tt class="option">
                </p><p>
                        Conky is in Gentoo's Portage.  Simply use "emerge conky" to install conky. 
                        There is also usually an up-to-date ebuild within Conky's package or in CVS.
-               </p></div><div class="refsect1" lang="en"><a name="id2448032"></a><h2>You Should Know</h2><p>
+               </p></div><div class="refsect1" lang="en"><a name="id239594"></a><h2>You Should Know</h2><p>
                Conky is generally very good on resources.  However, certain objects in
                Conky are harder on resources then others.  In particular, the $tail,
                $top, $font, and $graph objects are quite costly in comparison to the rest of Conky.
                </p><p>
                If you do use them, please do not complain about memory or CPU usage, 
                unless you think something is going seriously wrong (mem leak, et cetera).
-               </p></div><div class="refsect1" lang="en"><a name="id2448051"></a><h2>Options</h2><p>Command line options override configurations defined in configuration file.</p><div class="variablelist"><dl><dt><span class="term"><span><b class="command"><tt class="option">-V</tt></b></span></span></dt><dd>
+               </p></div><div class="refsect1" lang="en"><a name="id239610"></a><h2>Options</h2><p>Command line options override configurations defined in configuration file.</p><div class="variablelist"><dl><dt><span class="term"><span><b class="command"><tt class="option">-V</tt></b></span></span></dt><dd>
     Prints version and exits
     <p></p></dd><dt><span class="term"><span><b class="command"><tt class="option">-a </tt></b></span><tt class="option">ALIGNMENT</tt></span></dt><dd>
       Text alignment on screen, {top,bottom}_{left,right}
@@ -66,7 +66,7 @@
       X position
     <p></p></dd><dt><span class="term"><span><b class="command"><tt class="option">-y </tt></b></span><tt class="option">Y_COORDINATE</tt></span></dt><dd>
       Y position
-    <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2447524"></a><h2>Configuration Settings</h2><p>
+    <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id221336"></a><h2>Configuration Settings</h2><p>
                Default configuration file is $HOME/.conkyrc (can be changed from
                conky.c among other things). See conkyrc.sample. You might want to copy
                it to $HOME/.conkyrc and then start modifying it.
                Use Xft (anti-aliased font and stuff)
        <p></p></dd><dt><span class="term"><span><b class="command"><tt class="option">text</tt></b></span></span></dt><dd>
                After this begins text to be formatted on screen
-       <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2517515"></a><h2>Variables</h2><p>
+       <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id265183"></a><h2>Variables</h2><p>
                Colors are parsed using XParsecolor(), there might be a list of them:
                /usr/X11R6/lib/X11/rgb.txt. Also, <a href="http://sedition.com/perl/rgb.html" target="_top">
                                                                                                                                                         http://sedition.com/perl/rgb.html</a>
                <span><b class="command"><tt class="option">seti_credit</tt></b></span>
        </span></dt><dd>
                Seti@home total user credit
-       <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2521839"></a><h2>Examples</h2><div class="variablelist"><dl><dt><span class="term"><tt class="varname">conky </tt><tt class="option">-t '${time %D %H:%m}' -o -u 30</tt></span></dt><dd>Start Conky in its own window with date and clock as text and 30 sec update interval.</dd><dt><span class="term"><tt class="varname">conky </tt><tt class="option">-a top_left -x 5 -y 500 -d</tt></span></dt><dd>Start Conky to background at coordinates (5, 500).</dd></dl></div></div><div class="refsect1" lang="en"><a name="id2521880"></a><h2>Files</h2><tt class="filename">~/.conkyrc</tt> default configuration file
-       </div><div class="refsect1" lang="en"><a name="id2521893"></a><h2>Bugs</h2><p>  
+       <p></p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id269404"></a><h2>Examples</h2><div class="variablelist"><dl><dt><span class="term"><tt class="varname">conky </tt><tt class="option">-t '${time %D %H:%m}' -o -u 30</tt></span></dt><dd>Start Conky in its own window with date and clock as text and 30 sec update interval.</dd><dt><span class="term"><tt class="varname">conky </tt><tt class="option">-a top_left -x 5 -y 500 -d</tt></span></dt><dd>Start Conky to background at coordinates (5, 500).</dd></dl></div></div><div class="refsect1" lang="en"><a name="id269443"></a><h2>Files</h2><tt class="filename">~/.conkyrc</tt> default configuration file
+       </div><div class="refsect1" lang="en"><a name="id269455"></a><h2>Bugs</h2><p>   
                Drawing to root or some other desktop window directly doesn't work with 
                all window managers. Especially doesn't work well with Gnome and it has 
                been reported that it doesn't work with KDE either. Nautilus can be 
                to set some specific window id. You might find xwininfo -tree useful to 
                find the window to draw to. You can also use -o argument which makes
                Conky to create its own window.
-               </p></div><div class="refsect1" lang="en"><a name="id2521912"></a><h2>See Also</h2><p><a href="http://conky.sourceforge.net" target="_top">
+               </p></div><div class="refsect1" lang="en"><a name="id269470"></a><h2>See Also</h2><p><a href="http://conky.sourceforge.net" target="_top">
     http://conky.sourceforge.net</a></p><p><a href="http://www.sourceforge.net/projects/conky" target="_top">
     http://www.sourceforge.net/projects/conky</a></p><p>
                        #conky on irc.freenode.net
-               </p></div><div class="refsect1" lang="en"><a name="id2521938"></a><h2>Authors</h2><p>
+               </p></div><div class="refsect1" lang="en"><a name="id269495"></a><h2>Authors</h2><p>
                        The Conky dev team. What's up now??!
                </p></div></div></body></html>
diff --git a/x11.c b/x11.c
index 8c756ea..e0b6d9e 100644 (file)
--- a/x11.c
+++ b/x11.c
@@ -160,7 +160,11 @@ void set_transparent_background(Window win)
        XClearWindow(display, win);
 }
 
+#if defined OWN_WINDOW
+void init_window(int own_window, int w, int h, int l, int fixed_pos)
+#else
 void init_window(int own_window, int w, int h, int l)
+#endif
 {
        /* There seems to be some problems with setting transparent background (on
         * fluxbox this time). It doesn't happen always and I don't know why it
@@ -192,8 +196,9 @@ void init_window(int own_window, int w, int h, int l)
 
                        XClearWindow(display, window.window);
 
-                       XMoveWindow(display, window.window, window.x,
-                                   window.y);
+                       if (!fixed_pos)
+                               XMoveWindow(display, window.window, window.x,
+                                           window.y);
                }
 
                {