[Thread Prev][Thread Next]   >Date Index >Thread Index

[wmx] Alternative way to pop up submenus

Lasse Rasinen - Thu Jan 21 15:43:14 1999

I'm not too happy with the way the version I posted here pops up new
windows. The cursor feels all too jumpy. Therefore, this patch will pop
up submenus where the cursor is. Feels much more natural, IMHO. 

Try this, if you're not all fed up with compiling wmx yet again ;)
This patch goes over the patched wmx.

*** Menu.h.new	Thu Jan 21 16:14:15 1999
--- Menu.h	Thu Jan 21 16:14:18 1999
***************
*** 32,38 ****
      int m_nHidden;
  
      Boolean m_hasSubmenus;
!     virtual void createSubmenu (int i) {};
  
      WindowManager *m_windowManager;
      XEvent *m_event;
--- 32,38 ----
      int m_nHidden;
  
      Boolean m_hasSubmenus;
!     virtual void createSubmenu (XEvent *e, int i) {};
  
      WindowManager *m_windowManager;
      XEvent *m_event;
***************
*** 73,79 ****
      virtual ~CommandMenu();
  
  private:
!     void createSubmenu(int i);
      virtual char **getItems(int *, int *);
      char *m_commandDir;
  };
--- 73,79 ----
      virtual ~CommandMenu();
  
  private:
!     void createSubmenu(XEvent *, int i);
      virtual char **getItems(int *, int *);
      char *m_commandDir;
  };
*** Menu.C.new	Thu Jan 21 16:12:39 1999
--- Menu.C	Thu Jan 21 16:37:45 1999
***************
*** 177,185 ****
  	    warp = True;
  	}
  
! 	if (warp || m_hasSubmenus) XWarpPointer(display(), None, root(),
! 					       None, None, None, None,
! 					       xbev->x, xbev->y);
      }
  
      XMoveResizeWindow(display(), m_window, x, y, maxWidth, totalHeight);
--- 177,184 ----
  	    warp = True;
  	}
  
! 	if (warp) XWarpPointer(display(), None, root(), None, None,
! 			       None, None, xbev->x, xbev->y);
      }
  
      XMoveResizeWindow(display(), m_window, x, y, maxWidth, totalHeight);
***************
*** 291,297 ****
  	    if (m_hasSubmenus && (selecting >= 0 && selecting < m_nHidden) &&
  		x >= maxWidth-32 && x < maxWidth)
  	    {
! 		createSubmenu (selecting);
  		done = True;
  		break;
  	    }
--- 290,299 ----
  	    if (m_hasSubmenus && (selecting >= 0 && selecting < m_nHidden) &&
  		x >= maxWidth-32 && x < maxWidth)
  	    {
! 		xbev->x += event.xbutton.x - 32;
! 		xbev->y += event.xbutton.y;
! 		
! 		createSubmenu ((XEvent *)xbev, selecting);
  		done = True;
  		break;
  	    }
***************
*** 369,375 ****
  
  		if (m_hasSubmenus && selecting >= 0 && selecting < m_nHidden)
  		{
! 		    createSubmenu(selecting);
  		    selecting = -1;
  		}
  		m_windowManager->releaseGrabKeyMode(&event.xkey);
--- 371,377 ----
  
  		if (m_hasSubmenus && selecting >= 0 && selecting < m_nHidden)
  		{
! 		    createSubmenu((XEvent *)xbev, selecting);
  		    selecting = -1;
  		}
  		m_windowManager->releaseGrabKeyMode(&event.xkey);
***************
*** 656,662 ****
      return strcmp(*a, *b);
  }
  
! void CommandMenu::createSubmenu (int i)
  {
      char *new_directory;
      int dirlen = strlen (m_commandDir);
--- 658,664 ----
      return strcmp(*a, *b);
  }
  
! void CommandMenu::createSubmenu (XEvent *e, int i)
  {
      char *new_directory;
      int dirlen = strlen (m_commandDir);
***************
*** 666,672 ****
      new_directory[dirlen] = '/';
      strcpy (new_directory + dirlen + 1, m_items[i]);
      
!     CommandMenu menu (m_windowManager, m_event, new_directory);
      free(new_directory);
  }
  
--- 668,674 ----
      new_directory[dirlen] = '/';
      strcpy (new_directory + dirlen + 1, m_items[i]);
      
!     CommandMenu menu (m_windowManager, e, new_directory);
      free(new_directory);
  }
  


Next: