[gtk+] Clean up handling of _gdk_win32_grab_cursor
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Clean up handling of _gdk_win32_grab_cursor
- Date: Sat, 17 Oct 2015 16:46:47 +0000 (UTC)
commit c8604923598aad745a65ec16eb79113c97649345
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 17 12:45:25 2015 -0400
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
gdk/win32/gdkdevice-virtual.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index 3a97285..b947800 100644
--- a/gdk/win32/gdkdevice-virtual.c
+++ b/gdk/win32/gdkdevice-virtual.c
@@ -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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]