antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright xshell/Makefile xshell/arguments.c xs...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright xshell/Makefile xshell/arguments.c xs...
Date: Tue, 07 Aug 2007 16:25:24 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/08/07 16:25:24

Modified files:
        xshell         : Makefile arguments.c button.c button.h 
                         decoration.c decoration.h layout.c text.c 
                         text.h xshell.c xshell.h 
Added files:
        ACE-desktop/hacks: simple_load_applet.sh 
        xshell         : color.c color.h font.c font.h xshell_struct.h 

Log message:
        Added font selection utility function for xshell.  Added support for
        multiple line text display in xshell.  Set fonts for buttons and text.
        Allow widget width to be specified at runtime.  Fixed label arg counter 
        increment.  Added simple_load_applet.sh, which displays the system load
        on a panel.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/hacks/simple_load_applet.sh?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/Makefile?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/arguments.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/button.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/button.h?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/decoration.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/decoration.h?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/layout.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/text.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/text.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/color.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/color.h?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/font.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/font.h?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell_struct.h?cvsroot=antiright&rev=1.1

Patches:
Index: xshell/Makefile
===================================================================
RCS file: /sources/antiright/antiright/xshell/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/Makefile     28 Jul 2007 19:40:00 -0000      1.3
+++ xshell/Makefile     7 Aug 2007 16:25:23 -0000       1.4
@@ -32,6 +32,8 @@
 CFLAGS=$(INCLUDES) 
 CFLAGS+=-Os
 CFLAGS+=-DXSH_DECORATE
+# For use with patched version of evilwm
+# CFLAGS+=-DEVILWM_HACK_HACK
 #CFLAGS+=-DXSH_USE_GRADIENT
 #CFLAGS+=-DDEBUG -g3 -Wall -W
 #CFLAGS+=-DDEBUG_EVENTS
@@ -39,7 +41,7 @@
 LDFLAGS=$(LIBS)
 
 OBJECTS=xshell.o widget.o button.o arguments.o shell.o events.o decoration.o\
-       text.o layout.o
+       text.o layout.o color.o font.o
 
 all: xshell
 

Index: xshell/arguments.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/arguments.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xshell/arguments.c  7 Aug 2007 12:49:44 -0000       1.6
+++ xshell/arguments.c  7 Aug 2007 16:25:23 -0000       1.7
@@ -35,9 +35,13 @@
 handle_add_options(XShell * xsh, int argc, char ** argv,
        unsigned int * counter)
 {
+       XShellGUI * gui = &(xsh->gui);
+       XShellGUILayout * layout = &(gui->layout);
+
        switch(argv[*counter][2])
        {
        case 'l': /* Label.  */
+               (*counter)++;
                xshell_button_new(xsh, xsh->gui.widgets, 
                        argv[*counter]);
                xsh->gui.last_widget->events.button_press
@@ -51,12 +55,16 @@
                break;
 
        case 't': /* Field.  */
+               (*counter)++;
                xshell_text_new(xsh, xsh->gui.widgets, 0, 
-                       (*counter)*16, "TEXT");
+                       (*counter)*16, 1, argv[*counter]);
                break;
        case 'T': /* Text Area.  */
+               (*counter)++;
+               xsh->gui.layout.max_row_count*=2;
                xshell_text_new(xsh, xsh->gui.widgets, 0, 
-                       (*counter)*16, "TEXT");
+                       (*counter)*16, layout->max_row_count-layout->row_count, 
+                       argv[*counter]);
                break;
        }
 }

Index: xshell/button.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/button.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- xshell/button.c     6 Aug 2007 20:26:24 -0000       1.4
+++ xshell/button.c     7 Aug 2007 16:25:23 -0000       1.5
@@ -30,7 +30,7 @@
 
        data=(XSHButtonData *)button->data;
        label=data->label;
-
+       xsh_set_font(xsh, "-*-fixed-*-*-*-*-14-*-*-*-*-*-*-*");
        XDrawString(xsh->gui.display, button->window, xsh->gui.gc,
                5, 12, label, strlen(label));
 #if 0
@@ -58,10 +58,6 @@
                xsh_decorate(button, XSH_DECOR_OUT);
 #endif /* XSH_DECORATE */
        draw_label((XShell *)(button->xsh), button);
-       if(!button->events.button_press)
-       {
-               
-       }
 }
 
 static void
@@ -97,27 +93,25 @@
        button->events.button_press=&button_press;\
        button->events.button_release=&button_release;
 
-#define XSH_G xsh->gui
-#define XSH_G_L XSH_G.layout
-
 void
 xshell_button_new(XShell * xsh, XWidget * parent, const char * command)
 {
        XWidget * button;
        XSHButtonData * data;
        char * label;
+       XShellGUILayout *layout=&(xsh->gui.layout);
 
        xshell_XWidget_new(xsh, parent, 
-               XSH_WIDGET_WIDTH*(XSH_G_L.column_count), 
+               XSH_WIDGET_WIDTH*(layout->column_count), 
                XSH_WIDGET_HEIGHT*
-               ((XSH_G_L.row_count = 
-               XSH_G_L.row_count < XSH_G_L.max_row_count
-               ? XSH_G_L.row_count+1:0)-1), 
+               ((layout->row_count = 
+               layout->row_count < layout->max_row_count
+               ? layout->row_count+1:0)-1), 
                XSH_WIDGET_WIDTH, XSH_WIDGET_HEIGHT);
-       if(XSH_G_L.row_count==0)
-               XSH_G_L.column_count++;
+       if(layout->row_count==0)
+               layout->column_count++;
 
-       button=XSH_G.last_widget;
+       button=xsh->gui.last_widget;
        button->data=data=malloc(sizeof(XSHButtonData));
        data->command=(char *)command;
        data->label=(label=strchr(command, '#'))?label+1:(char*)command;

Index: xshell/button.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/button.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- xshell/button.h     23 Jul 2007 01:58:46 -0000      1.2
+++ xshell/button.h     7 Aug 2007 16:25:23 -0000       1.3
@@ -28,6 +28,7 @@
 {
        char * command;
        char * label;
+       Pixmap bitmap;
 };
 
 typedef struct XSHButtonData XSHButtonData;

Index: xshell/decoration.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/decoration.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xshell/decoration.c 7 Aug 2007 12:49:45 -0000       1.6
+++ xshell/decoration.c 7 Aug 2007 16:25:24 -0000       1.7
@@ -26,32 +26,6 @@
 #define GRADIENT_DELTA 16
 
 
-unsigned long 
-xsh_get_color(Display * display, 
-       unsigned short r, unsigned short g, unsigned short b)
-{
-       XColor color;
-
-       color.red=r*256;
-       color.green=g*256;
-       color.blue=b*256;
-       color.flags=DoRed|DoGreen|DoBlue;
-       XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), 
-               &color);
-
-       return color.pixel;
-}
-
-void
-xsh_set_foreground(Display * display, GC gc, unsigned long color)
-{
-       XGCValues values;
-
-       /* Set up GC.  */
-       values.foreground=color;
-       XChangeGC(display, gc, GCForeground, &values);
-}
-
 
 static void
 cleanup(Display * display, GC gc)

Index: xshell/decoration.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/decoration.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- xshell/decoration.h 7 Aug 2007 12:49:45 -0000       1.5
+++ xshell/decoration.h 7 Aug 2007 16:25:24 -0000       1.6
@@ -37,15 +37,6 @@
 void
 xsh_setup_gradients(XShell * xsh);
 
-unsigned long 
-xsh_get_color(Display * display, 
-       unsigned short r, unsigned short g, unsigned short b);
-
-void
-xsh_set_foreground(Display * display, GC gc, unsigned long color);
-
-#define XSH_SET_COLOR(dpy, gc, r, g, b)\
-       xsh_set_foreground(dpy, gc, xsh_get_color(dpy, r, g, b))
 
 #endif /* XSH_DECOR_H */
 

Index: xshell/layout.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/layout.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- xshell/layout.c     7 Aug 2007 12:49:45 -0000       1.4
+++ xshell/layout.c     7 Aug 2007 16:25:24 -0000       1.5
@@ -26,13 +26,18 @@
 void
 xsh_layout_widgets(XShell * xsh)
 {
-       XShellGUILayout *layout=&(xsh->gui.layout);
+       XShellGUI * gui = &(xsh->gui);
+       XShellGUILayout *layout=&(gui->layout);
        unsigned int column_count = layout->column_count;
 
-       XResizeWindow(xsh->gui.display, xsh->gui.widgets->window,
-               XSH_WIDGET_WIDTH*(column_count+1),
+       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+1));
+               ? layout->max_row_count : layout->row_count
+#ifdef EVILWM_HACK_HACK
+               + 1
+#endif /* EVILWM_HACK_HACK */
+               ));
 }
 
 

Index: xshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/text.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/text.c       22 Jul 2007 21:54:10 -0000      1.3
+++ xshell/text.c       7 Aug 2007 16:25:24 -0000       1.4
@@ -22,34 +22,44 @@
 
 #include "xshell.h"
 
-static void
-draw_label(XShell * xsh, XWidget * text)
+void draw_widget_text(XWidget * text_widget)
 {
-       XSHTextData * data;
-       char * label;
-
-       data=(XSHTextData *)text->data;
-       label=data->label;
-
-       XDrawString(xsh->gui.display, text->window, xsh->gui.gc,
-               5, 12, label, strlen(label));
+       XShell * xsh = (XShell *)text_widget->xsh;
+       XShellGUI * gui = &(xsh->gui);
+       XSHTextData * data = (XSHTextData *)text_widget->data;
+       char * text=data->label;
+       unsigned int i, length=strlen(text), line=0, columns=80,
+               font_height=18, font_width=8;
+       XShellGUILayout * layout=&(gui->layout);
+
+       XSH_SET_COLOR(gui->display, gui->gc, 0xff, 0xff, 0xff);
+       xsh_set_font(xsh, "-*-fixed-medium-r-*-*-14-*-*-*-*-*-*-*");
+       for(i=0; i<length; i+=columns)
+       {
+               unsigned int line_length
+                       =(length=strlen(text)) < columns ? length : columns;
+               XDrawString(gui->display, text_widget->window, gui->gc,
+                       font_width, (++line)*font_height, text, line_length);
+               text+=line_length;
+       }
 }
 
 static void
 expose(XWidget * text)
 {
-       draw_label((XShell *)(text->xsh), text);
+       draw_widget_text(text);
 }
 
+/* Set up for scrolling  */
 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);
+       system(data->command); */
 }
 
 static void
@@ -82,20 +92,26 @@
 
 void
 xshell_text_new(XShell * xsh, XWidget * parent, int x, int y,
-       const char * command)
+       unsigned int rows, const char * command)
 {
        XWidget * text;
        XSHTextData * data;
        char * label;
+       unsigned int font_width=8;
 
-       xshell_XWidget_new(xsh, parent, x, y, 100, 16);
+       xshell_XWidget_new(xsh, parent, x, y, 
+               xsh->gui.layout.widget_width=font_width*80, 
+               XSH_WIDGET_HEIGHT*rows);
        text=xsh->gui.last_widget;
        data=malloc(sizeof(XSHTextData));
+       data->font_height=16;
+       data->font_width=font_width;
+       data->rows=rows;
        data->command=(char *)command;
        label=strchr(command, '#');
        data->label= label ? label+1 : (char *) command;
        text->data=data;
        setup_events(text);
+       xsh->gui.layout.row_count+=rows;
 }
 
-

Index: xshell/text.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/text.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/text.h       22 Jul 2007 21:54:10 -0000      1.3
+++ xshell/text.h       7 Aug 2007 16:25:24 -0000       1.4
@@ -28,12 +28,13 @@
 {
        char * command;
        char * label;
+       unsigned int font_height, font_width, rows;
 };
 
 typedef struct XSHTextData XSHTextData;
 
 void
-xshell_text_new(XShell * xsh, XWidget * parent, int x, int y,
+xshell_text_new(XShell * xsh, XWidget * parent, int x, int y, unsigned int 
rows,
        const char * command);
 
 #endif /* XSH_TEXT_H */

Index: xshell/xshell.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/xshell.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- xshell/xshell.c     7 Aug 2007 12:49:45 -0000       1.4
+++ xshell/xshell.c     7 Aug 2007 16:25:24 -0000       1.5
@@ -26,7 +26,8 @@
 #define SETUP_XSHELL_GUI_LAYOUT(layout)\
        layout.row_count=0;\
        layout.column_count=0;\
-       layout.max_row_count=XSH_ROWS_PER_COLUMN;
+       layout.max_row_count=XSH_ROWS_PER_COLUMN;\
+       layout.widget_width=XSH_WIDGET_WIDTH;
 
 #define SETUP_XSHELL_GUI(gui)\
        gui.widgets=NULL;\

Index: xshell/xshell.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/xshell.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xshell/xshell.h     7 Aug 2007 12:49:45 -0000       1.3
+++ xshell/xshell.h     7 Aug 2007 16:25:24 -0000       1.4
@@ -36,63 +36,7 @@
 #define XMSG(msg) /* unused */
 #endif /* DEBUG */
 
-struct XWidget
-{
-       Window window;
-       XWindowAttributes geometry;
-       struct {
-               void (*expose)(struct XWidget *);
-               void (*button_press)(struct XWidget *);
-               void (*button_release)(struct XWidget *);
-               void (*key_press)(struct XWidget *);
-               void (*configure)(struct XWidget *);
-       } events;
-       void * data;
-       void * xsh; /* Ensure root access.  */
-       struct XWidget *next;
-       XEvent * event;
-};
-
-typedef struct XWidget XWidget;
-
-typedef unsigned int XSHBitmask;
-
-#define XSH_OVERRIDE_REDIRECT 1
-
-#ifdef XSH_USE_GRADIENT
-typedef struct 
-{
-       Pixmap outset;
-       Pixmap inset;
-}XShellGUIPixbufs;
-#endif /* XSH_USE_GRADIENT */
-
-typedef struct 
-{
-       unsigned int row_count;
-       unsigned int max_row_count;
-       unsigned int column_count;
-}XShellGUILayout;
-
-typedef struct 
-{
-       Display * display;
-       XWidget * widgets;
-       XWidget * last_widget;
-       unsigned int widget_count;
-       GC gc;
-
-#ifdef XSH_USE_GRADIENT
-       XShellGUIPixbufs pixbufs;
-#endif /* XSH_USE_GRADIENT */
-       XShellGUILayout layout;
-} XShellGUI;
-
-typedef struct 
-{
-       XShellGUI gui;
-       XSHBitmask options;
-} XShell;
+#include "xshell_struct.h"
 
 #include "widget.h"
 #include "button.h"
@@ -101,6 +45,8 @@
 #include "events.h"
 #include "decoration.h"
 #include "layout.h"
+#include "font.h"
+#include "color.h"
 
 #endif /* XSHELL_H */
 

Index: ACE-desktop/hacks/simple_load_applet.sh
===================================================================
RCS file: ACE-desktop/hacks/simple_load_applet.sh
diff -N ACE-desktop/hacks/simple_load_applet.sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ACE-desktop/hacks/simple_load_applet.sh     7 Aug 2007 16:25:23 -0000       
1.1
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#    AntiRight (c) 2002-2007 Jeffrey Bedard address@hidden
+
+#    This file is part of AntiRight.
+
+#     AntiRight is free software; you can redistribute it and/or
+#     modify it under the terms of the GNU General Public License as
+#     published by the Free Software Foundation; either version 2 of
+#     the License, or (at your option) any later version.  AntiRight
+#     is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of
+#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#     GNU General Public License for more details.  You should have
+#     received a copy of the GNU General Public License along with
+#     AntiRight; if not, write to the Free Software Foundation, Inc.,
+#     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+gtkshell -on -og +0+0 -aul "uptime | cut -d: -f4 "
+

Index: xshell/color.c
===================================================================
RCS file: xshell/color.c
diff -N xshell/color.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xshell/color.c      7 Aug 2007 16:25:23 -0000       1.1
@@ -0,0 +1,49 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#include "xshell.h"
+
+unsigned long 
+xsh_get_color(Display * display, 
+       unsigned short r, unsigned short g, unsigned short b)
+{
+       XColor color;
+
+       color.red=r*256;
+       color.green=g*256;
+       color.blue=b*256;
+       color.flags=DoRed|DoGreen|DoBlue;
+       XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), 
+               &color);
+
+       return color.pixel;
+}
+
+void
+xsh_set_foreground(Display * display, GC gc, unsigned long color)
+{
+       XGCValues values;
+
+       /* Set up GC.  */
+       values.foreground=color;
+       XChangeGC(display, gc, GCForeground, &values);
+}

Index: xshell/color.h
===================================================================
RCS file: xshell/color.h
diff -N xshell/color.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xshell/color.h      7 Aug 2007 16:25:24 -0000       1.1
@@ -0,0 +1,37 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef XSH_COLOR_H
+#define XSH_COLOR_H
+
+unsigned long 
+xsh_get_color(Display * display, 
+       unsigned short r, unsigned short g, unsigned short b);
+
+void
+xsh_set_foreground(Display * display, GC gc, unsigned long color);
+
+#define XSH_SET_COLOR(dpy, gc, r, g, b)\
+       xsh_set_foreground(dpy, gc, xsh_get_color(dpy, r, g, b))
+
+#endif /* not XSH_COLOR_H */
+

Index: xshell/font.c
===================================================================
RCS file: xshell/font.c
diff -N xshell/font.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xshell/font.c       7 Aug 2007 16:25:24 -0000       1.1
@@ -0,0 +1,35 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#include "xshell.h"
+
+void
+xsh_set_font(XShell * xsh, const char * name)
+{
+       XGCValues values;
+       XShellGUI * gui = &(xsh->gui);
+
+       values.font=XLoadFont(gui->display, name);
+
+       XChangeGC(gui->display, gui->gc, GCFont, &values);
+}
+

Index: xshell/font.h
===================================================================
RCS file: xshell/font.h
diff -N xshell/font.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xshell/font.h       7 Aug 2007 16:25:24 -0000       1.1
@@ -0,0 +1,30 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef XSH_FONT_H
+#define XSH_FONT_H
+
+void
+xsh_set_font(XShell * xsh, const char * name);
+
+#endif /* not XSH_FONT_H */
+

Index: xshell/xshell_struct.h
===================================================================
RCS file: xshell/xshell_struct.h
diff -N xshell/xshell_struct.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xshell/xshell_struct.h      7 Aug 2007 16:25:24 -0000       1.1
@@ -0,0 +1,86 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef XSH_STRUCT_H
+#define XSH_STRUCT_H
+
+struct XWidget
+{
+       Window window;
+       XWindowAttributes geometry;
+       struct {
+               void (*expose)(struct XWidget *);
+               void (*button_press)(struct XWidget *);
+               void (*button_release)(struct XWidget *);
+               void (*key_press)(struct XWidget *);
+               void (*configure)(struct XWidget *);
+       } events;
+       void * data;
+       void * xsh; /* Ensure root access.  */
+       struct XWidget *next;
+       XEvent * event;
+};
+
+typedef struct XWidget XWidget;
+
+typedef unsigned int XSHBitmask;
+
+#define XSH_OVERRIDE_REDIRECT 1
+
+#ifdef XSH_USE_GRADIENT
+typedef struct 
+{
+       Pixmap outset;
+       Pixmap inset;
+}XShellGUIPixbufs;
+#endif /* XSH_USE_GRADIENT */
+
+typedef struct 
+{
+       unsigned int row_count;
+       unsigned int max_row_count;
+       unsigned int column_count;
+       unsigned int widget_width;
+}XShellGUILayout;
+
+typedef struct 
+{
+       Display * display;
+       XWidget * widgets;
+       XWidget * last_widget;
+       unsigned int widget_count;
+       GC gc;
+
+#ifdef XSH_USE_GRADIENT
+       XShellGUIPixbufs pixbufs;
+#endif /* XSH_USE_GRADIENT */
+       XShellGUILayout layout;
+} XShellGUI;
+
+typedef struct 
+{
+       XShellGUI gui;
+       XSHBitmask options;
+} XShell;
+
+#endif /* not XSH_STRUCT_H */
+




reply via email to

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