antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright ACE-desktop/hacks/juke.sh rootcat/roo...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright ACE-desktop/hacks/juke.sh rootcat/roo...
Date: Mon, 21 Jan 2008 11:56:32 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 08/01/21 11:56:32

Modified files:
        ACE-desktop/hacks: juke.sh 
        rootcat        : rootcat.c 
        xshell         : Makefile arguments.c button.c button.h dialog.c 
                         dialog.h events.c layout.c text.c widget.c 
                         xshell.c 

Log message:
        Fix xshell layout and display error handling.  
        Added a control applet start option to juke.sh

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/hacks/juke.sh?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/rootcat.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/Makefile?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/arguments.c?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/button.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/button.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/dialog.c?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/dialog.h?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/events.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/layout.c?cvsroot=antiright&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/text.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/widget.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell.c?cvsroot=antiright&r1=1.8&r2=1.9

Patches:
Index: ACE-desktop/hacks/juke.sh
===================================================================
RCS file: /sources/antiright/antiright/ACE-desktop/hacks/juke.sh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- ACE-desktop/hacks/juke.sh   21 Oct 2007 01:28:54 -0000      1.9
+++ ACE-desktop/hacks/juke.sh   21 Jan 2008 11:56:31 -0000      1.10
@@ -23,14 +23,14 @@
 MUSIC_PLAYER=$(ACE mp3_player)
 
 song_title() {
-       ps xaww | grep -v xargs | grep $MUSIC_PLAYER | grep -v '(sh)'\
-               | awk '{print substr($0, index($0, $6)); exit(0);}'
+       TITLE="$(ps xaww | grep -v xargs | grep $MUSIC_PLAYER | grep -v '(sh)'\
+               | awk '{print substr($0, index($0, $6)); exit(0);}')"
+       echo $TITLE
 }
 
 osd_song_title() {
-       pkill -f osd_cat
-       song_title | osd_cat -f '-*-luxi sans-*-*-*-*-*-*-*-*-*-*-*-*'\
-               -c '#dde' -d 30
+       song_title > /dev/null
+       rootcat "$TITLE"
 }
 
 next_song() {
@@ -58,23 +58,6 @@
                'ACE -A Hack juke -k ,gtk-close' &
 }
 
-song_applet() {
-       if [ "$1" = "--split" ]; then
-               control_applet
-               nice -n 20 gtkshell -or 1 -oT JUKE_APPLET\
-                       -og '0+0' -on -oi menu\
-                       -aul 'ACE -A Hack juke -t' &
-       else
-               nice -n 20 gtkshell -or 1 -oT JUKE_APPLET\
-                       -og '0+0' -on -oL\
-                       -aul 'ACE -A Hack juke -t' -ol\
-                       'ACE -A Hack juke -s; ACE -A Hack juke ,gtk-media-play'\
-                       'ACE -A Hack juke -n ,gtk-media-next'\
-                       'ACE -A Hack juke -s ,gtk-media-stop'\
-                       'ACE -A Hack juke -k ,gtk-close' &
-       fi
-}
-
 random_song() {
        shuffle -p 1 -0 * | xargs -0 $MUSIC_PLAYER 
 }
@@ -82,7 +65,8 @@
 show_usage()
 {
        echo 'USAGE:'
-       echo '*         song applet'
+       echo '          song applet and play'
+       echo '-a        song applet'
        echo '-h        show usage'
        echo '-k        kill applet'
        echo '-n        next song'
@@ -92,22 +76,16 @@
 }
 
 if [ "$1" = "" ]; then
-       if [ "$(which osd_cat)" = "" ]; then
-               if [ "$(pgrep -f JUKE_APPLET)" = "" ]; then
-                       song_applet &
-               fi
-       else
-               control_applet
-       fi
        trap next_song 2
        trap stop_playing 3
+       control_applet &
        while :; do
-               if [ "$(which osd_cat)" ]; then
                        (sleep 1; osd_song_title) &
-               fi
                random_song
                sleep 0.25
        done
+elif [ "$1" = "-a" ]; then
+       control_applet &
 elif [ "$1" = "-h" ]; then
        show_usage
 elif [ "$1" = "-k" ]; then
@@ -123,6 +101,6 @@
 elif [ "$1" = "-T" ]; then
        osd_song_title
 else
-       song_applet --split
+       show_usage
 fi
 

Index: rootcat/rootcat.c
===================================================================
RCS file: /sources/antiright/antiright/rootcat/rootcat.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- rootcat/rootcat.c   16 Jan 2008 17:48:13 -0000      1.3
+++ rootcat/rootcat.c   21 Jan 2008 11:56:32 -0000      1.4
@@ -96,17 +96,15 @@
                iter+=length;
                lines++;
        }
+
        return lines;
-/*
-       XftDrawStringUtf8(rc->__draw, &(rc->color), rc->font,
-               x, y, (FcChar8 *)string, strlen(string)); */
 }
 
 static void
 delete_StringRenderer(StringRenderer * rc)
 {
        Display * dpy = rc->dpy;
-       int screen = DefaultScreen(dpy);
+       const int screen = DefaultScreen(dpy);
 
        XftColorFree(dpy, DefaultVisual(dpy, screen), 
                DefaultColormap(dpy, screen), &(rc->color));

Index: xshell/Makefile
===================================================================
RCS file: /sources/antiright/antiright/xshell/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- xshell/Makefile     25 Nov 2007 00:01:00 -0000      1.7
+++ xshell/Makefile     21 Jan 2008 11:56:32 -0000      1.8
@@ -35,9 +35,9 @@
 # For use with patched version of evilwm
 # CFLAGS+=-DEVILWM_HACK_HACK
 #CFLAGS+=-DXSH_USE_GRADIENT
-CFLAGS+=-DXSH_USE_INDICATORS
-#CFLAGS+=-DDEBUG -g3 -Wall -W
-#CFLAGS+=-DDEBUG_EVENTS
+#CFLAGS+=-DXSH_USE_INDICATORS
+CFLAGS+=-DDEBUG -g3 -Wall -W -Werror
+CFLAGS+=-DDEBUG_EVENTS
 # This is for a button status indicator, currently just a decoration.  
 #CFLAGS+=-DXSH_USE_INDICATOR
 LIBS=-L/usr/X11R6/lib -L/usr/pkg/lib -lX11

Index: xshell/arguments.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/arguments.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- xshell/arguments.c  1 Sep 2007 18:13:07 -0000       1.11
+++ xshell/arguments.c  21 Jan 2008 11:56:32 -0000      1.12
@@ -39,7 +39,7 @@
 }
 
 static void
-handle_add_options(XShell * xsh, int argc, char ** argv,
+handle_add_options(XShell * xsh, char ** argv,
        unsigned int * counter)
 {
        XShellGUI * gui = &(xsh->gui);
@@ -91,11 +91,12 @@
                = &(xsh->gui.widgets->geometry);
        XParseGeometry(geometry_string, 
                &(geometry->x), &(geometry->y), 
-               &(geometry->width), &(geometry->height)); 
+               (unsigned int *)&(geometry->width), 
+               (unsigned int *)&(geometry->height)); 
 }
 
 static void
-handle_option_options(XShell * xsh, int argc, char ** argv,
+handle_option_options(XShell * xsh, char ** argv,
        unsigned int * counter)
 {
        switch(argv[*counter][2])
@@ -118,7 +119,7 @@
 
 
 static void
-handle_options(XShell * xsh, int argc, char ** argv, 
+handle_options(XShell * xsh, char ** argv, 
        unsigned int * counter)
 {
        switch(argv[*counter][1])
@@ -127,16 +128,16 @@
                        xsh_show_usage_and_exit();
                        break;
                case 'a': /* Add options.  */
-                       handle_add_options(xsh, argc, argv, counter);
+                       handle_add_options(xsh, argv, counter);
                        break;
                case 'd':
-                       xshell_handle_dialog_options(xsh, argc, argv, counter);
+                       xshell_handle_dialog_options(xsh, argv, counter);
                        break;
                case 'h':
                        xsh_show_usage_and_exit();
                        break;
                case 'o':
-                       handle_option_options(xsh, argc, argv, counter);
+                       handle_option_options(xsh, argv, counter);
                        break;
                case 't': /* test area */
                {
@@ -148,10 +149,10 @@
 }
 
 static void
-handle_argument(XShell * xsh, int argc, char ** argv, unsigned int * counter)
+handle_argument(XShell * xsh, char ** argv, unsigned int * counter)
 {
        if(argv[*counter][0]=='-')
-               handle_options(xsh, argc, argv, counter);
+               handle_options(xsh, argv, counter);
        else
                xshell_button_new(xsh, xsh->gui.widgets, argv[*counter]);
 }
@@ -163,7 +164,7 @@
 
        for(counter=1; counter<(unsigned int)argc; counter++)
        {
-               handle_argument(xsh, argc, argv, &counter);
+               handle_argument(xsh, argv, &counter);
        }
 }
 

Index: xshell/button.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/button.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- xshell/button.c     29 Nov 2007 20:56:17 -0000      1.14
+++ xshell/button.c     21 Jan 2008 11:56:32 -0000      1.15
@@ -129,7 +129,6 @@
 {
        XWidget * button;
        XSHButtonData * data;
-       char * label;
 
        xshell_XWidget_new(xsh, parent, x, y, width, height);
        button=xsh->gui.last_widget;

Index: xshell/button.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/button.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/button.h     7 Aug 2007 16:25:23 -0000       1.3
+++ xshell/button.h     21 Jan 2008 11:56:32 -0000      1.4
@@ -37,6 +37,11 @@
 xshell_button_new(XShell * xsh, XWidget * parent,
        const char * command);
 
+void
+xshell_floating_button_new(XShell * xsh, XWidget * parent, 
+       const char * command, int x, int y, 
+       unsigned int width, unsigned int height);
+
 #endif /* XSH_BUTTON_H */
 
 

Index: xshell/dialog.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/dialog.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- xshell/dialog.c     28 Aug 2007 19:39:12 -0000      1.1
+++ xshell/dialog.c     21 Jan 2008 11:56:32 -0000      1.2
@@ -27,22 +27,22 @@
 {
        xsh->gui.widgets->geometry.width=200;
        xsh->gui.widgets->geometry.height=100;
-       xshell_floating_button_new(xsh, xsh->gui.widgets->window, "OK",
+       xshell_floating_button_new(xsh, xsh->gui.widgets, "OK",
                0, 0, 100, 50);
-       xshell_floating_button_new(xsh, xsh->gui.widgets->window, "Cancel",
+       xshell_floating_button_new(xsh, xsh->gui.widgets, "Cancel",
                100, 0, 100, 50);
-       xshell_floating_button_new(xsh, xsh->gui.widgets->window, message,
+       xshell_floating_button_new(xsh, xsh->gui.widgets, message,
                0, 50, 100, 50);
 }
 
 void
-xshell_handle_dialog_options(XShell * xsh, int argc, 
+xshell_handle_dialog_options(XShell * xsh,
        char ** argv, unsigned int * counter)
 {
        switch(argv[*counter][2])
        {
        case 'm':
-               *counter++;
+               (*counter)++;
                xshell_message_dialog(xsh, argv[*counter]);
                break;
        default:

Index: xshell/dialog.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/dialog.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- xshell/dialog.h     28 Aug 2007 19:39:12 -0000      1.1
+++ xshell/dialog.h     21 Jan 2008 11:56:32 -0000      1.2
@@ -24,7 +24,7 @@
 #define XSH_DIALOG_H
 
 void
-xshell_handle_dialog_options(XShell * xsh, int argc, 
+xshell_handle_dialog_options(XShell * xsh, 
        char ** argv, unsigned int * counter);
 
 #endif /* XSH_DIALOG_H */

Index: xshell/events.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/events.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- xshell/events.c     20 Aug 2007 16:12:09 -0000      1.4
+++ xshell/events.c     21 Jan 2008 11:56:32 -0000      1.5
@@ -87,6 +87,8 @@
        XEvent event;
        Display *dpy;
 
+       XFlush(xsh->gui.display);
+       
        for(dpy=xsh->gui.display;;XNextEvent(dpy, &event))      
        {
                if(event.type==ConfigureNotify)
@@ -94,15 +96,14 @@
 #ifdef DEBUG_EVENTS
                        XMSG("ConfigureNotify");
 #endif /* DEBUG_EVENTS */
-                       /* puts("resize"); */
                        xsh->gui.widgets->geometry.width
                                =event.xconfigure.width;
+               /*      xsh->gui.widgets->geometry.height
+                               =event.xconfigure.height; */
                        if(event.xany.window == xsh->gui.widgets->window)
                                xsh->gui.widgets->geometry.height
                                                =event.xconfigure.height;
-       //              if(event.xexpose.count < 1)     
                                xsh_layout_widgets(xsh);
-                       XFlush(dpy);
                }
                else
                        xshell_foreach_XWidget(xsh->gui.widgets, &event);

Index: xshell/layout.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/layout.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- xshell/layout.c     25 Nov 2007 00:01:00 -0000      1.8
+++ xshell/layout.c     21 Jan 2008 11:56:32 -0000      1.9
@@ -33,9 +33,9 @@
        if(!(xsh->options & XSH_STOP_LAYOUT))
                XResizeWindow(gui->display, gui->widgets->window,
                        layout->widget_width*(column_count+1),
-                       XSH_WIDGET_HEIGHT*(column_count>0 
-                       ? layout->max_row_count : layout->row_count));
-       xsh->options|=XSH_STOP_LAYOUT;
+                       XSH_WIDGET_HEIGHT*((column_count>0 
+                       ? layout->max_row_count : layout->row_count)));
+/*     xsh->options|=XSH_STOP_LAYOUT; */
 }
 
 

Index: xshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/text.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- xshell/text.c       25 Nov 2007 00:01:00 -0000      1.9
+++ xshell/text.c       21 Jan 2008 11:56:32 -0000      1.10
@@ -29,8 +29,9 @@
        XSHTextData * data = (XSHTextData *)text_widget->data;
        char * text=data->label;
        unsigned int i, length=strlen(text), line=0, columns=80,
-               font_height=data->font_height, font_width=data->font_width;
-       XTextItem * items=NULL;
+               font_height=data->font_height;
+       /*unsigned int font_width=data->font_width;
+       XTextItem * items=NULL; */
 
        XSH_SET_COLOR(gui->display, gui->gc, 0, 0, 0);
        for(i=0; i<length; i+=columns)
@@ -59,12 +60,12 @@
 static void
 button_press(XWidget * text)
 {
-/*     XSHTextData * data;
+       XSHTextData * data;
 
        XMSG("PRESSED");
        data=(XSHTextData *)text->data;
-       draw_label((XShell *)(text->xsh), text);
-       system(data->command); */
+       /*draw_label((XShell *)(text->xsh), text);*/
+       system(data->command); 
 }
 
 static void

Index: xshell/widget.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/widget.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/widget.c     20 Aug 2007 16:12:09 -0000      1.3
+++ xshell/widget.c     21 Jan 2008 11:56:32 -0000      1.4
@@ -20,7 +20,6 @@
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
 
-
 #include "xshell.h"
 
 XShell *
@@ -103,9 +102,13 @@
 
        widget=malloc(sizeof(XWidget));
        if(xsh->gui.widgets)
+       {
                xsh->gui.last_widget->next=widget;
+       }
        else
+       {
                xsh->gui.widgets=widget;
+       }
        initialize_widget_members(widget, x, y, width, height);
        widget->xsh=(void *)xsh;
        setup_widget_window(xsh, widget, parent);

Index: xshell/xshell.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/xshell.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- xshell/xshell.c     1 Sep 2007 18:13:07 -0000       1.8
+++ xshell/xshell.c     21 Jan 2008 11:56:32 -0000      1.9
@@ -24,7 +24,7 @@
 #include "xshell.h"
 
 static void
-setup_xshell_gui_layout(XShell * xsh, XShellGUILayout * layout)
+setup_xshell_gui_layout(XShellGUILayout * layout)
 {
        layout->row_count=0;
        layout->column_count=0;
@@ -33,18 +33,18 @@
 }
 
 static void
-setup_xshell_gui(XShell * xsh, XShellGUI * gui)
+setup_xshell_gui(XShellGUI * gui)
 {
        gui->widgets=NULL;
        gui->widget_count=0;
-       setup_xshell_gui_layout(xsh, &(gui->layout));
+       setup_xshell_gui_layout(&(gui->layout));
 }
 
 static void
 setup_xshell(XShell * xsh)
 {
        xsh->options=0;
-       setup_xshell_gui(xsh, &(xsh->gui));
+       setup_xshell_gui(&(xsh->gui));
 }
 
 static void
@@ -91,20 +91,29 @@
 setup_main_window(XShell * xsh)
 {
        XShellGUI * gui = &(xsh->gui);
+       Display * dpy = gui->display;
+       int screen = DefaultScreen(dpy);
+       const int x=DisplayWidth(dpy, screen)/3;
+       const int y=DisplayHeight(dpy, screen)/3;
+
 
        /* Main window.  */
-       xshell_XWidget_new(xsh, NULL, 0, 0, 100, 16);
-       gui->gc=XSH_SETUP_GC(gui->display, gui->widgets->window);
-       XSH_SET_COLOR(gui->display, gui->gc, 0xae, 0xb2, 0xc3);
+       xshell_XWidget_new(xsh, NULL, x, y, 100, 100);
+       gui->gc=XSH_SETUP_GC(dpy, gui->widgets->window);
+       XSH_SET_COLOR(dpy, gui->gc, 0xae, 0xb2, 0xc3);
        xsh_set_font(xsh, "-misc-fixed-medium-r-*-*-14-*-*-*-*-*-*-*");
 }
 
 static void
 apply_toplevel_geometry(XShell * xsh)
 {
-       XMoveWindow(xsh->gui.display, xsh->gui.widgets->window,
+       XShellGUI * gui = &(xsh->gui);
+
+       XMoveResizeWindow(xsh->gui.display, xsh->gui.widgets->window,
                xsh->gui.widgets->geometry.x,
-               xsh->gui.widgets->geometry.y);
+               xsh->gui.widgets->geometry.y,
+               gui->widgets->geometry.width,
+               gui->widgets->geometry.height);
 }
 
 int
@@ -115,7 +124,12 @@
        if(argc<=1)
                xsh_show_usage_and_exit();
        setup_xshell(&xsh);
-       xsh.gui.display=XOpenDisplay(NULL);
+       if(!(xsh.gui.display=XOpenDisplay(NULL)))
+       {
+               fprintf(stderr, "%s:  ERROR:  cannot open display\n",
+                       argv[0]);
+               exit(1);
+       }
        setup_main_window(&xsh);
 #ifdef XSH_USE_GRADIENT
        xsh_setup_gradients(&xsh);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]