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

[wmx] wheel mice

Chris Cannam - Tue May 16 10:35:02 2000

I've just had it pointed out to me that I neglected to
include a wheel-mouse patch in wmx-6pre4.

I actually seem to have two such patches: one was posted
by Richard Sharman to the list last October, and can be
found at

  http://ml.42.org/wmx/msg00337.html

The other one I've just discovered in my inbox from way
back last July (I wasn't paying much attention back then,
although I did forward the email to Stefan), courtesy of
Fraser McCrossan.  That one is attached.

Now, I don't have a wheel mouse so I can't answer this
myself: Which of these should I include?


Chris
--- Begin Message ---
Firstly, my congrats on wmx, a beautifully simple window manager! I like
it a lot, and use it both at home and at work.

At home, I use a wheel mouse (moving the wheel appears in X apps as
clicking buttons 4 and 5), so I patched wmx so that clicking button 2 (the
wheel) or moving the wheel up or down circulates through windows, and
button three becomes the channel surfing or command menu button.

I've attached the patches for wmx-5 (to Manager.h and Buttons.C), but
rather than give you a diff of the Config.h file, I'll just list the new
option below. I added it to the keybinding section, but wherever you think
is best.

Thanks for wmx!

--cut-here--

// Modify button bindings for Wheel-Mouse?
// Set this to True to reverse buttons 2 & 3, so that circulating windows
// is now button 2 and the wheel, and command menu and channel
// surfing is on Button 3
#define CONFIG_WHEEL_MOUSE        False
7a8,9
> #define MENUBUTTON ((CONFIG_WHEEL_MOUSE) ? Button3 : Button2)
> #define CIRCBUTTON ((CONFIG_WHEEL_MOUSE) ? Button2 : Button3)
13,14c15,17
<     if (e->button == Button3 && m_channelChangeTime == 0) {
< 	circulate(e->window == e->root);
---
>     if ((e->button == CIRCBUTTON || e->button == Button4 || e->button == Button5)
>         && m_channelChangeTime == 0) {
> 	circulate(e->window == e->root, !(e->button == Button5));
27c30
< 	    if (e->button == Button2) {
---
> 	    if (e->button == MENUBUTTON) {
37c40
< 	} else if (e->button == Button2 && m_channelChangeTime == 0) {
---
> 	} else if (e->button == MENUBUTTON && m_channelChangeTime == 0) {
44c47
< 	if (e->button == Button2 && CONFIG_CHANNEL_SURF) {
---
> 	if (e->button == MENUBUTTON && CONFIG_CHANNEL_SURF) {
56c59
< void WindowManager::circulate(Boolean activeFirst)
---
> void WindowManager::circulate(Boolean activeFirst, Boolean up)
66c69
< 	if (!m_activeClient) i = -1;
---
> 	if (!m_activeClient) i = 0;
67a71
> 	  if (up) {
69,70c73,74
< 		if (m_clients.item(i)->channel() != channel()) continue;
< 		if (m_clients.item(i) == m_activeClient) break;
---
> 	      if (m_clients.item(i)->channel() != channel()) continue;
> 	      if (m_clients.item(i) == m_activeClient) break;
71a76,82
> 	  }
> 	  else {
> 	    for (i = m_clients.count() - 1; i > 0; --i) {
> 	      if (m_clients.item(i)->channel() != channel()) continue;
> 	      if (m_clients.item(i) == m_activeClient) break;
> 	    }
> 	  }
73c84
< 	    if (i >= m_clients.count()-1) i = -1;
---
> 	    if (i >= m_clients.count()) i = -1;
76,83c87,98
< 	for (j = i + 1;
< 	     (!m_clients.item(j)->isNormal() ||
< 	       m_clients.item(j)->isTransient() ||
< 	       m_clients.item(j)->channel() != channel()); ++j) {
< 
< 	    if (j >= m_clients.count() - 1) j = -1;
< 	    if (j == i) return; // no suitable clients
< 	}
---
> 	j = i;
> 	do {
> 	  if (up) {
> 	    j = (j < m_clients.count() - 1) ? j+1 : 0;
> 	  }
> 	  else {
> 	    j = (j > 0) ? j-1 : m_clients.count() - 1;
> 	  }
> 	  if (j == i) return; // no suitable clients
> 	} while (!m_clients.item(j)->isNormal() ||
> 		 m_clients.item(j)->isTransient() ||
> 		 m_clients.item(j)->channel() != channel());
157c172
< 		    circulate(False);
---
> 		    circulate(False, True);
130c130
<     void circulate(Boolean activeFirst);
---
>     void circulate(Boolean activeFirst, Boolean up);

--- End Message ---

Next: