Clean up handling of _gdk_win32_grab_cursor

This is a variable holding a ref to an object, so it is
a great case to use g_set_object and g_clear_object.

 # Please enter the commit message for your changes. Lines starting
This commit is contained in:
Matthias Clasen 2015-10-17 12:45:25 -04:00
parent 00b39e4a82
commit c860492359

View File

@ -266,10 +266,9 @@ gdk_device_virtual_grab (GdkDevice *device,
{
if (GetCursor () == GDK_WIN32_CURSOR (_gdk_win32_grab_cursor)->hcursor)
SetCursor (NULL);
g_clear_object (&_gdk_win32_grab_cursor);
}
_gdk_win32_grab_cursor = (cursor == NULL) ? NULL : g_object_ref (cursor);
g_set_object (&_gdk_win32_grab_cursor, cursor);
if (_gdk_win32_grab_cursor != NULL)
SetCursor (GDK_WIN32_CURSOR (_gdk_win32_grab_cursor)->hcursor);
@ -303,9 +302,8 @@ gdk_device_virtual_ungrab (GdkDevice *device,
{
if (GetCursor () == GDK_WIN32_CURSOR (_gdk_win32_grab_cursor)->hcursor)
SetCursor (NULL);
g_clear_object (&_gdk_win32_grab_cursor);
}
_gdk_win32_grab_cursor = NULL;
g_clear_object (&_gdk_win32_grab_cursor);
ReleaseCapture ();
}