You are not logged in.

#1 2004-08-16 04:42:45

whatah
Member
Registered: 2003-08-10
Posts: 114

Fluxbox mouse wheel window shading patch

Hey all, i was an avid kahakai user (a wm) and really enjoyed shading my windows via the mouse wheel. I recently switched the fluxbox, and the damn thing doesn't have a way to configure mouse binds outside the source, so i wrote a patch to have fluxbox let me shade and unshade my windows.

http://bingweb.binghamton.edu/~nzohar1/ … ding.patch

--- src/Window.cc    2004-04-22 17:07:57.000000000 -0400
+++ Window.cc    2004-07-31 02:14:12.000000000 -0400
@@ -1525,6 +1525,36 @@
     m_layersig.notify();
 }
 
+
+void FluxboxWindow::unshade_only() {
+    if (!decorations.titlebar)
+        return;
+
+    if (shaded) {
+        frame().shade();
+        shaded = false;
+        m_blackbox_attrib.flags ^= ATTRIB_SHADED;
+        m_blackbox_attrib.attrib ^= ATTRIB_SHADED;
+
+        setState(NormalState, true);
+    } 
+}
+    
+void FluxboxWindow::shade_only() {
+    if (!decorations.titlebar)
+        return;
+
+    if (!shaded) {
+        frame().shade();
+         shaded = true;
+        m_blackbox_attrib.flags |= ATTRIB_SHADED;
+        m_blackbox_attrib.attrib |= ATTRIB_SHADED;
+        // shading is the same as iconic
+        setState(IconicState, true);
+    }
+}
+    
+
 void FluxboxWindow::shade() {
     // we can only shade if we have a titlebar
     if (!decorations.titlebar)
@@ -3416,6 +3444,8 @@
     CommandRef maximize_horiz_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeHorizontal));
     CommandRef close_cmd(new WindowCmd(*this, &FluxboxWindow::close));
     CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::shade));
+    CommandRef unshade_only_cmd(new WindowCmd(*this, &FluxboxWindow::unshade_only));
+    CommandRef shade_only_cmd(new WindowCmd(*this, &FluxboxWindow::shade_only));
     CommandRef raise_cmd(new WindowCmd(*this, &FluxboxWindow::raise));
     CommandRef lower_cmd(new WindowCmd(*this, &FluxboxWindow::lower));
     CommandRef raise_and_focus_cmd(new WindowCmd(*this, &FluxboxWindow::raiseAndFocus));
@@ -3490,6 +3520,8 @@
     frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
     frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
     frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2
+    frame().setOnClickTitlebar(shade_only_cmd, 4);
+    frame().setOnClickTitlebar(unshade_only_cmd, 5);
     frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
 
     // end setup frame

--- src/Window.hh    2004-04-18 17:17:36.000000000 -0400
+++ Window.hh    2004-07-31 02:14:12.000000000 -0400
@@ -199,6 +199,9 @@
     void maximizeFull();
     /// toggles shade
     void shade();
+    // t3h ugly hack for shade and unshading only
+    void unshade_only();
+    void shade_only();
     /// toggles sticky
     void stick(); 
     void raise();

apply with patch -p0 < fluxbox_mouse-wheel-shading.patch in the fluxbox-devel main directory.  If you don't know what window shading is, it is the coolest thing ever. And i mean ever.

Offline

#2 2004-08-16 17:00:41

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Fluxbox mouse wheel window shading patch

Personally I think integrated tabbing is the coolest feature ever, and I don't use window shading (nor icons for that matter).

What I would like to have in Fluxbox is that you can change the workspace with the mousewheel on the titlebar. Because your patch does most what I need for my feature, it was really helpful for me, thanks. It saved me time digging in the Fluxbox source to figure out where to add it.

For me the only thing left to do is to add the clock somewhere else. Not sure where yet, perhaps the focused window, or the menu. That way I can finally get rid of the toolbar and my screen can be totally empty, as it should be.

The patch is against the current CVS (made with "cvs diff"):

RCS file: /cvsroot/fluxbox/fluxbox/src/Window.cc,v
retrieving revision 1.296
diff -u -p -b -B -w -r1.296 Window.cc
--- src/Window.cc    13 Aug 2004 12:39:02 -0000    1.296
+++ src/Window.cc    16 Aug 2004 15:54:23 -0000
@@ -2017,6 +2017,14 @@ void FluxboxWindow::popupMenu() {
     showMenu(m_last_button_x, menu_y + frame().y());
 }
 
+void FluxboxWindow::nextWorkspace(){
+    screen().nextWorkspace(1);
+}
+
+void FluxboxWindow::prevWorkspace(){
+    screen().prevWorkspace(1);
+}
+
 /**
    Determine if this is the lowest tab of them all
 */
@@ -3480,6 +3488,8 @@ void FluxboxWindow::setupWindow() {
     CommandRef raise_and_focus_cmd(new WindowCmd(*this, &FluxboxWindow::raiseAndFocus));
     CommandRef stick_cmd(new WindowCmd(*this, &FluxboxWindow::stick));
     CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu));
+    CommandRef nextworkspace_cmd(new WindowCmd(*this, &FluxboxWindow::nextWorkspace));
+    CommandRef prevworkspace_cmd(new WindowCmd(*this, &FluxboxWindow::prevWorkspace));
 
     // clear old buttons from frame
     frame().removeAllButtons();
@@ -3549,6 +3559,8 @@ void FluxboxWindow::setupWindow() {
     frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
     frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
     frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2
+    frame().setOnClickTitlebar(nextworkspace_cmd, 4);
+    frame().setOnClickTitlebar(prevworkspace_cmd, 5);
     frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
 
     // end setup frame
Index: src/Window.hh
===================================================================
RCS file: /cvsroot/fluxbox/fluxbox/src/Window.hh,v
retrieving revision 1.118
diff -u -p -b -B -w -r1.118 Window.hh
--- src/Window.hh    10 Aug 2004 19:18:47 -0000    1.118
+++ src/Window.hh    16 Aug 2004 15:54:24 -0000
@@ -233,6 +233,8 @@ public:
     void showMenu(int mx, int my);
     // popup menu on last button press position
     void popupMenu();
+    void nextWorkspace();
+    void prevWorkspace();
 
     void pauseMoving();
     void resumeMoving();
Index: src/fluxbox.cc
===================================================================
RCS file: /cvsroot/fluxbox/fluxbox/src/fluxbox.cc,v
retrieving revision 1.248
diff -u -p -b -B -w -r1.248 fluxbox.cc
--- src/fluxbox.cc    15 Jul 2004 18:23:03 -0000    1.248
+++ src/fluxbox.cc    16 Aug 2004 15:54:28 -0000
@@ -440,7 +440,7 @@ Fluxbox::Fluxbox(int argc, char **argv, 
       m_shutdown(false),
       m_server_grabs(0),
       m_randr_event_type(0),
-      m_RC_PATH("fluxbox"),
+      m_RC_PATH("fluxbox-cvs"),
       m_RC_INIT_FILE("init") {
       
     _FB_USES_NLS;

It should apply with "patch -p0 < patchfile". Because the config files and themes can be different from the stable Fluxbox I changed the config dir to be ~/.fluxbox-cvs. If you don't want that then remove the last part of the above diff.

The proper fix would be to make the mousewheel action on the titlebar runtime configurable, but we're too lazy for that, aren't we whatah? ;-)

Offline

#3 2004-08-17 01:59:00

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: Fluxbox mouse wheel window shading patch

No, it's not that we are too lazy, rather it's that we aren't fluxbox developers. If I was to go and implement it, it would be a waste of time, because that is on the developers todo list, therefore i am sure they have their own plans for the implementation method and whatever i do is pointless.

Offline

#4 2004-08-17 12:05:29

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Fluxbox mouse wheel window shading patch

It would be only a waste of time when you implement it badly, or when you implement it in parallel with a Fluxbox developer. Otherwise it's just less work for them. I didn't knew it was on their todo list though. Most of the infrasturcure is already present I guess, you could probably use the code for keybinds.

Offline

#5 2004-08-24 16:35:08

wickedlester
Member
From: Texas, USA
Registered: 2004-07-22
Posts: 144

Re: Fluxbox mouse wheel window shading patch

Thanks for this patch whatah. I was searching for a way to do this. I use this same feature in fvwm and I love it.

Offline

#6 2004-08-24 16:52:15

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: Fluxbox mouse wheel window shading patch

no problem.
woot.

Offline

#7 2004-08-24 21:53:58

Egil.B
Member
From: Universitas Osloensis
Registered: 2004-02-14
Posts: 116

Re: Fluxbox mouse wheel window shading patch

Make sure you submit it to fluxgen wink

Offline

#8 2004-08-26 15:22:52

Egil.B
Member
From: Universitas Osloensis
Registered: 2004-02-14
Posts: 116

Re: Fluxbox mouse wheel window shading patch

One more thing: Could you make windows that gets unshaded by the mousewheel active?

Offline

#9 2004-08-26 21:35:55

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: Fluxbox mouse wheel window shading patch

If you want something like that, i would suggest a) switching to sloppy focus, so when you move your mouse to the titlebar to unshade, it gets focus or b) have the mouse button 4 or 5 give focus by messing with the source. If you want option b, i can look into it for you, but i do not have as much time now as i did before, so it might be a while.

Offline

#10 2004-09-12 19:26:48

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: Fluxbox mouse wheel window shading patch

Changed the fluxbox patch for flux 9.10, see first post.

Offline

#11 2004-09-25 00:29:30

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: Fluxbox mouse wheel window shading patch

and another patch, to get rid of that annoying scroll on toolbar desktop changing.

--- src/Toolbar.cc      2004-09-24 16:56:31.000000000 -0400
+++ Toolbar.cc  2004-09-24 16:57:37.000000000 -0400
@@ -512,10 +512,10 @@
 void Toolbar::buttonReleaseEvent(XButtonEvent &re) {
     if (re.button == 1)
         raise();
-    else if (re.button == 4) //mousewheel scroll up
-        screen().nextWorkspace(1);
-    else if (re.button == 5)   //mousewheel scroll down
-        screen().prevWorkspace(1);
+//    else if (re.button == 4) //mousewheel scroll up
+//        screen().nextWorkspace(1);
+//    else if (re.button == 5) //mousewheel scroll down
+//        screen().prevWorkspace(1);
 }

 void Toolbar::enterNotifyEvent(XCrossingEvent &not_used) {

Offline

#12 2007-08-27 03:06:27

droog
Member
Registered: 2004-11-18
Posts: 877

Re: Fluxbox mouse wheel window shading patch

I got this working again with fluxbox 1.0rc3 and figured i would post it in case anyone else wanted to use it. thanks watah for originally making this.

save it as fluxbox.patch in your build directory.


diff -aur fluxbox-1.0rc3/src/Window.cc fluxbox-1.0rc3.new/src/Window.cc
--- fluxbox-1.0rc3/src/Window.cc    2007-03-19 11:57:09.000000000 -0800
+++ fluxbox-1.0rc3.new/src/Window.cc    2007-08-23 12:22:41.000000000 -0700
@@ -1775,6 +1775,36 @@
     }
 }
 
+
+void FluxboxWindow::unshade_only() {
+    if (!decorations.titlebar)
+        return;
+
+    if (shaded) {
+        frame().shade();
+        shaded = false;
+        m_blackbox_attrib.flags ^= ATTRIB_SHADED;
+        m_blackbox_attrib.attrib ^= ATTRIB_SHADED;
+
+        setState(NormalState, true);
+    } 
+}
+    
+void FluxboxWindow::shade_only() {
+    if (!decorations.titlebar)
+        return;
+
+    if (!shaded) {
+        frame().shade();
+         shaded = true;
+        m_blackbox_attrib.flags |= ATTRIB_SHADED;
+        m_blackbox_attrib.attrib |= ATTRIB_SHADED;
+        // shading is the same as iconic
+        setState(IconicState, true);
+    }
+}
+    
+
 void FluxboxWindow::shade() {
     // we can only shade if we have a titlebar
     if (!decorations.titlebar)
@@ -3888,6 +3918,8 @@
     CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::shade));
     CommandRef shade_on_cmd(new WindowCmd(*this, &FluxboxWindow::shadeOn));
     CommandRef shade_off_cmd(new WindowCmd(*this, &FluxboxWindow::shadeOff));
+    CommandRef unshade_only_cmd(new WindowCmd(*this, &FluxboxWindow::unshade_only));
+    CommandRef shade_only_cmd(new WindowCmd(*this, &FluxboxWindow::shade_only));
     CommandRef next_tab_cmd(new WindowCmd(*this, &FluxboxWindow::nextClient));
     CommandRef prev_tab_cmd(new WindowCmd(*this, &FluxboxWindow::prevClient));
     CommandRef lower_cmd(new WindowCmd(*this, &FluxboxWindow::lower));
@@ -3955,6 +3987,8 @@
     frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
     frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
     frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2
+    frame().setOnClickTitlebar(shade_only_cmd, 4);
+    frame().setOnClickTitlebar(unshade_only_cmd, 5);
 
     int reverse = 0;
     if (screen().getScrollReverse())
diff -aur fluxbox-1.0rc3/src/Window.hh fluxbox-1.0rc3.new/src/Window.hh
--- fluxbox-1.0rc3/src/Window.hh    2007-03-19 11:57:09.000000000 -0800
+++ fluxbox-1.0rc3.new/src/Window.hh    2007-08-23 12:06:56.000000000 -0700
@@ -231,6 +231,8 @@
     /// maximizes the window fully
     void maximizeFull();
     /// toggles shade
+    void unshade_only();
+    void shade_only();
     void shade();
     /// shades window
     void shadeOn();

and the pkgbuild

# $Id: PKGBUILD,v 1.17 2007/03/26 23:56:13 tobias Exp $
# Contributor:  John Proctor <jproctor@prium.net>
# Maintainer: tobias <tobias@archlinux.org>

pkgname=fluxbox
pkgver=1.0rc3
pkgrel=1
pkgdesc="A lightweight and highly-configurable window manager."
arch=(i686 x86_64)
url="http://www.fluxbox.org"
makedepends=('automake' 'pkgconfig')
depends=('libxft' 'libxpm' 'libxinerama' 'libxrandr' 'gcc>=4.0' 'bash' 'imlib2')
source=(http://dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2 \
        $pkgname.desktop fluxbox.patch)
md5sums=('8ed52d10d7de72efab0948eaaa4a6a50'
         'eeae9c88a2526ac0bd8afcd9ce97f9ed'
         '8a0dbc8139eb77d52ebd8c6ab9889703')

build() {
  cd $startdir/src/$pkgname-${pkgver}
  patch -p1 -i ../fluxbox.patch
  ./configure --prefix=/usr \
   --enable-kde --enable-gnome \
   --enable-xft --enable-xinerama \
   --enable-imlib2 --enable-nls
  make || return 1
  make DESTDIR=$startdir/pkg install
 # this is a fix to allow fluxbox to shutdown, but this can be changed by the user :-(
  sed -i 's|^.*slit\.autoHide.*$|session.screen0.slit.autoHide:  True|' \
    $startdir/pkg/usr/share/fluxbox/init
  install -Dm 644 ../$pkgname.desktop \
    $startdir/pkg/etc/X11/sessions/$pkgname.desktop
}

Offline

Board footer

Powered by FluxBB