зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1470983 - Prelude: Remove use of gtk_widget_get_settings in LookAndFeel. r=heycam
The GTK nsLookAndFeel implementation uses `gtk_widget_get_settings` on temporary widgets that aren't attached to anything, which the documentation says not to do. Empirically, this seems to return the same settings object as `gtk_settings_get_default`. Explicitly using `gtk_settings_get_default` is useful for remote look-and-feel, so that the parent process can register for property changes on that object to know when to update the child processes. Differential Revision: https://phabricator.services.mozilla.com/D94535
This commit is contained in:
Родитель
a0a27f2ae7
Коммит
cb3356b35e
|
@ -462,7 +462,6 @@ STUB(gtk_widget_get_parent)
|
|||
STUB(gtk_widget_get_parent_window)
|
||||
STUB(gtk_widget_get_realized)
|
||||
STUB(gtk_widget_get_screen)
|
||||
STUB(gtk_widget_get_settings)
|
||||
STUB(gtk_widget_get_style)
|
||||
STUB(gtk_widget_get_toplevel)
|
||||
STUB(gtk_widget_get_type)
|
||||
|
|
|
@ -615,13 +615,10 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
aResult = 0;
|
||||
break;
|
||||
case IntID::SelectTextfieldsOnKeyFocus: {
|
||||
GtkWidget* entry;
|
||||
GtkSettings* settings;
|
||||
gboolean select_on_focus;
|
||||
|
||||
entry = gtk_entry_new();
|
||||
g_object_ref_sink(entry);
|
||||
settings = gtk_widget_get_settings(entry);
|
||||
settings = gtk_settings_get_default();
|
||||
g_object_get(settings, "gtk-entry-select-on-focus", &select_on_focus,
|
||||
nullptr);
|
||||
|
||||
|
@ -630,8 +627,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
else
|
||||
aResult = 0;
|
||||
|
||||
gtk_widget_destroy(entry);
|
||||
g_object_unref(entry);
|
||||
} break;
|
||||
case IntID::ScrollToClick: {
|
||||
GtkSettings* settings;
|
||||
|
@ -671,11 +666,9 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
break;
|
||||
case IntID::DragThresholdX:
|
||||
case IntID::DragThresholdY: {
|
||||
GtkWidget* box = gtk_hbox_new(FALSE, 5);
|
||||
gint threshold = 0;
|
||||
g_object_get(gtk_widget_get_settings(box), "gtk-dnd-drag-threshold",
|
||||
g_object_get(gtk_settings_get_default(), "gtk-dnd-drag-threshold",
|
||||
&threshold, nullptr);
|
||||
g_object_ref_sink(box);
|
||||
|
||||
aResult = threshold;
|
||||
} break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче