changeset 1791:8a5a07c67265

events
author corvid <corvid@lavabit.com>
date Thu, 06 Jan 2011 02:51:08 +0000
parents 45b10f359e51
children c4dd094670d3
files dw/fltkpreview.cc dw/fltkviewbase.cc dw/fltkviewport.cc src/findbar.cc src/keys.cc src/menu.cc src/ui.cc src/uicmd.cc src/xembed.cc
diffstat 9 files changed, 79 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkpreview.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/dw/fltkpreview.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -278,18 +278,18 @@
    /** \bug Some parts are missing. */
 
    switch (event) {
-   case PUSH:
+   case FL_PUSH:
       window->showWindow ();
       return Button::handle (event);
 
-   case DRAG:
+   case FL_DRAG:
       if (window->visible ()) {
-         window->scrollTo (event_x_root (), event_y_root ());
+         window->scrollTo (Fl::event_x_root (), Fl::event_y_root ());
          return 1;
       }
       return Button::handle (event);
 
-   case RELEASE:
+   case FL_RELEASE:
       window->hideWindow ();
       return Button::handle (event);
 
--- a/dw/fltkviewbase.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/dw/fltkviewbase.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -184,7 +184,7 @@
 
 core::ButtonState getDwButtonState ()
 {
-   int s1 = event_state ();
+   int s1 = Fl::event_state ();
    int s2 = (core::ButtonState)0;
 
    if (s1 & SHIFT)   s2 |= core::SHIFT_MASK;
@@ -207,7 +207,7 @@
     *    when passed a fltk::PUSH event. "
     */
    switch(event) {
-   case PUSH:
+   case FL_PUSH:
       processed =
          theLayout->buttonPress (this, event_clicks () + 1,
                                  translateViewXToCanvasX (event_x ()),
@@ -220,7 +220,7 @@
       }
       return processed ? true : Group::handle (event);
 
-   case RELEASE:
+   case FL_RELEASE:
       processed =
          theLayout->buttonRelease (this, event_clicks () + 1,
                                    translateViewXToCanvasX (event_x ()),
@@ -229,7 +229,7 @@
       _MSG("RELEASE => %s\n", processed ? "true" : "false");
       return processed ? true : Group::handle (event);
 
-   case MOVE:
+   case FL_MOVE:
       mouse_x = event_x();
       mouse_y = event_y();
       processed =
@@ -240,7 +240,7 @@
       _MSG("MOVE => %s\n", processed ? "true" : "false");
       return processed ? true : Group::handle (event);
 
-   case DRAG:
+   case FL_DRAG:
       processed =
          theLayout->motionNotify (this,
                                   translateViewXToCanvasX (event_x ()),
@@ -249,13 +249,13 @@
       _MSG("DRAG => %s\n", processed ? "true" : "false");
       return processed ? true : Group::handle (event);
 
-   case ENTER:
+   case FL_ENTER:
       theLayout->enterNotify (this, translateViewXToCanvasX (event_x ()),
                               translateViewYToCanvasY (event_y ()),
                               getDwButtonState ());
       return Group::handle (event);
 
-   case LEAVE:
+   case FL_LEAVE:
       theLayout->leaveNotify (this, getDwButtonState ());
       return Group::handle (event);
 
--- a/dw/fltkviewport.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/dw/fltkviewport.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -214,87 +214,87 @@
 {
    _MSG("FltkViewport::handle %d\n", event);
 
-   if (hscrollbar->Rectangle::contains (event_x (), event_y ()) &&
-       !(event_state() & (SHIFT | CTRL | ALT)) &&
+   if (hscrollbar->Rectangle::contains (Fl::event_x (), Fl::event_y ()) &&
+       !(Fl::event_state() & (SHIFT | CTRL | ALT)) &&
        hscrollbar->send (event)) {
       return 1;
    }
 
-   if (vscrollbar->Rectangle::contains (event_x (), event_y ()) &&
+   if (vscrollbar->Rectangle::contains (Fl::event_x (), Fl::event_y ()) &&
       vscrollbar->send (event)) {
       return 1;
    }
 
    switch(event) {
-   case ::fltk::KEY:
-      /* Tell fltk we want to receive KEY events as SHORTCUT.
+   case FL_KEYBOARD:
+      /* Tell fltk we want to receive KEYBOARD events as SHORTCUT.
        * As we don't know the exact keybindings set by the user, we ask
        * for all of them (except Tab to keep form navigation). */
-      if (::fltk::event_key() != FL_Tab)
+      if (Fl::event_key() != FL_Tab)
          return 0;
       break;
 
-   case ::fltk::FOCUS:
+   case FL_FOCUS:
       /** \bug Draw focus box. */
 
       /* If the user clicks with the left button we take focus
        * and thereby unfocus any form widgets.
        * Otherwise we let fltk do the focus handling.
        */
-      if (::fltk::event_button() == FL_LEFT_MOUSE || focus_index() < 0) {
+      if (Fl::event_button() == FL_LEFT_MOUSE || focus_index() < 0) {
          focus_index(-1);
          return 1;
       }
       break;
 
-   case ::fltk::UNFOCUS:
+   case FL_UNFOCUS:
       /** \bug Undraw focus box. */
       break;
 
-   case ::fltk::PUSH:
+   case FL_PUSH:
       take_focus();
-      if (::fltk::event_button() == FL_MIDDLE_MOUSE) {
+      if (Fl::event_button() == FL_MIDDLE_MOUSE) {
          /* pass event so that middle click can open link in new window */
          if (FltkWidgetView::handle (event) == 0) {
             dragScrolling = 1;
-            dragX = ::fltk::event_x();
-            dragY = ::fltk::event_y();
+            dragX = Fl::event_x();
+            dragY = Fl::event_y();
             setCursor (core::style::CURSOR_MOVE);
          }
          return 1;
       }
       break;
 
-   case ::fltk::DRAG:
-      if (::fltk::event_button() == FL_MIDDLE_MOUSE) {
+   case FL_DRAG:
+      if (Fl::event_button() == FL_MIDDLE_MOUSE) {
          if (dragScrolling) {
-            scroll(dragX - ::fltk::event_x(), dragY - ::fltk::event_y());
-            dragX = ::fltk::event_x();
-            dragY = ::fltk::event_y();
+            scroll(dragX - Fl::event_x(), dragY - Fl::event_y());
+            dragX = Fl::event_x();
+            dragY = Fl::event_y();
             return 1;
          }
       }
       break;
 
-   case ::fltk:: MOUSEWHEEL:
-      return (event_dx() ? hscrollbar : vscrollbar)->handle(event);
+   case FL_MOUSEWHEEL:
+      return (Fl::event_dx() ? hscrollbar : vscrollbar)->handle(event);
       break;
 
-   case ::fltk::RELEASE:
-      if (::fltk::event_button() == FL_MIDDLE_MOUSE) {
+   case FL_RELEASE:
+      if (Fl::event_button() == FL_MIDDLE_MOUSE) {
          dragScrolling = 0;
          setCursor (core::style::CURSOR_DEFAULT);
       }
       break;
 
-   case ::fltk::ENTER:
+   case FL_ENTER:
       /* could be the result of, e.g., closing another window. */
-      mouse_x = ::fltk::event_x();
-      mouse_y = ::fltk::event_y();
+      mouse_x = Fl::event_x();
+      mouse_y = Fl::event_y();
       positionChanged();
       break;
 
-   case ::fltk::LEAVE:
+   case FL_LEAVE:
       mouse_x = mouse_y = -1;
       break;
    }
--- a/src/findbar.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/findbar.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -34,8 +34,8 @@
 int MyInput::handle(int e)
 {
    _MSG("findbar MyInput::handle()\n");
-   int ret = 1, k = event_key();
-   unsigned modifier = event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META);
+   int ret = 1, k = Fl::event_key();
+   unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
 
    if (e == KEY) {
       if (k == FL_Left || k == FL_Right) {
@@ -92,7 +92,7 @@
     * Somehow fltk even regards the first loss of focus for the
     * window as a WHEN_ENTER_KEY_ALWAYS event.
     */
-   if (event_key() == FL_Enter)
+   if (Fl::event_key() == FL_Enter)
       search_cb(widget, vfb);
 }
 
@@ -177,8 +177,8 @@
 int Findbar::handle(int event)
 {
    int ret = 0;
-   int k = event_key();
-   unsigned modifier = event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META);
+   int k = Fl::event_key();
+   unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
 
    if (event == KEY && modifier == 0 && k == FL_Escape) {
       hide();
--- a/src/keys.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/keys.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -173,16 +173,16 @@
    KeysCommand_t ret = KEYS_NOP;
    KeyBinding_t keyNode;
    // We're only interested in some flags
-   keyNode.modifier = fltk::event_state() &
+   keyNode.modifier = Fl::event_state() &
      (FL_SHIFT | FL_CTRL | FL_ALT | FL_META);
 
    if (keyNode.modifier == FL_SHIFT &&
-       ispunct(fltk::event_text()[0])) {
+       ispunct(Fl::event_text()[0])) {
       // Get key code for a shifted character
-      keyNode.key = fltk::event_text()[0];
+      keyNode.key = Fl::event_text()[0];
       keyNode.modifier = 0;
    } else {
-      keyNode.key = fltk::event_key();
+      keyNode.key = Fl::event_key();
    }
 
    _MSG("getKeyCmd: key=%d, mod=%d\n", keyNode.key, keyNode.modifier);
--- a/src/menu.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/menu.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -57,7 +57,7 @@
    int button () { return EventButton; };
    void draw();
    int handle(int e) {
-      EventButton = event_button();
+      EventButton = Fl::event_button();
       return Item::handle(e);
    }
 };
@@ -139,7 +139,7 @@
 static void Menu_open_url_nt_cb(Widget* )
 {
    int focus = prefs.focus_new_tab ? 1 : 0;
-   if (event_state(FL_SHIFT)) focus = !focus;
+   if (Fl::event_state(FL_SHIFT)) focus = !focus;
    a_UIcmd_open_url_nt(popup_bw, popup_url, focus);
 }
 
@@ -293,7 +293,7 @@
       // Middle button, open in a new window/tab
       if (prefs.middle_click_opens_new_tab) {
          int focus = prefs.focus_new_tab ? 1 : 0;
-         if (event_state(FL_SHIFT)) focus = !focus;
+         if (Fl::event_state(FL_SHIFT)) focus = !focus;
          a_UIcmd_open_url_nt(popup_bw, url, focus);
       } else {
          a_UIcmd_open_url_nw(popup_bw, url);
--- a/src/ui.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/ui.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -108,18 +108,18 @@
  */
 int CustInput::handle(int e)
 {
-   int k = event_key();
+   int k = Fl::event_key();
 
    _MSG("CustInput::handle event=%d\n", e);
 
    // We're only interested in some flags
-   unsigned modifier = event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
+   unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
 
    // Don't focus with arrow keys
-   if (e == FOCUS &&
+   if (e == FL_FOCUS &&
        (k == FL_Up || k == FL_Down || k == FL_Left || k == FL_Right)) {
       return 0;
-   } else if (e == KEY) {
+   } else if (e == FL_KEYBOARD) {
       if (modifier == FL_CTRL) {
          if (k == 'l') {
             // Make text selected when already focused.
@@ -154,8 +154,8 @@
 
 int CustHighlightButton::handle(int e)
 {
-   if (e == PASTE) {
-      const char* t = event_text();
+   if (e == FL_PASTE) {
+      const char* t = Fl::event_text();
       if (t && *t) {
          a_UIcmd_set_location_text(a_UIcmd_get_bw_by_widget(this), t);
          a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(this), t);
@@ -207,7 +207,7 @@
  */
 static void search_cb(Widget *wid, void *data)
 {
-   int k = event_key();
+   int k = Fl::event_key();
 
    if (k == 1) {
       a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(wid));
@@ -243,7 +243,7 @@
  */
 static void filemenu_cb(Widget *wid, void *)
 {
-   int k = event_key();
+   int k = Fl::event_key();
    if (k == 1 || k == 3) {
       a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(wid), wid);
    }
@@ -256,7 +256,7 @@
 {
    UI *ui = (UI*)data;
 
-   int k = event_key();
+   int k = Fl::event_key();
    if (k == 1) {
       ui->set_location("");
       ui->focus_location();
@@ -288,7 +288,7 @@
     * other events we're not interested in. For instance pressing
     * The Back or Forward, buttons, or the first click on a rendered
     * page. BUG: this must be investigated and reported to FLTK2 team */
-   if (event_key() == FL_Enter) {
+   if (Fl::event_key() == FL_Enter) {
       a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(i), i->value());
    }
    if (ui->get_panelmode() == UI_TEMPORARILY_SHOW_PANELS) {
@@ -303,7 +303,7 @@
 static void b1_cb(Widget *wid, void *cb_data)
 {
    int bn = VOIDP2INT(cb_data);
-   int k = event_key();
+   int k = Fl::event_key();
    if (k && k <= 7) {
       _MSG("[%s], mouse button %d was pressed\n", button_names[bn], k);
       _MSG("mouse button %d was pressed\n", k);
@@ -373,7 +373,7 @@
  */
 static void bugmeter_cb(Widget *wid, void *data)
 {
-   int k = event_key();
+   int k = Fl::event_key();
    if (k == 1) {
       a_UIcmd_view_page_bugs(a_UIcmd_get_bw_by_widget(wid));
    } else if (k == 3) {
@@ -778,14 +778,14 @@
  */
 int UI::handle(int event)
 {
-   _MSG("UI::handle event=%d (%d,%d)\n", event, event_x(), event_y());
+   _MSG("UI::handle event=%d (%d,%d)\n", event, Fl::event_x(), Fl::event_y());
    _MSG("Panel->h()=%d Main->h()=%d\n", Panel->h() , Main->h());
 
    int ret = 0;
 
-   if (event == KEY) {
+   if (event == FL_KEYBOARD) {
       return 0; // Receive as shortcut
-   } else if (event == SHORTCUT) {
+   } else if (event == FL_SHORTCUT) {
       KeysCommand_t cmd = Keys::getKeyCmd();
       if (cmd == KEYS_NOP) {
          // Do nothing
@@ -851,11 +851,11 @@
          a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL);
          ret = 1;
       }
-   } else if (event == PUSH) {
+   } else if (event == FL_PUSH) {
       if (prefs.middle_click_drags_page == 0 &&
-          event_button() == FL_MIDDLE_MOUSE &&
+          Fl::event_button() == FL_MIDDLE_MOUSE &&
           !a_UIcmd_pointer_on_link(a_UIcmd_get_bw_by_widget(this))) {
-         if (Main->Rectangle::contains (event_x (), event_y ())) {
+         if (Main->Rectangle::contains (Fl::event_x (), Fl::event_y ())) {
             /* Offer the event to Main's children (form widgets) */
             int save_x = e_x, save_y = e_y;
 
--- a/src/uicmd.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/uicmd.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -246,10 +246,10 @@
       // Don't focus with arrow keys
       _MSG("CustTabGroup::handle %d\n", e);
       fltk::Rectangle r(btn_x,0,BTN_W,BTN_H);
-      if (e == KEY) {
-         int k = event_key();
+      if (e == FL_KEYBOARD) {
+         int k = Fl::event_key();
          // We're only interested in some flags
-         unsigned modifier = event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
+         unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
          if (k == FL_Up || k == FL_Down || k == FL_Tab) {
             return 0;
          } else if (k == FL_Left || k == FL_Right) {
@@ -268,9 +268,9 @@
          BrowserWindow *bw = a_UIcmd_get_bw_by_widget(selected_child());
          const char *title = a_History_get_title(NAV_TOP_UIDX(bw), 1);
          a_UIcmd_set_page_title(bw, title ? title : "");
-      } else if (e == MOVE) {
+      } else if (e == FL_MOVE) {
          CustShrinkTabPager *cstp = (CustShrinkTabPager *) pager();
-         if (event_inside(r) && children() > 1) {
+         if (Fl::event_inside(r) && children() > 1) {
             /* We're inside the button area */
             cstp->btn_highlight(true);
             if (prefs.show_tooltip) {
@@ -295,12 +295,12 @@
                }
             }
          }
-      } else if (e == PUSH && event_inside(r) &&
-                 event_button() == 1 && children() > 1) {
+      } else if (e == FL_PUSH && Fl::event_inside(r) &&
+                 Fl::event_button() == 1 && children() > 1) {
          buttonPushed = true;
          return 1;                 /* non-zero */
-      } else if (e == RELEASE) {
-         if (event_inside(r) && event_button() == 1 &&
+      } else if (e == FL_RELEASE) {
+         if (Fl::event_inside(r) && Fl::event_button() == 1 &&
              children() > 1 && buttonPushed) {
             a_UIcmd_close_bw(a_UIcmd_get_bw_by_widget(selected_child()));
          } else {
@@ -308,13 +308,13 @@
             cstp->btn_highlight(false);
          }
          buttonPushed = false;
-      } else if (e == DRAG) {
+      } else if (e == FL_DRAG) {
          /* Ignore this event */
          return 1;
       }
       int ret = TabGroup::handle(e);
 
-      if (e == PUSH) {
+      if (e == FL_PUSH) {
          /* WORKAROUND: FLTK raises the window on unhandled clicks,
           * which we do not want.
           */
--- a/src/xembed.cc	Thu Jan 06 02:15:06 2011 +0000
+++ b/src/xembed.cc	Thu Jan 06 02:51:08 2011 +0000
@@ -71,7 +71,7 @@
 
 int
 Xembed::handle(int e) {
-   if (e == fltk::PUSH)
+   if (e == FL_PUSH)
       sendXembedEvent(XEMBED_REQUEST_FOCUS);
 
    return Window::handle(e);