[gimp] app: add gimp-priorities.h and keep the most important priorities there



commit c88800e840913e4e7845d10c85de871b71c74d65
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 2 04:47:24 2014 +0200

    app: add gimp-priorities.h and keep the most important priorities there
    
    also add comments with all predefined priorities as documentation.

 app/Makefile.am                |   51 ++++++++++++++++++++-------------------
 app/core/gimpprojection.c      |    8 +----
 app/core/gimpundo.c            |    4 ++-
 app/core/gimpviewable.h        |    2 -
 app/display/gimpdisplayshell.c |    8 +----
 app/gimp-priorities.h          |   43 +++++++++++++++++++++++++++++++++
 app/widgets/gimpviewrenderer.c |    6 +++-
 7 files changed, 80 insertions(+), 42 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index b145419..674fcb2 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -44,31 +44,32 @@ bin_PROGRAMS = gimp- GIMP_APP_VERSION@
 endif
 
 libapp_sources = \
-       about.h         \
-       app.c           \
-       app.h           \
-       batch.c         \
-       batch.h         \
-       errors.c        \
-       errors.h        \
-       language.c      \
-       language.h      \
-       sanity.c        \
-       sanity.h        \
-       signals.c       \
-       signals.h       \
-       tests.c         \
-       tests.h         \
-       unique.c        \
-       unique.h        \
-       units.c         \
-       units.h         \
-       version.c       \
-       version.h       \
-       gimp-debug.c    \
-       gimp-debug.h    \
-       gimp-log.c      \
-       gimp-log.h      \
+       about.h                 \
+       app.c                   \
+       app.h                   \
+       batch.c                 \
+       batch.h                 \
+       errors.c                \
+       errors.h                \
+       language.c              \
+       language.h              \
+       sanity.c                \
+       sanity.h                \
+       signals.c               \
+       signals.h               \
+       tests.c                 \
+       tests.h                 \
+       unique.c                \
+       unique.h                \
+       units.c                 \
+       units.h                 \
+       version.c               \
+       version.h               \
+       gimp-debug.c            \
+       gimp-debug.h            \
+       gimp-log.c              \
+       gimp-log.h              \
+       gimp-priorities.h       \
        gimp-intl.h
 
 libapp_generated_sources = \
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 847cf85..7cd5352 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -41,13 +41,9 @@
 #include "gimpprojection.h"
 
 #include "gimp-log.h"
+#include "gimp-priorities.h"
 
 
-/*  just a bit less than GDK_PRIORITY_REDRAW, also see
- *  GIMP_DISPLAY_SHELL_FILL_IDLE_PRIORITY in gimpdisplayshell.c
- */
-#define GIMP_PROJECTION_IDLE_PRIORITY (G_PRIORITY_HIGH_IDLE + 20 + 2)
-
 /*  chunk size for one iteration of the chunk renderer  */
 static gint GIMP_PROJECTION_CHUNK_WIDTH  = 256;
 static gint GIMP_PROJECTION_CHUNK_HEIGHT = 128;
@@ -702,7 +698,7 @@ gimp_projection_chunk_render_start (GimpProjection *proj)
   g_return_if_fail (proj->priv->chunk_render.idle_id == 0);
 
   proj->priv->chunk_render.idle_id =
-    g_idle_add_full (GIMP_PROJECTION_IDLE_PRIORITY,
+    g_idle_add_full (GIMP_PRIORITY_PROJECTION_IDLE,
                      gimp_projection_chunk_render_callback, proj,
                      NULL);
 }
diff --git a/app/core/gimpundo.c b/app/core/gimpundo.c
index 2a2d9db..ef14b5d 100644
--- a/app/core/gimpundo.c
+++ b/app/core/gimpundo.c
@@ -37,6 +37,8 @@
 #include "gimpundo.h"
 #include "gimpundostack.h"
 
+#include "gimp-priorities.h"
+
 #include "gimp-intl.h"
 
 
@@ -424,7 +426,7 @@ gimp_undo_create_preview (GimpUndo    *undo,
         idle->context = g_object_ref (context);
 
       undo->preview_idle_id =
-        g_idle_add_full (GIMP_VIEWABLE_PRIORITY_IDLE,
+        g_idle_add_full (GIMP_PRIORITY_VIEWABLE_IDLE,
                          gimp_undo_create_preview_idle, idle,
                          (GDestroyNotify) gimp_undo_idle_free);
     }
diff --git a/app/core/gimpviewable.h b/app/core/gimpviewable.h
index 0fb0306..cb55175 100644
--- a/app/core/gimpviewable.h
+++ b/app/core/gimpviewable.h
@@ -30,8 +30,6 @@
 #define GIMP_VIEWABLE_MAX_BUTTON_SIZE    64
 #define GIMP_VIEWABLE_MAX_MENU_SIZE      48
 
-#define GIMP_VIEWABLE_PRIORITY_IDLE    G_PRIORITY_LOW
-
 
 #define GIMP_TYPE_VIEWABLE            (gimp_viewable_get_type ())
 #define GIMP_VIEWABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEWABLE, GimpViewable))
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index eaca6ef..18a6193 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -81,15 +81,11 @@
 
 #include "about.h"
 #include "gimp-log.h"
+#include "gimp-priorities.h"
 
 #include "gimp-intl.h"
 
 
-/* a bit higher than projection construction, see gimpprojection.c
- */
-#define GIMP_DISPLAY_SHELL_FILL_IDLE_PRIORITY (G_PRIORITY_HIGH_IDLE + 20 + 1)
-
-
 enum
 {
   PROP_0,
@@ -1512,7 +1508,7 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
     }
 
   shell->fill_idle_id =
-    g_idle_add_full (GIMP_DISPLAY_SHELL_FILL_IDLE_PRIORITY,
+    g_idle_add_full (GIMP_PRIORITY_DISPLAY_SHELL_FILL_IDLE,
                      (GSourceFunc) gimp_display_shell_fill_idle, shell,
                      NULL);
 }
diff --git a/app/gimp-priorities.h b/app/gimp-priorities.h
new file mode 100644
index 0000000..f20759a
--- /dev/null
+++ b/app/gimp-priorities.h
@@ -0,0 +1,43 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PRIORITIES_H__
+#define __GIMP_PRIORITIES_H__
+
+
+/* #define G_PRIORITY_HIGH -100 */
+
+/* #define G_PRIORITY_DEFAULT 0 */
+
+/* #define G_PRIORITY_HIGH_IDLE 100 */
+
+/* #define GTK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20) */
+
+/*  a bit higher than projection construction  */
+#define GIMP_PRIORITY_DISPLAY_SHELL_FILL_IDLE (G_PRIORITY_HIGH_IDLE + 21)
+
+/*  just a bit less than GDK_PRIORITY_REDRAW   */
+#define GIMP_PRIORITY_PROJECTION_IDLE (G_PRIORITY_HIGH_IDLE + 22)
+
+/* #define G_PRIORITY_DEFAULT_IDLE 200 */
+
+#define GIMP_PRIORITY_VIEWABLE_IDLE (G_PRIORITY_LOW)
+
+/* #define G_PRIORITY_LOW 300 */
+
+
+#endif /* __GIMP_PRIORITIES_H__ */
diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c
index 2645049..e629ddd 100644
--- a/app/widgets/gimpviewrenderer.c
+++ b/app/widgets/gimpviewrenderer.c
@@ -43,6 +43,8 @@
 #include "gimpviewrenderer-utils.h"
 #include "gimpwidgets-utils.h"
 
+#include "gimp-priorities.h"
+
 
 enum
 {
@@ -540,7 +542,7 @@ gimp_view_renderer_invalidate (GimpViewRenderer *renderer)
   GIMP_VIEW_RENDERER_GET_CLASS (renderer)->invalidate (renderer);
 
   renderer->idle_id =
-    g_idle_add_full (GIMP_VIEWABLE_PRIORITY_IDLE,
+    g_idle_add_full (GIMP_PRIORITY_VIEWABLE_IDLE,
                      (GSourceFunc) gimp_view_renderer_idle_update,
                      renderer, NULL);
 }
@@ -568,7 +570,7 @@ gimp_view_renderer_update_idle (GimpViewRenderer *renderer)
     g_source_remove (renderer->idle_id);
 
   renderer->idle_id =
-    g_idle_add_full (GIMP_VIEWABLE_PRIORITY_IDLE,
+    g_idle_add_full (GIMP_PRIORITY_VIEWABLE_IDLE,
                      (GSourceFunc) gimp_view_renderer_idle_update,
                      renderer, NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]