changeset 1843:8139561cd4cb

more UI button event handling
author corvid <corvid@lavabit.com>
date Mon, 17 Jan 2011 14:44:39 +0000
parents 63bb7eefc5f6
children 7416663822a0
files src/ui.cc
diffstat 1 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.cc	Mon Jan 17 14:24:08 2011 +0000
+++ b/src/ui.cc	Mon Jan 17 14:44:39 2011 +0000
@@ -197,13 +197,13 @@
  */
 static void search_cb(Fl_Widget *wid, void *data)
 {
-   int k = Fl::event_key();
+   int b = Fl::event_button();
 
-   if (k == 1) {
+   if (b == FL_LEFT_MOUSE) {
       a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(wid));
-   } else if (k == 2) {
+   } else if (b == FL_MIDDLE_MOUSE) {
       ((UI*)data)->color_change_cb_i();
-   } else if (k == 3) {
+   } else if (b == FL_RIGHT_MOUSE) {
       ((UI*)data)->panel_cb_i();
    }
 }
@@ -233,8 +233,8 @@
  */
 static void filemenu_cb(Fl_Widget *wid, void *)
 {
-   int k = Fl::event_key();
-   if (k == 1 || k == 3) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
       a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(wid), wid);
    }
 }
@@ -246,11 +246,11 @@
 {
    UI *ui = (UI*)data;
 
-   int k = Fl::event_key();
-   if (k == 1) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE) {
       ui->set_location("");
       ui->focus_location();
-   } if (k == 2) {
+   } if (b == FL_MIDDLE_MOUSE) {
       ui->paste_url();
    }
 }
@@ -293,53 +293,53 @@
 static void b1_cb(Fl_Widget *wid, void *cb_data)
 {
    int bn = VOIDP2INT(cb_data);
-   int k = Fl::event_button();
-   if (k >= FL_LEFT_MOUSE && k <= FL_RIGHT_MOUSE) {
-      _MSG("[%s], mouse button %d was pressed\n", button_names[bn], k);
-      _MSG("mouse button %d was pressed\n", k);
+   int b = Fl::event_button();
+   if (b >= FL_LEFT_MOUSE && b <= FL_RIGHT_MOUSE) {
+      _MSG("[%s], mouse button %d was pressed\n", button_names[bn], b);
+      _MSG("mouse button %d was pressed\n", b);
    }
    switch (bn) {
    case UI_BACK:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_back(a_UIcmd_get_bw_by_widget(wid));
-      } else if (k == FL_RIGHT_MOUSE) {
+      } else if (b == FL_RIGHT_MOUSE) {
          a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_FORW:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_forw(a_UIcmd_get_bw_by_widget(wid));
-      } else if (k == FL_RIGHT_MOUSE) {
+      } else if (b == FL_RIGHT_MOUSE) {
          a_UIcmd_forw_popup(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_HOME:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_home(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_RELOAD:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_reload(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_SAVE:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_save(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_STOP:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_stop(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_BOOK:
-      if (k == FL_LEFT_MOUSE) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_book(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_TOOLS:
-      if (k == FL_LEFT_MOUSE || k == FL_RIGHT_MOUSE) {
+      if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
          a_UIcmd_tools(a_UIcmd_get_bw_by_widget(wid), wid);
       }
       break;
@@ -363,10 +363,10 @@
  */
 static void bugmeter_cb(Fl_Widget *wid, void *data)
 {
-   int k = Fl::event_key();
-   if (k == 1) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE) {
       a_UIcmd_view_page_bugs(a_UIcmd_get_bw_by_widget(wid));
-   } else if (k == 3) {
+   } else if (b == FL_RIGHT_MOUSE) {
       a_UIcmd_bugmeter_popup(a_UIcmd_get_bw_by_widget(wid));
    }
 }