summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-03-31 21:36:37 +0000
committerphintuka <phintuka>2008-03-31 21:36:37 +0000
commit224e30034054603bc6b7f1be04a9117809b03155 (patch)
tree301cc201b4f7719f400058c42b929fb259355270
parent5325e0c5448138081a7bf76086a6193d8baa7ad9 (diff)
downloadxineliboutput-224e30034054603bc6b7f1be04a9117809b03155.tar.gz
xineliboutput-224e30034054603bc6b7f1be04a9117809b03155.tar.bz2
Move code to enable/disable cursor to separate function
(Patch from Antti Seppälä and Rolf Ahrenberg)
-rw-r--r--xine_sxfe_frontend.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c
index e1567817..7256f77b 100644
--- a/xine_sxfe_frontend.c
+++ b/xine_sxfe_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_sxfe_frontend.c,v 1.32 2008-03-28 22:17:17 phintuka Exp $
+ * $Id: xine_sxfe_frontend.c,v 1.33 2008-03-31 21:36:37 phintuka Exp $
*
*/
@@ -370,6 +370,25 @@ static void set_above(sxfe_t *this, int stay_above)
#endif
}
+static void set_cursor(Display *dpy, Window win, const int enable)
+{
+ if(enable)
+ XDefineCursor(dpy, win, None);
+ else {
+ /* no cursor */
+ static char bm_no_data[] = { 0,0,0,0, 0,0,0,0 };
+ Pixmap bm_no;
+ Cursor no_ptr;
+ XColor black, dummy;
+ bm_no = XCreateBitmapFromData(dpy, win, bm_no_data, 8, 8);
+ XAllocNamedColor(dpy, DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
+ "black", &black, &dummy);
+ no_ptr = XCreatePixmapCursor(dpy, bm_no, bm_no, &black, &black, 0, 0);
+ XDefineCursor(dpy, win, None);
+ XDefineCursor(dpy, win, no_ptr);
+ }
+}
+
/*
* sxfe_display_open
*
@@ -567,19 +586,8 @@ static int sxfe_display_open(frontend_t *this_gen, int width, int height, int fu
this->atom_wm_delete_window = XInternAtom(this->display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(this->display, this->window[this->fullscreen ? 1 : 0], &(this->atom_wm_delete_window), 1);
- if(this->window_id <= 0) {
- /* no cursor */
- static char bm_no_data[] = { 0,0,0,0, 0,0,0,0 };
- Pixmap bm_no;
- Cursor no_ptr;
- XColor black, dummy;
- bm_no = XCreateBitmapFromData(this->display, this->window[this->fullscreen ? 1 : 0], bm_no_data, 8, 8);
- XAllocNamedColor(this->display, DefaultColormapOfScreen(DefaultScreenOfDisplay(this->display)),
- "black", &black, &dummy);
- no_ptr = XCreatePixmapCursor(this->display, bm_no, bm_no, &black, &black, 0, 0);
- XDefineCursor(this->display, this->window[1], None);
- XDefineCursor(this->display, this->window[1], no_ptr);
- }
+ if(this->window_id <= 0)
+ set_cursor(this->display, this->window[1], 0);
XUnlockDisplay (this->display);