aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2025-04-11 23:32:49 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-04-27 20:56:44 +0200
commite6364911979d9c147a153a4af3352604dd306905 (patch)
tree9bfbf29c122cc3e54eb5bceba85a11a18dd8d35d /src
parentdd1ce83521403d81ebfe46f7815a10220e4f3a96 (diff)
Control + left click opens link in new tab
Small laptops and netbooks that lack a proper 3 button touchpad make it difficult to open a new tab. Using the control modifier makes is easier to open links in new tabs. It also allows mixing it with the shift modifier to control the focus.
Diffstat (limited to 'src')
-rw-r--r--src/html.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/html.cc b/src/html.cc
index ebe36599..c06fd172 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2,7 +2,7 @@
* File: html.cc
*
* Copyright (C) 2005-2007 Jorge Arellano Cid <jcid@dillo.org>
- * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ * Copyright (C) 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -813,11 +813,21 @@ bool DilloHtml::HtmlLinkReceiver::click (Widget *widget, int link, int img,
Html_set_link_coordinates(html, link, x, y);
if (event->button == 1) {
- a_UIcmd_open_url(bw, url);
+ if (event->state & CONTROL_MASK) {
+ if (prefs.middle_click_opens_new_tab) {
+ int focus = prefs.focus_new_tab ? 1 : 0;
+ if (event->state & SHIFT_MASK) focus = !focus;
+ a_UIcmd_open_url_nt(bw, url, focus);
+ } else {
+ a_UIcmd_open_url_nw(bw, url);
+ }
+ } else {
+ a_UIcmd_open_url(bw, url);
+ }
} else if (event->button == 2) {
if (prefs.middle_click_opens_new_tab) {
int focus = prefs.focus_new_tab ? 1 : 0;
- if (event->state == SHIFT_MASK) focus = !focus;
+ if (event->state & SHIFT_MASK) focus = !focus;
a_UIcmd_open_url_nt(bw, url, focus);
} else
a_UIcmd_open_url_nw(bw, url);