Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ endif

# We need X11 to workaround a bug, see http://stackoverflow.com/questions/18647475
ifeq ($(filter x11, $(shell pkg-config --errors-to-stdout --variable=target gtk+-$(GTK_VERSION).0; pkg-config --errors-to-stdout --variable=targets gtk+-$(GTK_VERSION).0)), x11)
LIBS+=x11
LIBS+=x11 xext
endif

# Add backend-specific libraries and objects
Expand Down
20 changes: 19 additions & 1 deletion pqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include <cairo/cairo-xlib.h>

#if GTK_MAJOR_VERSION < 3
Expand Down Expand Up @@ -291,10 +292,12 @@ gboolean option_hide_info_box = FALSE;
gboolean option_start_fullscreen = FALSE;
gdouble option_initial_scale = 1.0;
gboolean option_start_with_slideshow_mode = FALSE;
gboolean option_click_through = FALSE;
gboolean option_sort = FALSE;
enum { NAME, MTIME } option_sort_key = NAME;
gboolean option_shuffle = FALSE;
gboolean option_transparent_background = FALSE;
gboolean option_keep_above = FALSE;
gboolean option_watch_directories = FALSE;
gboolean option_wait_for_images_to_appear = FALSE;
gboolean option_fading = FALSE;
Expand Down Expand Up @@ -389,6 +392,7 @@ PQIV_DISABLE_PEDANTIC
// implemented for option parsing.
GOptionEntry options[] = {
{ "transparent-background", 'c', 0, G_OPTION_ARG_NONE, &option_transparent_background, "Borderless transparent window", NULL },
{ "keep-above", 0,0, G_OPTION_ARG_NONE, &option_keep_above, "Keep window above others", NULL },
{ "slideshow-interval", 'd', 0, G_OPTION_ARG_DOUBLE, &option_slideshow_interval, "Set slideshow interval", "n" },
{ "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &option_start_fullscreen, "Start in fullscreen mode", NULL },
{ "fade", 'F', 0, G_OPTION_ARG_NONE, (gpointer)&option_fading, "Fade between images", NULL },
Expand All @@ -403,6 +407,7 @@ GOptionEntry options[] = {
{ "scale-images-up", 't', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &option_scale_level_callback, "Scale images up to fill the whole screen", NULL },
{ "window-title", 'T', 0, G_OPTION_ARG_STRING, &option_window_title, "Set the title of the window. See manpage for available variables.", "TITLE" },
{ "zoom-level", 'z', 0, G_OPTION_ARG_DOUBLE, &option_initial_scale, "Set initial zoom level (1.0 is 100%)", "FLOAT" },
{ "click-through", 0, 0, G_OPTION_ARG_NONE, &option_click_through, "Window does not accept mouse input", NULL },

#ifndef CONFIGURED_WITHOUT_EXTERNAL_COMMANDS
{ "command-1", '1', 0, G_OPTION_ARG_STRING, &external_image_filter_commands[0], "Bind the external COMMAND to key 1. See manpage for extended usage (commands starting with `>' or `|'). Use 2..9 for further commands.", "COMMAND" },
Expand Down Expand Up @@ -6631,6 +6636,20 @@ gboolean window_configure_callback(GtkWidget *widget, GdkEventConfigure *event,
}
#endif

if(option_click_through) {
Display *display = GDK_SCREEN_XDISPLAY(gdk_screen_get_default());
unsigned long window_xid = gdk_x11_window_get_xid(gtk_widget_get_window(GTK_WIDGET(main_window)));
Region region = XCreateRegion();
XRectangle rectangle = { 0, 0, 1, 1 };
XUnionRectWithRegion(&rectangle, region, region);
XShapeCombineRegion(display, window_xid, ShapeInput, 0, 0, region, ShapeSet);
XDestroyRegion(region);
}

if(option_keep_above) {
gtk_window_set_keep_above(main_window, TRUE);
}

return FALSE;
}/*}}}*/
void handle_input_event(guint key_binding_value);
Expand Down Expand Up @@ -6907,7 +6926,6 @@ gboolean window_button_release_callback(GtkWidget *widget, GdkEventButton *event
if(option_transparent_background) {
gtk_window_set_decorated(main_window, !gtk_window_get_decorated(main_window));
}

// All other bindings are only handled in fullscreen.
return FALSE;
}
Expand Down