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

also add comments with all predefined priorities as documentation.
This commit is contained in:
Michael Natterer 2014-07-02 04:47:24 +02:00
parent b5530e9e3d
commit c88800e840
7 changed files with 80 additions and 42 deletions

View file

@ -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 = \

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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))

View file

@ -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);
}

43
app/gimp-priorities.h Normal file
View file

@ -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__ */

View file

@ -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);
}