Okay, I've done some changes at Fl_Menu_.cxx:

I deleted the whole line 330:


At line 797 there starts a block of code "make sure all the menus..." 
(it ends at line 802) and I replaced the whole block by the following:

  int w_menu= 0;
  for (int k = menubar; k < pp.nummenus; k++)
  {
         w_menu+= pp.p[k]->w();
         if (!pp.p[k]->shown())
         {
                 if (pp.p[k]->title) pp.p[k]->title->show();
                 pp.p[k]->show();
         }
  }
  if (pp.nummenus)
  {
         int scr_x, scr_y, scr_w, scr_h;
         Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
         int rx= 0;
         if (X + w_menu > scr_x + scr_w)        rx= scr_x + scr_w;
                // Start relocation at screen border
         else if (X!= pp.p[0]->x())        rx= X + w_menu;
                // Relocate back to origin
         if (rx) for (int menu= pp.nummenus -1; menu > -1; --menu)
                 {      // menu structure must be relocated
                         rx-= pp.p[menu]->w();
                         pp.p[menu]->position(rx, pp.p[menu]->y());
                 }
  }


This code can be optimised for example by moving Fl::screen_xywh() 
before the for-ever-loop and "if (pp.nummenus)" can be enlarged to check 
for change of number of menus, but to show the effect it is better to 
present just one code block.
The moving to the left seems okay to me, but the relocation to the 
origin maybe should be changed to observe only case of left menu side 
leaving screen, because this way the menu jumps and leaves mouse cursor.
What do you think of this?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to