From 6f8d68350e0c1b8dc8765182a34d0b03972a0b82 Mon Sep 17 00:00:00 2001 From: Matthew Rahtz Date: Thu, 18 Nov 2010 15:15:08 +0000 Subject: [PATCH] various cursor-related fixes and reorganisation A callback has been added in settings.c, called on the "property-changed" event of the xsettings channel of xfconf, enabling cursor's theme and size to be changed without restart of xfwm4. To facilitate this, spinning_cursor.c has been renamed cursors.c, into which various cursor-related functions have been consolidated and added, including ones for creation and freeing of cursors. --- po/POTFILES.in | 2 +- src/Makefile.am | 4 +- src/client.c | 1 + src/cursors.c | 178 ++++++++++++++++++++++++++++++++++++++++++++ src/cursors.h | 41 ++++++++++ src/display.c | 85 +-------------------- src/display.h | 5 - src/main.c | 2 +- src/moveresize.c | 1 + src/settings.c | 32 ++++++++ src/spinning_cursor.c | 91 ---------------------- src/spinning_cursor.h | 35 --------- src/startup_notification.c | 1 + 13 files changed, 261 insertions(+), 217 deletions(-) create mode 100644 src/cursors.c create mode 100644 src/cursors.h delete mode 100644 src/spinning_cursor.c delete mode 100644 src/spinning_cursor.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 9ba1762..e721b55 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -34,7 +34,7 @@ src/poswin.c src/screen.c src/session.c src/settings.c -src/spinning_cursor.c +src/cursors.c src/stacking.c src/startup_notification.c src/stock_icons.c diff --git a/src/Makefile.am b/src/Makefile.am index c13a2b9..1e41a69 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -55,8 +55,8 @@ xfwm4_SOURCES = \ session.h \ settings.c \ settings.h \ - spinning_cursor.c \ - spinning_cursor.h \ + cursors.c \ + cursors.h \ stacking.c \ stacking.h \ startup_notification.c \ diff --git a/src/client.c b/src/client.c index c603d96..170ec75 100644 --- a/src/client.c +++ b/src/client.c @@ -63,6 +63,7 @@ #include "workspaces.h" #include "xsync.h" #include "event_filter.h" +#include "cursors.h" /* Event mask definition */ diff --git a/src/cursors.c b/src/cursors.c new file mode 100644 index 0000000..fcc6e65 --- /dev/null +++ b/src/cursors.c @@ -0,0 +1,178 @@ +/* $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + + + mozilla - (c) 1998 mozilla.org + xfwm4 - (c) 2002-2009 Olivier Fourdan + + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cursors.h" + +#ifndef CURSOR_ROOT +#define CURSOR_ROOT XC_left_ptr +#endif + +#ifndef CURSOR_MOVE +#define CURSOR_MOVE XC_fleur +#endif + +static const unsigned char xlib_spinning_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, + 0xfc, 0x3b, 0x00, 0x00, 0x7c, 0x38, 0x00, 0x00, 0x6c, 0x54, 0x00, 0x00, + 0xc4, 0xdc, 0x00, 0x00, 0xc0, 0x44, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, + 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const unsigned char xlib_spinning_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x3b, 0x00, 0x00, + 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, + 0xee, 0xff, 0x01, 0x00, 0xe4, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, + 0xc0, 0x7f, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static Cursor +cursorCreateSpinning (Display * dpy) +{ + Pixmap cursor; + Pixmap mask; + XColor fg, bg; + Cursor xcursor; + + fg.pixel = 0; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + fg.flags = 0xf; + + bg.pixel = 0xffffffff; + bg.red = 0xffff; + bg.green = 0xffff; + bg.blue = 0xffff; + bg.flags = 0xf; + + cursor = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), + (char *) xlib_spinning_bits, + 32, 32, 0xffffffff, 0x0, 1); + mask = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), + (char *) xlib_spinning_mask_bits, + 32, 32, 0xffffffff, 0x0, 1); + xcursor = XCreatePixmapCursor (dpy, cursor, mask, &fg, &bg, 2, 2); + XFreePixmap (dpy, mask); + XFreePixmap (dpy, cursor); + + return xcursor; +} + +#include + +void +initCursors (DisplayInfo *display) +{ + display->root_cursor = + XCreateFontCursor (display->dpy, CURSOR_ROOT); + display->move_cursor = + XCreateFontCursor (display->dpy, CURSOR_MOVE); + display->busy_cursor = + cursorCreateSpinning (display->dpy); + display->resize_cursor[CORNER_TOP_LEFT] = + XCreateFontCursor (display->dpy, XC_top_left_corner); + display->resize_cursor[CORNER_TOP_RIGHT] = + XCreateFontCursor (display->dpy, XC_top_right_corner); + display->resize_cursor[CORNER_BOTTOM_LEFT] = + XCreateFontCursor (display->dpy, XC_bottom_left_corner); + display->resize_cursor[CORNER_BOTTOM_RIGHT] = + XCreateFontCursor (display->dpy, XC_bottom_right_corner); + display->resize_cursor[CORNER_COUNT + SIDE_LEFT] = + XCreateFontCursor (display->dpy, XC_left_side); + display->resize_cursor[CORNER_COUNT + SIDE_RIGHT] = + XCreateFontCursor (display->dpy, XC_right_side); + display->resize_cursor[CORNER_COUNT + SIDE_TOP] = + XCreateFontCursor (display->dpy, XC_top_side); + display->resize_cursor[CORNER_COUNT + SIDE_BOTTOM] = + XCreateFontCursor (display->dpy, XC_bottom_side); +} + +void +freeCursors (DisplayInfo *display) +{ + int i; + + XFreeCursor (display->dpy, display->root_cursor); + display->root_cursor = None; + XFreeCursor (display->dpy, display->move_cursor); + display->move_cursor = None; + XFreeCursor (display->dpy, display->busy_cursor); + display->busy_cursor = None; + for (i = 0; i < (SIDE_COUNT + CORNER_COUNT); i++) + { + XFreeCursor (display->dpy, display->resize_cursor[i]); + display->resize_cursor[i] = None; + } +} + +Cursor +myDisplayGetCursorRoot (DisplayInfo *display) +{ + g_return_val_if_fail (display, None); + + return display->root_cursor; +} + +Cursor +myDisplayGetCursorBusy (DisplayInfo *display) +{ + g_return_val_if_fail (display, None); + + return display->busy_cursor; +} + + +Cursor +myDisplayGetCursorMove (DisplayInfo *display) +{ + g_return_val_if_fail (display, None); + + return display->move_cursor; +} + +Cursor +myDisplayGetCursorResize (DisplayInfo *display, guint list) +{ + g_return_val_if_fail (display, None); + g_return_val_if_fail (list < 8, None); + + return display->resize_cursor [list]; +} diff --git a/src/cursors.h b/src/cursors.h new file mode 100644 index 0000000..7d44ce3 --- /dev/null +++ b/src/cursors.h @@ -0,0 +1,41 @@ +/* $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + + + mozilla - (c) 1998 mozilla.org + xfwm4 - (c) 2002-2009 Olivier Fourdan + + */ + +#ifndef INC_CURSORS_H +#define INC_CURSORS_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "display.h" + +void initCursors (DisplayInfo *); +void freeCursors (DisplayInfo *); +Cursor myDisplayGetCursorRoot (DisplayInfo *); +Cursor myDisplayGetCursorBusy (DisplayInfo *); +Cursor myDisplayGetCursorMove (DisplayInfo *); +Cursor myDisplayGetCursorResize (DisplayInfo *, guint); + +#endif /* INC_CURSORS_H */ diff --git a/src/display.c b/src/display.c index 6ca9bca..e10da11 100644 --- a/src/display.c +++ b/src/display.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -38,7 +37,7 @@ #include #endif -#include "spinning_cursor.h" +#include "cursors.h" #include "display.h" #include "screen.h" #include "client.h" @@ -48,14 +47,6 @@ #define MAX_HOSTNAME_LENGTH 32 #endif /* MAX_HOSTNAME_LENGTH */ -#ifndef CURSOR_ROOT -#define CURSOR_ROOT XC_left_ptr -#endif - -#ifndef CURSOR_MOVE -#define CURSOR_MOVE XC_fleur -#endif - static int handleXError (Display * dpy, XErrorEvent * err) { @@ -310,28 +301,7 @@ myDisplayInit (GdkDisplay *gdisplay) display->have_xrandr = FALSE; #endif /* HAVE_RANDR */ - display->root_cursor = - XCreateFontCursor (display->dpy, CURSOR_ROOT); - display->move_cursor = - XCreateFontCursor (display->dpy, CURSOR_MOVE); - display->busy_cursor = - cursorCreateSpinning (display->dpy); - display->resize_cursor[CORNER_TOP_LEFT] = - XCreateFontCursor (display->dpy, XC_top_left_corner); - display->resize_cursor[CORNER_TOP_RIGHT] = - XCreateFontCursor (display->dpy, XC_top_right_corner); - display->resize_cursor[CORNER_BOTTOM_LEFT] = - XCreateFontCursor (display->dpy, XC_bottom_left_corner); - display->resize_cursor[CORNER_BOTTOM_RIGHT] = - XCreateFontCursor (display->dpy, XC_bottom_right_corner); - display->resize_cursor[CORNER_COUNT + SIDE_LEFT] = - XCreateFontCursor (display->dpy, XC_left_side); - display->resize_cursor[CORNER_COUNT + SIDE_RIGHT] = - XCreateFontCursor (display->dpy, XC_right_side); - display->resize_cursor[CORNER_COUNT + SIDE_TOP] = - XCreateFontCursor (display->dpy, XC_top_side); - display->resize_cursor[CORNER_COUNT + SIDE_BOTTOM] = - XCreateFontCursor (display->dpy, XC_bottom_side); + initCursors (display); myDisplayCreateTimestampWin (display); @@ -358,16 +328,7 @@ myDisplayInit (GdkDisplay *gdisplay) DisplayInfo * myDisplayClose (DisplayInfo *display) { - int i; - - XFreeCursor (display->dpy, display->busy_cursor); - display->busy_cursor = None; - XFreeCursor (display->dpy, display->move_cursor); - display->move_cursor = None; - XFreeCursor (display->dpy, display->root_cursor); - display->root_cursor = None; - XDestroyWindow (display->dpy, display->timestamp_win); - display->timestamp_win = None; + freeCursors (display); if (display->hostname) { @@ -375,12 +336,6 @@ myDisplayClose (DisplayInfo *display) display->hostname = NULL; } - for (i = 0; i < SIDE_COUNT + CORNER_COUNT; i++) - { - XFreeCursor (display->dpy, display->resize_cursor[i]); - display->resize_cursor[i] = None; - } - g_slist_free (display->clients); display->clients = NULL; @@ -406,40 +361,6 @@ myDisplayHaveRender (DisplayInfo *display) return (display->have_render); } -Cursor -myDisplayGetCursorBusy (DisplayInfo *display) -{ - g_return_val_if_fail (display, None); - - return display->busy_cursor; -} - -Cursor -myDisplayGetCursorMove (DisplayInfo *display) -{ - g_return_val_if_fail (display, None); - - return display->move_cursor; -} - -Cursor -myDisplayGetCursorRoot (DisplayInfo *display) -{ - g_return_val_if_fail (display, None); - - return display->root_cursor; -} - -Cursor -myDisplayGetCursorResize (DisplayInfo *display, guint list) -{ - g_return_val_if_fail (display, None); - g_return_val_if_fail (list < 8, None); - - return display->resize_cursor [list]; -} - - void myDisplayGrabServer (DisplayInfo *display) { diff --git a/src/display.h b/src/display.h index f305274..ffcef8a 100644 --- a/src/display.h +++ b/src/display.h @@ -361,11 +361,6 @@ DisplayInfo *myDisplayInit (GdkDisplay *); DisplayInfo *myDisplayClose (DisplayInfo *); gboolean myDisplayHaveShape (DisplayInfo *); gboolean myDisplayHaveRender (DisplayInfo *); -Cursor myDisplayGetCursorBusy (DisplayInfo *); -Cursor myDisplayGetCursorMove (DisplayInfo *); -Cursor myDisplayGetCursorRoot (DisplayInfo *); -Cursor myDisplayGetCursorResize (DisplayInfo *, - guint); void myDisplayGrabServer (DisplayInfo *); void myDisplayUngrabServer (DisplayInfo *); void myDisplayAddClient (DisplayInfo *, diff --git a/src/main.c b/src/main.c index 15f0947..10d133f 100644 --- a/src/main.c +++ b/src/main.c @@ -60,8 +60,8 @@ #include "session.h" #include "startup_notification.h" #include "compositor.h" -#include "spinning_cursor.h" #include "stock_icons.h" +#include "cursors.h" #define BASE_EVENT_MASK \ SubstructureNotifyMask|\ diff --git a/src/moveresize.c b/src/moveresize.c index 57c303c..49dd33a 100644 --- a/src/moveresize.c +++ b/src/moveresize.c @@ -48,6 +48,7 @@ #include "event_filter.h" #include "workspaces.h" #include "xsync.h" +#include "cursors.h" #define MOVERESIZE_EVENT_MASK \ PointerMotionMask | \ diff --git a/src/settings.c b/src/settings.c index ca0cd7a..2e689af 100644 --- a/src/settings.c +++ b/src/settings.c @@ -34,6 +34,8 @@ #include #include #include +#include /* for XDefineCursor */ +#include /* for XcursorSetTheme and XcursorSetDefaultSize */ #include "screen.h" #include "hints.h" @@ -43,8 +45,10 @@ #include "workspaces.h" #include "compositor.h" #include "ui_style.h" +#include "cursors.h" #define CHANNEL_XFWM "xfwm4" +#define CHANNEL_XSETTINGS "xsettings" #define THEMERC "themerc" #define XPM_COLOR_SYMBOL_SIZE 22 @@ -74,6 +78,10 @@ static void cb_xfwm4_channel_property_changed (XfconfChannel *, const gchar *, const GValue *, ScreenInfo *); +static void cb_xsettings_channel_property_changed (XfconfChannel *, + const gchar *, + const GValue *, + ScreenInfo *); static void cb_keys_changed (GdkKeymap *, ScreenInfo *); static void cb_shortcut_added (XfceShortcutsProvider *, @@ -1008,6 +1016,9 @@ initSettings (ScreenInfo *screen_info) g_signal_connect (screen_info->xfwm4_channel, "property-changed", G_CALLBACK (cb_xfwm4_channel_property_changed), screen_info); + g_signal_connect (xfconf_channel_new(CHANNEL_XSETTINGS), "property-changed", + G_CALLBACK (cb_xsettings_channel_property_changed), screen_info); + keymap = gdk_keymap_get_default (); g_signal_connect (keymap, "keys-changed", G_CALLBACK (cb_keys_changed), screen_info); @@ -1355,6 +1366,27 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_ } static void +cb_xsettings_channel_property_changed(XfconfChannel *channel, const gchar *property_name, const GValue *value, ScreenInfo *screen_info) +{ + DisplayInfo *display = screen_info->display_info; + + if (!strcmp (property_name, "/Gtk/CursorThemeName")) + { + freeCursors (display); + XcursorSetTheme (display->dpy, g_value_get_string (value)); + initCursors (display); + XDefineCursor (display->dpy, screen_info->xroot, display->root_cursor); + } + else if (!strcmp (property_name, "/Gtk/CursorThemeSize")) + { + freeCursors (display); + XcursorSetDefaultSize (display->dpy, g_value_get_int (value)); + initCursors (display); + XDefineCursor (display->dpy, screen_info->xroot, display->root_cursor); + } +} + +static void cb_keys_changed (GdkKeymap *keymap, ScreenInfo *screen_info) { /* Recompute modifiers mask in case it changed */ diff --git a/src/spinning_cursor.c b/src/spinning_cursor.c deleted file mode 100644 index 55dfab5..0000000 --- a/src/spinning_cursor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA. - - - mozilla - (c) 1998 mozilla.org - xfwm4 - (c) 2002-2009 Olivier Fourdan - - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "spinning_cursor.h" - -static const unsigned char xlib_spinning_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x7c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, - 0xfc, 0x3b, 0x00, 0x00, 0x7c, 0x38, 0x00, 0x00, 0x6c, 0x54, 0x00, 0x00, - 0xc4, 0xdc, 0x00, 0x00, 0xc0, 0x44, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, - 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static const unsigned char xlib_spinning_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x3b, 0x00, 0x00, - 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, - 0xee, 0xff, 0x01, 0x00, 0xe4, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, - 0xc0, 0x7f, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -Cursor -cursorCreateSpinning (Display * dpy) -{ - Pixmap cursor; - Pixmap mask; - XColor fg, bg; - Cursor xcursor; - - fg.pixel = 0; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - fg.flags = 0xf; - - bg.pixel = 0xffffffff; - bg.red = 0xffff; - bg.green = 0xffff; - bg.blue = 0xffff; - bg.flags = 0xf; - - cursor = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), - (char *) xlib_spinning_bits, - 32, 32, 0xffffffff, 0x0, 1); - mask = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), - (char *) xlib_spinning_mask_bits, - 32, 32, 0xffffffff, 0x0, 1); - xcursor = XCreatePixmapCursor (dpy, cursor, mask, &fg, &bg, 2, 2); - XFreePixmap (dpy, mask); - XFreePixmap (dpy, cursor); - - return xcursor; -} diff --git a/src/spinning_cursor.h b/src/spinning_cursor.h deleted file mode 100644 index 38cf759..0000000 --- a/src/spinning_cursor.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA. - - - mozilla - (c) 1998 mozilla.org - xfwm4 - (c) 2002-2009 Olivier Fourdan - - */ - -#ifndef INC_SPINNING_CURSOR_H -#define INC_SPINNING_CURSOR_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -Cursor cursorCreateSpinning (Display *); - -#endif /* INC_SPINNING_CURSOR_H */ diff --git a/src/startup_notification.c b/src/startup_notification.c index c91292a..ff566e6 100644 --- a/src/startup_notification.c +++ b/src/startup_notification.c @@ -44,6 +44,7 @@ #include "screen.h" #include "client.h" #include "startup_notification.h" +#include "cursors.h" #define STARTUP_TIMEOUT (30 /* seconds */ * 1000) -- 1.7.3.2