/*
- * Geeqie
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <glib/gprintf.h>
gint ret;
gint x = 0;
gint y = 0;
-
+
/* LIRC code and corresponding geeqie command (and parameters)*/
gchar *code;
gchar *cmd;
ptr = cmd + 4;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
x -= i_parm;
}
ptr = cmd + 5;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
x += i_parm;
}
ptr = cmd + 2;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
y -= i_parm;
}
ptr = cmd + 4;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
y += i_parm;
}
ptr = cmd + 7;
while (g_ascii_isspace(*ptr)) ptr++;
fl_parm = atoi(ptr) / 10.0;
-
+
if (fl_parm <= 0.01) fl_parm = get_zoom_increment();
layout_image_zoom_adjust(lw, fl_parm, FALSE);
}
ptr = cmd + 8;
while (g_ascii_isspace(*ptr)) ptr++;
fl_parm = atoi(ptr) / 10.0;
-
+
if (fl_parm <= 0.01) fl_parm = get_zoom_increment();
layout_image_zoom_adjust(lw, -fl_parm, FALSE);
}
ptr = cmd + 8;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
layout_image_zoom_set(lw, 1.0, FALSE);
}
ptr = cmd + 12;
while (g_ascii_isspace(*ptr)) ptr++;
i_parm = atoi(ptr);
-
+
if (i_parm <= 0) i_parm = 1;
layout_image_zoom_set(lw, -i_parm, FALSE);
}
void layout_image_lirc_init(LayoutWindow *lw)
{
gint flags;
-
- DEBUG_1("Initializing LIRC...");
- lirc_fd = lirc_init(GQ_APPNAME_LC, get_debug_level() > 0);
+ gboolean lirc_verbose = (get_debug_level() >= 2);
+
+ lirc_fd = lirc_init(GQ_APPNAME_LC, lirc_verbose);
if (lirc_fd == -1)
{
- g_fprintf(stderr, _("Could not init LIRC support\n"));
+ DEBUG_1("Initializing LIRC... failed");
return;
}
+
+ DEBUG_1("Initializing LIRC... OK");
if (lirc_readconfig(NULL, &config, NULL) == -1)
{
lirc_deinit();
+
g_fprintf(stderr,
_("could not read LIRC config file\n"
"please read the documentation of LIRC to \n"
"know how to create a proper config file\n"));
+ fflush(stderr);
+
+ DEBUG_1("Failed to read LIRC config file");
return;
}
+ if (lirc_verbose) fflush(stderr);
+
gio_chan = g_io_channel_unix_new(lirc_fd);
input_tag = g_io_add_watch(gio_chan, G_IO_IN,
lirc_input_callback, lw);
fcntl(lirc_fd, F_SETOWN, getpid());
flags = fcntl(lirc_fd, F_GETFL, 0);
if (flags != -1) fcntl(lirc_fd, F_SETFL, flags|O_NONBLOCK);
- fflush(stderr);
}
#endif /* HAVE_LIRC */