summaryrefslogtreecommitdiff
path: root/src/winwidget.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-03 21:35:30 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-03 21:35:30 +0200
commit72b77e61ce4030114558fc794e431a30657126d7 (patch)
tree8e8795f4a33be9ecf7e546d64f17f4a0913d055c /src/winwidget.c
parenta067d336ff8d64565661c61ec749ca9dc5ab50ee (diff)
Add keybinding to toggle cursor visibility at runtime
Diffstat (limited to 'src/winwidget.c')
-rw-r--r--src/winwidget.c31
1 files changed, 20 insertions, 11 deletions
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];