[gnome-screensaver] Use GDK_CURSOR_BLANK instead of empty bitmap



commit 3bd19f9c3562a38daa489d41fc8c2e6187d542d0
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 29 11:51:48 2010 -0400

    Use GDK_CURSOR_BLANK instead of empty bitmap
    
    Ever since gtk 2.16, we've had an explicit blank cursor, in
    GDK.  Prior to that, applications had to use tricks involving
    empty bitmaps.
    
    This commit moves gnome-screensaver from the empty bitmap trick
    to the blank cursor.
    
    It simplifies the code and paves the way to gtk3 support, which
    lacks GdkBitmaps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630593

 src/gs-grab-x11.c   |   27 +--------------------------
 src/gs-window-x11.c |   17 +----------------
 2 files changed, 2 insertions(+), 42 deletions(-)
---
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index eeb8651..2e03ddd 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -58,31 +58,6 @@ struct GSGrabPrivate
         GtkWidget *invisible;
 };
 
-static GdkCursor *
-get_cursor (void)
-{
-        GdkBitmap *empty_bitmap;
-        GdkCursor *cursor;
-        GdkColor   useless;
-        char       invisible_cursor_bits [] = { 0x0 };
-
-        useless.red = useless.green = useless.blue = 0;
-        useless.pixel = 0;
-
-        empty_bitmap = gdk_bitmap_create_from_data (NULL,
-                                                    invisible_cursor_bits,
-                                                    1, 1);
-
-        cursor = gdk_cursor_new_from_pixmap (empty_bitmap,
-                                             empty_bitmap,
-                                             &useless,
-                                             &useless, 0, 0);
-
-        g_object_unref (empty_bitmap);
-
-        return cursor;
-}
-
 static const char *
 grab_string (int status)
 {
@@ -201,7 +176,7 @@ gs_grab_get_mouse (GSGrab    *grab,
         g_return_val_if_fail (window != NULL, FALSE);
         g_return_val_if_fail (screen != NULL, FALSE);
 
-        cursor = get_cursor ();
+        cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
 
         gs_debug ("Grabbing mouse widget=%X", (guint32) GDK_WINDOW_XID (window));
         status = gdk_pointer_grab (window, TRUE, 0, NULL,
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index fce98d9..3e3180b 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -144,25 +144,10 @@ static void
 set_invisible_cursor (GdkWindow *window,
                       gboolean   invisible)
 {
-        GdkBitmap *empty_bitmap;
         GdkCursor *cursor = NULL;
-        GdkColor   useless;
-        char       invisible_cursor_bits [] = { 0x0 };
 
         if (invisible) {
-                useless.red = useless.green = useless.blue = 0;
-                useless.pixel = 0;
-
-                empty_bitmap = gdk_bitmap_create_from_data (window,
-                                                            invisible_cursor_bits,
-                                                            1, 1);
-
-                cursor = gdk_cursor_new_from_pixmap (empty_bitmap,
-                                                     empty_bitmap,
-                                                     &useless,
-                                                     &useless, 0, 0);
-
-                g_object_unref (empty_bitmap);
+                cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
         }
 
         gdk_window_set_cursor (window, cursor);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]