Skip to content
Snippets Groups Projects
Commit 78a066bc authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Use SIGUSR1/SIGUSR2 in slideshow mode to change images

parent 231d1264
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ git HEAD ...@@ -13,6 +13,7 @@ git HEAD
* Draw a nice little message when in caption editing mode with empty * Draw a nice little message when in caption editing mode with empty
caption (to indicate that caption editing is actually active) caption (to indicate that caption editing is actually active)
* caption mode: Automatically create caption directory if it doesn't exist * caption mode: Automatically create caption directory if it doesn't exist
* Slideshow mode: SIGUSR1 = next image, SIGUSR2 = previous image
Sat Jun 5 21:35:25 CEST 2010 Daniel Friesel <derf@chaosdorf.de Sat Jun 5 21:35:25 CEST 2010 Daniel Friesel <derf@chaosdorf.de
......
...@@ -27,8 +27,10 @@ multiwindow.o: multiwindow.c feh.h structs.h menu.h ipc.h utils.h \ ...@@ -27,8 +27,10 @@ multiwindow.o: multiwindow.c feh.h structs.h menu.h ipc.h utils.h \
getopt.h debug.h winwidget.h timers.h filelist.h options.h getopt.h debug.h winwidget.h timers.h filelist.h options.h
options.o: options.c feh.h structs.h menu.h ipc.h utils.h getopt.h \ options.o: options.c feh.h structs.h menu.h ipc.h utils.h getopt.h \
debug.h filelist.h options.h debug.h filelist.h options.h
signals.o: signals.c feh.h structs.h menu.h ipc.h utils.h getopt.h \
debug.h winwidget.h
slideshow.o: slideshow.c feh.h structs.h menu.h ipc.h utils.h getopt.h \ slideshow.o: slideshow.c feh.h structs.h menu.h ipc.h utils.h getopt.h \
debug.h filelist.h timers.h winwidget.h options.h debug.h filelist.h timers.h winwidget.h options.h signals.h
support.o: support.c feh.h structs.h menu.h ipc.h utils.h getopt.h \ support.o: support.c feh.h structs.h menu.h ipc.h utils.h getopt.h \
debug.h filelist.h options.h support.h debug.h filelist.h options.h support.h
thumbnail.o: thumbnail.c feh.h structs.h menu.h ipc.h utils.h getopt.h \ thumbnail.o: thumbnail.c feh.h structs.h menu.h ipc.h utils.h getopt.h \
......
/* signals.c
Copyright (C) 2010 by Daniel Friesel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies of the Software and its documentation and acknowledgment shall be
given in the documentation and software packages that this Software was
used.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "feh.h"
#include "winwidget.h"
void feh_handle_signal(int);
void setup_signal_handlers()
{
struct sigaction feh_sh;
sigset_t feh_ss;
D_ENTER(4);
sigemptyset(&feh_ss);
sigaddset(&feh_ss, SIGUSR1);
sigaddset(&feh_ss, SIGUSR2);
feh_sh.sa_handler = feh_handle_signal;
feh_sh.sa_mask = feh_ss;
sigaction(SIGUSR1, &feh_sh, NULL);
sigaction(SIGUSR2, &feh_sh, NULL);
D_RETURN_(4);
}
void feh_handle_signal(int signo)
{
D_ENTER(4);
winwidget winwid
= winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW);
if (winwid) {
if (signo == SIGUSR1)
slideshow_change_image(winwid, SLIDE_NEXT);
else if (signo == SIGUSR2)
slideshow_change_image(winwid, SLIDE_PREV);
}
D_RETURN_(4);
}
/* signals.h
Copyright (C) 2010 by Daniel Friesel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies of the Software and its documentation and acknowledgment shall be
given in the documentation and software packages that this Software was
used.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SIGNALS_H
#define SIGNALS_H
void setup_signal_handlers();
#endif
...@@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "timers.h" #include "timers.h"
#include "winwidget.h" #include "winwidget.h"
#include "options.h" #include "options.h"
#include "signals.h"
void init_slideshow_mode(void) void init_slideshow_mode(void)
{ {
...@@ -75,6 +76,9 @@ void init_slideshow_mode(void) ...@@ -75,6 +76,9 @@ void init_slideshow_mode(void)
} }
if (!success) if (!success)
show_mini_usage(); show_mini_usage();
setup_signal_handlers();
D_RETURN_(3); D_RETURN_(3);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment