[patch] and question about weird pager problem.



Hi people!

(I'm sorry if this shows up twice, I mailed this in earlier today, but
 it didn't show up, and I thought it might be because I wasn't on the
 list, but now I am, and here we go.)

All of this is on Solaris 2.6 for Sparc, a Creator 3D framebuffer,
gnome-core 1.0.3, gnome-libs-1.0.3, gtk-1.2.0

I've got a weird problem that I can't get to budge. The pager will
_sometimes_ show an empty label in some of the task buttons after I
switch workspaces. (Windowmaker)

It happens more often if the string that's supposed to go in the label
is longger than allowed (so that it should end with "...")

It happens more often if there are many tasks around. (Total amount of
tasks, not just the ones on that workspace.)

If I look in the label in the button, it does contain the correct
string. It just hasn't gotten drawn.

If I run the pager with --sync, this does not happen.

I'm starting to suspect that this is an X bug, so my question is, has
anyone seen this anywehere else than on Solaris 2.6? (Or even on
solaris, so I'll know that this isn't some local fluke.)

Anyway, while chasing this thing, I ran into some other stuff. The
attached patch does:

* Changes desktroy_task_widgets() to destroy_task_widgets(). I think
  it's a typo. If it was supposed to be a joke, then I'm sorry.

* Removes the "enter" and "leave" handlers for the buttons, they didn't
  do anything useful. (But sort-of covered up the real bug I was looking
  for. It makes the buttons reset to correctness if the mouse enters
  them.) 
 
* -                   len = 3; /*strlen("???");*/
  +                   len = strlen("???");
   (Constant expression. The compiler will figure this out.)

I have a few more things that I'm looking at, but that I'm less sure of:

* The string-shortening in set_task_info_to_button() (to make the strings
  fit into the buttons) are O(n) where n is how much too long the string
  is. It should be possible to make it a bit smarter.

* Every task has it's own copy of (for example) the icon pixmaps.

* Too much is being regenerated on every call to populate_tasks(). For
  example the icon pixmaps, which are converted from xpms.

Now, maybe there's some point to this, maybe the tasks are supposed to
get task-specific icons in the future or something, I don't know. I
don't want to touch this suince I don't know the plan. (I was worried
enough about the enter/leave stuff above. Anyone?)

Keep up the good work, people!

/August, planning to throw away CDE at work _pretty_ soon...
-- 
Wrong on most accounts.  const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo.  const Foo const *foo; would mean the same but is
illegal (double const).  You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system
--- org_gnomepager_applet.c	Fri Mar 19 01:38:52 1999
+++ gnomepager_applet.c	Fri Mar 19 20:49:33 1999
@@ -2020,28 +2020,6 @@
 }
 
 gboolean
-task_cb_button_enter(GtkWidget * widget, GdkEventCrossing *event)
-{
-  Task *t;
-  
-  t = (Task *)gtk_object_get_data(GTK_OBJECT(widget), "task");
-  set_task_info_to_button(t);
-
-  return TRUE;
-}
-
-gboolean
-task_cb_button_leave(GtkWidget * widget, GdkEventCrossing *event)
-{
-  Task *t;
-  
-  t = (Task *)gtk_object_get_data(GTK_OBJECT(widget), "task");
-  set_task_info_to_button(t);
-
-  return TRUE;
-}
-
-gboolean
 task_cb_button_down(GtkWidget * widget, GdkEventButton *event)
 {
   gint button;
@@ -2124,7 +2102,7 @@
 }
 
 void
-desktroy_task_widgets(void)
+destroy_task_widgets(void)
 {
   GList        *p;
   
@@ -2281,14 +2259,15 @@
 	    if (t->name)
 		    len = strlen(t->name);
 	    else
-		    len = 3; /*strlen("???");*/
-	    
+		    len = strlen("???");
+
 	    len--;
 	    str = g_malloc(len+4);
 	    if(t->name)
 		    strcpy(str,t->name);
 	    else
 		    strcpy(str,"???");
+
 	    strcat(str,"..");
 	    for(;len>0;len--) {
 		    int label_len;
@@ -2301,7 +2280,7 @@
 			    break;
 	    }
 	    if(len<=0)
-		    gtk_label_set_text (GTK_LABEL(label), "");
+	            gtk_label_set_text (GTK_LABEL(label), "");
 	    else
 		    gtk_label_set_text (GTK_LABEL(label), str);
 	    g_free(str);
@@ -2385,7 +2364,7 @@
       task_dest = NULL;
     }
   else
-    desktroy_task_widgets();
+    destroy_task_widgets();
   
   if (!tasks)
     return;
@@ -2416,10 +2395,6 @@
 			     GTK_SIGNAL_FUNC(task_cb_button_down), t);
 	  gtk_signal_connect(GTK_OBJECT(button), "button_release_event",
 			     GTK_SIGNAL_FUNC(task_cb_button_up), t);
-	  gtk_signal_connect(GTK_OBJECT(button), "enter",
-			     GTK_SIGNAL_FUNC(task_cb_button_enter), t);
-	  gtk_signal_connect(GTK_OBJECT(button), "leave",
-			     GTK_SIGNAL_FUNC(task_cb_button_leave), t);
 	  if ((blists_num > 0) && (blists) && (t->sticky) && (blists[0]))
 	    gtk_box_pack_start(GTK_BOX(blists[0]), button, TRUE, TRUE, 0);
 	  else if ((blists_num > ((t->desktop % num_desk) + 1)) && (blists) && 
@@ -2456,7 +2431,7 @@
 	  hbox = gtk_hbox_new(0, FALSE);
 	  gtk_widget_show(hbox);
 	  
-	  label = gtk_label_new(t->name?t->name:"???");
+	  label = gtk_label_new("");
 	  gtk_widget_show(label);
 
 	  icon1 = icon2 = icon3 = NULL;
@@ -2501,10 +2476,6 @@
 			     GTK_SIGNAL_FUNC(task_cb_button_down), t);
 	  gtk_signal_connect(GTK_OBJECT(button), "button_release_event",
 			     GTK_SIGNAL_FUNC(task_cb_button_up), t);
-	  gtk_signal_connect(GTK_OBJECT(button), "enter",
-			     GTK_SIGNAL_FUNC(task_cb_button_enter), t);
-	  gtk_signal_connect(GTK_OBJECT(button), "leave",
-			     GTK_SIGNAL_FUNC(task_cb_button_leave), t);
 /*	  
 	  tip = (GtkWidget *)gtk_tooltips_new();
 	  gtk_tooltips_set_tip(GTK_TOOLTIPS(tip), button, t->name, NULL);


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