changeset 438:29c514f5ce00

- Added the "middle_click_drags_page" dillorc option.
author jcid
date Sun, 26 Oct 2008 19:21:51 +0100
parents 1495020f452f
children db5ae912fcb4
files ChangeLog dillorc src/html.cc src/prefs.c src/prefs.h src/ui.cc src/ui.hh src/uicmd.cc src/uicmd.hh
diffstat 9 files changed, 47 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 26 15:36:26 2008 +0100
+++ b/ChangeLog	Sun Oct 26 19:21:51 2008 +0100
@@ -19,6 +19,8 @@
 +- Allowed compilation with older machines by removing a few C99isms.
  - Added use of inttypes.h when stdint.h isn't found.
    Patches: Dan Fandrich
++- Added the "middle_click_drags_page" dillorc option.
+   Patch: Jorge Arellano, Thomas Orgis
 +- Set the File menu label to hide when the File menu-button is shown.
  ? Trying a new iconv() test in configure.in.
    Patch: Jorge Arellano
--- a/dillorc	Sun Oct 26 15:36:26 2008 +0100
+++ b/dillorc	Sun Oct 26 19:21:51 2008 +0100
@@ -203,6 +203,11 @@
 # If you prefer to open a new Window instead, set it to NO.
 #middle_click_opens_new_tab=YES
 
+# Mouse middle click by default drives drag-scrolling.
+# To paste an URL into the window instead of scrolling, set it to NO.
+# Note: You could always paste the URL onto the URL box clear button.
+#middle_click_drags_page=YES
+
 # Focus follows new Tabs.
 # You can hold SHIFT to temporarily revert this behaviour.
 #focus_new_tab=YES
--- a/src/html.cc	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/html.cc	Sun Oct 26 19:21:51 2008 +0100
@@ -732,10 +732,12 @@
    if (link == -1) {
       _MSG(" Link  LEAVE  notify...\n");
       a_UIcmd_set_msg(bw, "");
+      a_UIcmd_set_pointer_on_link(bw, FALSE);
    } else {
       _MSG(" Link  ENTER  notify...\n");
       Html_set_link_coordinates(html, link, x, y);
       a_UIcmd_set_msg(bw, "%s", URL_STR(html->links->get(link)));
+      a_UIcmd_set_pointer_on_link(bw, TRUE);
    }
    return true;
 }
--- a/src/prefs.c	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/prefs.c	Sun Oct 26 19:21:51 2008 +0100
@@ -61,6 +61,7 @@
 
 /* define enumeration values to be returned for specific symbols */
 typedef enum {
+   DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE,
    DRC_TOKEN_ALLOW_WHITE_BG,
    DRC_TOKEN_BG_COLOR,
    DRC_TOKEN_CONTRAST_VISITED_COLOR,
@@ -141,6 +142,7 @@
    { "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH },
    { "link_color", DRC_TOKEN_LINK_COLOR },
    { "load_images", DRC_TOKEN_LOAD_IMAGES },
+   { "middle_click_drags_page", DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE },
    { "middle_click_opens_new_tab", DRC_TOKEN_MIDDLE_CLICK_OPENS_NEW_TAB },
    { "no_proxy", DRC_TOKEN_NOPROXY },
    { "panel_size", DRC_TOKEN_PANEL_SIZE },
@@ -236,6 +238,9 @@
    case DRC_TOKEN_ALLOW_WHITE_BG:
       prefs.allow_white_bg = (strcmp(value, "YES") == 0);
       break;
+   case DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE:
+      prefs.middle_click_drags_page = (strcmp(value, "YES") == 0);
+      break;
    case DRC_TOKEN_FORCE_MY_COLORS:
       prefs.force_my_colors = (strcmp(value, "YES") == 0);
       break;
@@ -459,6 +464,7 @@
    prefs.save_dir = dStrdup(D_SAVE_DIR);
    prefs.show_msg = TRUE;
    prefs.show_extra_warnings = FALSE;
+   prefs.middle_click_drags_page = TRUE;
 
    /* this locale stuff is to avoid parsing problems with float numbers */
    old_locale = dStrdup (setlocale (LC_NUMERIC, NULL));
--- a/src/prefs.h	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/prefs.h	Sun Oct 26 19:21:51 2008 +0100
@@ -62,6 +62,7 @@
    char *save_dir;
    bool_t show_msg;
    bool_t show_extra_warnings;
+   bool_t middle_click_drags_page;
 };
 
 /* Global Data */
--- a/src/ui.cc	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/ui.cc	Sun Oct 26 19:21:51 2008 +0100
@@ -625,6 +625,8 @@
    if (f)
       this->labelfont(f);
 
+   PointerOnLink = FALSE;
+
    Tabs = NULL;
    TabTooltip = NULL;
    TopGroup = new PackedGroup(0, 0, ww, wh);
@@ -801,6 +803,14 @@
             ret = 1;
          }
       }
+
+   } else if (event == PUSH) {
+      if (prefs.middle_click_drags_page == 0 &&
+          event_button() == MiddleButton &&
+          !a_UIcmd_pointer_on_link(a_UIcmd_get_bw_by_widget(this))) {
+         paste_url();
+         ret = 1;
+      }
    }
 
    if (!ret)
--- a/src/ui.hh	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/ui.hh	Sun Oct 26 19:21:51 2008 +0100
@@ -64,6 +64,7 @@
 
    UIPanelmode Panelmode;
    Findbar *findbar;
+   int PointerOnLink;
 
    PackedGroup *make_toolbar(int tw, int th);
    PackedGroup *make_location();
@@ -103,6 +104,8 @@
 
    CustTabGroup *tabs() { return Tabs; }
    void tabs(CustTabGroup *tabs) { Tabs = tabs; }
+   int pointerOnLink() { return PointerOnLink; }
+   void pointerOnLink(int flag) { PointerOnLink = flag; }
 
    // Hooks to method callbacks
    void panel_cb_i();
--- a/src/uicmd.cc	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/uicmd.cc	Sun Oct 26 19:21:51 2008 +0100
@@ -914,6 +914,22 @@
 }
 
 /*
+ * Keep track of mouse pointer over a link.
+ */
+void a_UIcmd_set_pointer_on_link(BrowserWindow *bw, int flag)
+{
+   BW2UI(bw)->pointerOnLink(flag);
+}
+
+/*
+ * Is the mouse pointer over a link?
+ */
+int a_UIcmd_pointer_on_link(BrowserWindow *bw)
+{
+   return BW2UI(bw)->pointerOnLink();
+}
+
+/*
  * Toggle control panel (aka. fullscreen)
  */
 void a_UIcmd_fullscreen_toggle(BrowserWindow *bw)
--- a/src/uicmd.hh	Sun Oct 26 15:36:26 2008 +0100
+++ b/src/uicmd.hh	Sun Oct 26 19:21:51 2008 +0100
@@ -73,7 +73,8 @@
 void a_UIcmd_set_images_enabled(BrowserWindow *bw, int flag);
 void a_UIcmd_set_buttons_sens(BrowserWindow *bw);
 void a_UIcmd_fullscreen_toggle(BrowserWindow *bw);
-
+void a_UIcmd_set_pointer_on_link(BrowserWindow *bw, int flag);
+int a_UIcmd_pointer_on_link(BrowserWindow *bw);
 
 #ifdef __cplusplus
 }