[3ddesktop-dev] Re: Multi digit desktop numbers

On Thursday 17 July 2003 01:37, Brad Wasson wrote:
> Robert Wittams wrote:
> > Heres a patch to do desktop numbers > 10.
> > Didn't do rows  & columns yet.
>
> Cool!  I will take a look.  Howerver the freelists.org mailing list
> handler stripped the patch.  I've enabled mime attachments now I
> think though.  Can you try sending it again?  (Or just send it
> directly to me).

Hm, I've noticed that my fix works when the daemon is run with -v, but 
not if forked. Odd, any ideas? I've attached it again. 

> > Re the build system: kde detection is really odd.
> > It completely misses my installation ( gentoo cvs ebuilds in
> > /usr/kde/ cvs/) and I couldn't get it to work with configure
> > switches. Didn't try too long..
> > Why don't you use the executable kde-config?
>
> I believe I didn't use kde-config because I didn't know how to.  Most
> -config's will take a --cflags arg to get the include path.  I didn't
> see how to do that with kde-config.

 `kde-config --prefix`/include
 
everything is relative to the prefix. 

> > I was thinking about what would be needed to achieve the Fast User
> > Switch and Expose features from MacOSX -
> > Fast User Switch:
> > -- Biggest issue is getting X servers and kernel to communicate and
> > avoid pointless and slow mode switching.
>
> 3ddesktop should use the same mode as you're currently in so mode
> switching should not be noticable.

I'm talking about switching between seperate running X servers. 
When you switch, X will switch the mode back to the video mode 
that the kernel virtual consoles use. Then the other X server will 
switch back to your mode. This leads to two mode switches when 0 
would suffice in the common case, and 1 would suffice with X servers 
with different resolutions. 

See http://www.apple.com/macosx/panther/fast_user_switching.html 
for the Mac OSX feature I'm talking about. 

For expose -  http://www.apple.com/macosx/panther/expose.html

> > -- Have an instance of 3ddeskd for each active server .
> > -- These servers communicate ( /tmp files? races  ) , and use
> > mmaped files to share an image of the screen wih each other.
> >
> > Expose:
> > -- Basically take a shot of every toplevel window that is ever
> > mapped. -- Currently workable ( hack) methods of doing this is to
> > cycle through the windows - eek , get signaled by the wm on map (
> > dbus / dcop.. ). Is there another way?
> > -- Proper way is when XFree gets proper backing store & save
> > unders, and a glX extension to use the backing store directly as a
> > texture. Amazing would be if this texture was dynamic, ie the
> > texture would update as the app drew into backing store. Might even
> > be the easiest implementation in the end.
> >  -- Also need a shot of empty desktop. Easy enough..
> > -- Then on activate, do the funky scalotron fun and see.
> >
> > The expose stuff would also enable any number of slightly evil
> > window manager hacks. eg OSX/Longhorn style fancy window move and
> > resize. Other windows would not update in the evil version... The
> > correct version is when XFree gets compositing.. and it interacts
> > well with OpenGL.
> > MacOSX can do this because the "root" window is composited using
> > OpenGL for all toplevels on top of it.
> >
> > All of these things would indeed be memory hogs, but we're not here
> > for minimalism, eh?
> >
> > On a more mundane note... the unacquired desktop textures could be
> > ( as a placeholder), a copy of the least "busy" other desktop
> > texture. Also could have an effect to show its not perfectly
> > accurate..
>
> No doubt, a better working knowledge of how X worked and more time
> we could make some improvements.  And certainly if X was better
> integrated with hardware accel everything could be a lot easier.
> Thanks for the notes and suggestions.
>
> --Brad
>
> > -- Binary/unsupported file stripped by Ecartis --
> > -- Type: text/x-diff
> > -- File: 3ddesktop-multidigit.patch
>
> Please resend ^^^^
>
>
>
>
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
? .deps
? 3ddesk
? 3ddeskd
? 3ddesktop.spec
? Makefile
? Makefile.in
? aclocal.m4
? autom4te.cache
? config.h
? config.log
? config.status
? configure
? maketar.sh
? stamp-h1
Index: 3ddeskd.cpp
===================================================================
RCS file: /cvsroot/desk3d/3ddesktop/3ddeskd.cpp,v
retrieving revision 1.8
diff -u -3 -p -u -r1.8 3ddeskd.cpp
--- 3ddeskd.cpp 16 Mar 2003 03:09:27 -0000      1.8
+++ 3ddeskd.cpp 14 Jul 2003 22:35:54 -0000
@@ -428,7 +428,6 @@ uint digit_texture;
 
 
 static void draw_digits (int r, int c);
-static void draw_digit (int d);
 static void draw_digit (int d, float x_trans, float y_trans);
 static void draw_x (float x_trans, float y_trans);
 static void set_color (int color, float level);
@@ -469,6 +468,33 @@ set_color (int color, float level) 
 }
 
 
+static void 
+draw_desktop_number(int num){
+  float digit_size = cfg->options->digit_size;
+  
+  // where to draw to 
+  float centre_x = GLWin.get_width() / 2 ;
+  float centre_y = GLWin.get_height() - (digit_size / 2) ;
+  
+  // decode to digits
+ 
+  int numdigits = (int) log10((float)num);
+ 
+  float current_x = centre_x - (digit_size * numdigits / 2);
+  
+  while(num >= 10){
+       draw_digit(num / 10, 
+                  current_x, 
+                  centre_y);
+       current_x += digit_size;
+       num = num % 10; 
+  }
+
+  draw_digit(num, 
+            current_x, 
+            centre_y);
+}
+
 static void
 draw_digits (int r, int c)
 {
@@ -533,40 +559,34 @@ draw_x (float x_trans, float y_trans)
     glPopMatrix();
 }
 
-static void 
-draw_digit (int d)
-{
-    // draw a digit in the middle
-    draw_digit (d, 
-                GLWin.get_width() / 2, 
-                GLWin.get_height() - (cfg->options->digit_size / 2) );
-}
-
 
 // this is where the digit is located in the texture
 float digit_texture_coords[] = 
-{ 0, 0, .25, 0, .5, 0, .75, 0, 0, .25, .25, .25, .5, .25, .75, .25, 
-  0, .5, .25, .5 };
+{ .25  , .5, 
+  0    , 0, 
+ .25   , 0, 
+ .5    , 0, 
+ .75   , 0, 
+ 0     , .25, 
+ .25   , .25, 
+ .5    , .25, 
+ .75   , .25, 
+ 0     , .5, 
+ .25   , .5 };
 
 static void
 draw_digit (int d, float x_trans, float y_trans)
 {
     float x1, y1, x2, y2;
 
-    if (d >= 10) {
-        msgout (DEBUG, "^^^^^^^^ above 10\n");
-        x1 = 0.25;  // show zero
-        y1 = 0.5;
-    } else {
-        x1 = digit_texture_coords[(d-1) * 2];
-        y1 = digit_texture_coords[(d-1) * 2 + 1];
-    }
+    x1 = digit_texture_coords[d * 2];
+    y1 = digit_texture_coords[d * 2 + 1];
     
     x2 = x1 + 0.25;
     y2 = y1 + 0.25;
 
@@ -883,7 +903,7 @@ render_scene(void)
             else
                 n = faces->get_current_row() + 1;
 
-            draw_digit (n);
+            draw_desktop_number (n);
         }
 
 #if 0  // use a string rather then the digit

Other related posts: