Import code from mousepad development repository which fixes a dbus
messages storm causing heavy CPU usage, memory allocation and disk usage when working with multiple windows. While here also import a GTK3 specific fix. Ref.: https://bugzilla.xfce.org/show_bug.cgi?id=14184 https://bugzilla.xfce.org/show_bug.cgi?id=12134 Reported by: Erich Dollansky <freebsd.ed.lists@sumeritec.com> Obtained from: https://git.xfce.org/apps/mousepad/ MFH: 2018Q1
This commit is contained in:
parent
aac6f41b92
commit
0163d504d8
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=459693
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME= mousepad
|
||||
PORTVERSION= 0.4.0
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= editors xfce
|
||||
MASTER_SITES= XFCE/src/apps/${PORTNAME}/${PORTVERSION:R}
|
||||
DIST_SUBDIR= xfce4
|
||||
|
@ -1,25 +1,48 @@
|
||||
--- mousepad/mousepad-action-group.c.orig 2014-09-01 20:50:07 UTC
|
||||
+++ mousepad/mousepad-action-group.c
|
||||
@@ -283,7 +283,8 @@ void
|
||||
mousepad_action_group_set_active_style_scheme (MousepadActionGroup *self,
|
||||
GtkSourceStyleScheme *scheme)
|
||||
{
|
||||
- GtkAction *action;
|
||||
+ GtkAction *action;
|
||||
+ const gchar *scheme_name = NULL;
|
||||
@@ -124,7 +124,7 @@ mousepad_action_group_class_init (MousepadActionGroupC
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
- G_TYPE_NONE, 0,
|
||||
+ G_TYPE_NONE, 1,
|
||||
GTK_SOURCE_TYPE_LANGUAGE);
|
||||
}
|
||||
|
||||
g_return_if_fail (MOUSEPAD_IS_ACTION_GROUP (self));
|
||||
|
||||
@@ -303,8 +304,11 @@ mousepad_action_group_set_active_style_s
|
||||
@@ -302,11 +302,6 @@ mousepad_action_group_set_active_style_scheme (Mousepa
|
||||
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
|
||||
self->locked = FALSE;
|
||||
|
||||
/* update the setting when the active action is changed */
|
||||
+ if (scheme != NULL)
|
||||
+ scheme_name = gtk_source_style_scheme_get_id(scheme);
|
||||
+
|
||||
self->locked = TRUE;
|
||||
- /* update the setting when the active action is changed */
|
||||
- self->locked = TRUE;
|
||||
- MOUSEPAD_SETTING_SET_STRING (COLOR_SCHEME, gtk_source_style_scheme_get_id (scheme));
|
||||
+ MOUSEPAD_SETTING_SET_STRING (COLOR_SCHEME, scheme_name);
|
||||
self->locked = FALSE;
|
||||
|
||||
- self->locked = FALSE;
|
||||
-
|
||||
g_object_notify (G_OBJECT (self), "active-style-scheme");
|
||||
}
|
||||
|
||||
@@ -473,6 +468,8 @@ static void
|
||||
mousepad_action_group_style_scheme_action_activate (MousepadActionGroup *self,
|
||||
MousepadStyleSchemeAction *action)
|
||||
{
|
||||
+ const gchar *scheme_name = NULL;
|
||||
+
|
||||
/* only update the active action if we're not already in the process of
|
||||
* setting it and the sender action is actually active */
|
||||
if (! self->locked &&
|
||||
@@ -481,7 +478,14 @@ mousepad_action_group_style_scheme_action_activate (Mo
|
||||
GtkSourceStyleScheme *scheme;
|
||||
|
||||
scheme = mousepad_style_scheme_action_get_style_scheme (action);
|
||||
- mousepad_action_group_set_active_style_scheme (self, scheme);
|
||||
+
|
||||
+ /* update the setting when the active action is changed */
|
||||
+ if (scheme != NULL)
|
||||
+ scheme_name = gtk_source_style_scheme_get_id(scheme);
|
||||
+
|
||||
+ self->locked = TRUE;
|
||||
+ MOUSEPAD_SETTING_SET_STRING (COLOR_SCHEME, scheme_name);
|
||||
+ self->locked = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
11
editors/mousepad/files/patch-mousepad_mousepad-util.c
Normal file
11
editors/mousepad/files/patch-mousepad_mousepad-util.c
Normal file
@ -0,0 +1,11 @@
|
||||
--- mousepad/mousepad-util.c.orig 2014-09-01 20:50:07 UTC
|
||||
+++ mousepad/mousepad-util.c
|
||||
@@ -1063,7 +1063,7 @@ mousepad_util_search (GtkTextBuffer *buffer,
|
||||
GtkAction *
|
||||
mousepad_util_find_related_action (GtkWidget *widget)
|
||||
{
|
||||
- GtkAction *action;
|
||||
+ GtkAction *action = NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
@ -1,18 +1,64 @@
|
||||
--- mousepad/mousepad-window.c.orig 2014-09-01 20:58:02 UTC
|
||||
+++ mousepad/mousepad-window.c
|
||||
@@ -717,12 +717,13 @@ mousepad_window_action_group_style_schem
|
||||
MousepadActionGroup *group)
|
||||
{
|
||||
GtkSourceStyleScheme *scheme;
|
||||
@@ -712,32 +712,6 @@ mousepad_window_create_languages_menu (MousepadWindow
|
||||
|
||||
|
||||
static void
|
||||
-mousepad_window_action_group_style_scheme_changed (MousepadWindow *window,
|
||||
- GParamSpec *pspec,
|
||||
- MousepadActionGroup *group)
|
||||
-{
|
||||
- GtkSourceStyleScheme *scheme;
|
||||
- const gchar *scheme_id;
|
||||
+ const gchar *scheme_id = NULL;
|
||||
gint npages, i;
|
||||
|
||||
/* get the new active language */
|
||||
scheme = mousepad_action_group_get_active_style_scheme (group);
|
||||
- gint npages, i;
|
||||
-
|
||||
- /* get the new active language */
|
||||
- scheme = mousepad_action_group_get_active_style_scheme (group);
|
||||
- scheme_id = gtk_source_style_scheme_get_id (scheme);
|
||||
+ if (scheme != NULL)
|
||||
+ scheme_id = gtk_source_style_scheme_get_id (scheme);
|
||||
-
|
||||
- /* update the color scheme on all the documents */
|
||||
- npages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
|
||||
- for (i = 0; i < npages; i++)
|
||||
- {
|
||||
- MousepadDocument *document;
|
||||
-
|
||||
- document = MOUSEPAD_DOCUMENT (gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), i));
|
||||
- mousepad_view_set_color_scheme (document->textview, scheme_id);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
-
|
||||
-static void
|
||||
mousepad_window_create_style_schemes_menu (MousepadWindow *window)
|
||||
{
|
||||
GtkWidget *menu, *item;
|
||||
@@ -751,13 +725,6 @@ mousepad_window_create_style_schemes_menu (MousepadWin
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
|
||||
gtk_widget_show_all (menu);
|
||||
gtk_widget_show (item);
|
||||
-
|
||||
- /* watch for activations of the style schemes actions */
|
||||
- g_signal_connect_object (window->action_group,
|
||||
- "notify::active-style-scheme",
|
||||
- G_CALLBACK (mousepad_window_action_group_style_scheme_changed),
|
||||
- window,
|
||||
- G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
/* update the color scheme on all the documents */
|
||||
npages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
|
||||
|
||||
@@ -2122,7 +2089,14 @@ mousepad_window_notebook_create_window (GtkNotebook
|
||||
g_object_ref (G_OBJECT (document));
|
||||
|
||||
/* remove the document from the active window */
|
||||
+#if GTK_CHECK_VERSION (3, 16, 0)
|
||||
+ gtk_notebook_detach_tab (GTK_CONTAINER (window->notebook), page);
|
||||
+#else
|
||||
+ /* crashes on GTK+ 3 somewhere between 3.10-3.16
|
||||
+ * Fixed above using new function added in 3.16
|
||||
+ * See: https://bugzilla.gnome.org/show_bug.cgi?id=744385 */
|
||||
gtk_container_remove (GTK_CONTAINER (window->notebook), page);
|
||||
+#endif
|
||||
|
||||
/* emit the new window with document signal */
|
||||
g_signal_emit (G_OBJECT (window), window_signals[NEW_WINDOW_WITH_DOCUMENT], 0, document, x, y);
|
||||
|
Loading…
Reference in New Issue
Block a user