Building a new xfwm4 Debian package: Try it, you’ll like it!

In the askubuntu web forum (http://askubuntu.com/questions/821940/configure-mouse-buttons-in-xfce4), I asked if it is possible to change the behavior of the mouse in response to  Alt-Middle click. Currently, that causes a window to be moved to the bottom of the stack of windows. On a new Dell precision 5510, the trackpad makes it difficult to know where the left button is separated from the middle button and I often accidentally get the middle when I want left.

There were no answers for a while, so I asked same question in the XFCE4 support forum. https://forum.xfce.org/viewtopic.php?pid=43174#p43174

The answer is that the Alt-Middle click behavior (pushes window to bottom of stack) is hard coded in the xfwm4 source code. Only way to change it is to recompile xfwm4. Helpful person pointed at src file events.c line 928 for revision. I found easy to build new package and now have xfwm4 behaving the way I want!

In case you have not tried this for yourself, the process is much more straightforward than one might expect. It seems quite a bit better than it was just 18 months ago. In brief, get the source for the package, fiddle the source code, try to rebuild, let it make a patch, then build again.

$ sudo apt-get build-dep xfwm4
$ mkdir -p tmp/xfmw4
$ cd tmp/xfwm4
$ apt-get source xfwm4 
$ cd xfwm4-4.12.3/src
$ vi events.c

In that file I made a correction that amounted to this patchfile. It looks like the spaces were destroyed in cutting an pasting, but if you open events.c and go to line 928, you see there is one line I've commented out and one I've added.

+++ xfwm4-4.12.3/src/events.c
@@ -925,7 +925,8 @@ handleButtonPress (DisplayInfo *display_
}
else if ((ev->button == Button2) && (state) && (state == screen_info->params->easy_click))
{
- clientLower (c, None);
+ /* clientLower (c, None); */
+ button1Action (c, ev);
}
else if ((ev->button == Button3) && (state) && (state == screen_info->params->easy_click))
{

This causes the Alt-Middle and Alt-Left behaviors to be the same. I fiddle those lines in the source, then run

$ dpkg-buildpackage -rfakeroot

In new version of this program, there is a very handy feature. The builder notices you edited the file and it makes a patch for you and puts the patch in the debian directory, under patches. Read the output, it will be obvious what to do.

$ dpkg-source commit

Before running the builder again, edit the changelog to update the version. The easiest way is to use the helper named "dch"

$ dch

Opens a dialogue where you need to make sure you are incrementing the package name, so that when you install the new xfwm4 you will build, it gets a new number.

Then run the builder again

$ dpkg-buildpackage -rfakeroot

If all goes well, then the new packages will be in the directory above.

$ cd ..
$ sudo dpkg -i xfwm4_4.12.3-1ubuntu4_amd64.deb
$ xfwm4 --replace &

You'll see the effect of the change right away.

If you've never rebuild a Debian/Ubuntu package, you might as well download the source and give it a try. This is one of the most satisfying parts of being a Linux user.

This change in xfwm4 helps me quite a lot because this touchpad is, well, very difficult to use. Without looking down at the touchpad, I find it impossible to know for sure where the left button area ends and the middle button begins. My right thumb does not always reach far enough to find the left button. By making the left and middle button alt-click behaviors the same, I reduce the error rate quite a bit.

In caveman talk, I'd say to Dell: "trackpad bad! buttons good!". I know I'm out of style here.

About pauljohn

Paul E. Johnson is a Professor of Political Science at the University of Kansas. He is an avid Linux User, an adequate system administrator and C programmer, and humility is one of his greatest strengths.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply