Commit 74725209 authored by Cédric Bellegarde's avatar Cédric Bellegarde

navigation_action.get_modifiers() is working with WebKitGTK 2.24!

parent 2231749a
Pipeline #66100 passed with stage
in 10 minutes and 39 seconds
......@@ -10,7 +10,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import WebKit2, Gtk, Gio, Gdk, GLib
from gi.repository import WebKit2, Gtk, Gio, GLib
from urllib.parse import urlparse
from time import time
......@@ -584,8 +584,7 @@ class WebView(WebKit2.WebView):
self._window.toolbar.title.show_indicator(
Indicator.POPUPS)
elif (properties.get_toolbar_visible() or
properties.get_scrollbars_visible()) and\
not self._window.modifiers == Gdk.KEY_Shift_L:
properties.get_scrollbars_visible()):
self._window.container.add_webview_with_new_view(
webview,
LoadingType.FOREGROUND)
......
......@@ -346,14 +346,15 @@ class WebViewNavigation:
decision.use()
return False
elif mouse_button == 1:
modifiers = navigation_action.get_modifiers()
if decision_type == WebKit2.PolicyDecisionType.NEW_WINDOW_ACTION:
decision.use()
return False
elif self._window.modifiers == Gdk.KEY_Control_L:
elif modifiers == Gdk.ModifierType.CONTROL_MASK:
self.new_page(navigation_uri, LoadingType.BACKGROUND)
decision.ignore()
return True
elif self._window.modifiers == Gdk.KEY_Shift_L:
elif modifiers == Gdk.ModifierType.SHIFT_MASK:
self.new_page(navigation_uri, LoadingType.POPOVER)
decision.ignore()
return True
......
......@@ -227,15 +227,6 @@ class Window(Gtk.ApplicationWindow):
"""
return self.__window_state & Gdk.WindowState.FULLSCREEN
@property
def modifiers(self):
"""
Get modifier
return int
"""
# https://bugs.webkit.org/show_bug.cgi?id=181041
return self.__modifiers
@property
def size(self):
"""
......@@ -379,8 +370,6 @@ class Window(Gtk.ApplicationWindow):
@param window as Window
@param event as Gdk.EventKey
"""
if event.keyval in [Gdk.KEY_Shift_L, Gdk.KEY_Control_L]:
self.__modifiers = event.keyval
if event.state & Gdk.ModifierType.CONTROL_MASK and\
event.keyval == Gdk.KEY_Tab:
if not self.container.in_expose:
......@@ -392,7 +381,6 @@ class Window(Gtk.ApplicationWindow):
@param window as Window
@param event as Gdk.EventKey
"""
self.__modifiers = 0
if event.keyval == Gdk.KEY_Control_L:
self.__container.ctrl_released()
elif event.keyval == Gdk.KEY_Escape:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment