Commit 9c77b69d authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

Switch to GTK+ 3

parent 74dab93c
......@@ -1925,49 +1925,48 @@ pdf_selection_get_selected_text (EvSelection *selection,
return retval;
}
static GdkRegion *
create_gdk_region_from_poppler_region (GList *region)
static cairo_region_t *
create_region_from_poppler_region (GList *region, gdouble scale)
{
GList *l;
GdkRegion *retval;
retval = gdk_region_new ();
cairo_region_t *retval;
retval = cairo_region_create ();
for (l = region; l; l = g_list_next (l)) {
PopplerRectangle *rectangle;
GdkRectangle rect;
PopplerRectangle *rectangle;
cairo_rectangle_int_t rect;
rectangle = (PopplerRectangle *)l->data;
rect.x = (gint) rectangle->x1;
rect.y = (gint) rectangle->y1;
rect.width = (gint) (rectangle->x2 - rectangle->x1);
rect.height = (gint) (rectangle->y2 - rectangle->y1);
gdk_region_union_with_rect (retval, &rect);
rect.x = (gint) ((rectangle->x1 * scale) + 0.5);
rect.y = (gint) ((rectangle->y1 * scale) + 0.5);
rect.width = (gint) (((rectangle->x2 - rectangle->x1) * scale) + 0.5);
rect.height = (gint) (((rectangle->y2 - rectangle->y1) * scale) + 0.5);
cairo_region_union_rectangle (retval, &rect);
poppler_rectangle_free (rectangle);
}
return retval;
}
static GdkRegion *
static cairo_region_t *
pdf_selection_get_selection_region (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
EvRectangle *points)
{
PopplerPage *poppler_page;
GdkRegion *retval;
GList *region;
PopplerPage *poppler_page;
cairo_region_t *retval;
GList *region;
poppler_page = POPPLER_PAGE (rc->page->backend_page);
region = poppler_page_get_selection_region (poppler_page,
rc->scale,
1.0,
(PopplerSelectionStyle)style,
(PopplerRectangle *) points);
retval = create_gdk_region_from_poppler_region (region);
retval = create_region_from_poppler_region (region, rc->scale);
g_list_free (region);
return retval;
......@@ -1983,14 +1982,14 @@ pdf_selection_iface_init (EvSelectionInterface *iface)
/* EvDocumentText */
static GdkRegion *
static cairo_region_t *
pdf_document_text_get_text_mapping (EvDocumentText *document_text,
EvPage *page)
{
PopplerPage *poppler_page;
PopplerRectangle points;
GList *region;
GdkRegion *retval;
cairo_region_t *retval;
g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
......@@ -2003,7 +2002,7 @@ pdf_document_text_get_text_mapping (EvDocumentText *document_text,
region = poppler_page_get_selection_region (poppler_page, 1.0,
POPPLER_SELECTION_GLYPH,
&points);
retval = create_gdk_region_from_poppler_region (region);
retval = create_region_from_poppler_region (region, 1.0);
g_list_free (region);
return retval;
......
......@@ -122,7 +122,7 @@ AM_CONDITIONAL([PLATFORM_HILDON],[test "$with_platform" = "hildon"])
AM_CONDITIONAL([PLATFORM_WIN32],[test "$with_platform" = "win32"])
dnl Specify required versions of dependencies
GTK_REQUIRED=2.21.2
GTK_REQUIRED=2.90.4
GLIB_REQUIRED=2.25.9
KEYRING_REQUIRED=2.22.0
AC_SUBST([GLIB_REQUIRED])
......@@ -140,11 +140,12 @@ dnl Check dependencies
# SHELL_CFLAGS for shell implementation.
# SHELL_LIBS
PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBVIEW, gtk+-2.0 >= $GTK_REQUIRED gail >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBVIEW, gtk+-3.0 >= $GTK_REQUIRED gail-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(BACKEND, gtk+-3.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(PREVIEWER, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
SHELL_PLATFORM_PKGS=
case "$with_platform" in
......@@ -170,13 +171,13 @@ case "$with_platform" in
;;
esac
PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
# *********
# SM client
# *********
GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
GDK_TARGET="$($PKG_CONFIG --variable target gdk-3.0)"
AC_MSG_CHECKING([which smclient backend to use])
AC_ARG_WITH([smclient],
......@@ -202,7 +203,7 @@ if test "$with_smclient" != "no"; then
*) SMCLIENT_PKGS="" ;;
esac
PKG_CHECK_MODULES([SMCLIENT],[gtk+-2.0 gthread-2.0 $SMCLIENT_PKGS])
PKG_CHECK_MODULES([SMCLIENT],[gtk+-3.0 gthread-2.0 $SMCLIENT_PKGS])
AC_SUBST([SMCLIENT_CFLAGS])
AC_SUBST([SMCLIENT_LIBS])
fi
......@@ -239,7 +240,7 @@ AC_ARG_WITH([gtk-unix-print],
AC_MSG_RESULT([$with_gtk_unix_print])
if test "$with_gtk_unix_print" = "yes"; then
PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-2.0 >= $GTK_REQUIRED])
PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-3.0 >= $GTK_REQUIRED])
AC_DEFINE([GTKUNIXPRINT_ENABLED], [1], [Define if gtk+-unix-print is enabled.])
fi
......@@ -371,7 +372,7 @@ AC_ARG_ENABLE([nautilus],
esac])
if test "$enable_nautilus" = "yes" ; then
PKG_CHECK_MODULES([NAUTILUS],[gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension],
PKG_CHECK_MODULES([NAUTILUS],[gtk+-x11-3.0 $MM gthread-2.0 libnautilus-extension],
[],[AC_MSG_ERROR([libnautilus-extension not found; use --disable-nautilus to disable the nautilus extensions])])
NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
AC_SUBST([nautilusextensiondir],[$NAUTILUS_EXTENSION_DIR])
......@@ -410,7 +411,7 @@ AC_ARG_ENABLE([previewer],
esac])
if test x$enable_previewer = "xyes" ; then
PKG_CHECK_MODULES([PREVIEWER],[gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED])
PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gtk+-unix-print-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED])
fi
AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"])
......@@ -732,7 +733,7 @@ AM_CONDITIONAL(ENABLE_HELP, test "x$enable_help" = "xyes")
GTK_DOC_CHECK([1.13],[--flavour no-tmpl])
AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-2.0)])
AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-3.0)])
# ******************
# Backends directory
......
......@@ -7,6 +7,6 @@ backenddir=@libdir@/evince/@EV_BINARY_VERSION@/backends
Name: Evince Document
Description: GNOME document viewer backend library
Version: @VERSION@
Requires: gio-2.0 >= @GLIB_REQUIRED@ gtk+-2.0 >= @GTK_REQUIRED@
Requires: gio-2.0 >= @GLIB_REQUIRED@ gtk+-3.0 >= @GTK_REQUIRED@
Libs: -L${libdir} -levdocument
Cflags: -I${includedir}
......@@ -57,7 +57,7 @@ ev_document_text_get_text_layout (EvDocumentText *document_text,
return iface->get_text_layout (document_text, page, areas, n_areas);
}
GdkRegion *
cairo_region_t *
ev_document_text_get_text_mapping (EvDocumentText *document_text,
EvPage *page)
{
......
......@@ -49,26 +49,26 @@ struct _EvDocumentTextInterface
GTypeInterface base_iface;
/* Methods */
GdkRegion *(* get_text_mapping) (EvDocumentText *document_text,
EvPage *page);
gchar *(* get_text) (EvDocumentText *document_text,
EvPage *page);
gboolean (* get_text_layout) (EvDocumentText *document_text,
EvPage *page,
EvRectangle **areas,
guint *n_areas);
cairo_region_t *(* get_text_mapping) (EvDocumentText *document_text,
EvPage *page);
gchar *(* get_text) (EvDocumentText *document_text,
EvPage *page);
gboolean (* get_text_layout) (EvDocumentText *document_text,
EvPage *page,
EvRectangle **areas,
guint *n_areas);
};
GType ev_document_text_get_type (void) G_GNUC_CONST;
GType ev_document_text_get_type (void) G_GNUC_CONST;
gchar *ev_document_text_get_text (EvDocumentText *document_text,
EvPage *page);
gboolean ev_document_text_get_text_layout (EvDocumentText *document_text,
EvPage *page,
EvRectangle **areas,
guint *n_areas);
GdkRegion *ev_document_text_get_text_mapping (EvDocumentText *document_text,
EvPage *page);
gchar *ev_document_text_get_text (EvDocumentText *document_text,
EvPage *page);
gboolean ev_document_text_get_text_layout (EvDocumentText *document_text,
EvPage *page,
EvRectangle **areas,
guint *n_areas);
cairo_region_t *ev_document_text_get_text_mapping (EvDocumentText *document_text,
EvPage *page);
G_END_DECLS
......
......@@ -62,7 +62,7 @@ ev_selection_get_selected_text (EvSelection *selection,
return iface->get_selected_text (selection, page, style, points);
}
GdkRegion *
cairo_region_t *
ev_selection_get_selection_region (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
......
......@@ -52,41 +52,41 @@ struct _EvSelectionInterface
{
GTypeInterface base_iface;
void (* render_selection) (EvSelection *selection,
EvRenderContext *rc,
cairo_surface_t **surface,
EvRectangle *points,
EvRectangle *old_points,
EvSelectionStyle style,
GdkColor *text,
GdkColor *base);
gchar * (* get_selected_text) (EvSelection *selection,
EvPage *page,
EvSelectionStyle style,
EvRectangle *points);
GdkRegion * (* get_selection_region) (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
EvRectangle *points);
void (* render_selection) (EvSelection *selection,
EvRenderContext *rc,
cairo_surface_t **surface,
EvRectangle *points,
EvRectangle *old_points,
EvSelectionStyle style,
GdkColor *text,
GdkColor *base);
gchar * (* get_selected_text) (EvSelection *selection,
EvPage *page,
EvSelectionStyle style,
EvRectangle *points);
cairo_region_t * (* get_selection_region) (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
EvRectangle *points);
};
GType ev_selection_get_type (void);
void ev_selection_render_selection (EvSelection *selection,
EvRenderContext *rc,
cairo_surface_t **surface,
EvRectangle *points,
EvRectangle *old_points,
EvSelectionStyle style,
GdkColor *text,
GdkColor *base);
gchar *ev_selection_get_selected_text (EvSelection *selection,
EvPage *page,
EvSelectionStyle style,
EvRectangle *points);
GdkRegion *ev_selection_get_selection_region (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
EvRectangle *points);
GType ev_selection_get_type (void) G_GNUC_CONST;
void ev_selection_render_selection (EvSelection *selection,
EvRenderContext *rc,
cairo_surface_t **surface,
EvRectangle *points,
EvRectangle *old_points,
EvSelectionStyle style,
GdkColor *text,
GdkColor *base);
gchar *ev_selection_get_selected_text (EvSelection *selection,
EvPage *page,
EvSelectionStyle style,
EvRectangle *points);
cairo_region_t *ev_selection_get_selection_region (EvSelection *selection,
EvRenderContext *rc,
EvSelectionStyle style,
EvRectangle *points);
G_END_DECLS
......
......@@ -462,7 +462,7 @@ ev_job_render_dispose (GObject *object)
}
if (job->selection_region) {
gdk_region_destroy (job->selection_region);
cairo_region_destroy (job->selection_region);
job->selection_region = NULL;
}
......
......@@ -212,7 +212,7 @@ struct _EvJobRender
gboolean include_selection;
cairo_surface_t *selection;
GdkRegion *selection_region;
cairo_region_t *selection_region;
EvRectangle selection_points;
EvSelectionStyle selection_style;
GdkColor base;
......@@ -247,7 +247,7 @@ struct _EvJobPageData
GList *image_mapping;
GList *form_field_mapping;
GList *annot_mapping;
GdkRegion *text_mapping;
cairo_region_t *text_mapping;
gchar *text;
EvRectangle *text_layout;
guint text_layout_length;
......
......@@ -32,17 +32,17 @@
#include "ev-page-cache.h"
typedef struct _EvPageCacheData {
EvJob *job;
gboolean done : 1;
GList *link_mapping;
GList *image_mapping;
GList *form_field_mapping;
GList *annot_mapping;
GdkRegion *text_mapping;
EvRectangle *text_layout;
guint text_layout_length;
gchar *text;
EvJob *job;
gboolean done : 1;
GList *link_mapping;
GList *image_mapping;
GList *form_field_mapping;
GList *annot_mapping;
cairo_region_t *text_mapping;
EvRectangle *text_layout;
guint text_layout_length;
gchar *text;
} EvPageCacheData;
struct _EvPageCache {
......@@ -92,7 +92,7 @@ ev_page_cache_data_free (EvPageCacheData *data)
}
if (data->text_mapping) {
gdk_region_destroy (data->text_mapping);
cairo_region_destroy (data->text_mapping);
data->text_mapping = NULL;
}
......@@ -340,7 +340,7 @@ ev_page_cache_get_annot_mapping (EvPageCache *cache,
return data->annot_mapping;
}
GdkRegion *
cairo_region_t *
ev_page_cache_get_text_mapping (EvPageCache *cache,
gint page)
{
......
......@@ -55,7 +55,7 @@ GList *ev_page_cache_get_form_field_mapping (EvPageCache *cach
gint page);
GList *ev_page_cache_get_annot_mapping (EvPageCache *cache,
gint page);
GdkRegion *ev_page_cache_get_text_mapping (EvPageCache *cache,
cairo_region_t *ev_page_cache_get_text_mapping (EvPageCache *cache,
gint page);
const gchar *ev_page_cache_get_text (EvPageCache *cache,
gint page);
......
......@@ -13,7 +13,7 @@ typedef struct _CacheJobInfo
gboolean page_ready;
/* Region of the page that needs to be drawn */
GdkRegion *region;
cairo_region_t *region;
/* Data we get from rendering */
cairo_surface_t *surface;
......@@ -27,7 +27,7 @@ typedef struct _CacheJobInfo
gboolean points_set;
cairo_surface_t *selection;
GdkRegion *selection_region;
cairo_region_t *selection_region;
} CacheJobInfo;
struct _EvPixbufCache
......@@ -174,7 +174,7 @@ dispose_cache_job_info (CacheJobInfo *job_info,
job_info->surface = NULL;
}
if (job_info->region) {
gdk_region_destroy (job_info->region);
cairo_region_destroy (job_info->region);
job_info->region = NULL;
}
if (job_info->selection) {
......@@ -182,7 +182,7 @@ dispose_cache_job_info (CacheJobInfo *job_info,
job_info->selection = NULL;
}
if (job_info->selection_region) {
gdk_region_destroy (job_info->selection_region);
cairo_region_destroy (job_info->selection_region);
job_info->selection_region = NULL;
}
......@@ -259,12 +259,12 @@ copy_job_to_job_info (EvJobRender *job_render,
job_info->selection = NULL;
}
if (job_info->selection_region) {
gdk_region_destroy (job_info->selection_region);
cairo_region_destroy (job_info->selection_region);
job_info->selection_region = NULL;
}
job_info->selection_points = job_render->selection_points;
job_info->selection_region = gdk_region_copy (job_render->selection_region);
job_info->selection_region = cairo_region_reference (job_render->selection_region);
job_info->selection = cairo_surface_reference (job_render->selection);
g_assert (job_info->selection_points.x1 >= 0);
job_info->points_set = TRUE;
......@@ -620,21 +620,21 @@ get_selection_colors (GtkWidget *widget, GdkColor **text, GdkColor **base)
}
static void
add_job (EvPixbufCache *pixbuf_cache,
CacheJobInfo *job_info,
GdkRegion *region,
gint width,
gint height,
gint page,
gint rotation,
gfloat scale,
EvJobPriority priority)
add_job (EvPixbufCache *pixbuf_cache,
CacheJobInfo *job_info,
cairo_region_t *region,
gint width,
gint height,
gint page,
gint rotation,
gfloat scale,
EvJobPriority priority)
{
job_info->page_ready = FALSE;
if (job_info->region)
gdk_region_destroy (job_info->region);
job_info->region = region ? gdk_region_copy (region) : NULL;
cairo_region_destroy (job_info->region);
job_info->region = region ? cairo_region_reference (region) : NULL;
job_info->job = ev_job_render_new (pixbuf_cache->document,
page, rotation, scale,
......@@ -920,10 +920,10 @@ ev_pixbuf_cache_style_changed (EvPixbufCache *pixbuf_cache)
}
cairo_surface_t *
ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache,
gint page,
gfloat scale,
GdkRegion **region)
ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache,
gint page,
gfloat scale,
cairo_region_t **region)
{
CacheJobInfo *job_info;
......@@ -975,7 +975,7 @@ ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache,
g_object_unref (ev_page);
if (job_info->selection_region)
gdk_region_destroy (job_info->selection_region);
cairo_region_destroy (job_info->selection_region);
job_info->selection_region =
ev_selection_get_selection_region (EV_SELECTION (pixbuf_cache->document),
rc, job_info->selection_style,
......@@ -1131,7 +1131,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
selection->page = page;
selection->rect = pixbuf_cache->prev_job[i].selection_points;
if (pixbuf_cache->prev_job[i].selection_region)
selection->covered_region = gdk_region_copy (pixbuf_cache->prev_job[i].selection_region);
selection->covered_region = cairo_region_reference (pixbuf_cache->prev_job[i].selection_region);
retval = g_list_append (retval, selection);
}
......@@ -1145,7 +1145,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
selection->page = page;
selection->rect = pixbuf_cache->job_list[i].selection_points;
if (pixbuf_cache->job_list[i].selection_region)
selection->covered_region = gdk_region_copy (pixbuf_cache->job_list[i].selection_region);
selection->covered_region = cairo_region_reference (pixbuf_cache->job_list[i].selection_region);
retval = g_list_append (retval, selection);
}
......@@ -1161,7 +1161,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
selection->page = page;
selection->rect = pixbuf_cache->next_job[i].selection_points;
if (pixbuf_cache->next_job[i].selection_region)
selection->covered_region = gdk_region_copy (pixbuf_cache->next_job[i].selection_region);
selection->covered_region = cairo_region_reference (pixbuf_cache->next_job[i].selection_region);
retval = g_list_append (retval, selection);
}
......@@ -1172,11 +1172,11 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
}
void
ev_pixbuf_cache_reload_page (EvPixbufCache *pixbuf_cache,
GdkRegion *region,
gint page,
gint rotation,
gdouble scale)
ev_pixbuf_cache_reload_page (EvPixbufCache *pixbuf_cache,
cairo_region_t *region,
gint page,
gint rotation,
gdouble scale)
{
CacheJobInfo *job_info;
gint width, height;
......
......@@ -47,7 +47,7 @@ G_BEGIN_DECLS
typedef struct {
int page;
EvRectangle rect;
GdkRegion *covered_region;
cairo_region_t *covered_region;
EvSelectionStyle style;
} EvViewSelection;
......@@ -68,18 +68,18 @@ cairo_surface_t *ev_pixbuf_cache_get_surface (EvPixbufCache *pixbuf_cache
gint page);
void ev_pixbuf_cache_clear (EvPixbufCache *pixbuf_cache);
void ev_pixbuf_cache_style_changed (EvPixbufCache *pixbuf_cache);
void ev_pixbuf_cache_reload_page (EvPixbufCache *pixbuf_cache,
GdkRegion *region,
gint page,
gint rotation,
gdouble scale);
void ev_pixbuf_cache_reload_page (EvPixbufCache *pixbuf_cache,
cairo_region_t *region,
gint page,
gint rotation,
gdouble scale);
void ev_pixbuf_cache_set_inverted_colors (EvPixbufCache *pixbuf_cache,
gboolean inverted_colors);
/* Selection */
cairo_surface_t *ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache,
gint page,
gfloat scale,
GdkRegion **region);
cairo_surface_t *ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache,
gint page,
gfloat scale,
cairo_region_t **region);
void ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache,
GList *selection_list);
GList *ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache);
......
......@@ -189,14 +189,14 @@ static void show_loading_window (EvView
static void hide_loading_window (EvView *view);
static void ev_view_reload_page (EvView *view,
gint page,
GdkRegion *region);
cairo_region_t *region);
static void ev_view_loading_window_move (EvView *view);
/*** Callbacks ***/
static void ev_view_change_page (EvView *view,
gint new_page);
static void job_finished_cb (EvPixbufCache *pixbuf_cache,
GdkRegion *region,
cairo_region_t *region,
EvView *view);
static void ev_view_page_changed_cb (EvDocumentModel *model,
gint old_page,
......@@ -803,15 +803,13 @@ compute_scroll_increment (EvView *view,
{
GtkWidget *widget = GTK_WIDGET (view);
GtkAdjustment *adjustment = view->vadjustment;
GdkRegion *text_region, *region;
cairo_region_t *text_region, *region;
GtkAllocation allocation;
gint page;
GdkRectangle rect;
EvRectangle doc_rect;
GdkRectangle page_area;
GtkBorder border;
GdkRectangle *recs;
gint n_recs;
gdouble fraction = 1.0;
if (scroll != GTK_SCROLL_PAGE_BACKWARD && scroll != GTK_SCROLL_PAGE_FORWARD)
......@@ -820,7 +818,7 @@ compute_scroll_increment (EvView *view,
page = scroll == GTK_SCROLL_PAGE_BACKWARD ? view->start_page : view->end_page;
text_region = ev_page_cache_get_text_mapping (view->page_cache, page);
if (!text_region || gdk_region_empty (text_region))
if (!text_region || cairo_region_is_empty (text_region))
return gtk_adjustment_get_page_size (adjustment);
gtk_widget_get_allocation (widget, &allocation);
......@@ -836,37 +834,37 @@ compute_scroll_increment (EvView *view,
rect.y = doc_rect.y1;
rect.width = doc_rect.x2 - doc_rect.x1;
rect.height = MAX (1, doc_rect.y2 - doc_rect.y1);
region = gdk_region_rectangle (&rect);
region = cairo_region_create_rectangle (&rect);
gdk_region_intersect (region, text_region);
gdk_region_get_rectangles (region, &recs, &n_recs);
gdk_region_destroy (region);
if (n_recs > 0) {
cairo_region_intersect (region, text_region);
if (cairo_region_num_rectangles (region)) {
EvRenderContext *rc;
EvPage *ev_page;
cairo_region_t *sel_region;
cairo_region_get_rectangle (region, 0, &rect);
ev_page = ev_document_get_page (view->document, page);
rc = ev_render_context_new (ev_page, view->rotation, view->scale);
g_object_unref (ev_page);
/* Get the selection region to know the height of the line */
doc_rect.x1 = doc_rect.x2 = recs[0].x + 0.5;
doc_rect.y1 = doc_rect.y2 = recs[0].y + 0.5;
doc_rect.x1 = doc_rect.x2 = rect.x + 0.5;
doc_rect.y1 = doc_rect.y2 = rect.y + 0.5;
ev_document_doc_mutex_lock ();
region = ev_selection_get_selection_region (EV_SELECTION (view->document),
rc, EV_SELECTION_STYLE_LINE,
&doc_rect);
sel_region = ev_selection_get_selection_region (EV_SELECTION (view->document),
rc, EV_SELECTION_STYLE_LINE,
&doc_rect);
ev_document_doc_mutex_unlock ();
g_object_unref (rc);
g_free (recs);
gdk_region_get_rectangles (region, &recs, &n_recs);
gdk_region_destroy (region);
if (n_recs > 0) {
fraction = 1 - (recs[0].height / gtk_adjustment_get_page_size (adjustment));
if (cairo_region_num_rectangles (sel_region) > 0) {
cairo_region_get_rectangle (sel_region, 0, &rect);
fraction = 1 - (rect.height / gtk_adjustment_get_page_size (adjustment));
}
g_free (recs);
cairo_region_destroy (sel_region);
}
cairo_region_destroy (region);
return gtk_adjustment_get_page_size (adjustment) * fraction;
......@@ -1363,7 +1361,7 @@ location_in_text (EvView *view,
gdouble x,
gdouble y)
{
GdkRegion *region;
cairo_region_t *region;
gint page = -1;
gint x_offset = 0, y_offset = 0;
......@@ -1375,7 +1373,7 @@ location_in_text (EvView *view,
region = ev_page_cache_get_text_mapping (view->page_cache, page);
if (region)
return gdk_region_point_in (region, x_offset / view->scale, y_offset / view->scale);
return cairo_region_contains_point (region, x_offset / view->scale, y_offset / view->scale);
else
return FALSE;
}
......@@ -1399,7 +1397,7 @@ location_in_selected_text (EvView *view,
continue;
if (selection->covered_region &&
gdk_region_point_in (selection->covered_region, x_offset, y_offset))
cairo_region_contains_point (selection->covered_region, x_offset, y_offset))
return TRUE;
}
......@@ -1921,7 +1919,7 @@ ev_view_get_form_field_at_location (EvView *view,
return NULL;
}
static GdkRegion *
static cairo_region_t *
ev_view_form_field_get_region (EvView *view,
EvFormField *field)
{
......@@ -1934,7 +1932,7 @@ ev_view_form_field_get_region (EvView *view,
forms_mapping,
field, &view_area);
return gdk_region_rectangle (&view_area);
return cairo_region_create_rectangl