maximum_width
authorBrenden Matthews <brenden1@rty.ca>
Wed, 24 Aug 2005 06:21:50 +0000 (06:21 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Wed, 24 Aug 2005 06:21:50 +0000 (06:21 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@160 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
Conky.kdevelop
README
doc/config_settings.xml
src/config.h.in [deleted file]
src/conky.c

index 34290b8..1aa4754 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # $Id$
 
+2005-08-23
+       * Added maximum_width
+
 2005-08-22
        * Added $execibar and $execigraph
 
index 48c9787..983a704 100644 (file)
@@ -21,7 +21,7 @@
       <mainprogram>conky</mainprogram>
       <directoryradio>build</directoryradio>
       <customdirectory>/</customdirectory>
-      <programargs></programargs>
+      <programargs/>
       <terminal>false</terminal>
       <autocompile>true</autocompile>
       <envvars/>
         <f77compiler>kdevpgf77options</f77compiler>
         <cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -ggdb</cflags>
         <envvars/>
-        <topsourcedir></topsourcedir>
-        <cppflags></cppflags>
-        <ldflags></ldflags>
-        <ccompilerbinary></ccompilerbinary>
-        <cxxcompilerbinary></cxxcompilerbinary>
-        <f77compilerbinary></f77compilerbinary>
-        <cxxflags></cxxflags>
-        <f77flags></f77flags>
+        <topsourcedir/>
+        <cppflags/>
+        <ldflags/>
+        <ccompilerbinary/>
+        <cxxcompilerbinary/>
+        <f77compilerbinary/>
+        <cxxflags/>
+        <f77flags/>
       </debug>
       <debug-no-x>
         <envvars/>
diff --git a/README b/README
index 00ec525..f04b689 100644 (file)
--- a/README
+++ b/README
@@ -197,7 +197,11 @@ CONFIGURATION SETTINGS
              Mail spool for mail checking
 
 
-       minimum_size
+       maximum_width pixels
+             Maximum width of window
+
+
+       minimum_size width (height)
              Minimum size of window
 
 
index 275ded7..448d84b 100644 (file)
 </varlistentry>
 
 <varlistentry>
-       <term><command><option>minimum_size</option></command></term>
+       <term><command><option>maximum_width</option></command>
+               <option>pixels</option>
+       </term>
+       <listitem>
+               Maximum width of window
+               <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+       <term><command><option>minimum_size</option></command>
+       <option>width (height)</option>
+       </term>
        <listitem>
                Minimum size of window
        <para></para></listitem>
diff --git a/src/config.h.in b/src/config.h.in
deleted file mode 100644 (file)
index 1b64a4c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/* src/config.h.in.  Generated from configure.in by autoheader.  */
-
-/* Define if you are using Cairo */
-#undef CAIRO
-
-/* Define if you want support for the DBE extension */
-#undef DOUBLE_BUFFER
-
-/* Define to 1 if you have the <cairo.h> header file. */
-#undef HAVE_CAIRO_H
-
-/* Define to 1 if you have the <cairo-xlib.h> header file. */
-#undef HAVE_CAIRO_XLIB_H
-
-/* Define to 1 if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define if you have getloadavg */
-#undef HAVE_GETLOADAVG
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if you have kstat (Solaris) */
-#undef HAVE_KSTAT
-
-/* Define to 1 if you have the <linux/soundcard.h> header file. */
-#undef HAVE_LINUX_SOUNDCARD_H
-
-/* Define to 1 if you have the <mcheck.h> header file. */
-#undef HAVE_MCHECK_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `popen' function. */
-#undef HAVE_POPEN
-
-/* Define to 1 if you have the <signal.h> header file. */
-#undef HAVE_SIGNAL_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have sysinfo (Linux) */
-#undef HAVE_SYSINFO
-
-/* Define to 1 if you have the <sys/mount.h> header file. */
-#undef HAVE_SYS_MOUNT_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the <sys/statfs.h> header file. */
-#undef HAVE_SYS_STATFS_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <sys/utsname.h> header file. */
-#undef HAVE_SYS_UTSNAME_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have X11 */
-#undef HAVE_X11
-
-/* Define to 1 if you have the <X11/Xlib.h> header file. */
-#undef HAVE_X11_XLIB_H
-
-/* Xdbe */
-#undef HAVE_XDBE
-
-/* Define if you want MLDonkey support */
-#undef MLDONKEY
-
-/* Define if you want MPD support */
-#undef MPD
-
-/* Define if you want support for window creating */
-#undef OWN_WINDOW
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define if you want to use /proc/uptime for uptime */
-#undef PROC_UPTIME
-
-/* Define if you want SETI at Home stats */
-#undef SETI
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define if you want to use X11 */
-#undef X11
-
-/* Define if you are using Xft */
-#undef XFT
-
-/* Define to 1 if the X Window System is missing or not being used. */
-#undef X_DISPLAY_MISSING
index 7ee1366..ef83bdb 100644 (file)
@@ -239,6 +239,7 @@ static int fixed_size = 0, fixed_pos = 0;
 #endif
 
 static int minimum_width, minimum_height;
+static int maximum_width;
 
 /* UTF-8 */
 int utf8_mode = 0;
@@ -2658,6 +2659,8 @@ static void text_size_updater(char *s)
                w += get_string_width(s);
        if (w > text_width)
                text_width = w;
+       if (text_width > maximum_width && maximum_width)
+               text_width = maximum_width;
 
        text_height += h;
        if (fontchange) {
@@ -2684,6 +2687,8 @@ static void update_text_area()
                text_width += 1;
                if (text_height < minimum_height)
                        text_height = minimum_height;
+               if (text_width > maximum_width && maximum_width > 0)
+                       text_width = maximum_width;
        }
 
        /* get text position on workarea */
@@ -2804,6 +2809,12 @@ static void draw_string(const char *s)
                        }
                }
        }
+       if (text_width == maximum_width) {
+               /* this means the text is probably pushing the limit, so we'll chop it */
+               while (cur_x + get_string_width(tmpstring2) - text_start_x > maximum_width && strlen(tmpstring2) > 0) {
+                       tmpstring2[strlen(tmpstring2)-1] = '\0';
+               }
+       }
        s = tmpstring2;
 #ifdef X11
 #ifdef XFT
@@ -3021,6 +3032,9 @@ static void draw_line(char *s)
 
                        case BAR:
                                {
+                                       if (cur_x > maximum_width - text_start_x) {
+                                               break;
+                                       }
                                        int h =
                                            specials[special_index].height;
                                        int bar_usage =
@@ -3064,6 +3078,9 @@ static void draw_line(char *s)
 
                        case GRAPH:
                                {
+                                       if (cur_x > maximum_width - text_start_x && maximum_width > 0) {
+                                               break;
+                                       }
                                        int h =
                                            specials[special_index].height;
                                        int by;
@@ -3508,6 +3525,8 @@ static void main_loop()
                                                text_height =
                                                    window.height -
                                                    border_margin * 2 - 1;
+                                               if (text_width > maximum_width && maximum_width > 0)
+                                                       text_width = maximum_width;
                                        }
 
                                        /* if position isn't what expected, set fixed pos, total_updates
@@ -3701,6 +3720,7 @@ static void set_default_configurations(void)
        gap_y = 5;
        minimum_width = 5;
        minimum_height = 5;
+       maximum_width = 0;
 #ifdef OWN_WINDOW
        own_window = 0;
 #endif
@@ -3995,14 +4015,21 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
                }
 #ifdef X11
                CONF("minimum_size") {
+       if (value) {
+               if (sscanf
+                                 (value, "%d %d", &minimum_width,
+                                  &minimum_height) != 2)
+                       if (sscanf
+                                                (value, "%d",
+                                                  &minimum_width) != 1)
+                               CONF_ERR;
+       } else
+               CONF_ERR;
+               }
+               CONF("maximum_width") {
                        if (value) {
-                               if (sscanf
-                                   (value, "%d %d", &minimum_width,
-                                    &minimum_height) != 2)
-                                       if (sscanf
-                                           (value, "%d",
-                                            &minimum_width) != 1)
-                                               CONF_ERR;
+                               if (sscanf(value, "%d", &maximum_width) != 1)
+                                       CONF_ERR;
                        } else
                                CONF_ERR;
                }