Adds MouseWheel up to NextDesktop and MouseWheel down to PreviousDesktop
moves the {Next,Previous}Desktop functions out of Hotkeys.C into Desktop.C
Adds Mousewheel support to the Frame and to the Root.
MouseWheel support for changing desktops
Logged In: NO
diff -x '*.[^CH]' -u flwm-1.00/Desktop.C flwm-new/Desktop.C --- flwm-1.00/Desktop.C 1999-05-16 10:27:04.000000000 -0700 +++ flwm-new/Desktop.C 2005-07-14 02:27:45.813566000 -0700 @@ -146,4 +146,22 @@ dont_send = 0; }
+void NextDesk() { + if (Desktop::current()) { + Desktop::current(Desktop::current()->next? + Desktop::current()->next:Desktop::first); + } else { + Desktop::current(Desktop::first); + } +} + +void PreviousDesk() { + Desktop* search=Desktop::first; + while (search->next && search->next!=Desktop::current()){ + search=search->next; + } + Desktop::current(search); +} + + #endif diff -x '*.[^CH]' -u flwm-1.00/Desktop.H flwm-new/Desktop.H --- flwm-1.00/Desktop.H 1999-04-26 12:02:52.000000000 -0700 +++ flwm-new/Desktop.H 2005-07-14 02:31:51.886598000 -0700 @@ -1,5 +1,8 @@ // Desktop.H
+extern void NextDesk(); +extern void PreviousDesk(); + class Desktop { const char* name_; int number_; diff -x '*.[^CH]' -u flwm-1.00/Frame.C flwm-new/Frame.C --- flwm-1.00/Frame.C 2000-09-22 09:53:05.000000000 -0700 +++ flwm-new/Frame.C 2005-07-14 02:57:39.518537017 -0700 @@ -1422,6 +1422,20 @@ set_cursor(mouse_location()); return 1;
+ + + case FL_MOUSEWHEEL: + // 1 is up, -1 is down + if (Fl::event_dy() > 0) { + set_cursor(-1); + NextDesk(); + } else { + set_cursor(-1); + PreviousDesk(); + } + return 1; + + case FL_PUSH: if (Fl::event_button() > 2) { set_cursor(-1); diff -x '*.[^CH]' -u flwm-1.00/Hotkeys.C flwm-new/Hotkeys.C --- flwm-1.00/Hotkeys.C 2000-09-22 09:53:05.000000000 -0700 +++ flwm-new/Hotkeys.C 2005-07-14 02:32:47.896750000 -0700 @@ -24,23 +24,6 @@
#if DESKTOPS
-static void NextDesk() { - if (Desktop::current()) { - Desktop::current(Desktop::current()->next? - Desktop::current()->next:Desktop::first); - } else { - Desktop::current(Desktop::first); - } -} - -static void PreviousDesk() { - Desktop* search=Desktop::first; - while (search->next && search->next!=Desktop::current()){ - search=search->next; - } - Desktop::current(search); -} - // warning: this assummes it is bound to Fn key: static void DeskNumber() { Desktop::current(Desktop::number(Fl::event_key()-FL_F, 1)); diff -x '*.[^CH]' -u flwm-1.00/main.C flwm-new/main.C --- flwm-1.00/main.C 2005-07-14 02:44:57.723731509 -0700 +++ flwm-new/main.C 2005-07-14 02:41:46.478884000 -0700 @@ -13,6 +13,9 @@ #include <time.h> #include <signal.h> #endif +#ifdef DESKTOPS +#include "Desktop.H" +#endif
////////////////////////////////////////////////////////////////
@@ -59,7 +62,19 @@ ShowMenu(); return 1; } +#ifdef DESKTOPS + if (e == FL_MOUSEWHEEL) { + if (Fl::event_dy() > 0) { + NextDesk(); + } else { + PreviousDesk(); + } + return 1; + } +#endif + return 0; + }
#if CLICK_RAISES || CLICK_TO_TYPE
Log in to post a comment.
MouseWheel support for changing desktops
Logged In: NO
diff -x '*.[^CH]' -u flwm-1.00/Desktop.C flwm-new/Desktop.C
--- flwm-1.00/Desktop.C 1999-05-16 10:27:04.000000000 -0700
+++ flwm-new/Desktop.C 2005-07-14 02:27:45.813566000 -0700
@@ -146,4 +146,22 @@
dont_send = 0;
}
+void NextDesk() {
+ if (Desktop::current()) {
+ Desktop::current(Desktop::current()->next?
+ Desktop::current()->next:Desktop::first);
+ } else {
+ Desktop::current(Desktop::first);
+ }
+}
+
+void PreviousDesk() {
+ Desktop* search=Desktop::first;
+ while (search->next && search->next!=Desktop::current()){
+ search=search->next;
+ }
+ Desktop::current(search);
+}
+
+
#endif
diff -x '*.[^CH]' -u flwm-1.00/Desktop.H flwm-new/Desktop.H
--- flwm-1.00/Desktop.H 1999-04-26 12:02:52.000000000 -0700
+++ flwm-new/Desktop.H 2005-07-14 02:31:51.886598000 -0700
@@ -1,5 +1,8 @@
// Desktop.H
+extern void NextDesk();
+extern void PreviousDesk();
+
class Desktop {
const char* name_;
int number_;
diff -x '*.[^CH]' -u flwm-1.00/Frame.C flwm-new/Frame.C
--- flwm-1.00/Frame.C 2000-09-22 09:53:05.000000000 -0700
+++ flwm-new/Frame.C 2005-07-14 02:57:39.518537017 -0700
@@ -1422,6 +1422,20 @@
set_cursor(mouse_location());
return 1;
+
+
+ case FL_MOUSEWHEEL:
+ // 1 is up, -1 is down
+ if (Fl::event_dy() > 0) {
+ set_cursor(-1);
+ NextDesk();
+ } else {
+ set_cursor(-1);
+ PreviousDesk();
+ }
+ return 1;
+
+
case FL_PUSH:
if (Fl::event_button() > 2) {
set_cursor(-1);
diff -x '*.[^CH]' -u flwm-1.00/Hotkeys.C flwm-new/Hotkeys.C
--- flwm-1.00/Hotkeys.C 2000-09-22 09:53:05.000000000 -0700
+++ flwm-new/Hotkeys.C 2005-07-14 02:32:47.896750000 -0700
@@ -24,23 +24,6 @@
#if DESKTOPS
-static void NextDesk() {
- if (Desktop::current()) {
- Desktop::current(Desktop::current()->next?
- Desktop::current()->next:Desktop::first);
- } else {
- Desktop::current(Desktop::first);
- }
-}
-
-static void PreviousDesk() {
- Desktop* search=Desktop::first;
- while (search->next && search->next!=Desktop::current()){
- search=search->next;
- }
- Desktop::current(search);
-}
-
// warning: this assummes it is bound to Fn key:
static void DeskNumber() {
Desktop::current(Desktop::number(Fl::event_key()-FL_F, 1));
diff -x '*.[^CH]' -u flwm-1.00/main.C flwm-new/main.C
--- flwm-1.00/main.C 2005-07-14 02:44:57.723731509 -0700
+++ flwm-new/main.C 2005-07-14 02:41:46.478884000 -0700
@@ -13,6 +13,9 @@
#include <time.h>
#include <signal.h>
#endif
+#ifdef DESKTOPS
+#include "Desktop.H"
+#endif
////////////////////////////////////////////////////////////////
@@ -59,7 +62,19 @@
ShowMenu();
return 1;
}
+#ifdef DESKTOPS
+ if (e == FL_MOUSEWHEEL) {
+ if (Fl::event_dy() > 0) {
+ NextDesk();
+ } else {
+ PreviousDesk();
+ }
+ return 1;
+ }
+#endif
+
return 0;
+
}
#if CLICK_RAISES || CLICK_TO_TYPE