mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Added a GTK3-safe null guard before unrefing cursors while keeping GTK2 behavior under !HAVE_GTK3.
Added a GTK3 pointer-device null fallback in gtk_xtext_get_pointer to safely handle missing devices before using gdk_device_get_position.
This commit is contained in:
@@ -156,6 +156,8 @@ gtk_xtext_cursor_unref (GdkCursor *cursor)
|
||||
#if !HAVE_GTK3
|
||||
gdk_cursor_unref (cursor);
|
||||
#else
|
||||
if (!cursor)
|
||||
return;
|
||||
g_object_unref (cursor);
|
||||
#endif
|
||||
}
|
||||
@@ -746,6 +748,17 @@ gtk_xtext_get_pointer (GdkWindow *window, gint *x, gint *y, GdkModifierType *mas
|
||||
gint win_x = 0;
|
||||
gint win_y = 0;
|
||||
|
||||
if (!device)
|
||||
{
|
||||
if (x)
|
||||
*x = 0;
|
||||
if (y)
|
||||
*y = 0;
|
||||
if (mask)
|
||||
*mask = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_device_get_position (device, &screen, &root_x, &root_y);
|
||||
gdk_window_get_origin (window, &win_x, &win_y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user