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
cbb22739
Commit
cbb22739
authored
Jun 16, 2012
by
Moritz Lipp
Browse files
Fix sc_adjust_window
parent
4868bcec
Changes
1
Hide whitespace changes
Inline
Side-by-side
shortcuts.c
View file @
cbb22739
...
...
@@ -76,8 +76,8 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
/* get window size */
GtkAllocation
allocation
;
gtk_widget_get_allocation
(
session
->
gtk
.
view
,
&
allocation
);
gint
width
=
allocation
.
width
;
gint
height
=
allocation
.
height
;
double
width
=
allocation
.
width
;
double
height
=
allocation
.
height
;
/* correct view size */
if
(
gtk_widget_get_visible
(
GTK_WIDGET
(
session
->
gtk
.
inputbar
))
==
true
)
{
...
...
@@ -119,6 +119,13 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
}
unsigned
int
rotation
=
zathura_document_get_rotation
(
zathura
->
document
);
double
page_ratio
=
total_height
/
total_width
;
double
window_ratio
=
height
/
width
;
if
(
rotation
==
90
||
rotation
==
270
)
{
page_ratio
=
total_width
/
total_height
;
}
switch
(
argument
->
n
)
{
case
ZATHURA_ADJUST_WIDTH
:
if
(
rotation
==
0
||
rotation
==
180
)
{
...
...
@@ -129,13 +136,13 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
break
;
case
ZATHURA_ADJUST_BESTFIT
:
if
(
rotation
==
0
||
rotation
==
180
)
{
if
(
width
<
height
)
{
if
(
page_ratio
<
window_ratio
)
{
zathura_document_set_scale
(
zathura
->
document
,
width
/
total_width
);
}
else
{
zathura_document_set_scale
(
zathura
->
document
,
height
/
total_height
);
}
}
else
{
if
(
width
<
height
)
{
if
(
page_ratio
<
window_ratio
)
{
zathura_document_set_scale
(
zathura
->
document
,
width
/
total_height
);
}
else
{
zathura_document_set_scale
(
zathura
->
document
,
height
/
total_width
);
...
...
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