Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
squeekboard
Commits
383c93a4
Commit
383c93a4
authored
Aug 18, 2011
by
Daiki Ueno
Browse files
Fix fit-size calculation.
parent
860fbe8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
eek/eek-gtk-renderer.c
View file @
383c93a4
...
...
@@ -87,10 +87,16 @@ eek_gtk_renderer_real_render_key_icon (EekRenderer *self,
width
=
gdk_pixbuf_get_width
(
pixbuf
);
height
=
gdk_pixbuf_get_height
(
pixbuf
);
if
(
bounds
.
width
*
height
<
bounds
.
height
*
width
)
scale
=
bounds
.
width
/
width
;
else
scale
=
bounds
.
height
/
height
;
if
(
bounds
.
height
*
width
/
bounds
.
width
<=
height
)
scale
=
width
/
bounds
.
width
;
else
if
(
bounds
.
width
*
height
/
bounds
.
height
<=
width
)
scale
=
height
/
bounds
.
height
;
else
{
if
(
bounds
.
width
*
height
<
bounds
.
height
*
width
)
scale
=
bounds
.
width
/
width
;
else
scale
=
bounds
.
height
/
height
;
}
cairo_save
(
cr
);
cairo_translate
(
cr
,
...
...
eek/eek-renderer.c
View file @
383c93a4
...
...
@@ -880,8 +880,17 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
priv
->
allocation_height
=
height
;
eek_element_get_bounds
(
EEK_ELEMENT
(
priv
->
keyboard
),
&
bounds
);
scale
=
width
>
height
?
height
/
bounds
.
height
:
width
/
bounds
.
width
;
if
(
bounds
.
height
*
width
/
bounds
.
width
<=
height
)
scale
=
width
/
bounds
.
width
;
else
if
(
bounds
.
width
*
height
/
bounds
.
height
<=
width
)
scale
=
height
/
bounds
.
height
;
else
{
if
(
bounds
.
width
*
height
<
bounds
.
height
*
width
)
scale
=
bounds
.
width
/
width
;
else
scale
=
bounds
.
height
/
height
;
}
if
(
scale
!=
priv
->
scale
)
{
priv
->
scale
=
scale
;
...
...
Write
Preview
Markdown
is supported
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