Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
feh
Commits
81963c7b
Commit
81963c7b
authored
7 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
add (experimental and still slightly buggy) --inner-geometry feature
See #278
parent
ec974e9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/options.c
+5
-0
5 additions, 0 deletions
src/options.c
src/options.h
+5
-0
5 additions, 0 deletions
src/options.h
src/winwidget.c
+26
-0
26 additions, 0 deletions
src/winwidget.c
with
36 additions
and
0 deletions
src/options.c
+
5
−
0
View file @
81963c7b
...
...
@@ -416,6 +416,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
{
"no-recursive"
,
0
,
0
,
241
},
{
"cache-size"
,
1
,
0
,
243
},
{
"version-sort"
,
0
,
0
,
246
},
{
"inner-geometry"
,
1
,
0
,
247
},
{
0
,
0
,
0
,
0
}
};
int
optch
=
0
,
cmdx
=
0
;
...
...
@@ -784,6 +785,10 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
case
246
:
opt
.
version_sort
=
1
;
break
;
case
247
:
opt
.
inner_geom_flags
=
XParseGeometry
(
optarg
,
&
opt
.
inner_geom_x
,
&
opt
.
inner_geom_y
,
&
opt
.
inner_geom_w
,
&
opt
.
inner_geom_h
);
break
;
default:
break
;
}
...
...
This diff is collapsed.
Click to expand it.
src/options.h
+
5
−
0
View file @
81963c7b
...
...
@@ -111,6 +111,11 @@ struct __fehoptions {
int
geom_y
;
unsigned
int
geom_w
;
unsigned
int
geom_h
;
int
inner_geom_flags
;
int
inner_geom_x
;
int
inner_geom_y
;
unsigned
int
inner_geom_w
;
unsigned
int
inner_geom_h
;
int
default_zoom
;
int
zoom_mode
;
unsigned
char
adjust_reload
;
...
...
This diff is collapsed.
Click to expand it.
src/winwidget.c
+
26
−
0
View file @
81963c7b
...
...
@@ -555,6 +555,32 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
winwid
->
im_y
=
(
int
)
(
winwid
->
h
-
(
winwid
->
im_h
*
winwid
->
zoom
))
>>
1
;
}
/*
* Adjust X/Y offset if the image is larger than the window and
* --inner-geometry is set. This will cause odd behaviour when
* zooming an already large image in --inner-geometry mode, but in most
* cases this should be what the user wants. Plus, it doesn't require
* fiddling around in two or three places above, so it's the best
* solution considering a future refactoring of this function.
*/
if
(
need_center
||
resize
)
{
if
((
opt
.
inner_geom_flags
&
XValue
)
&&
(
winwid
->
im_w
*
winwid
->
zoom
)
>
winwid
->
w
)
{
if
(
opt
.
inner_geom_flags
&
XNegative
)
{
winwid
->
im_x
=
winwid
->
w
-
(
winwid
->
im_w
*
winwid
->
zoom
)
-
opt
.
inner_geom_x
;
}
else
{
winwid
->
im_x
=
-
opt
.
inner_geom_x
*
winwid
->
zoom
;
}
}
if
((
opt
.
inner_geom_flags
&
YValue
)
&&
(
winwid
->
im_h
*
winwid
->
zoom
)
>
winwid
->
h
)
{
if
(
opt
.
inner_geom_flags
&
YNegative
)
{
winwid
->
im_y
=
winwid
->
h
-
(
winwid
->
im_h
*
winwid
->
zoom
)
-
opt
.
inner_geom_y
;
}
else
{
winwid
->
im_y
=
-
opt
.
inner_geom_y
*
winwid
->
zoom
;
}
}
}
/* Now we ensure only to render the area we're looking at */
dx
=
winwid
->
im_x
;
dy
=
winwid
->
im_y
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment