-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello All,

This is my first patch for BlackBox (actually my first patch for any open
source project :), so I'm hoping I am doing this all correctly, please
don't get too upset if I am not..

This patch adds new functionality to the bbappconf tool. The author states
on the bbtools page that he is stopping development until he can figure
out if he can roll the application into blackbox itself. If the author of
bbappconf could contact me, I could probly help in that job. Anyhow.. the
new features! With this patch you can specify the coordinates to place a
window (upper left corner), and you can now also specify the width/height
of a window. The entries for the bbappconf.bb file are such as follows:

bbappconf.1.positionX: 10
bbappconf.1.positionY: 300
bbappconf.1.width: 280
bbappconf.1.height: 400

If only one of either pair is specified (x but not y), then nothing is
done with that pair. Position can be specified as a negative number (i
used -1111 as the "illegal value" so that would actually not work, i doubt
anyone is putting windows that far into negative space..anyone disagree
with this?). For the width and height, a negative value is disregarded
entirely, they must be positive numbers.

Please give me any feedback you have regarding this all.

xOr
- -- 
you have no chance to survive make your time
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7UALc8mPQRGtSu14RAmexAJ9i8sErvTEZIF25AI0s0bmQFXab7wCghad9
+N5QU/3baJ4oPJwYb0E7PkA=
=xv4B
-----END PGP SIGNATURE-----
diff -r -u bbappconf-0.0.1-peak3~/appconf.hh bbappconf-0.0.1-peak3/appconf.hh
--- bbappconf-0.0.1-peak3~/appconf.hh   Mon Feb 19 12:40:11 2001
+++ bbappconf-0.0.1-peak3/appconf.hh    Sat Jul 14 03:12:43 2001
@@ -37,7 +37,11 @@
   unsigned int getStartOnDesktop(void) { return start_on_desktop;}
   bool getMaxHoriz(void) { return max_horiz;}
   bool getMaxVert(void) {return max_vert;}
-  
+       int getPositionX(void) {return position_x;}
+       int getPositionY(void) {return position_y;}
+       int getWidth(void) {return width;}
+       int getHeight(void) {return height;}
+ 
   char *getName(void) { return appname;}
   char *getClass(void) { return appclass;}
 
@@ -47,6 +51,10 @@
   void setMaxHoriz(bool _max_horiz) {max_horiz=_max_horiz;}
   void setStartOnDesktop(unsigned int _start_on_desktop) 
                        {start_on_desktop=_start_on_desktop;}
+       void setPositionX(int _position_x) {position_x=_position_x;}
+       void setPositionY(int _position_y) {position_y=_position_y;}
+       void setWidth(int _width) {width=_width;}
+       void setHeight(int _height) {height=_height;}
 private:
   
   bool sticky;
@@ -54,7 +62,9 @@
   bool max_horiz;
   bool max_vert;
   unsigned int start_on_desktop;
-       char *appname;
+       int position_x, position_y;
+       int width, height;
+       char *appname;
        char *appclass;
 };
 
diff -r -u bbappconf-0.0.1-peak3~/bbappconf.cc bbappconf-0.0.1-peak3/bbappconf.cc
--- bbappconf-0.0.1-peak3~/bbappconf.cc Mon Feb 19 13:57:03 2001
+++ bbappconf-0.0.1-peak3/bbappconf.cc  Sat Jul 14 03:15:53 2001
@@ -245,6 +245,16 @@
         getWMInterface()->sendWindowToDesktop(*win,
                                 resource->getAppConf(i)->getStartOnDesktop()-1);
       }
+      /* set window size */
+                       if (resource->getAppConf(i)->getWidth()>=0 &&
+                               resource->getAppConf(i)->getHeight()>=0) {
+                               
+getWMInterface()->resizeWindow(*win,resource->getAppConf(i)->getWidth(),resource->getAppConf(i)->getHeight());
+
+                       }
+                       /* set window position */
+      if (resource->getAppConf(i)->getPositionX()!=-1111 &&
+                               resource->getAppConf(i)->getPositionY()!=-1111) {
+        
+getWMInterface()->moveWindow(*win,resource->getAppConf(i)->getPositionX(),resource->getAppConf(i)->getPositionY());
+
+      }
       if (resource->getAppConf(i)->getMaxHoriz() ||
          resource->getAppConf(i)->getMaxVert()) {
         if (XGetWindowProperty(getXDisplay(), *win, 
diff -r -u bbappconf-0.0.1-peak3~/resource.cc bbappconf-0.0.1-peak3/resource.cc
--- bbappconf-0.0.1-peak3~/resource.cc  Mon Feb 19 13:17:56 2001
+++ bbappconf-0.0.1-peak3/resource.cc   Sat Jul 14 03:12:25 2001
@@ -61,6 +61,8 @@
   int i;
   char rclass[40];
   char rname[40];
+       int position_x, position_y;
+       int width, height;
   
   if ((XrmGetResource(resource_db, "bbappconf.numberOf.configs",
                        "Bbappconf.NumberOf.Configs",
@@ -164,7 +166,50 @@
       app_conf[i].setMaxHoriz(false);
     }
 
-    
+    sprintf(rclass, "Bbappconf.%d.Width",i+1);
+               sprintf(rname,  "bbappconf.%d.width",i+1);
+               if ((XrmGetResource(resource_db, rname,rclass,
+                                                                                      
+         &value_type, &value))) {
+                       if (sscanf(value.addr, "%u", &width) != 1) {
+                               width = -1;
+                       }
+               } else
+                width=-1;
+               app_conf[i].setWidth(width);
+
+               sprintf(rclass, "Bbappconf.%d.Height",i+1);
+               sprintf(rname,  "bbappconf.%d.height",i+1);
+               if ((XrmGetResource(resource_db, rname,rclass,
+                                                                                      
+         &value_type, &value))) {
+                       if (sscanf(value.addr, "%u", &height) != 1) {
+                               height = -1;
+                       }
+               } else
+                height=-1;
+               app_conf[i].setHeight(height);
+
+               sprintf(rclass, "Bbappconf.%d.PositionX",i+1);
+    sprintf(rname,  "bbappconf.%d.positionX",i+1);
+    if ((XrmGetResource(resource_db, rname,rclass,
+                        &value_type, &value))) {
+      if (sscanf(value.addr, "%u", &position_x) != 1) {
+        position_x = -1111;
+      }
+    } else
+     position_x=-1111;
+               app_conf[i].setPositionX(position_x);
+
+    sprintf(rclass, "Bbappconf.%d.PositionY",i+1);
+    sprintf(rname,  "bbappconf.%d.positionY",i+1);
+    if ((XrmGetResource(resource_db, rname,rclass,
+                        &value_type, &value))) {
+      if (sscanf(value.addr, "%u", &position_y) != 1) {
+        position_y = -1111;
+      }
+    } else
+     position_y=-1111;
+               app_conf[i].setPositionY(position_y);
+
   }
 }
 
diff -r -u bbappconf-0.0.1-peak3~/wminterface.cc bbappconf-0.0.1-peak3/wminterface.cc
--- bbappconf-0.0.1-peak3~/wminterface.cc       Tue Oct 17 15:03:14 2000
+++ bbappconf-0.0.1-peak3/wminterface.cc        Sat Jul 14 03:07:38 2001
@@ -415,3 +415,12 @@
   } else if (number_of_desktops<old_number_of_desktops)
     bbtool->removeDesktopWindow();*/
 }
+
+void WMInterface::moveWindow(Window win, int x, int y) {
+       XMoveWindow(bbtool->getXDisplay(), win, x, y);
+}
+
+void WMInterface::resizeWindow(Window win, int width, int height) {
+       XResizeWindow(bbtool->getXDisplay(), win, width, height);
+}
+
diff -r -u bbappconf-0.0.1-peak3~/wminterface.hh bbappconf-0.0.1-peak3/wminterface.hh
--- bbappconf-0.0.1-peak3~/wminterface.hh       Wed Oct 11 12:45:22 2000
+++ bbappconf-0.0.1-peak3/wminterface.hh        Sat Jul 14 03:07:59 2001
@@ -53,7 +53,9 @@
   int getAttributes(Window);
   void changeIconState(Window);
   void windowAttributeChange(Window);
-  
+       void moveWindow(Window,int,int);
+       void resizeWindow(Window,int,int);
+       
   int getNumberOfDesktops();
   int getCurrentDesktop();
   void changeDesktop(int);

Reply via email to