mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 803633 - Add basic support for new scrollbar behavior in GTK+ [Part 1]. r=mstange, r=karlt
This commit is contained in:
parent
2dc6881d41
commit
7c18aef885
@ -534,6 +534,21 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
mDragStart = pos - mThumbStart;
|
mDragStart = pos - mThumbStart;
|
||||||
}
|
}
|
||||||
|
#ifdef MOZ_WIDGET_GTK
|
||||||
|
else if (ShouldScrollForEvent(aEvent) &&
|
||||||
|
aEvent->mClass == eMouseEventClass &&
|
||||||
|
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eRightButton) {
|
||||||
|
// HandlePress and HandleRelease are usually called via
|
||||||
|
// nsFrame::HandleEvent, but only for the left mouse button.
|
||||||
|
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||||
|
HandlePress(aPresContext, aEvent, aEventStatus);
|
||||||
|
} else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||||
|
HandleRelease(aPresContext, aEvent, aEventStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// XXX hack until handle release is actually called in nsframe.
|
// XXX hack until handle release is actually called in nsframe.
|
||||||
// if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
// if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
||||||
@ -955,8 +970,14 @@ nsSliderFrame::ShouldScrollForEvent(WidgetGUIEvent* aEvent)
|
|||||||
case NS_MOUSE_BUTTON_DOWN:
|
case NS_MOUSE_BUTTON_DOWN:
|
||||||
case NS_MOUSE_BUTTON_UP: {
|
case NS_MOUSE_BUTTON_UP: {
|
||||||
uint16_t button = aEvent->AsMouseEvent()->button;
|
uint16_t button = aEvent->AsMouseEvent()->button;
|
||||||
|
#ifdef MOZ_WIDGET_GTK
|
||||||
|
return (button == WidgetMouseEvent::eLeftButton) ||
|
||||||
|
(button == WidgetMouseEvent::eRightButton && GetScrollToClick()) ||
|
||||||
|
(button == WidgetMouseEvent::eMiddleButton && gMiddlePref && !GetScrollToClick());
|
||||||
|
#else
|
||||||
return (button == WidgetMouseEvent::eLeftButton) ||
|
return (button == WidgetMouseEvent::eLeftButton) ||
|
||||||
(button == WidgetMouseEvent::eMiddleButton && gMiddlePref);
|
(button == WidgetMouseEvent::eMiddleButton && gMiddlePref);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -978,8 +999,8 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
|
||||||
// On Mac, clicking the scrollbar thumb should never scroll to click.
|
// On Mac and Linux, clicking the scrollbar thumb should never scroll to click.
|
||||||
if (IsEventOverThumb(aEvent)) {
|
if (IsEventOverThumb(aEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -995,6 +1016,12 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
|
|||||||
return GetScrollToClick() != invertPref;
|
return GetScrollToClick() != invertPref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_WIDGET_GTK
|
||||||
|
if (mouseEvent->button == WidgetMouseEvent::eRightButton) {
|
||||||
|
return !GetScrollToClick();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,16 +574,18 @@ pref("accessibility.browsewithcaret_shortcut.enabled", true);
|
|||||||
// unless accessibility.tabfocus is set by the user.
|
// unless accessibility.tabfocus is set by the user.
|
||||||
pref("accessibility.tabfocus", 7);
|
pref("accessibility.tabfocus", 7);
|
||||||
pref("accessibility.tabfocus_applies_to_xul", false);
|
pref("accessibility.tabfocus_applies_to_xul", false);
|
||||||
|
|
||||||
// On OS X, we follow the "Click in the scrollbar to:" system preference
|
|
||||||
// unless this preference was set manually
|
|
||||||
pref("ui.scrollToClick", 0);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Only on mac tabfocus is expected to handle UI widgets as well as web content
|
// Only on mac tabfocus is expected to handle UI widgets as well as web content
|
||||||
pref("accessibility.tabfocus_applies_to_xul", true);
|
pref("accessibility.tabfocus_applies_to_xul", true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// We follow the "Click in the scrollbar to:" system preference on OS X and
|
||||||
|
// "gtk-primary-button-warps-slider" property with GTK (since 2.24 / 3.6),
|
||||||
|
// unless this preference is explicitly set.
|
||||||
|
#if !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GTK)
|
||||||
|
pref("ui.scrollToClick", 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// provide ability to turn on support for canvas focus rings
|
// provide ability to turn on support for canvas focus rings
|
||||||
pref("canvas.focusring.enabled", true);
|
pref("canvas.focusring.enabled", true);
|
||||||
pref("canvas.customfocusring.enabled", false);
|
pref("canvas.customfocusring.enabled", false);
|
||||||
|
@ -555,6 +555,26 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
|
|||||||
g_object_unref(entry);
|
g_object_unref(entry);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case eIntID_ScrollToClick:
|
||||||
|
{
|
||||||
|
GtkSettings *settings;
|
||||||
|
gboolean warps_slider = FALSE;
|
||||||
|
|
||||||
|
settings = gtk_settings_get_default ();
|
||||||
|
if (g_object_class_find_property (G_OBJECT_GET_CLASS(settings),
|
||||||
|
"gtk-primary-button-warps-slider")) {
|
||||||
|
g_object_get (settings,
|
||||||
|
"gtk-primary-button-warps-slider",
|
||||||
|
&warps_slider,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warps_slider)
|
||||||
|
aResult = 1;
|
||||||
|
else
|
||||||
|
aResult = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case eIntID_SubmenuDelay:
|
case eIntID_SubmenuDelay:
|
||||||
{
|
{
|
||||||
GtkSettings *settings;
|
GtkSettings *settings;
|
||||||
|
Loading…
Reference in New Issue
Block a user