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
2bb1b9e3
Commit
2bb1b9e3
authored
12 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
patch by sdaau: button bindings for zoom in / out
parent
acae8f06
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
ChangeLog
+1
-0
1 addition, 0 deletions
ChangeLog
examples/buttons
+4
-0
4 additions, 0 deletions
examples/buttons
man/feh.pre
+9
-0
9 additions, 0 deletions
man/feh.pre
src/events.c
+60
-0
60 additions, 0 deletions
src/events.c
src/options.h
+2
-0
2 additions, 0 deletions
src/options.h
with
76 additions
and
0 deletions
ChangeLog
+
1
−
0
View file @
2bb1b9e3
...
...
@@ -6,6 +6,7 @@ git HEAD
* Use "feh -" to read image from stdin
* Fix Imlib2 and X11 warnings when opening a URL that returned an HTTP
error
* Add button bindings to zoom in / out (patch by sdaau)
Mon, 24 Dec 2012 15:45:54 +0100 Daniel Friesel <derf+feh@finalrewind.org>
...
...
This diff is collapsed.
Click to expand it.
examples/buttons
+
4
−
0
View file @
2bb1b9e3
...
...
@@ -11,3 +11,7 @@
# Switch menu and zoom keys, useful for two-button touchpads
menu 2
zoom 3
# make scroll wheel (mousewheel up and down) zoom, instead of flipping images
zoom_in 4
zoom_out 5
\ No newline at end of file
This diff is collapsed.
Click to expand it.
man/feh.pre
+
9
−
0
View file @
2bb1b9e3
...
...
@@ -1376,6 +1376,15 @@ Blur current image
.
Rotate current image
.
.It unbound Bq zoom_in
.
Zoom in
.
.It unbound Bq zoom_out
.
Zoom out
.
.
.El
.
.
...
...
This diff is collapsed.
Click to expand it.
src/events.c
+
60
−
0
View file @
2bb1b9e3
...
...
@@ -152,6 +152,10 @@ void init_buttonbindings(void)
cur_bb
=
&
buttons
.
blur
;
else
if
(
!
strcmp
(
action
,
"rotate"
))
cur_bb
=
&
buttons
.
rotate
;
else
if
(
!
strcmp
(
action
,
"zoom_in"
))
cur_bb
=
&
buttons
.
zoom_in
;
else
if
(
!
strcmp
(
action
,
"zoom_out"
))
cur_bb
=
&
buttons
.
zoom_out
;
else
weprintf
(
"buttons: Invalid action: %s"
,
action
);
...
...
@@ -246,6 +250,62 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
winwid
->
im_click_offset_y
=
(
winwid
->
click_offset_y
-
winwid
->
im_y
)
/
winwid
->
old_zoom
;
}
else
if
(
feh_is_bb
(
&
buttons
.
zoom_in
,
button
,
state
))
{
D
((
"Zoom_In Button Press event
\n
"
));
D
((
"click offset is %d,%d
\n
"
,
ev
->
xbutton
.
x
,
ev
->
xbutton
.
y
));
winwid
->
click_offset_x
=
ev
->
xbutton
.
x
;
winwid
->
click_offset_y
=
ev
->
xbutton
.
y
;
winwid
->
old_zoom
=
winwid
->
zoom
;
/* required to adjust the image position in zoom mode */
winwid
->
im_click_offset_x
=
(
winwid
->
click_offset_x
-
winwid
->
im_x
)
/
winwid
->
old_zoom
;
winwid
->
im_click_offset_y
=
(
winwid
->
click_offset_y
-
winwid
->
im_y
)
/
winwid
->
old_zoom
;
/* copied from zoom_in, keyevents.c */
winwid
->
zoom
=
winwid
->
zoom
*
1
.
25
;
if
(
winwid
->
zoom
>
ZOOM_MAX
)
winwid
->
zoom
=
ZOOM_MAX
;
/* copied from below (ZOOM, feh_event_handle_MotionNotify) */
winwid
->
im_x
=
winwid
->
click_offset_x
-
(
winwid
->
im_click_offset_x
*
winwid
->
zoom
);
winwid
->
im_y
=
winwid
->
click_offset_y
-
(
winwid
->
im_click_offset_y
*
winwid
->
zoom
);
winwidget_sanitise_offsets
(
winwid
);
winwidget_render_image
(
winwid
,
0
,
0
);
}
else
if
(
feh_is_bb
(
&
buttons
.
zoom_out
,
button
,
state
))
{
D
((
"Zoom_Out Button Press event
\n
"
));
D
((
"click offset is %d,%d
\n
"
,
ev
->
xbutton
.
x
,
ev
->
xbutton
.
y
));
winwid
->
click_offset_x
=
ev
->
xbutton
.
x
;
winwid
->
click_offset_y
=
ev
->
xbutton
.
y
;
winwid
->
old_zoom
=
winwid
->
zoom
;
/* required to adjust the image position in zoom mode */
winwid
->
im_click_offset_x
=
(
winwid
->
click_offset_x
-
winwid
->
im_x
)
/
winwid
->
old_zoom
;
winwid
->
im_click_offset_y
=
(
winwid
->
click_offset_y
-
winwid
->
im_y
)
/
winwid
->
old_zoom
;
/* copied from zoom_out, keyevents.c */
winwid
->
zoom
=
winwid
->
zoom
*
0
.
80
;
if
(
winwid
->
zoom
<
ZOOM_MIN
)
winwid
->
zoom
=
ZOOM_MIN
;
/* copied from below (ZOOM, feh_event_handle_MotionNotify) */
winwid
->
im_x
=
winwid
->
click_offset_x
-
(
winwid
->
im_click_offset_x
*
winwid
->
zoom
);
winwid
->
im_y
=
winwid
->
click_offset_y
-
(
winwid
->
im_click_offset_y
*
winwid
->
zoom
);
winwidget_sanitise_offsets
(
winwid
);
winwidget_render_image
(
winwid
,
0
,
0
);
}
else
if
(
feh_is_bb
(
&
buttons
.
reload
,
button
,
state
))
{
D
((
"Reload Button Press event
\n
"
));
feh_reload_image
(
winwid
,
0
,
1
);
...
...
This diff is collapsed.
Click to expand it.
src/options.h
+
2
−
0
View file @
2bb1b9e3
...
...
@@ -207,6 +207,8 @@ struct __fehbb {
struct
__fehbutton
menu
;
struct
__fehbutton
blur
;
struct
__fehbutton
rotate
;
struct
__fehbutton
zoom_in
;
struct
__fehbutton
zoom_out
;
};
void
init_parse_options
(
int
argc
,
char
**
argv
);
...
...
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