summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyevents.c5
-rw-r--r--src/winwidget.c31
-rw-r--r--src/winwidget.h2
3 files changed, 27 insertions, 11 deletions
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);