The shadow boys are breaking all the laws

Scott Moynes smoynes at nexus.carleton.ca
Fri Oct 25 21:19:35 EDT 2002


In attempt to slaughter the menu redraw bug I've been seeing I came up
with a partial solution. It is ugly and probably wrong, but I hope it
gives someone an idea how to fix it for good because I am lost.

First, to reproduce the bug consistently:
 - open the root menu
 - tear off the workspaces menu
 - on the root menu, highlight the styles entry and move the mouse off
 without losing the highlight
 - drag the torn off menu over the root menu.
 - watch the expose bummy up

After this patch it kind of works. It doesn't work on the left/right
expose. On the right it will lose the bullet, and on the left it will
lose the text. Also, with xft you can really see the flicker, so it
might be prudent to throw it all out and come up with some sort of
futuristic caching mechanism that uses quantum flux capacitors and
emoticon engines or something.

Regards,
Scott

-- 
Scott Moynes http://www.icculus.org/openbox/
"Computer science is as much about computers
as astronomy is about telescopes." -- Dijkstra
-------------- next part --------------
? menu-redraw-idea.diff
Index: Basemenu.cc
===================================================================
RCS file: /cvs/cvsroot/openbox/src/Basemenu.cc,v
retrieving revision 1.35
diff -p -u -r1.35 Basemenu.cc
--- Basemenu.cc	2002/10/17 02:37:23	1.35
+++ Basemenu.cc	2002/10/26 00:59:38
@@ -528,6 +528,8 @@ void Basemenu::drawItem(int index, bool 
 
   bool dotext = True, dohilite = True, dosel = True, dooppsel = True;
   const char *text = item->label();
+  cout << text << endl;
+  bool cleared = false;
   const int sbl = index / menu.persub, i = index - (sbl * menu.persub);
   const unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4;
   int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h);
@@ -579,12 +581,12 @@ void Basemenu::drawItem(int index, bool 
   if (clear) {
     XClearArea(display, menu.frame, item_x, item_y, menu.item_w, menu.item_h,
                False);
+    cout << "clear1"<<endl;
   } else if (! (x == y && y == -1 && w == h && h == 0)) {
     // calculate the which part of the hilite to redraw
     if (! (max(item_x, x) <= min<signed>(item_x + menu.item_w, x + w) &&
            max(item_y, y) <= min<signed>(item_y + menu.item_h, y + h))) {
       dohilite = False;
-    } else {
       hilite_x = max(item_x, x);
       hilite_y = max(item_y, y);
       hilite_w = min(item_x + menu.item_w, x + w) - hilite_x;
@@ -613,10 +615,15 @@ void Basemenu::drawItem(int index, bool 
 
 #ifdef    XFT
   if (dotext)
-    XClearArea(display, menu.frame, text_x, text_y , text_w, text_h, False);
+    {
+      XClearArea(display, menu.frame, text_x, text_y , text_w, text_h, False);
+      cout << "clear2" << endl;
+      cleared = true;
+    }
+  
 #endif // XFT
-
-  if (dohilite && highlight && (menu.hilite_pixmap != ParentRelative)) {
+  cout << dohilite << dotext << highlight << (menu.hilite_pixmap != ParentRelative) << endl;
+  if ( (dohilite || cleared) && highlight && (menu.hilite_pixmap != ParentRelative)) {
     if (menu.hilite_pixmap)
       XCopyArea(display, menu.hilite_pixmap, menu.frame,
                 hipen.gc(), hoff_x, hoff_y,
@@ -626,7 +633,7 @@ void Basemenu::drawItem(int index, bool 
                      hilite_x, hilite_y, hilite_w, hilite_h);
   }
 
-  if (dooppsel && item->isSelected()) {
+  if ( (dooppsel || cleared) && item->isSelected()) {
 #ifdef    BITMAPBUTTONS
     if ( style->tick_image.mask != None) {
       XSetClipOrigin(blackbox->getXDisplay(), pen.gc(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://icculus.org/pipermail/openbox/attachments/20021025/cc4920af/attachment.pgp>


More information about the openbox mailing list