Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
22fea7d2
Commit
22fea7d2
authored
Jan 11, 2011
by
Moritz Lipp
Browse files
Began to set locks for rendering thread
parent
02f64675
Changes
3
Hide whitespace changes
Inline
Side-by-side
ft/document.c
View file @
22fea7d2
...
...
@@ -110,10 +110,7 @@ zathura_document_open(const char* path, const char* password)
goto
error_free
;
}
page
->
offset
=
offset
;
page
->
number
=
page_id
;
page
->
rendered
=
false
;
page
->
offset
=
offset
;
offset
+=
page
->
height
;
document
->
pages
[
page_id
]
=
page
;
...
...
@@ -246,7 +243,7 @@ zathura_document_attachments_free(zathura_list_t* list)
}
zathura_page_t
*
zathura_page_get
(
zathura_document_t
*
document
,
unsigned
int
page
)
zathura_page_get
(
zathura_document_t
*
document
,
unsigned
int
page
_id
)
{
if
(
!
document
)
{
return
NULL
;
...
...
@@ -257,7 +254,15 @@ zathura_page_get(zathura_document_t* document, unsigned int page)
return
NULL
;
}
return
document
->
functions
.
page_get
(
document
,
page
);
zathura_page_t
*
page
=
document
->
functions
.
page_get
(
document
,
page_id
);
if
(
page
)
{
page
->
number
=
page_id
;
page
->
rendered
=
false
;
g_static_mutex_init
(
&
(
page
->
lock
));
}
return
page
;
}
bool
...
...
ft/document.h
View file @
22fea7d2
...
...
@@ -82,6 +82,7 @@ typedef struct zathura_page_s
zathura_document_t
*
document
;
void
*
data
;
bool
rendered
;
GStaticMutex
lock
;
}
zathura_page_t
;
struct
zathura_document_s
...
...
@@ -101,7 +102,7 @@ struct zathura_document_s
bool
(
*
document_save_as
)(
zathura_document_t
*
document
,
const
char
*
path
);
zathura_list_t
*
(
*
document_attachments_get
)(
zathura_document_t
*
document
);
zathura_page_t
*
(
*
page_get
)(
zathura_document_t
*
document
,
unsigned
int
page
);
zathura_page_t
*
(
*
page_get
)(
zathura_document_t
*
document
,
unsigned
int
page
_id
);
zathura_list_t
*
(
*
page_search_text
)(
zathura_page_t
*
page
,
const
char
*
text
);
zathura_list_t
*
(
*
page_links_get
)(
zathura_page_t
*
page
);
zathura_list_t
*
(
*
page_form_fields_get
)(
zathura_page_t
*
page
);
...
...
@@ -120,7 +121,7 @@ bool zathura_document_index_free(zathura_list_t* list);
zathura_list_t
*
zathura_document_attachments_get
(
zathura_document_t
*
document
);
bool
zathura_document_attachments_free
(
zathura_list_t
*
list
);
zathura_page_t
*
zathura_page_get
(
zathura_document_t
*
document
,
unsigned
int
page
);
zathura_page_t
*
zathura_page_get
(
zathura_document_t
*
document
,
unsigned
int
page
_id
);
bool
zathura_page_free
(
zathura_page_t
*
page
);
zathura_list_t
*
zathura_page_search_text
(
zathura_page_t
*
page
,
const
char
*
text
);
zathura_list_t
*
zathura_page_links_get
(
zathura_page_t
*
page
);
...
...
render.c
View file @
22fea7d2
...
...
@@ -3,13 +3,17 @@
bool
page_render
(
zathura_page_t
*
page
)
{
g_static_mutex_lock
(
&
(
page
->
lock
));
GtkWidget
*
image
=
zathura_page_render
(
page
);
g_static_mutex_unlock
(
&
(
page
->
lock
));
if
(
!
image
)
{
printf
(
"error: rendering failed
\n
"
);
return
false
;
}
/* add new page */
g_static_mutex_lock
(
&
(
page
->
lock
));
GList
*
list
=
gtk_container_get_children
(
GTK_CONTAINER
(
Zathura
.
UI
.
page_view
));
GtkWidget
*
widget
=
(
GtkWidget
*
)
g_list_nth_data
(
list
,
page
->
number
);
g_list_free
(
list
);
...
...
@@ -17,6 +21,7 @@ bool page_render(zathura_page_t* page)
if
(
!
widget
)
{
printf
(
"error: page container does not exist
\n
"
);
g_object_unref
(
image
);
g_static_mutex_unlock
(
&
(
page
->
lock
));
return
false
;
}
...
...
@@ -39,6 +44,7 @@ bool page_render(zathura_page_t* page)
/* reorder child */
gtk_box_reorder_child
(
GTK_BOX
(
Zathura
.
UI
.
page_view
),
image
,
page
->
number
);
g_static_mutex_unlock
(
&
(
page
->
lock
));
return
true
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment