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

[wmx] The infamous new on click

Lasse Rasinen - Sun Aug 01 11:29:12 1999

So I did code it after all. The reason I feel this might be a good
thing is based on usability, and not on logic. Ask yourself:

   1. What functionality I use the most?
   2. Which finger is the fastest when it comes to clicking
      mouse buttons?

As far as I'm concerned, the answers are "New shell" and 
"The index finger". Ergo, the following. Note that this is
added functionality, the "New" menu option stays where it has
always been.

Judging from a few days experience, this is bloody convinient, so
give it a try.


--- Menu.C	Wed Jan 13 12:28:43 1999
+++ diff/Menu.C	Sun Aug  1 07:33:13 1999
@@ -424,7 +424,22 @@
 ClientMenu::ClientMenu(WindowManager *manager, XEvent *e)
     : Menu(manager, e), m_allowExit(False)
 {
+    Time enterTime = 0;
+    Time leaveTime;
+
+    if (e->type == ButtonPress)
+	enterTime = ((XButtonEvent *)e)->time;
+
     int selecting = getSelection();
+
+    leaveTime = m_windowManager->timestamp(True);
+
+    if (CONFIG_NEW_ON_CLICK_DELAY && enterTime && selecting <  0 &&
+	leaveTime - enterTime < CONFIG_NEW_ON_CLICK_DELAY)
+    {
+	m_windowManager->spawn(CONFIG_NEW_WINDOW_COMMAND, NULL);
+	return;
+    }

     if (selecting == m_nItems-1 && m_allowExit) { // getItems sets
m_allowExit
	m_windowManager->setSignalled();
--- Config.h	Wed Jan 13 12:28:43 1999
+++ diff/Config.h	Sun Aug  1 07:33:17 1999
@@ -78,6 +78,11 @@
 // alternatively,
 #define CONFIG_DISABLE_NEW_WINDOW_COMMAND (dConfig.disableNew())

+// Spawn a new shell by clicking on the root window?
+// Zero means disabled, other values are time in milliseconds,
+// indicating when a button press is  no longer a click. Experiment with this.
+#define CONFIG_NEW_ON_CLICK_DELAY 200L
+
 // Area where [exit wmx] is added (0 -> everywhere -# -> px from other side)
 #define CONFIG_EXIT_CLICK_SIZE_X 0
 #define CONFIG_EXIT_CLICK_SIZE_Y -3


Next: