Use "notify::gtk-theme-name" from GtkSettings to generate wxSysColourChangedEvent

"style-updated" occurs frequently for other reasons, such as switching focus between TLWs
This commit is contained in:
Paul Cornett
2016-12-13 09:07:01 -08:00
parent 803d40a63f
commit 61c8a7ca60
2 changed files with 19 additions and 53 deletions

View File

@@ -439,6 +439,19 @@ gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget),
}
}
//-----------------------------------------------------------------------------
// "notify::gtk-theme-name" from GtkSettings
//-----------------------------------------------------------------------------
extern "C" {
static void notify_gtk_theme_name(GObject*, GParamSpec*, wxTopLevelWindowGTK* win)
{
wxSysColourChangedEvent event;
event.SetEventObject(win);
win->HandleWindowEvent(event);
}
}
//-----------------------------------------------------------------------------
bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom)
@@ -780,6 +793,9 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
gtk_widget_set_size_request(m_widget, w, h);
}
g_signal_connect(gtk_settings_get_default(), "notify::gtk-theme-name",
G_CALLBACK(notify_gtk_theme_name), this);
return true;
}
@@ -808,6 +824,9 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
if (g_activeFrame == this)
g_activeFrame = NULL;
g_signal_handlers_disconnect_by_func(
gtk_settings_get_default(), (void*)notify_gtk_theme_name, this);
}
bool wxTopLevelWindowGTK::EnableCloseButton( bool enable )