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

[wmx] Small hack to keyboard client menu

Lasse Rasinen - Mon Jan 17 00:23:57 2000

This patch adds CONFIG_EXIT_ON_KBD_MENU (self-explanatory, I hope) and the
assorted code. I made some changes regarding the detection of keyboard
menu, but it's small.

Caveat emptor: Not tested at all. It compiles, though ;)

diff -c wmx-6pre1-old/Config.h wmx-6pre1/Config.h
*** wmx-6pre1-old/Config.h	Tue May 18 01:34:14 1999
--- wmx-6pre1/Config.h	Mon Jan 17 01:16:11 2000
***************
*** 201,206 ****
--- 201,207 ----
  #define CONFIG_WANT_KEYBOARD_MENU	True
  #define CONFIG_CLIENT_MENU_KEY		XK_Menu
  #define CONFIG_COMMAND_MENU_KEY		XK_Multi_key
+ #define CONFIG_EXIT_ON_KBD_MENU		True
  // these are for navigating on the menu; they don't require a modifier
  #define CONFIG_MENU_UP_KEY	XK_Up
  #define CONFIG_MENU_DOWN_KEY	XK_Down
diff -c wmx-6pre1-old/Menu.C wmx-6pre1/Menu.C
*** wmx-6pre1-old/Menu.C	Sun May 16 01:44:35 1999
--- wmx-6pre1/Menu.C	Mon Jan 17 01:17:29 2000
***************
*** 136,143 ****
      }
      maxWidth += 32;
  
!     Boolean isKeyboardMenu =
! 	(CONFIG_WANT_KEYBOARD_MENU && (xbev->type == KeyPress));
      int selecting = isKeyboardMenu ? 0 : -1, prev = -1;
      int entryHeight = m_font->ascent + m_font->descent + 4;
      int totalHeight = entryHeight * m_nItems + 13;
--- 136,142 ----
      }
      maxWidth += 32;
  
!     Boolean isKeyboardMenu = isKeyboardMenuEvent(m_event);
      int selecting = isKeyboardMenu ? 0 : -1, prev = -1;
      int entryHeight = m_font->ascent + m_font->descent + 4;
      int totalHeight = entryHeight * m_nItems + 13;
***************
*** 526,531 ****
--- 525,533 ----
  	  (CONFIG_EXIT_CLICK_SIZE_Y > 0 ? 
  	   (xbev->y < CONFIG_EXIT_CLICK_SIZE_Y) : 
  	   (xbev->y > my + CONFIG_EXIT_CLICK_SIZE_Y)) : 1));
+ 
+     m_allowExit = m_allowExit ||
+ 	(isKeyboardMenuEvent(m_event) && CONFIG_EXIT_ON_KBD_MENU);
  
      if (m_allowExit) ++n;
  
diff -c wmx-6pre1-old/Menu.h wmx-6pre1/Menu.h
*** wmx-6pre1-old/Menu.h	Tue Feb 23 01:24:21 1999
--- wmx-6pre1/Menu.h	Mon Jan 17 01:13:44 2000
***************
*** 42,47 ****
--- 42,50 ----
      Display *display() { return m_windowManager->display(); }
      Window root()      { return m_windowManager->root();    }
      int screen()       { return m_windowManager->screen();  }
+     
+     Boolean isKeyboardMenuEvent (XEvent *e) {
+ 	(CONFIG_WANT_KEYBOARD_MENU && (e->type == KeyPress)); }
  
      virtual void showFeedback(int) { }
      virtual void removeFeedback(int, Boolean) { }


Next: