summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--man/feh.12
-rw-r--r--src/keyevents.c5
-rw-r--r--src/winwidget.c31
-rw-r--r--src/winwidget.h2
5 files changed, 30 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 749d0f6..4e4ce35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ git HEAD
* Fix memory leak related to the menu
* Make --start-at work with filenames instead of list positions
+ * Add keybinding to toggle pointer visibility (see --hide-pointer)
Thu Apr 22 22:28:09 CEST 2010 Daniel Friesel <derf@chaosdorf.de>
diff --git a/man/feh.1 b/man/feh.1
index 9d1bea0..b0d6cae 100644
--- a/man/feh.1
+++ b/man/feh.1
@@ -537,6 +537,8 @@ Show next image
Reload current image. Useful for webcams
.It v , V
Toggle fullscreen
+.It o, O
+Toggle pointer visibility
.It m , M
Show menu
.It c , C
diff --git a/src/keyevents.c b/src/keyevents.c
index 4924bcb..eeb3d1e 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -322,6 +322,11 @@ void feh_event_handle_keypress(XEvent * ev)
if (opt.slideshow)
slideshow_change_image(winwid, SLIDE_NEXT);
break;
+ case 'o':
+ case 'O':
+ winwidget_set_pointer(winwid, opt.hide_pointer);
+ opt.hide_pointer = !opt.hide_pointer;
+ break;
case 'p':
case 'P':
case '\b':
diff --git a/src/winwidget.c b/src/winwidget.c
index 4a649bd..ddf6372 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -32,7 +32,6 @@ static void winwidget_unregister(winwidget win);
static void winwidget_register(winwidget win);
static winwidget winwidget_allocate(void);
-static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
int window_num = 0; /* For window list */
winwidget *windows = NULL; /* List of windows to loop though */
@@ -280,16 +279,8 @@ void winwidget_create_window(winwidget ret, int w, int h)
XSetWMNormalHints(disp, ret->win, &xsz);
XMoveWindow(disp, ret->win, x, y);
}
- if (ret->full_screen && opt.hide_pointer) {
- Cursor no_ptr;
- XColor black, dummy;
- Pixmap bm_no;
- bm_no = XCreateBitmapFromData(disp, ret->win, bm_no_data, 8, 8);
- XAllocNamedColor(disp, DefaultColormapOfScreen(DefaultScreenOfDisplay(disp)), "black", &black, &dummy);
-
- no_ptr = XCreatePixmapCursor(disp, bm_no, bm_no, &black, &black, 0, 0);
- XDefineCursor(disp, ret->win, no_ptr);
- }
+ if (ret->full_screen && opt.hide_pointer)
+ winwidget_set_pointer(ret, 0);
/* set the icon name property */
XSetIconName(disp, ret->win, "feh");
@@ -975,6 +966,24 @@ void winwidget_size_to_image(winwidget winwid)
D_RETURN_(4);
}
+void winwidget_set_pointer(winwidget winwid, int visible)
+{
+ Cursor no_ptr;
+ XColor black, dummy;
+ Pixmap bm_no;
+ static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ if (visible)
+ XUndefineCursor(disp, winwid->win);
+ else {
+ bm_no = XCreateBitmapFromData(disp, winwid->win, bm_no_data, 8, 8);
+ XAllocNamedColor(disp, DefaultColormapOfScreen(DefaultScreenOfDisplay(disp)), "black", &black, &dummy);
+
+ no_ptr = XCreatePixmapCursor(disp, bm_no, bm_no, &black, &black, 0, 0);
+ XDefineCursor(disp, winwid->win, no_ptr);
+ }
+}
+
int winwidget_get_width(winwidget winwid)
{
int rect[4];
diff --git a/src/winwidget.h b/src/winwidget.h
index 137ceda..37e0624 100644
--- a/src/winwidget.h
+++ b/src/winwidget.h
@@ -131,6 +131,8 @@ void winwidget_rerender_all(int resize, int alias);
void winwidget_destroy_xwin(winwidget winwid);
int winwidget_count(void);
+void winwidget_set_pointer(winwidget winwid, int visible);
+
void winwidget_get_geometry(winwidget winwid, int *rect);
int winwidget_get_width(winwidget winwid);
int winwidget_get_height(winwidget winwid);